Hi!
I'm currently trying to bring some colors to my virtual worlds by adding textures. But I'm somewhat stuck.
I created a model & texture according to
http://www.code5.ch/meckardt/tutorials/wings_textur.html (German)
and exported it as VRML. The exported stuff seems reasonable, even though I didn't check it manually.
#VRML V2.0 utf8
#Exported from Wings 3D 1.2
DEF cube1 Transform {
children [
Shape {
appearance Appearance {
material DEF cube1_auv Material {
diffuseColor 1.0 1.0 1.0
emissiveColor 0.0 0.0 0.0
specularColor 1.0 1.0 1.0
ambientIntensity 1.0
transparency 0.0
shininess 1.0
}
texture ImageTexture { url "PATH/TO/TEXTURE" }
}
geometry IndexedFaceSet {
coord Coordinate { point [
-3.032000000000004 -3.032000000000004 3.032000000000004,
-3.032000000000004 3.032000000000004 3.032000000000004,
3.032000000000004 3.032000000000004 3.032000000000004,
3.032000000000004 -3.032000000000004 3.032000000000004,
-3.032000000000004 -3.032000000000004 -3.032000000000004,
-3.032000000000004 3.032000000000004 -3.032000000000004,
3.032000000000004 3.032000000000004 -3.032000000000004,
3.032000000000004 -3.032000000000004 -3.032000000000004 ] }
coordIndex [
0, 1, 4, -1,
0, 3, 1, -1,
0, 4, 3, -1,
1, 2, 6, -1,
1, 3, 2, -1,
1, 5, 4, -1,
1, 6, 5, -1,
2, 3, 6, -1,
3, 4, 7, -1,
3, 7, 6, -1,
4, 5, 6, -1,
4, 6, 7, -1 ]
texCoord TextureCoordinate { point [
0.0 0.5540970937771938,
0.0 1.0,
2.7755575615628914e-17 0.7387961250362586,
1.1102230246251565e-16 0.18469903125906445,
0.18469903125906464 0.36939806251812923,
0.18469903125906464 0.7387961250362585,
0.18469903125906495 0.0,
0.2612038749637414 1.0,
0.2612038749637415 0.7387961250362587,
0.36939806251812923 0.554097093777194,
0.3693980625181294 0.1846990312590646,
0.5540970937771938 0.7387961250362587,
0.5540970937771941 5.551115123125783e-17,
0.5540970937771941 0.36939806251812934,
0.7387961250362585 0.5540970937771941,
0.7387961250362587 0.18469903125906478 ] }
texCoordIndex [
4, 3, 10, -1,
4, 9, 0, -1,
4, 10, 9, -1,
2, 8, 7, -1,
0, 9, 5, -1,
3, 6, 10, -1,
2, 7, 1, -1,
11, 9, 14, -1,
9, 10, 13, -1,
9, 13, 14, -1,
10, 12, 15, -1,
10, 15, 13, -1 ]
}
}
]
}
The VRML-Spec says, that the TextureCoordinate-Node contains st-coordinates. As far as I know, that differs from uv-coordinates by already being "height-aware".
But I'm not really an expert to this... Anyway, the triangles load fine, and i tried just to push the st-coords along with the vertices into jPCT. Obviously without much success.
I also had a short look at TextureInfo that seems to have a different purpose.
I should add, that I have to load the models myself into a different world model. jPCT pulls the vertices (and...) from there.
This is like this:
Object3D o = new Object3D(..);
o.addTriangle( t.vertices[0], (float)t.vertices[0].u, (float)t.vertices[0].v,
t.vertices[1], (float)t.vertices[1].u, (float)t.vertices[1].v,
t.vertices[2], (float)t.vertices[2].u, (float)t.vertices[2].v);
Any help/hint would be great!
Roland
PS: I tried to attach a screenshot, but I failed... hard to use these boards ;-)