Browse Source

Doc LinesEdge Renderer

sebastien 7 năm trước cách đây
mục cha
commit
4026242bd0

+ 1 - 16
src/Mesh/babylon.linesMesh.ts

@@ -2,10 +2,7 @@
     export class LinesMesh extends Mesh {
         public color = new Color3(1, 1, 1);
         public alpha = 1;
-        /**
-         @hidden
-         **/
-        public _edgesRenderer: Nullable<LineEdgesRenderer>;
+
         /**
          * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
          * This margin is expressed in world space coordinates, so its value may vary.
@@ -144,18 +141,6 @@
         }
 
         /**
-         * Disables the mesh edge rendering mode
-         * @returns the currentAbstractMesh
-         */
-        public disableEdgesRendering(): AbstractMesh {
-            if (this._edgesRenderer) {
-                this._edgesRenderer.dispose();
-                this._edgesRenderer = null;
-            }
-            return this;
-        }
-
-        /**
          * Enables the edge rendering mode on the mesh.
          * This mode makes the mesh edges visible
          * @param epsilon defines the maximal distance between two angles to detect a face

+ 11 - 3
src/Rendering/babylon.edgesRenderer.ts

@@ -1,5 +1,7 @@
 module BABYLON {
-
+    /**
+     * FaceAdjacencies Helper class to generate edges
+     */
     class FaceAdjacencies {
         public edges = new Array<number>();
         public p0: Vector3;
@@ -8,6 +10,9 @@
         public edgesConnectedCount = 0;
     }
 
+    /**
+     * This class is used to generate edges of the mesh that could then easily be rendered in a scene.
+     */
     export class EdgesRenderer {
         public edgesWidthScalerForOrthographic = 1000.0;
         public edgesWidthScalerForPerspective = 50.0;
@@ -26,9 +31,9 @@
         /** Gets or sets a boolean indicating if the edgesRenderer is active */
         public isEnabled = true;
 
-        // Beware when you use this class with complex objects as the adjacencies computation can be really long
         /**
-         *
+         * Creates an instance of the EdgesRenderer. It is primarily use to display edges of a mesh.
+         * Beware when you use this class with complex objects as the adjacencies computation can be really long
          * @param  source Mesh used to create edges
          * @param  epsilon sum of angles in adjacency to check for edge
          * @param  checkVerticesInsteadOfIndices
@@ -78,6 +83,9 @@
             this._ib = engine.createIndexBuffer(this._linesIndices);
         }
 
+        /**
+         * Releases the required resources for the edges renderer
+         */
         public dispose(): void {
 
             var buffer = this._buffers[VertexBuffer.PositionKind];

+ 1 - 7
src/Rendering/babylon.lineEdgesRenderer.ts

@@ -1,7 +1,6 @@
 module BABYLON {
     /**
      * FaceAdjacencies Helper class to generate edges
-     *
      */
     class FaceAdjacencies {
         public edges = new Array<number>();
@@ -12,9 +11,7 @@
 
     /**
      * LineEdgesRenderer for LineMeshes to remove unnecessary triangulation
-     * @param {string} author Bartosz Ostapowicz
-     *
-     * */
+     */
     export class LineEdgesRenderer extends EdgesRenderer {
 
         /**
@@ -22,7 +19,6 @@
          * @param  source LineMesh used to generate edges
          * @param  epsilon not important (specified angle for edge detection)
          * @param  checkVerticesInsteadOfIndices not important for LineMesh
-         *
          */
         constructor(source: AbstractMesh, epsilon = 0.95, checkVerticesInsteadOfIndices = false) {
                 super(source, epsilon, checkVerticesInsteadOfIndices, false);
@@ -36,7 +32,6 @@
          * @param  faceNormals not important for LineMesh
          * @param  p0 beginnig of line
          * @param  p1 end of line
-         * @private
          */
         protected _checkEdge(faceIndex: number, edge: number, faceNormals: Array<Vector3>, p0: Vector3, p1: Vector3): void {
                 var offset = this._linesPositions.length / 3;
@@ -92,7 +87,6 @@
 
         /**
          * Generate edges for each line in LinesMesh. Every Line should be rendered as edge.
-         * @private
          */
         _generateEdgesLines(): void {
             var positions = this._source.getVerticesData(VertexBuffer.PositionKind);