PDA

View Full Version : OpenInventor: Problems applying SoRayPickAction



Vincentdhs
11-13-2008, 05:54 AM
Hi there,


i've got a problem using SGI Inventor. I've already posted this on the sgi dev-mailing list. Maybe someone can help me here (or at least can point me to a more specific forum).

Now my problem:


I am currently implementing an Node, which should position three Shapenode's(the DiagnosticMirrors-Objects in the following source) with respect to the current Cameraview (or, in other words, places those nodes in the camera-coordinate system).


The node is inherited from SoShape and at initialisation creates an internal network of those shapenodes (as follows):


void SoAllSurfaceMirrors::createNetwork(){


root = new SoSeparator();

root->ref();

mirMirrorOne = new SoDiagnosticMirror;
mirMirrorTwo = new SoDiagnosticMirror;
mirMirrorThree = new SoDiagnosticMirror;

camCoords = new SoTransform;
pitch = new SoTransform;
extension = new SoTransform;
scale = new SoTransform;
tsfMirror = new SoTransform;

root->addChild(camCoords);
root->addChild(tsfMirror);

/*********************************/
/** SPECIFIC PART OF MIRROR ONE **/
/*********************************/

SoSeparator *sepMirrorOne = new SoSeparator;

sepMirrorOne->addChild(extension);
sepMirrorOne->addChild(pitch);

sepMirrorOne->addChild(scale);
sepMirrorOne->addChild(mirMirrorOne);

root->addChild(sepMirrorOne);


... (and so on)
}

This network is rendered into a Texture in the GLRender-Method using an SoGLRenderaction which shares its context with the calling (the SoGLRenderAction which called GLRender) SoGLRenderaction.
(this part works just fine).



Now i want to change the appearance of the Shape/DiagnosticMirror-Node based on user-input (e.g. draw/highlight the mirrors in a different color, if the user's mouse cursor is over those objects). Basically i need to be able to pick those nodes of the internal network.


Therefore i tried to use the handleEvent-Method (afaik the SoHandleEventAction is doing picking as well) which didn't turned out to be working. (Of course it doesn't, since the Action doesn't know anything about the internal network)

The next thing i tried, was invoking an SoRayPickAction on the network which doesn't work either because this action needs an existing camera volume to be able to pick something.

Now, if i create a new (internal) network which consists of a new seperator and two childs:SoOrthographic/PerspectiveCamera and the already existing root, the SoRayPickAction is doing something. Unfortunately the viewvolume of the camera in the internal network does not update to the view volume of the "outer" camera.

So my question: Is there a way to set the ViewVolume of the internal camera/the SoRaypickaction (to the ViewVolume etc. of the outer camera)?


regards
Florian

P.S.: Please let me know if you need further sources

romero
10-14-2009, 05:51 PM
Very interested, set the ViewVolume of the internal camera/the SoRaypickaction? it seem can't support currently.