Browse Source

Submesh to material dependency

sebavan 6 năm trước cách đây
mục cha
commit
7fa413cbb9

+ 1 - 7
Tools/Config/tempCircularValidation/core.json

@@ -23,12 +23,6 @@
     "../../src/Materials/Textures/internalTexture.ts": [
         "../../src/Engines/engine.ts"
     ],
-    "../../src/Materials/material.ts": [
-        "../../src/Meshes/subMesh.ts"
-    ],
-    "../../src/Meshes/subMesh.ts": [
-        "../../src/Materials/material.ts"
-    ],
     "../../src/Particles/particleHelper.ts": [
         "../../src/Particles/particleSystemSet.ts"
     ],
@@ -59,5 +53,5 @@
     "../../src/Rendering/geometryBufferRendererSceneComponent.ts": [
         "../../src/Rendering/geometryBufferRenderer.ts"
     ],
-    "errorCount": 20
+    "errorCount": 18
 }

+ 55 - 0
src/Engines/constants.ts

@@ -232,6 +232,61 @@ export class Constants {
     public static readonly MATERIAL_AllDirtyFlag = 31;
 
     /**
+     * Returns the triangle fill mode
+     */
+    public static readonly MATERIAL_TriangleFillMode = 0;
+
+    /**
+     * Returns the wireframe mode
+     */
+    public static readonly MATERIAL_WireFrameFillMode = 1;
+
+    /**
+     * Returns the point fill mode
+     */
+    public static readonly MATERIAL_PointFillMode = 2;
+
+    /**
+     * Returns the point list draw mode
+     */
+    public static readonly MATERIAL_PointListDrawMode = 3;
+
+    /**
+     * Returns the line list draw mode
+     */
+    public static readonly MATERIAL_LineListDrawMode = 4;
+
+    /**
+     * Returns the line loop draw mode
+     */
+    public static readonly MATERIAL_LineLoopDrawMode = 5;
+
+    /**
+     * Returns the line strip draw mode
+     */
+    public static readonly MATERIAL_LineStripDrawMode = 6;
+
+    /**
+     * Returns the triangle strip draw mode
+     */
+    public static readonly MATERIAL_TriangleStripDrawMode = 7;
+
+    /**
+     * Returns the triangle fan draw mode
+     */
+    public static readonly MATERIAL_TriangleFanDrawMode = 8;
+
+    /**
+     * Stores the clock-wise side orientation
+     */
+    public static readonly MATERIAL_ClockWiseSideOrientation = 0;
+
+    /**
+     * Stores the counter clock-wise side orientation
+     */
+    public static readonly MATERIAL_CounterClockWiseSideOrientation = 1;
+
+    /**
      * Nothing
      * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers
      */

+ 11 - 63
src/Materials/material.ts

@@ -25,104 +25,52 @@ declare var BABYLON: any;
      * Base class for the main features of a material in Babylon.js
      */
     export class Material implements IAnimatable {
-        // Triangle views
-        private static _TriangleFillMode = 0;
-        private static _WireFrameFillMode = 1;
-        private static _PointFillMode = 2;
-        // Draw modes
-        private static _PointListDrawMode = 3;
-        private static _LineListDrawMode = 4;
-        private static _LineLoopDrawMode = 5;
-        private static _LineStripDrawMode = 6;
-        private static _TriangleStripDrawMode = 7;
-        private static _TriangleFanDrawMode = 8;
-
         /**
          * Returns the triangle fill mode
          */
-        public static get TriangleFillMode(): number {
-            return Material._TriangleFillMode;
-        }
-
+        public static readonly TriangleFillMode = Constants.MATERIAL_TriangleFillMode;
         /**
          * Returns the wireframe mode
          */
-        public static get WireFrameFillMode(): number {
-            return Material._WireFrameFillMode;
-        }
-
+        public static readonly WireFrameFillMode = Constants.MATERIAL_WireFrameFillMode;
         /**
          * Returns the point fill mode
          */
-        public static get PointFillMode(): number {
-            return Material._PointFillMode;
-        }
-
+        public static readonly PointFillMode = Constants.MATERIAL_PointFillMode;
         /**
          * Returns the point list draw mode
          */
-        public static get PointListDrawMode(): number {
-            return Material._PointListDrawMode;
-        }
-
+        public static readonly PointListDrawMode = Constants.MATERIAL_PointListDrawMode;
         /**
          * Returns the line list draw mode
          */
-        public static get LineListDrawMode(): number {
-            return Material._LineListDrawMode;
-        }
-
+        public static readonly LineListDrawMode = Constants.MATERIAL_LineListDrawMode;
         /**
          * Returns the line loop draw mode
          */
-        public static get LineLoopDrawMode(): number {
-            return Material._LineLoopDrawMode;
-        }
-
+        public static readonly LineLoopDrawMode = Constants.MATERIAL_LineLoopDrawMode;
         /**
          * Returns the line strip draw mode
          */
-        public static get LineStripDrawMode(): number {
-            return Material._LineStripDrawMode;
-        }
-
+        public static readonly LineStripDrawMode = Constants.MATERIAL_LineStripDrawMode;
         /**
          * Returns the triangle strip draw mode
          */
-        public static get TriangleStripDrawMode(): number {
-            return Material._TriangleStripDrawMode;
-        }
-
+        public static readonly TriangleStripDrawMode = Constants.MATERIAL_TriangleStripDrawMode;
         /**
          * Returns the triangle fan draw mode
          */
-        public static get TriangleFanDrawMode(): number {
-            return Material._TriangleFanDrawMode;
-        }
+        public static readonly TriangleFanDrawMode = Constants.MATERIAL_TriangleFanDrawMode;
 
         /**
          * Stores the clock-wise side orientation
          */
-        private static _ClockWiseSideOrientation = 0;
+        public static readonly ClockWiseSideOrientation = Constants.MATERIAL_ClockWiseSideOrientation;
 
         /**
          * Stores the counter clock-wise side orientation
          */
-        private static _CounterClockWiseSideOrientation = 1;
-
-        /**
-         * Returns the clock-wise side orientation
-         */
-        public static get ClockWiseSideOrientation(): number {
-            return Material._ClockWiseSideOrientation;
-        }
-
-        /**
-         * Returns the counter clock-wise side orientation
-         */
-        public static get CounterClockWiseSideOrientation(): number {
-            return Material._CounterClockWiseSideOrientation;
-        }
+        public static readonly CounterClockWiseSideOrientation = Constants.MATERIAL_CounterClockWiseSideOrientation;
 
         /**
          * The dirty texture flag value

+ 10 - 9
src/Meshes/subMesh.ts

@@ -8,10 +8,11 @@ import { IntersectionInfo } from "../Collisions/pickingInfo";
 import { Ray } from "../Culling/ray";
 import { ICullable, BoundingInfo } from "../Culling/boundingInfo";
 import { Effect } from "../Materials/effect";
-import { Material } from "../Materials/material";
-import { MaterialDefines } from "../Materials/materialDefines";
-import { MultiMaterial } from "../Materials/multiMaterial";
+import { Constants } from "../Engines/constants";
 
+declare type Material = import("../Materials/material").Material;
+declare type MaterialDefines = import("../Materials/materialDefines").MaterialDefines;
+declare type MultiMaterial = import("../Materials/multiMaterial").MultiMaterial;
 declare type AbstractMesh = import("./abstractMesh").AbstractMesh;
 declare type Mesh = import("./mesh").Mesh;
 
@@ -349,12 +350,12 @@ declare type Mesh = import("./mesh").Mesh;
             }
 
             switch (material.fillMode) {
-                case Material.PointListDrawMode:
-                case Material.LineListDrawMode:
-                case Material.LineLoopDrawMode:
-                case Material.LineStripDrawMode:
-                case Material.TriangleFanDrawMode:
-                case Material.TriangleStripDrawMode:
+                case Constants.MATERIAL_PointListDrawMode:
+                case Constants.MATERIAL_LineListDrawMode:
+                case Constants.MATERIAL_LineLoopDrawMode:
+                case Constants.MATERIAL_LineStripDrawMode:
+                case Constants.MATERIAL_TriangleFanDrawMode:
+                case Constants.MATERIAL_TriangleStripDrawMode:
                     return null;
             }