66using System . Runtime . InteropServices ;
77using UnityEngine ;
88using UnityEngine . Internal ;
9+ using UnityEngine . Rendering ;
910
1011namespace UnityEditor
1112{
@@ -107,7 +108,7 @@ public void Dispose()
107108 }
108109 }
109110
110- static Mesh cubeMesh
111+ internal static Mesh cubeMesh
111112 {
112113 get
113114 {
@@ -117,7 +118,7 @@ static Mesh cubeMesh
117118 }
118119 }
119120
120- static Mesh coneMesh
121+ internal static Mesh coneMesh
121122 {
122123 get
123124 {
@@ -127,7 +128,7 @@ static Mesh coneMesh
127128 }
128129 }
129130
130- static Mesh cylinderMesh
131+ internal static Mesh cylinderMesh
131132 {
132133 get
133134 {
@@ -137,7 +138,7 @@ static Mesh cylinderMesh
137138 }
138139 }
139140
140- static Mesh sphereMesh
141+ internal static Mesh sphereMesh
141142 {
142143 get
143144 {
@@ -147,6 +148,16 @@ static Mesh sphereMesh
147148 }
148149 }
149150
151+ internal static Mesh quadMesh
152+ {
153+ get
154+ {
155+ if ( s_QuadMesh == null )
156+ Init ( ) ;
157+ return s_QuadMesh ;
158+ }
159+ }
160+
150161 internal static int s_xRotateHandleHash = "xRotateHandleHash" . GetHashCode ( ) ;
151162 internal static int s_yRotateHandleHash = "yRotateHandleHash" . GetHashCode ( ) ;
152163 internal static int s_zRotateHandleHash = "zRotateHandleHash" . GetHashCode ( ) ;
@@ -1408,9 +1419,14 @@ public static void DrawCamera(Rect position, Camera camera)
14081419 }
14091420
14101421 public static void DrawCamera ( Rect position , Camera camera , [ DefaultValue ( "UnityEditor.DrawCameraMode.Normal" ) ] DrawCameraMode drawMode )
1422+ {
1423+ DrawCamera ( position , camera , drawMode , true ) ;
1424+ }
1425+
1426+ public static void DrawCamera ( Rect position , Camera camera , [ DefaultValue ( "UnityEditor.DrawCameraMode.Normal" ) ] DrawCameraMode drawMode , bool drawGizmos )
14111427 {
14121428 DrawGridParameters nullGridParam = new DrawGridParameters ( ) ;
1413- DrawCameraImpl ( position , camera , drawMode , false , nullGridParam , true ) ;
1429+ DrawCameraImpl ( position , camera , drawMode , false , nullGridParam , true , drawGizmos ) ;
14141430 }
14151431
14161432 internal enum CameraFilterMode
@@ -1491,5 +1507,41 @@ public static Vector3[] MakeBezierPoints(Vector3 startPosition, Vector3 endPosit
14911507 throw new ArgumentOutOfRangeException ( "division" , "Must be greater than zero" ) ;
14921508 return Internal_MakeBezierPoints ( startPosition , endPosition , startTangent , endTangent , division ) ;
14931509 }
1510+
1511+ public static void DrawTexture3DSDF ( Texture texture ,
1512+ [ DefaultValue ( "1.0f" ) ] float stepScale = 1.0f ,
1513+ [ DefaultValue ( "0.0f" ) ] float surfaceOffset = 0.0f ,
1514+ [ DefaultValue ( "null" ) ] Gradient customColorRamp = null )
1515+ {
1516+ Vector3 localScale = new Vector3 ( matrix . GetColumn ( 0 ) . magnitude , matrix . GetColumn ( 1 ) . magnitude , matrix . GetColumn ( 2 ) . magnitude ) ;
1517+ Texture3DInspector . PrepareSDFPreview ( Texture3DInspector . Materials . SDF , texture , localScale , stepScale , surfaceOffset , customColorRamp ) ;
1518+ Texture3DInspector . Materials . SDF . SetPass ( 0 ) ;
1519+ Graphics . DrawMeshNow ( cubeMesh , matrix ) ;
1520+ }
1521+
1522+ public static void DrawTexture3DSlice ( Texture texture , Vector3 slicePositions ,
1523+ [ DefaultValue ( "FilterMode.Bilinear" ) ] FilterMode filterMode = FilterMode . Bilinear ,
1524+ [ DefaultValue ( "false" ) ] bool useColorRamp = false ,
1525+ [ DefaultValue ( "null" ) ] Gradient customColorRamp = null )
1526+ {
1527+ Vector3 localScale = new Vector3 ( matrix . GetColumn ( 0 ) . magnitude , matrix . GetColumn ( 1 ) . magnitude , matrix . GetColumn ( 2 ) . magnitude ) ;
1528+ Texture3DInspector . PrepareSlicePreview ( Texture3DInspector . Materials . Slice , texture , slicePositions , filterMode , useColorRamp , customColorRamp ) ;
1529+ Texture3DInspector . Materials . Slice . SetPass ( 0 ) ;
1530+ Graphics . DrawMeshNow ( cubeMesh , matrix ) ;
1531+ }
1532+
1533+ public static void DrawTexture3DVolume ( Texture texture ,
1534+ [ DefaultValue ( "1.0f" ) ] float opacity = 1.0f ,
1535+ [ DefaultValue ( "1.0f" ) ] float qualityModifier = 1.0f ,
1536+ [ DefaultValue ( "FilterMode.Bilinear" ) ] FilterMode filterMode = FilterMode . Bilinear ,
1537+ [ DefaultValue ( "false" ) ] bool useColorRamp = false ,
1538+ [ DefaultValue ( "null" ) ] Gradient customColorRamp = null )
1539+ {
1540+ Vector3 localScale = new Vector3 ( matrix . GetColumn ( 0 ) . magnitude , matrix . GetColumn ( 1 ) . magnitude , matrix . GetColumn ( 2 ) . magnitude ) ;
1541+ int sampleCount = Texture3DInspector . PrepareVolumePreview ( Texture3DInspector . Materials . Volume , texture , localScale , opacity ,
1542+ filterMode , useColorRamp , customColorRamp , Camera . current , matrix , qualityModifier ) ;
1543+ Texture3DInspector . Materials . Volume . SetPass ( 0 ) ;
1544+ Graphics . DrawProceduralNow ( MeshTopology . Quads , 4 , sampleCount ) ;
1545+ }
14941546 }
14951547}
0 commit comments