Hi Kim (and Jean-Sebastien), Kim Bale <kcb...@googlemail.com> wrote: > Hi Jan, > > My apologies for not replying earlier, I haven't been checking > osg-users as much as I possibly should have. It appears that I've > missed quite a few osgOcean posts.
No problem :) > > >> BTW, is there a reason why is the size of the screen hardwired to > >> 1024x768? Do the shaders expect this? Or why is it so? It took me a > >> while to figure out why it doesn't draw correctly on our wall. > > J-S pretty much answered this one- the screen resolution is only > required for setting up the FBOs involved in the fullscreen effects. > However, this can be changed using: > > /** Sets the current screen size, needed to initialise the God Ray and > DOF frame buffers. > * Default is 1024x768. > */ > inline void OceanScene::setScreenDims( osg::Vec2s size ){ > _screenDims = size; > _isDirty = true; > } Ah, OK - I have missed this function. I saw that the variables are initialized in the constructors but that there wasn't a way to pass new screen dimension to them (would be a good addition to the constructor, IMO). > Setting that will cause the FBO textures to be resized and rebound at > the desired resolution on the next pass of the update visitor. You > could easily bind this function to a callback which calls it when the > screen resolution changes. Good, that will help. I more-or-less need to call this only on setup, but at least it saves me hacking in an extra constructor. > > > Back to the original problem with collision detection. As J-S said, > direct access to the vertices is not currently supported. However you > should be able to get access to the geometry by adding some simple > accessors. To be honest I haven't thought about collision detection > much as it wasn't an original requirement for me, but I can see that > it would be a valuable addition and i'll try and give you some > pointers. What I need is rather simple - I need an object to bob on the surface of the waves, so basically I just need the current height at a given x,y position. <...> > Like I say I haven't thought about collision detection much, but my > initial thoughts are that you could use the bounding boxes of the > mipmap geometries as a quick way to find the patch in which the > collision occurs and the test the triangles within that patch. The > animation, of course complicates things somewhat. If you're planning > on doing accurate collision detection you should be able to get access > all the vertices involved for the frames at the current LOD from the > _mipmapData container. I think that is even an overkill for me - I just need the height to be able to attach an object to the surface of the wave. But thanks for the pointers, I am going to have a closer look at it today. Regards, Jan
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org