Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-14 Thread Jean-Sébastien Guay
Hi all, Just a note to let you all know that the changes to allow height checks against the ocean surface have been checked in, and the oceanExample will demonstrate this when started with the --testCollision command line argument, i.e. oceanExample --testCollision Thanks to Dimitrios

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-13 Thread Jean-Sébastien Guay
Hi all, Just drop me an e-mail off-list and I can send you a simple hack for testing it - e.g. a buoy bobbing on the water surface or something similar. Dimitrios sent me an example over the weekend, and I've been able to test the changes I've made with his example. Seems to work well. I'm

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-13 Thread Dimitrios Filiagos
Hi, you can certainly redistribute the boat model. Please be my guest!!! Thanks Dimitrios -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18229#18229 ___ osg-users mailing list

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-09 Thread Jan Ciger
Hello, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Hi Jan, While I was at it, I started integrating the changes for getting the ocean surface height at a position. I went with a combination of Jean-Claude's and Dimitrios' code, with a few small modifications. The only

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-09 Thread Jean-Sébastien Guay
Hi Jan, Right, of course. I have a bit of code that makes an object bob on the surface, but my code is likely a bit different from Dimitrios's, so it would need to be changed based on what you have done. Likely it's just the method name that would change. I don't mind doing that. Is there a

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-09 Thread Jan Ciger
Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Is there a place where I can get your changes? Ideally, just make an experimental branch, commit it there and once it is tested, merge into the trunk. That is fairly easy to do with SVN. I'll try to get that done before the end

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-08 Thread Jean-Sébastien Guay
Hi Jan, While I was at it, I started integrating the changes for getting the ocean surface height at a position. I went with a combination of Jean-Claude's and Dimitrios' code, with a few small modifications. The only problem is I have no way of testing it (it builds, thus it works by

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Jan Ciger
Dimitrios Filiagos dfili...@yahoo.com wrote: One other thing what is the functionality of _isDirty and buid() in Jean Claudes code ? It will save me a lot of time. isDirty forces a rebuild of the data structures and build() does the actual construction of the surface. Your original code

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Dimitrios Filiagos
Hi, you 're right now I understand why I had some crashes from time to time Thanks! Cheers, Dimitrios -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18014#18014 ___ osg-users mailing list

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Dimitrios Filiagos
Hi, here's the code for normal interpolation I promised osg::Vec3f OceanTile::normBiLinearInterp(float x, float y ) const{ float dx = x / _spacing; float dy = y / _spacing; unsigned int ix = dx; unsigned int iy = dy; dx -= ix; dy -= iy; osg::Vec3f s00 =

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Jan Ciger
Dimitrios Filiagos dfili...@yahoo.com wrote: Hi, here's the code for normal interpolation I promised Cool, this looks good. Jean-Se, Kim, could we get these things merged in, please? Right now I am maintaining my own patch based on Dimitrios's code, but this is really useful. Of

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Jean-Sébastien Guay
Hi Jan, Dimitrios, Cool, this looks good. Jean-Se, Kim, could we get these things merged in, please? Right now I am maintaining my own patch based on Dimitrios's code, but this is really useful. Of course, the function needs to be exposed in the higher-level classes too, so that we can

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Jan Ciger
Hi, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Send us the whole files of what you need and I'll have a look for sure. I'm not the one who needs this so I don't want to start guessing in which classes you need access to this... J-S I need it in the following two:

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Kim Bale
Hi Jan, Dimitrios, On the face of it this all looks good, but I'll take some time to review and test the code at the weekend, but as J-S says could you send the whole files where the changes are made as it makes my life a lot easier to test. Of course, the function needs to be exposed in the

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-07 Thread Jan Ciger
Kim Bale kcb...@googlemail.com wrote: Jan - I'm not sure what is meant by get to it from the viewer here? I am accessing the code like this within my viewer's main loop: // osgOcean::OceanTechnique *ocean; float height = ocean-getSeaHeightAt(pos.x(), pos.y()); ... Therefore the function

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-06 Thread Dimitrios Filiagos
Hi all, the code that Jean Claude posted works like a sweet. I also wrote a function similar to biLinearInterp to interpolate the normals of 4 vertices. I renamed the function getHeightAt(x,y) to getSurfaceDataAt(x,y) that return an osg::Vec4f now. The x,y,z represent the interpolated normal

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-05 Thread Jean-Claude Monnin
Hi all, I also need to query the height of the ocean. Based on Dimitrios posted code, I modified it to do a bi-linear interpolation. Below is the code I would like to share. Should there be general interest in height query of the ocean, then it would be good to put this or similar code in the

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-05 Thread Kim Bale
Hi Jean-Claude, Thanks for code snippet, this does seem to be a popular bit of functionality so I'll go through it and work out the best way to integrate it. To avoid these windows header conflicts, would it be possible to change Not a problem I'll make those changes to the trunk today.

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-10-05 Thread Jan Ciger
Jean-Claude Monnin jc_mon...@emailplus.org wrote: Hi all, I also need to query the height of the ocean. Based on Dimitrios posted code, I modified it to do a bi-linear interpolation. Below is the code I would like to share. Should there be general interest in height query of the ocean, then

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-30 Thread Dimitrios Filiagos
Hi, I saw the Update function and understood that you're absolutely right! I saw more accurate results also! Yesterday I changed the function to retrieve the normal too. Now with the normal I can make the models not only to move up and down but rotate also when a wave passes. I will try to use

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-30 Thread Kim Bale
Hi Dimitrios, The interpolation function in OceanTile works on indices fetching the vertices from the vertex array within it. So you pass it the 4 unique row/column indices that make up the surrounding four points and then a row and a column index for the target point (tx ty). For your

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-30 Thread Dimitrios Filiagos
Hi Kim, yesterday I realized that my object goes up and down from the water because: a) it is smaller than the distance of two vertices of the grid b) the vertice displacement that takes place to simulate the wave on larger objects it works fine! I used the linear interpolation

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-29 Thread Dimitrios Filiagos
Hi, it seems to work fine but I am still testing. For big models of height 2.0 and more works fine, for smaller height models there are frames that goes above water, just a little though and also on some other frames just below the surface, especially on high wind speeds. This behavior might

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-29 Thread Kim Bale
Hi Dimitrios, Glad to hear you got it working. I have a couple of further hints for you. You may find that the accuracy is improved if you use _oldFrame without the increment. The variable name is a little misleading as it is actually stores the id for the current frame, if you look at the

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-28 Thread Jean-Sébastien Guay
Hi Dimitrios, I tried to write a function during the weekend. It works but the result is not so accurate. The floating objects are going up and down but they're not completely synchronized with the ocean surface. It seems that they are moving on a different phase or something. Here's my code

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-28 Thread Dimitrios Filiagos
Hi, I checked the _oldFrame and you are absolutely right. Thanks! Dimitrios -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=17686#17686 ___ osg-users mailing list

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-28 Thread Jean-Sébastien Guay
Hi Dimitrios, I checked the _oldFrame and you are absolutely right. So does that mean that my suggestion fixed it for you? J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-25 Thread Dimitrios Filiagos
Hi Kim Bale, your hints are valuable. As I've seen so far I need to know the height on a specific point on sea surface. I wrote a function in FFTOceanSurface passing the x,y of a point. That function finds the corresponding ocean tile and retrives the closest vertice using the

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-25 Thread Jean-Sébastien Guay
Hi Dimitrios, I wrote a function in FFTOceanSurface passing the x,y of a point. That function finds the corresponding ocean tile and retrives the closest vertice using the getVertex of OceanTile function. That's good. We could add another function that would return a weighted average of the