浏览代码

add getClass to engine

Trevor Baron 6 年之前
父节点
当前提交
9e7e0a840e
共有 3 个文件被更改,包括 11 次插入3 次删除
  1. 8 0
      src/Engines/engine.ts
  2. 1 1
      src/Materials/Textures/texture.ts
  3. 2 2
      src/Materials/effectRenderer.ts

+ 8 - 0
src/Engines/engine.ts

@@ -1564,6 +1564,14 @@ export class Engine {
     }
 
     /**
+     * Gets a string idenfifying the name of the class
+     * @returns "Engine" string
+     */
+    public getClassName(): string {
+        return "Engine";
+    }
+
+    /**
      * Returns true if the stencil buffer has been enabled through the creation option of the context.
      */
     public get isStencilEnable(): boolean {

+ 1 - 1
src/Materials/Textures/texture.ts

@@ -269,7 +269,7 @@ export class Texture extends BaseTexture {
      * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
      */
     constructor(url: Nullable<string>, sceneOrEngine: Nullable<Scene | Engine>, noMipmap: boolean = false, invertY: boolean = true, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, buffer: Nullable<string | ArrayBuffer | HTMLImageElement | Blob> = null, deleteBuffer: boolean = false, format?: number) {
-        super((sceneOrEngine && (sceneOrEngine as Scene).getClassName && (sceneOrEngine as Scene).getClassName() === "Scene") ? (sceneOrEngine as Scene) : null);
+        super((sceneOrEngine && sceneOrEngine.getClassName() === "Scene") ? (sceneOrEngine as Scene) : null);
 
         this.name = url || "";
         this.url = url;

+ 2 - 2
src/Materials/effectRenderer.ts

@@ -27,8 +27,8 @@ export class EffectRenderer {
             for (var i = 0; i < 2; i++) {
                 var internalTexture = this.engine.createRenderTargetTexture(
                     {
-                        width: Math.floor(this.engine.getRenderWidth(true)),
-                        height: Math.floor(this.engine.getRenderHeight(true)),
+                        width: this.engine.getRenderWidth(true),
+                        height: this.engine.getRenderHeight(true),
                     },
                     {
                         generateDepthBuffer: false,