Selaa lähdekoodia

make tessellation as option for rotationGizmo

Trevor Baron 7 vuotta sitten
vanhempi
commit
b301732da7

+ 2 - 2
src/Gizmos/babylon.planeRotationGizmo.ts

@@ -24,8 +24,9 @@ module BABYLON {
          * @param gizmoLayer The utility layer the gizmo will be added to
          * @param gizmoLayer The utility layer the gizmo will be added to
          * @param planeNormal The normal of the plane which the gizmo will be able to rotate on
          * @param planeNormal The normal of the plane which the gizmo will be able to rotate on
          * @param color The color of the gizmo
          * @param color The color of the gizmo
+         * @param tessellation Amount of tessellation to be used when creating rotation circles
          */
          */
-        constructor(planeNormal:Vector3, color:Color3 = Color3.Gray(), gizmoLayer:UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer){
+        constructor(planeNormal:Vector3, color:Color3 = Color3.Gray(), gizmoLayer:UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer, tessellation = 32){
             super(gizmoLayer);
             super(gizmoLayer);
             
             
             // Create Material
             // Create Material
@@ -41,7 +42,6 @@ module BABYLON {
             var parentMesh = new BABYLON.AbstractMesh("", gizmoLayer.utilityLayerScene);
             var parentMesh = new BABYLON.AbstractMesh("", gizmoLayer.utilityLayerScene);
 
 
             // Create circle out of lines
             // Create circle out of lines
-            var tessellation = 20;
             var radius = 0.8;
             var radius = 0.8;
             var points = new Array<Vector3>();
             var points = new Array<Vector3>();
             for(var i = 0;i < tessellation;i++){
             for(var i = 0;i < tessellation;i++){

+ 5 - 4
src/Gizmos/babylon.rotationGizmo.ts

@@ -26,12 +26,13 @@ module BABYLON {
         /**
         /**
          * Creates a RotationGizmo
          * Creates a RotationGizmo
          * @param gizmoLayer The utility layer the gizmo will be added to
          * @param gizmoLayer The utility layer the gizmo will be added to
+         * @param tessellation Amount of tessellation to be used when creating rotation circles
          */
          */
-        constructor(gizmoLayer:UtilityLayerRenderer=UtilityLayerRenderer.DefaultUtilityLayer){
+        constructor(gizmoLayer:UtilityLayerRenderer=UtilityLayerRenderer.DefaultUtilityLayer, tessellation = 32){
             super(gizmoLayer);
             super(gizmoLayer);
-            this.xGizmo = new PlaneRotationGizmo(new Vector3(1,0,0), BABYLON.Color3.Red().scale(0.5), gizmoLayer);
-            this.yGizmo = new PlaneRotationGizmo(new Vector3(0,1,0), BABYLON.Color3.Green().scale(0.5), gizmoLayer);
-            this.zGizmo = new PlaneRotationGizmo(new Vector3(0,0,1), BABYLON.Color3.Blue().scale(0.5), gizmoLayer);
+            this.xGizmo = new PlaneRotationGizmo(new Vector3(1,0,0), BABYLON.Color3.Red().scale(0.5), gizmoLayer, tessellation);
+            this.yGizmo = new PlaneRotationGizmo(new Vector3(0,1,0), BABYLON.Color3.Green().scale(0.5), gizmoLayer, tessellation);
+            this.zGizmo = new PlaneRotationGizmo(new Vector3(0,0,1), BABYLON.Color3.Blue().scale(0.5), gizmoLayer, tessellation);
             this.attachedMesh = null;
             this.attachedMesh = null;
         }
         }