MultiPassView and Locale

Hi,

Quick question for the Xith experts:

I want to use a MultiPassView to draw in both Perspective and Parallele view (view for the scene and the hud). When I check the java doc for the MultiPassView constructor, I find:

MultiPassView(BranchGroup sceneGraph)
          Creates a new MultiPassView associating the given Locale with it.

But when I check, Locale is not a BranchGroup. They are both nodes, but thats about where there common ancestry ends. Im confused.

Alex

Just do :


// Creates the multi pass view
MultiPassView view = new MultiPassView(new BranchGroup());

// Add the perspective render pass
BranchGroup perspectiveBg = new BranchGroup();
RenderPass perspectiveRp = new RenderPass(RenderPass.PERSPECTIVE_PROJECTION);
view.addRenderPass(perspectiveRp);
((Group)perspectiveRp.getNode()).addChild(perspectiveBg);

// Add the parallel render pass
BranchGroup parallelBg = new BranchGroup();
RenderPass parallelRp = new RenderPass(RenderPass.PARALLEL_PROJECTION);
view.addRenderPass(parallelRp);
((Group)parallelRp.getNode()).addChild(parallelBg);

Is this what you wanted to know ? The Javadoc is wrong. The locale is not handled in the MultiPassView class

Ok, that helps! Its difficult to start when the Javadoc has errors in it. ???

The code bellow bring two other questions to mind.

  1. When working with a single view, I would use something like

         view.getTransform().lookAt(
                 new Vector3f(0, 0, 2.41f),  // location of eye
                 new Vector3f( 0, 0, 0),     // center of view
                 new Vector3f( 0, 1, 0));    // vector pointing up

Now, that I have two render pass,I still want the perspective pass to look at that direction, but I want the parallel pass to stay fixed. I saw your previous message where you used hud.setCameraMode(View.VIEW_FIXED); , however, what object is hud. I can’t find the setCameraMode function in any of my objects (i checked, the view, the nodes, the renderpass, etc).

To change the perspective pass, do I still call the lookAt function at the view level?

  1. If my two branches (perspective and parallele) are added to the view, do I still need to add them to the local?

Thanks

That reflects the shift between doc and code when it’s developed in one’s free time.
This has been fixed and will be right in the next release (0.8.1)

Well, I think so, although I don’t really know, cause I use org.xith3d.render.ExtXith3DEnvironment where it is done automagically. You should check this class : it’s really useful. (It has been written by Qudus inspired by my old Scene class).

[quote="<MagicSpark.org [ BlueSky ]>,post:4,topic:27764"]
Well, I think so, although I don’t really know, cause I use org.xith3d.render.ExtXith3DEnvironment where it is done automagically. You should check this class : it’s really useful. (It has been written by Qudus inspired by my old Scene class).
[/quote]
Take a look at org.xith3d.test.base.BaseTest to get a hint on how to use it in combination with org.xith3d.render.ExtRenderLoop.
(There’s an unnecessary “implements KeyboardListener” in this test class. Simply leave it.)

Looks like a good solution to my situation. But that doesn’t answer my first question.

How do I make sure that the camera doesn’t move for my hud render pass?

Alex

Add this line to you code:


hud.setCameraMode(View.VIEW_FIXED);

It is an issue which is fixed in the current CVS version of the HUD and will be in the next release (0.8.1). This should fix your problem.

Ok, I think I understand, lookAt only affects perspective render, for parallel, I need to rotate and translate my group.

Alex

Edit: Oups, didn’t see your last message there. Ill go get the CVS version.

No ^^ But with View.VIEW_FIXED lookAt doesn’t affect at all Foreground/Background nodes.

Anyway it’s the wisest option : I’ll always recommand to anybody to work from CVS.
(You can find instructions on http://xith3d.dev.java.net and http://xith-tk.dev.java.net but you should register into dev.java.net first)

(>“Oups”… are you french ;D “Oops” or “Whoops” is more engl-ish ^^)

French canadian, so you might see some french slip into the posts sometimes :slight_smile:

Alex

Ça m’arrive aussi ;D