Hello !
I'm using simple S3DVertex to build my custom scene node... And when looking to Irrlicht's API, I fall on this class.
As the documentation specify, the constructor looks like:
From what I read, the constructor expect two 2D vectors for the texture. I'm not sure how this two vectors are used: how does they apply from the texture to the vertex ?
I'm wondering if the following image describe how moving from S3DVertex to S3DVertex2TCoords could be used:
In this case: C and E have the same world positions but not the same texture positions, idem for D and F.
But I think I might be wrong, so what it is for ?
Thanks for you answer !
No - you need really 8 vertices for this case because you have different uv's per vertex.
The S3DVertex2TCoords is when you want a second texture on top of it. For example to add details. Then that can have a different set of uv-coordinates.
The S3DVertex2TCoords is a vertex type composed of:
-A Position 3D Vector
-A Normal 3D Vector
-A Color which is a 32 bit unsigned integer
-A first Set of texture coordinates as a 2D Vector, TC0
-A second Set of texture coordinates as a 2D Vector, TC1
It adds a second set of texture coordinates so you can have 2 sets of independent texture coordinates at any given time. This second set of texture coordinates is used on the follwing materials, besides the shaders. IN these cases, the texture1 uses the second set of texture coordinates
EMT_LIGHTMAP : the textures 0 and 1 are multiplied
EMT_LIGHTMAP_ADD :the textures 0 and 1 are added
EMT_LIGHTMAP_M2 : the texture 0 is multiplied by 2*texture1
EMT_LIGHTMAP_M4 : the texture 0 is multiplied by 4*texture1
EMT_LIGHTMAP_LIGHTING : Same as EMT_LIGHTMAP, but adds dynamic lighting
EMT_LIGHTMAP_LIGHTING_M2 : Same as EMT_LIGHTMAP_M2, but adds dynamic lighting
EMT_LIGHTMAP_LIGHTING_M4 : Same as EMT_LIGHTMAP_M4, but adds dynamic lighting.
EMT_DETAIL_MAP : the textures 0 and 1 blended, and the TC1 is a multiply of TC0 so large that produces good detail on terrains when the original texture starts to be too blurry, it is the material used in the terrain example
And you can convert directly from a standard vertex type to a 2TCoords mesh using the mesh manipulator utility of the scene manager.
Their utility is just to provide another set of texture coordinates, which is mainly used to do lightmapping techniques, present on the Quake III levels, for example, although they aren't necesarily used for that. It's all about texture coordinates, not world positions, To build the faces, you need the triangles whose vertices are represented by the world positions, but with this type of vertex, it can contain aditional info
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt