Game Development Reference
In-Depth Information
for (i=0; i<ply->numverts; i++){
pt=&pts[ply->p[i]];
ply->tc[i].u=((float)pt->x - tex->centre.x)/
tex->size.x + 0.5f;
ply->tc[i].v=((float)pt->z - tex->centre.z)/
tex->size.z + 0.5f;
}
break;
case 4://Z axis
for (i=0; i<ply->numverts; i++){
pt=&pts[ply->p[i]];
ply->tc[i].u=((float)pt->x - tex->centre.x)/
tex->size.x + 0.5f;
ply->tc[i].v=((float)pt->y - tex->centre.y)/
tex->size.y + 0.5f;
}
break;
}
Cylindrical and spherical mapping
For the principles of cylindrical and spherical mapping, refer to Chapter 6.
UV mapping
Beginning with Lightwave 6, an object file can contain UV texture
coordinates. UV mapped textures use vertex maps, defined in the object
file as a VMAP sub-chunk of type TXUV to hold the U and V texture
coordinates. TXUV VMAPs have a dimension of 2. A very simple VMAP
chunk that defines the u , v texture coordinates for one polygon of a cube.
Vertex 2 will use texture coordinates (0, 0), vertex 3 uses coordinates (1,
0), vertex 6 uses coordinates (0, 1) and vertex 7 uses coordinates (1, 1).
In this example the full texture is mapped to the polygon.
VMAP 58
TXUV
2
“UV Texture”
2 0.0 0.0
3 1.0 0.0
6 0.0 1.0
7 1.0 1.0
Search Nedrilad ::




Custom Search