Hello Maximilian,
Maximilian Haupt wrote:
> is it possible to have a projection camera with e.g. 2 viewports and
> somehow define that certain nodes should only be visible in one of the
> two viewports?
the easiest way is probably to use TravMasks. A node is only visited by
the RenderAction if the bitwise AND of the trav mask of the node and
trav mask of the action are non-zero. Additionally Viewports have a trav
mask that they set on the RenderAction when rendering that viewport.
Set the trav mask of one viewport to 0x01 of the other to 0x02 and nodes
you only want to show on VP1 need to have a trav mask of ~0x02 and those
that show only on VP2 have a trav maks of ~0x01.
> I tried to create a wrapper node around the scene and set it as the
> root of the viewports. But this is not possible, because both wrapper
> nodes need the scene as its child. But the scene node can have one
> parent only.
in 2.0 you can get around that by using a Node with a VisitSubTree core.
You should use great care when doing that though since it breaks the
fundamental "single parent" assumption and for example getWorldMatrix()
can not accumulate matrices properly (so there should not be any
transforms above a VisitSubTree).
> I also thought about hiding the nodes by a shader program, but I don't
> know whether I have the information in which viewport I am inside the
> shader program.
No, there is not a direct way to get that information. If you render the
viewports individually (instead of calling Window::render()) you could
change the value of a uniform when switching viewports. Overall that
seems like a complicated solution. I think the trav mask should be able
to solve your problem.
Cheers,
Carsten
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users