Martin, J-S, I haven't tried applying any transformations to the ocean surface yet, but I foresee some problems there.
The mipmapping detail tests in FFTOceanSurface are pretty hard coded and don't take into account any transformations from it's parents. This I realise is a flaw in the design. Adding in a transform between OceanScene and OceanTechnique would be ok, aslong as it's just a translation on the z axis. Any other transformations (scaling x/y trans, rotations) would cause problems with the mipmap level calculations and the tracking of the sea relative to the camera position. The only thing I think I would be wary of is this line in UpdateMipMaps(): osg::Vec3f newbound = getTile(x,y)->getBound().center(); That getBound would have to be updated manually as I don't think a transform from a parent would change it's size/position and so would still be using zero for z. Not a big task but something to consider. Subclassing from MatrixTransform might be a good way to do this type of thing cleanly. I was in fact thinking of changing the base class for OceanTechnique to a group style class anyway as it lends itself nicely to some ideas I've had about improving the efficiency of the mipmapping and vertex updates and also gives more flexibility if people wish to add their own OceanTechnique. Alternatively a quick hack would be add an offset to the _startPos variable in FFTOceanSurface, or even make it a member variable of the base class. That way you could position the ocean surface at any point on the x,y,z and *i think* it would all still work. However, I think perhaps adding in support for matrix transforms is a more desirable solution. I apologise for the vague answer but I don't have time at the moment to dig around and test out how it would be done best. Regards, Kim. 2009/7/23 Jean-Sébastien Guay <[email protected]> > > Hi Martin, > >> That reminds me, is there a way to set the height of the ocean? > > Not yet, but I'll be needing that soon too, it was on my ToDo list. You can > always implement it and submit it here, if you get to it before I do... :-) > > Theoretically it should just amount to inserting a transform between the > OceanScene and the OceanTechnique, and making a setHeight() and getHeight() > that set/get the transform's matrix's Z coordinate. Perhaps the > OceanTechnique should even subclass MatrixTransform instead of Geode? Kim, > what do you think? > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay [email protected] > http://www.cm-labs.com/ > http://whitestar02.webhop.org/ > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

