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.


Topics - brunotrodrigues

Pages: [1]
1
Support / Texturing a triangle
« on: April 18, 2012, 10:42:42 pm »
Guys, I'm trying to texture the triangle faces of a rhombus with this code:

Code: [Select]
public Object3D buildMarker(){
Object3D mrkr = new Object3D(8);
mrkr.setCulling(false);
float offset = MARKER_SIZE/2;

mrkr.addTriangle(new SimpleVector(-offset, 0,-offset), 0, 1,
new SimpleVector( offset, 0,-offset), 1, 1,
new SimpleVector( 0,-MARKER_SIZE, 0), 0.5f, 0);
mrkr.addTriangle(new SimpleVector( offset, 0,-offset), 0, 1,
new SimpleVector( offset, 0, offset), 1, 1,
new SimpleVector( 0,-MARKER_SIZE, 0), 0.5f, 0);
mrkr.addTriangle(new SimpleVector( offset, 0, offset), 0, 1,
new SimpleVector(-offset, 0, offset), 1, 1,
new SimpleVector( 0,-MARKER_SIZE, 0), 0.5f, 0);
mrkr.addTriangle(new SimpleVector(-offset, 0, offset), 0, 1,
new SimpleVector(-offset, 0,-offset), 1, 1,
new SimpleVector( 0,-MARKER_SIZE, 0), 0.5f, 0);

mrkr.addTriangle(new SimpleVector( offset, 0,-offset), 0, 1,
new SimpleVector(-offset, 0,-offset), 1, 1,
new SimpleVector( 0,MARKER_SIZE, 0), 0.5f, 0);
mrkr.addTriangle(new SimpleVector( offset, 0, offset), 0, 1,
new SimpleVector( offset, 0,-offset), 1, 1,
new SimpleVector( 0,MARKER_SIZE, 0), 0.5f, 0);
mrkr.addTriangle(new SimpleVector(-offset, 0, offset), 0, 1,
new SimpleVector( offset, 0, offset), 1, 1,
new SimpleVector( 0,MARKER_SIZE, 0), 0.5f, 0);
mrkr.addTriangle(new SimpleVector(-offset, 0,-offset), 0, 1,
new SimpleVector(-offset, 0, offset), 1, 1,
new SimpleVector( 0,MARKER_SIZE, 0), 0.5f, 0);
return mrkr;
}

The Object3D structure is fine, but I'm positive my U/V-coordinates are wrong because it is not showing it how I expected.
The texture is a 128x128 black png with a transparent triangle with its base running along the base of the picture and its top touching the middle of the picture's top border (sorry, I can't upload it right now). I wanna make a red, wireframed rhombus.
This is how I'm adding the textures I use to the TextureManager tm:

Code: [Select]
tm.addTexture("frame", new Texture("markerFrame.png"));
tm.addTexture("red", new Texture(8,8,java.awt.Color.RED));

And this is how I Multi-texture them:

Code: [Select]
tInfo = new TextureInfo(tm.getTextureID("frame"));
tInfo.add(tm.getTextureID("red"), TextureInfo.MODE_ADD);

Help, please!

2
Support / Texturing problem
« on: April 05, 2012, 02:40:22 pm »
(Possibly a beginner mistake with a simple sollution, still I was not able to make it work)

I'm extending the snork example as a way to practice using jPCT. So I took the dome.3ds file, mirroed it and united the parts in 3ds Max. I used the resulting object in my code and it seemed to work fine. But I noticed the stars texture was mirroed too in the application. Looking around you don't notice it until you look to the "horizon." There you can clearly see the mirroed texture because the stars are repeated.
How can I change this so that you don't notice the repetition of the texture?

3
Support / Extending Object3D
« on: April 04, 2012, 05:09:30 pm »
How can I do this?
I'm trying to extend it like this:

Code: [Select]
import com.threed.jpct.Object3D;

public class Unit extends Object3D{

public Unit(String textureName){
...
CODE
...
}
}

And I get the error "no suitable constructor found for Object3D."
Help?

4
Support / Wireframed 3d quad-map
« on: March 22, 2012, 04:21:35 pm »
Hello, everyone! I'm new to jPCT so I have a question:

I need to draw a 3d quad-map (30 x 30 x 30 squares where I'm gonna place my markers) but I couldn't find a way to do it with jPCT. It needs to be a wireframe so that the user can see what is in the 3d space, and I need to control its transparency so that it doesn't make visualization of all the markers difficult. Can anyone give me a hand?

Pages: [1]