r3-legacy/src/game-lib-texture-map.js

33 lines
824 B
JavaScript

/**
* We have a mapping between GameLib.D3.Texture and the Instance material map.
* Our GameLib.D3.Material.map.alpha corresponds to THREE.Material.alphaMap
* @constructor
* @param texture GameLib.D3.Texture
* @param instanceMapId string
*/
GameLib.D3.TextureMap = function TextureMap(
texture,
instanceMapId
) {
if (GameLib.D3.Utils.UndefinedOrNull(texture)) {
texture = null;
}
this.texture = texture;
if (GameLib.D3.Utils.UndefinedOrNull(instanceMapId)) {
instanceMapId = null;
}
this.instanceMapId = instanceMapId;
};
GameLib.D3.TextureMap.prototype.toApiTextureMap = function() {
var apiTexture = null;
if (this.texture) {
apiTexture = this.texture.toApiTexture();
}
return new GameLib.D3.TextureMap(apiTexture, this.instanceMapId);
};