www.jpct.net

jPCT - a 3d engine for Java => Bugs => Topic started by: Klaudiusz on September 27, 2007, 11:28:59 am

Title: Bilboarding when object has parent
Post by: Klaudiusz on September 27, 2007, 11:28:59 am
Hello,

Billboarding doesn't work when object has a parent. In documentation is written that object is always faced to the camera.
Title: Re: Bilboarding when object has parent
Post by: EgonOlsen on September 27, 2007, 05:31:14 pm
Could be...i'll look into it.
Title: Re: Bilboarding when object has parent
Post by: Klaudiusz on September 27, 2007, 07:48:13 pm
Thanks:)
Title: Re: Bilboarding when object has parent
Post by: EgonOlsen on October 01, 2007, 08:32:14 pm
Version 1.15 may fix this. Please give it a try.
Title: Re: Bilboarding when object has parent
Post by: Klaudiusz on October 01, 2007, 09:36:12 pm
Thx, i'll do this tommorow.

BTW. Maybe could You implement parent functionality also for lights and cameras? It could be usefull.
Title: Re: Bilboarding when object has parent
Post by: Klaudiusz on October 02, 2007, 08:42:35 am
Something wrong. It goes crazy when parent object is moving (translated).

See attached example:

Code: [Select]
import java.awt.Color;

import com.threed.jpct.*;

public class TestBB {

public static void main(String[] args) {
World w = new World();
FrameBuffer fb = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_GL_AA_2X);
fb.disableRenderer(IRenderer.RENDERER_SOFTWARE);
fb.enableRenderer(IRenderer.RENDERER_OPENGL);
Object3D Toy= Primitives.getCube(10);


TextureManager tm = TextureManager.getInstance();
Texture vt = new Texture("blue067.jpg");

tm.addTexture("uv", vt);


TextureInfo ti=new TextureInfo(tm.getTextureID("uv"));
Toy.calcTextureWrapSpherical();
Toy.setTexture(ti);

Object3D Toy2=Toy.cloneObject();
Toy2.translate(35, 0, 0);
Toy.addChild(Toy2);
Toy2.setBillboarding(Object3D.BILLBOARDING_ENABLED);

w.getCamera().moveCamera(Camera.CAMERA_MOVEOUT, 200);
w.getCamera().moveCamera(Camera.CAMERA_MOVEUP, 50);
w.setAmbientLight(250, 250, 250);
Toy.build();
w.addObject(Toy);
Toy2.build();
w.addObject(Toy2);


while(!org.lwjgl.opengl.Display.isCloseRequested()) {

fb.clear(Color.PINK);
w.renderScene(fb);
w.draw(fb);
fb.update();
fb.displayGLOnly();

Toy.rotateY(-0.02f);
Toy.translate(0.01f,0,0);



try {
Thread.sleep(10);
} catch(Exception e) {}

}
fb.dispose();

}

}
Title: Re: Bilboarding when object has parent
Post by: EgonOlsen on October 02, 2007, 09:05:46 am
I expected something to be wrong...it was just too easy... ;)
Thanks for the test case, i'll look into it.
Title: Re: Bilboarding when object has parent
Post by: EgonOlsen on October 02, 2007, 05:23:33 pm
I've updated the release version. Please have a look at the issue again to see, if this fixes your problem.
Title: Re: Bilboarding when object has parent
Post by: Klaudiusz on October 03, 2007, 08:43:02 am
Works fine. Now i can do some partices magic:) Thanks!