Switching between Parralel and Perspective projection more high-performance

hi

After the great MultiPassView implementation looses a few performance, I think we will have to step into the rendering process more deeply.

I suggest to make a BranchGroup extension called something like ProjectionBranchGroup or so. When the rendering process finds such an object, it switches to the projection policy that’s found on this object. After traversing this group it switches back to that what it had previously.

I think, this wouldn’t loose any performance and it’s quite simple to use.

The other aspect of the MultiPassView which is specifying the rendering order should be solved by giving the the added child groups an order in their parent group. I think, I remember, theres an OrderedGroup or something like that, which should do this but doesn’t actually. Am I right?

What do you think.

Seems good.

Of course the BranchGroup extension would be quite easy to implement. It’d look something like that:


public class ProjectionBranchGroup extends BranchGroup
{
    private int projectionPolicy;
    
    public int getProjectionPolicy()
    {
        return(projectionPolicy);
    }
    
    public ProjectionBranchGroup(int projectionPolicy)
    {
        super();
        
        this.projectionPolicy = projectionPolicy;
    }
}

But I cannot do the renderprocess modification since I’m not a developer on the core. I don’t think the modification would be too heavy, so if this mod is wanted, could a core dev please do it.

Maybe this could even be integrated directy into the BranchGroup class adding a second constructor like the above one and taking PerspectiveProjection as the default when using the empty constructor.

An additional idea for the default projection policy is a value indicating that the value is taken from the view. So in default case no recognizable change would be there.

I would add it if it’s wanted but I should take time to learn how to switch from PARALLEL to PERSPECTIVE projection in the RendererImpl classes.

[quote="<MagicSpark.org [ BlueSky ]>,post:5,topic:27674"]
I would add it if it’s wanted but I should take time to learn how to switch from PARALLEL to PERSPECTIVE projection in the RendererImpl classes.
[/quote]
Take your time. We don’t need to rush it. During the next days I will have to attend to my studies anyway :frowning: So I won’t have too much time for Xith.

I’ve done this for the BranchGroup and View classes. It still renders but there seems to be something wrong. The z translations of my test cubes were beeing totally ignored. Hope someone can look at the code to fix this.

The CanvasPeerImpl part needs to be done by somebody with a little more knowlede of The Force. I’ve intensively looked into the code. And it seems to me, like it is not possible without such tricks like in the MultiPassView (draw first group, draw second group, …, flush buffers). Ok, too. But I don’t know enough of the CanvasPeerImpl classes.

Well, here ais my work. I’ve cleaned up the view classes from all the not needed private variables. So it’s a little shorter now.