Custom rotation of sky dome coordinates

atorkhov

08-01-2009 08:55:38

First, following code in PointStarfield::ensureGeometry could be replaced with call of CaelumSystem::makeDirection():

Ogre::Vector3 pos;
pos.z = -Math::Cos (Ogre::Degree(azm)) * Math::Cos (Ogre::Degree(alt));
pos.x = Math::Sin (Ogre::Degree(azm)) * Math::Cos (Ogre::Degree(alt));
pos.y = -Math::Sin (Ogre::Degree(alt));


And second, I'm suggesting to add custom parameter, like "CoordinateSystemRotation" that would be added to azimuth in CaelumSystem::makeDirection.
It will ease integration of Caelum with existing systems. For example, in our game client Z axis was pointing south, but Caelum's Z pointing towards north, so we had to change Caelum's sources a bit to accommodate this.

cdleonard

08-01-2009 18:46:38

There is already a way to rotate the sky dome: CaelumSystem allows you to retrieve the root scene node to which the various sky components are attached. CaelumSystem will move it with the camera but you can rotate it freely. This is the recommended way to adapt Caelum's coordinate system to your own.

In trunk there is also a separate root node for clouds because cloud layers now have actual height in world units. CaelumSystem will not move that node with the camera; you can move and rotate it for your own purposes.

As for using CaelumSystem::makeDirection in PointStarfield: I'm not sure it would help. That function is currently private static inside CaelumSystem and it should remain that way. In fact it would be better if all star rotations would be done with matrices instead of rebuilding the entire vertex buffer on the CPU. This can hurt if latitude/longitude changes quickly. Your original suggestion was probably motivated by rotating the entire sky and there are other ways to do that anyway.

atorkhov

08-01-2009 19:54:01

There is already a way to rotate the sky dome: CaelumSystem allows you to retrieve the root scene node to which the various sky components are attached. CaelumSystem will move it with the camera but you can rotate it freely. This is the recommended way to adapt Caelum's coordinate system to your own.
Thanks, I'll try this.