The two commits fix two things:
- implemented SoTextureCoordinateObject for linear texture functions
- fixed draggers so that interaction works correctly even if the camera is moving while a
user moves the dragger
Good to see that someone is again interested in Coin3D :). Are you becoming an active maintainer ?
About the SoDragger.
SoDragger stores a SbViewVolume data structure to compute the projection of the 2D mouse pointer onto the dragger geometry. This includes the projection information from the current camera, the camera transformation and any other transformation along the path to the dragger. However, the dragger computes this information only once, at the beginning of the interaction (mouse down event). After that it is assumed to be fixed.
We were using Coin3D in a large virtual reality/augmented reality framework and for us the camera usually represented the head mounted display of a user. So the camera was tracked by some real-time tracking device and would move also during dragger interaction. Therefore the above information would be wrong and the interaction would become difficult or even impossible.
My fix changes that so that the dragger always updates this view volume data structure. basically, I only had to add the code to the SoDragger::getViewVolume(void) method. However to make various symbols visible, I also had to move them before the getViewVolume implementation. That is the second part of the change.
It is not the most efficient way, but should not be so expensive as it only happens on an interaction event. As the FIXME comment by pederb states, it would be better and more efficient if the SoHandleEventAction would already compute the transformations along the paths.
let me know, if you have any other questions. I would be happy if the fix goes into some publicly used version of Coin3D.
I am not sure, but I just looked at the full code of SoDragger.cpp and I
see that the implementation in getViewVolume was moved from setCameraInfo().
So I think it needs to be as it is, because otherwise the vvdata struct and
the callback action are not initialised.
I assumed that getViewVolume() would only be called after picking the dragger, which would cause the initialisation. But this may not always be the case, I don't know. So it is safer to do it your way.
We used this for projective texture mapping, then the 4x4 matrix is the projection matrix into the "virtual camera" that projects the texture onto the geometry.
To your questions:
yes, I think it is complete that way
well, it is still pretty much a dummy just to be able to return a const & Vec4. So name change is maybe not necessary
* Not really. I currently don't have time to work on this anymore. I stopped working with Coin3D several years ago. This pull request was the last attempt to contribute to it :)
Do you have more plans with it? I have a bunch of general extension nodes that could easily be added.
Well, since Kongsberg gave up Coin3D it is now up to its users to keep it alive. Luckily Roy stepped up as the new maintainer. We are still organising ourselves, but I think there is enough interest to keep it going; I certainly hope it will.
You are very welcome to share your extension nodes. If not in Coin, they could find a home in SmallChange. It would be best if you can adopt the same license (but you can keep the copyright) in order to keep legalities as simple as possible.
I have implemented both these fixes in my viewer application. I was able to test the dragger change and that is OK. I don't have a model to really test your SoTextureCoordinateObject change. Is it possible, or practical, for you to supply me with one?
Here is an example IV file. The image in the Texture2 node can be any image you want. The idea is that the texture should be projected onto the cube as if it is thrown by a video projector onto the geometry. so the front of the cube will have a smaller image than the back etc.
I am not sure what the resulting image will look like for this file, I fixed this several years ago and I don't have a running Coin3D installation for over a year on my machine.