Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - apchar

Pages: [1]
1
Support / Re: I can texture any primitive except a plane. Why?
« on: December 09, 2010, 02:16:55 am »
Both solutions worked. Thanks guys.
I guess I don't understand  environment mapping. I thought it yielded the same results only slower. No?
Is the plane supposed to be invisible from the other side? Is there a way to texture both sides without putting 2 planes back-to-back?
I get the impression primitives are rarely used or even discouraged. Why? Are they less efficient than a custom mesh?

2
Support / I can texture any primitive except a plane. Why?
« on: December 08, 2010, 09:45:14 am »
Consider this bit o' code:
Code: [Select]
import com.threed.jpct.*;

public class PrimitiveTests2 {

private World world;
private FrameBuffer buffer;
private Object3D floor, part;

public static void main(String[] args) throws Exception {
new PrimitiveTests2().loop();
}

public PrimitiveTests2() throws Exception {
world = new World();
world.setAmbientLight(0, 255, 0);

TextureManager.getInstance().addTexture("expo_bumps", new Texture("images/expo_bumps.png"));

                floor = Primitives.getPlane(5, 1f);
                floor.setTexture("expo_bumps");
                floor.setEnvmapped(Object3D.ENVMAP_ENABLED);
                floor.build();
                world.addObject(floor);

                part = Primitives.getSphere(10, 1f);
                part.setTexture("expo_bumps");
                part.setEnvmapped(Object3D.ENVMAP_ENABLED);
                part.build();
                world.addObject(part);

world.getCamera().setPosition(5, 5, -10);
world.getCamera().lookAt(SimpleVector.ORIGIN);
}

private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);

while (!org.lwjgl.opengl.Display.isCloseRequested()) {
buffer.clear(java.awt.Color.BLUE);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
Thread.sleep(10);
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
System.exit(0);
}
}

The sphere primitive takes the texture (as do all the other primitives) but the plane doesn't. Why?  ???

3
Feedback / Suggestions for the javadocs
« on: December 06, 2010, 09:01:26 am »
I'm new to all this & I'm really glad to find JPCT. Jmonkey is just too hard for a beginner.
I think most beginners will work almost exclusively with primitives (I know I will. I am so not ready for my own meshes.) So I'm playing with the stuff in the Primitives class now. But the javadocs have too little detail on how the arguments of the methods apply to the objects. These are things I found by trial & error. Which is good but tedious. So may I suggest adding:

In getCone()
The axis of the cone is on the y-axis with the tip pointing in the -y direction. scale is the radius of the base & half the height of the cone. The origin lies on the axis of symmetry half way between the base & tip of the cone.

In getCylinder()
The axis of the cylinder is on the y axis. scale is the radius of the cylinder & half the height. The origin lies on the axis of symmetry half way between the base & top.

In getPyramide()
The axis of the pyramide is on the y axis with the tip pointing in the -y direction. scale is the width of the base & half the height. The origin lies on the axis of symmetry half way between the base & top. The tips  of the base point in the x & z directions.

In getDoubleCone()
The result is 2 cones placed base to base on the origin. The axis of symmetry is on the y axis. scale is  the radius of the base & the height of each cone.

In getBox()
The result is a scale x scale cube. It's origin is at the center. In the XZ plane, the corners point in the x & z directions.

In getSphere()
scale is the radius of the sphere. The origin is at the center.

In getEllipsoid()
The axis of symmetry is along the y axis. scale is the radius in the xz plane. scaleHeight acts in the y direction.

I suggest something for getPlane() too. I still haven't figured it out.

This would save other noobs a lot of tedium.


Pages: [1]