I've made a bit of progress here, and I think what I need to do is:

- Position a node using the Latitude/Longitude/Altitude from a GPS
- Use a NodeTrackerManipulator on that node (the "povNode")
- Load the VirtualPlanetBuilder terrain into a second node "terrainNode"
- Set up a CoordinateSystemNode / EllipsoidModel to wrap the terrainNode.
- Maintain two PositionAttitudeTransforms wrapping the povNode and the terrainNode.

Inside the while(!done) loop:

double x = 0;
double y = 0;
double z = 0;
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(osg::DegreesToRadians(latitude),osg::DegreesToRadians(longitude), altitude, x, y, z);

povXForm->setPosition( osg::Vec3(x, y, z));
terrainXForm->setAttitude(osg::Quat(osg::DegreesToRadians( yaw ), osg::Vec3(0,0,1), osg::DegreesToRadians( pitch ), osg::Vec3(1,0,0), osg::DegreesToRadians( roll ), osg::Vec3(0,1,0)));
viewer.frame();

This seems to me like it should be reasonable, but something is wrong. I believe it could be with the CoordinateSystemNode since I'm not adding the CSN to the view root... I'm adding the terrainNode to the CSN and to the PAT, and then adding the PAT to the view root group. My thinking here is that I don't want to position the terrain at that point, I want to position the camera (using the NodeTrackerManipulator) - but I want to tilt the terrain so that it would match the "out the window" view from a plane at that point.

At any rate, I get a blank blue screen when I try to use the povXForm and the terrainXForm, even when hard coding the lat/long/altitude to values that make sense. The terrain just never seems to render.

I appreciate anyone who made it to the end of this :)

-Matthew
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to