Additionaly to color, all core built-in builders, e.g. terrain, building, tree, etc. support textures.
It is not surprise, that texture usage is controlled by mapcss definitions:
area|z9-16[kind=park] {
...
texture-index: 0;
texture-type: background;
texture-scale: 50;
}
Here:
- [Required] texture_index: texture index provided by @texture
- [Required] texture-type: texture type inside given texture.
- [Required] texture-scale: texture scale ratio relative to tile size.
Texture index is inside texture mapping file:
1,2048,2048
background,0,1536,512,512
background,0,1024,512,512
barrier,512,1536,512,512
brick,512,1024,512,512
drive,0,512,512,512
facade,512,512,512,512
facade,1024,1536,512,512
facade,1024,1024,512,512
glass,1024,512,512,512
grass,0,0,512,512
metal,512,0,512,512
pedestrian,1024,0,512,512
roof,1536,1536,512,512
tree,1536,1024,512,512
water,1536,512,512,512
wood,1536,0,512,512
It has the following format:
[texture index],[texture atlas width],[texture atlas height]
[texture type name],[start x],[start y],[width][height]
[texture type name],[start x],[start y],[width][height]
...
So, this file reflects structure of real texture atlas which contains multiple images (texture types) inside. Texture atlas has to be included inside mapcss with the following rule:
@texture url("default.detail-atlas.txt");
In runtime, utymap uses this information to build proper texture coordinates and exposes this information through mesh's uvMap field:
void MeshBuilder::writeTextureMappingInfo(Mesh &mesh, const AppearanceOptions &appearanceOptions) const {
...
mesh.uvMap.push_back(static_cast<int>(mesh.uvs.size()));
mesh.uvMap.push_back(appearanceOptions.textureId);
mesh.uvMap.push_back(appearanceOptions.textureRegion.atlasWidth);
mesh.uvMap.push_back(appearanceOptions.textureRegion.atlasHeight);
mesh.uvMap.push_back(appearanceOptions.textureRegion.x);
mesh.uvMap.push_back(appearanceOptions.textureRegion.y);
mesh.uvMap.push_back(appearanceOptions.textureRegion.width);
mesh.uvMap.push_back(appearanceOptions.textureRegion.height);
}