Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private static _GetTextureWrapMode(context: string, mode: TextureWrapMode | undefined): number {
// Set defaults if undefined
mode = mode == undefined ? TextureWrapMode.REPEAT : mode;
switch (mode) {
case TextureWrapMode.CLAMP_TO_EDGE: return Texture.CLAMP_ADDRESSMODE;
case TextureWrapMode.MIRRORED_REPEAT: return Texture.MIRROR_ADDRESSMODE;
case TextureWrapMode.REPEAT: return Texture.WRAP_ADDRESSMODE;
default:
Tools.Warn(`${context}: Invalid value (${mode})`);
return Texture.WRAP_ADDRESSMODE;
}
}
private static _GetTextureWrapMode(context: string, mode: TextureWrapMode | undefined): number {
// Set defaults if undefined
mode = mode == undefined ? TextureWrapMode.REPEAT : mode;
switch (mode) {
case TextureWrapMode.CLAMP_TO_EDGE: return Texture.CLAMP_ADDRESSMODE;
case TextureWrapMode.MIRRORED_REPEAT: return Texture.MIRROR_ADDRESSMODE;
case TextureWrapMode.REPEAT: return Texture.WRAP_ADDRESSMODE;
default:
Logger.Warn(`${context}: Invalid value (${mode})`);
return Texture.WRAP_ADDRESSMODE;
}
}
private _getGLTFTextureWrapMode(wrapMode: number): TextureWrapMode {
switch (wrapMode) {
case Texture.WRAP_ADDRESSMODE: {
return TextureWrapMode.REPEAT;
}
case Texture.CLAMP_ADDRESSMODE: {
return TextureWrapMode.CLAMP_TO_EDGE;
}
case Texture.MIRROR_ADDRESSMODE: {
return TextureWrapMode.MIRRORED_REPEAT;
}
default: {
Tools.Error(`Unsupported Texture Wrap Mode ${wrapMode}!`);
return TextureWrapMode.REPEAT;
}
}
}