Thanks a lot. I understand know the u/v components and it work now !
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.
Show posts Menu
public Object3D composeModule(final float width, final float length,
final float depth) {
final Object3D box = new Object3D(12);
final float x = width / 2;
final float y = length / 2;
final float z = depth / 2;
final SimpleVector upperLeftFront = new SimpleVector(-x, -y, -z);
final SimpleVector upperRightFront = new SimpleVector(x, -y, -z);
final SimpleVector lowerLeftFront = new SimpleVector(-x, y, -z);
final SimpleVector lowerRightFront = new SimpleVector(x, y, -z);
final SimpleVector upperLeftBack = new SimpleVector(-x, -y, z);
final SimpleVector upperRightBack = new SimpleVector(x, -y, z);
final SimpleVector lowerLeftBack = new SimpleVector(-x, y, z);
final SimpleVector lowerRightBack = new SimpleVector(x, y, z);
// Front
box.addTriangle(upperLeftFront, lowerLeftFront, upperRightFront);
box.addTriangle(upperRightFront, lowerLeftFront, lowerRightFront);
// Back
box.addTriangle(upperLeftBack, upperRightBack, lowerLeftBack);
box.addTriangle(upperRightBack, lowerRightBack, lowerLeftBack);
// Upper
// Bad part
box.addTriangle(upperLeftBack, upperLeftFront, upperRightBack);
// Good part
box.addTriangle(upperRightBack, upperLeftFront, upperRightFront);
// Lower
// Good part
box.addTriangle(lowerRightBack, lowerRightFront, lowerLeftFront);
// Bad part
box.addTriangle(lowerLeftBack, lowerRightBack, lowerLeftFront);
// Left
box.addTriangle(upperLeftFront, upperLeftBack, lowerLeftFront);
box.addTriangle(upperLeftBack, lowerLeftBack, lowerLeftFront);
// Right
box.addTriangle(upperRightFront, lowerRightFront, upperRightBack);
box.addTriangle(upperRightBack, lowerRightFront, lowerRightBack);
return box;
}
public void composeWall(final Object3D drawFrom, final Object3D drawTo) {
Object3D wall = null;
// Business stuff not touching the Object3D.
wall = composeModule(moduleLength, moduleDepth, moduleHeight);
wall.setUserObject(wallModel);
wall.setOrigin(wallPosition);
wall.setName(Globals.MODEL3D_WALL_PREFIX + wall.getID());
wall.build();
wall.setTexture("white_wall.jpg");
wall.calcTextureWrap();
wall.recreateTextureCoords();
tileTexture(wall, 100);
composer.getWorld().addObject(wall);
Page created in 0.025 seconds with 12 queries.