|
@@ -241,5 +241,61 @@
|
|
public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null): Texture {
|
|
public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null): Texture {
|
|
return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data);
|
|
return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static ParseTexture(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture {
|
|
|
|
+ if (parsedTexture.isCube) {
|
|
|
|
+ return CubeTexture.ParseCubeTexture(parsedTexture, scene, rootUrl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!parsedTexture.name && !parsedTexture.isRenderTarget) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var texture;
|
|
|
|
+
|
|
|
|
+ if (parsedTexture.mirrorPlane) {
|
|
|
|
+ texture = new MirrorTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene);
|
|
|
|
+ texture._waitingRenderList = parsedTexture.renderList;
|
|
|
|
+ texture.mirrorPlane = Plane.FromArray(parsedTexture.mirrorPlane);
|
|
|
|
+ } else if (parsedTexture.isRenderTarget) {
|
|
|
|
+ texture = new RenderTargetTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene);
|
|
|
|
+ texture._waitingRenderList = parsedTexture.renderList;
|
|
|
|
+ } else {
|
|
|
|
+ if (parsedTexture.base64String) {
|
|
|
|
+ texture = Texture.CreateFromBase64String(parsedTexture.base64String, parsedTexture.name, scene);
|
|
|
|
+ } else {
|
|
|
|
+ texture = new Texture(rootUrl + parsedTexture.name, scene);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ texture.name = parsedTexture.name;
|
|
|
|
+ texture.hasAlpha = parsedTexture.hasAlpha;
|
|
|
|
+ texture.getAlphaFromRGB = parsedTexture.getAlphaFromRGB;
|
|
|
|
+ texture.level = parsedTexture.level;
|
|
|
|
+
|
|
|
|
+ texture.coordinatesIndex = parsedTexture.coordinatesIndex;
|
|
|
|
+ texture.coordinatesMode = parsedTexture.coordinatesMode;
|
|
|
|
+ texture.uOffset = parsedTexture.uOffset;
|
|
|
|
+ texture.vOffset = parsedTexture.vOffset;
|
|
|
|
+ texture.uScale = parsedTexture.uScale;
|
|
|
|
+ texture.vScale = parsedTexture.vScale;
|
|
|
|
+ texture.uAng = parsedTexture.uAng;
|
|
|
|
+ texture.vAng = parsedTexture.vAng;
|
|
|
|
+ texture.wAng = parsedTexture.wAng;
|
|
|
|
+
|
|
|
|
+ texture.wrapU = parsedTexture.wrapU;
|
|
|
|
+ texture.wrapV = parsedTexture.wrapV;
|
|
|
|
+
|
|
|
|
+ // Animations
|
|
|
|
+ if (parsedTexture.animations) {
|
|
|
|
+ for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {
|
|
|
|
+ var parsedAnimation = parsedTexture.animations[animationIndex];
|
|
|
|
+
|
|
|
|
+ texture.animations.push(Animation.ParseAnimation(parsedAnimation));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return texture;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|