BGE/BGE/Model3dOps
Alias: BGE.BGE.Model3dOps
Static Methods
resolveEffectiveTexturePath(
options: BGE.Model3dLoadOptions,
model: BGE.Model3d,
): dynamic
Picks the texture path an .obj model should actually use: an explicit override always wins over whatever mtllib/map_Kd resolution found while parsing.
Parameters
options(BGE.Model3dLoadOptions)model(BGE.Model3d)
Returns
dynamic
applyTexture(
model: BGE.Model3d,
bitmap: roBitmap,
cacheId: string,
): void
Finalizes every face's texture data now that the texture bitmap is loaded and its dimensions are known: wraps bitmap in one shared region+id (every face on this model points at the same RegionWithId - one texture per model, per issue #89's v1 scope), and converts each textured face's normalized (0..1) UV points to pixel space, flipping v since .obj UVs are bottom-up and bitmaps are top-down. Faces with no Texture (a corner was missing a vt index while parsing) are left alone.
Parameters
model(BGE.Model3d)bitmap(roBitmap)cacheId(string) — a stable, unique-per-texture id (the resolved texture path works well) used as the triangle-cache key for every draw of this texture
Returns
void
clearTextures(model: BGE.Model3d): void
Clears every face's placeholder Texture, so the model falls back to flat-color rendering. Call this on every path where texture resolution/loading fails, so a face's Texture is never left as a placeholder whose srcRegionWithId.region is invalid - SceneObjectModel's draw path only checks face.Texture <> invalid, not the region inside it, so an uncleared placeholder crashes at draw time instead of degrading gracefully.
Parameters
model(BGE.Model3d)
Returns
void