Billboards

Hi

I want to use billboards, where the center of the billboard is the origin.

until now the geometry for billboards gets created like this:


        float halfParticleWidth = width / 2;

        // get the center of particle

        float x = 0;
        float y = 0;
        float z = 0;

        // calculate all the corners of the quad
        vec[0].set(-halfParticleWidth, 0, 0);
        vec[1].set(+halfParticleWidth, 0, 0);
        vec[2].set(+halfParticleWidth, height, 0);
        vec[3].set(-halfParticleWidth, height, 0);

I was only able to adjust it my needs by changing the code to:


        float halfParticleWidth = width / 2;

        // get the center of particle

        float x = 0;
        float y = 0;
        float z = 0;

        // calculate all the corners of the quad
        vec[0].set(-halfParticleWidth, -height/2, 0);
        vec[1].set(+halfParticleWidth, -height/2, 0);
        vec[2].set(+halfParticleWidth, height/2, 0);
        vec[3].set(-halfParticleWidth, height/2, 0);

Is there a better way, or should I add this to IssueZilla?

It’s pretty bad to have changes in the Xith-code, because it’s for a project (Spacebomber) and you can’t request from all to change their Xith. (At least it would be really nasty)

Arne

I think billboards are created in a mysterious way…
However if you need a change for spacebomber just do another class that isn’t included in Xith.

That’s the problem - I copied the modified Billboard class to Spacebomber and used that, but then it mysteriously doesn’t work anymore.

Hah! I hacked around it now :slight_smile:
I simply extend my Billboard class from the Xith-Billboard, but overwrite all functions - that works :smiley:

A change of Xith would be better still, because I create all things twice :frowning:

We could do some “reference” attribute (enum {CENTER, BOTTOM, UP}) in the standard Xith billboard class… It would be rather easy to do.

We could do some “reference” attribute (enum {CENTER, BOTTOM, UP}) in the standard Xith billboard class… It would be rather easy to do.

Such a change sounds fine to me (though we’re not at 1.5 yet with Xith3D).

I agree that the billboard class is a bit messy.

Will.