3
3
using System ;
4
4
using System . Collections . Generic ;
5
5
using System . IO ;
6
- using System . Linq ;
7
6
using System . Text ;
8
7
using GaussianSplatting . Runtime ;
9
8
using Unity . Collections . LowLevel . Unsafe ;
@@ -22,11 +21,11 @@ public class GaussianSplatRendererEditor : UnityEditor.Editor
22
21
const string kPrefExportBake = "nesnausk.GaussianSplatting.ExportBakeTransform" ;
23
22
24
23
SerializedProperty m_PropAsset ;
24
+ SerializedProperty m_PropRenderOrder ;
25
25
SerializedProperty m_PropSplatScale ;
26
26
SerializedProperty m_PropOpacityScale ;
27
27
SerializedProperty m_PropSHOrder ;
28
28
SerializedProperty m_PropSHOnly ;
29
- SerializedProperty m_CenterEyeOnly ;
30
29
SerializedProperty m_PropSortNthFrame ;
31
30
SerializedProperty m_PropRenderMode ;
32
31
SerializedProperty m_PropPointDisplaySize ;
@@ -35,10 +34,7 @@ public class GaussianSplatRendererEditor : UnityEditor.Editor
35
34
SerializedProperty m_PropShaderComposite ;
36
35
SerializedProperty m_PropShaderDebugPoints ;
37
36
SerializedProperty m_PropShaderDebugBoxes ;
38
- SerializedProperty m_PropCSSplatUtilities_deviceRadixSort ;
39
- SerializedProperty m_PropCSSplatUtilities_fidelityFxSort ;
40
- SerializedProperty m_gpuSortType ;
41
- SerializedProperty m_PropOptimizeForQuest ;
37
+ SerializedProperty m_PropCSSplatUtilities ;
42
38
43
39
bool m_ResourcesExpanded = false ;
44
40
int m_CameraIndex = 0 ;
@@ -65,23 +61,21 @@ public void OnEnable()
65
61
m_ExportBakeTransform = EditorPrefs . GetBool ( kPrefExportBake , false ) ;
66
62
67
63
m_PropAsset = serializedObject . FindProperty ( "m_Asset" ) ;
64
+ m_PropRenderOrder = serializedObject . FindProperty ( "m_RenderOrder" ) ;
68
65
m_PropSplatScale = serializedObject . FindProperty ( "m_SplatScale" ) ;
69
66
m_PropOpacityScale = serializedObject . FindProperty ( "m_OpacityScale" ) ;
70
67
m_PropSHOrder = serializedObject . FindProperty ( "m_SHOrder" ) ;
71
68
m_PropSHOnly = serializedObject . FindProperty ( "m_SHOnly" ) ;
72
69
m_PropSortNthFrame = serializedObject . FindProperty ( "m_SortNthFrame" ) ;
73
- m_CenterEyeOnly = serializedObject . FindProperty ( "m_CenterEyeOnly" ) ;
74
70
m_PropRenderMode = serializedObject . FindProperty ( "m_RenderMode" ) ;
75
71
m_PropPointDisplaySize = serializedObject . FindProperty ( "m_PointDisplaySize" ) ;
76
72
m_PropCutouts = serializedObject . FindProperty ( "m_Cutouts" ) ;
77
73
m_PropShaderSplats = serializedObject . FindProperty ( "m_ShaderSplats" ) ;
78
74
m_PropShaderComposite = serializedObject . FindProperty ( "m_ShaderComposite" ) ;
79
75
m_PropShaderDebugPoints = serializedObject . FindProperty ( "m_ShaderDebugPoints" ) ;
80
76
m_PropShaderDebugBoxes = serializedObject . FindProperty ( "m_ShaderDebugBoxes" ) ;
81
- m_PropCSSplatUtilities_deviceRadixSort = serializedObject . FindProperty ( "m_CSSplatUtilities_deviceRadixSort" ) ;
82
- m_PropCSSplatUtilities_fidelityFxSort = serializedObject . FindProperty ( "m_CSSplatUtilities_fidelityFX" ) ;
83
- m_gpuSortType = serializedObject . FindProperty ( "m_gpuSortType" ) ;
84
- m_PropOptimizeForQuest = serializedObject . FindProperty ( "m_OptimizeForQuest" ) ;
77
+ m_PropCSSplatUtilities = serializedObject . FindProperty ( "m_CSSplatUtilities" ) ;
78
+
85
79
s_AllEditors . Add ( this ) ;
86
80
}
87
81
@@ -111,45 +105,12 @@ public override void OnInspectorGUI()
111
105
112
106
EditorGUILayout . Space ( ) ;
113
107
GUILayout . Label ( "Render Options" , EditorStyles . boldLabel ) ;
108
+ EditorGUILayout . PropertyField ( m_PropRenderOrder ) ;
114
109
EditorGUILayout . PropertyField ( m_PropSplatScale ) ;
115
110
EditorGUILayout . PropertyField ( m_PropOpacityScale ) ;
116
111
EditorGUILayout . PropertyField ( m_PropSHOrder ) ;
117
112
EditorGUILayout . PropertyField ( m_PropSHOnly ) ;
118
- EditorGUILayout . PropertyField ( m_gpuSortType ) ;
119
- if ( gs . m_gpuSortType != GpuSorting . SortType . None )
120
- {
121
- EditorGUILayout . PropertyField ( m_PropSortNthFrame ) ;
122
- EditorGUILayout . PropertyField ( m_CenterEyeOnly ) ;
123
- }
124
- EditorGUILayout . PropertyField ( m_PropOptimizeForQuest ) ;
125
-
126
- if ( gs . HasValidAsset )
127
- {
128
- EditorGUILayout . Space ( ) ;
129
- GUILayout . Label ( "Layer Options" , EditorStyles . boldLabel ) ;
130
- for ( int i = 0 ; i < gs . asset . layerInfo . Count ; i ++ )
131
- {
132
- if ( gs . asset . layerInfo . Count > gs . m_LayerActivationState . Count )
133
- {
134
- var toAdd = Enumerable . Repeat ( default ( int2 ) , gs . asset . layerInfo . Count - gs . m_LayerActivationState . Count ) ;
135
- gs . m_LayerActivationState . AddRange ( toAdd ) ;
136
-
137
- // On initial resize, activate first layer
138
- gs . m_LayerActivationState [ 0 ] = new int2 ( 0 , 1 ) ;
139
- gs . UpdateRessources ( ) ;
140
- }
141
-
142
- var layer = gs . m_LayerActivationState . ElementAtOrDefault ( i ) ;
143
- var layerActive = layer . y > 0 ;
144
- var check = EditorGUILayout . Toggle ( $ "Show layer { i } ", layerActive ) ;
145
- if ( check != layerActive )
146
- {
147
- gs . m_LayerActivationState [ i ] = new int2 ( i , check ? 1 : 0 ) ;
148
- gs . UpdateRessources ( ) ;
149
- EditorUtility . SetDirty ( gs ) ;
150
- }
151
- }
152
- }
113
+ EditorGUILayout . PropertyField ( m_PropSortNthFrame ) ;
153
114
154
115
EditorGUILayout . Space ( ) ;
155
116
GUILayout . Label ( "Debugging Tweaks" , EditorStyles . boldLabel ) ;
@@ -165,8 +126,7 @@ public override void OnInspectorGUI()
165
126
EditorGUILayout . PropertyField ( m_PropShaderComposite ) ;
166
127
EditorGUILayout . PropertyField ( m_PropShaderDebugPoints ) ;
167
128
EditorGUILayout . PropertyField ( m_PropShaderDebugBoxes ) ;
168
- EditorGUILayout . PropertyField ( m_PropCSSplatUtilities_deviceRadixSort ) ;
169
- EditorGUILayout . PropertyField ( m_PropCSSplatUtilities_fidelityFxSort ) ;
129
+ EditorGUILayout . PropertyField ( m_PropCSSplatUtilities ) ;
170
130
}
171
131
bool validAndEnabled = gs && gs . enabled && gs . gameObject . activeInHierarchy && gs . HasValidAsset ;
172
132
if ( validAndEnabled && ! gs . HasValidRenderSetup )
@@ -225,7 +185,7 @@ void MultiEditGUI()
225
185
return ;
226
186
}
227
187
228
- if ( targetGs . asset . chunkDataSize > 0 )
188
+ if ( targetGs . asset . chunkData != null )
229
189
{
230
190
EditorGUILayout . HelpBox ( $ "Can't merge into { target . name } (needs to use Very High quality preset)", MessageType . Warning ) ;
231
191
return ;
@@ -309,7 +269,7 @@ void EditGUI(GaussianSplatRenderer gs)
309
269
ToolManager . SetActiveContext < GameObjectToolContext > ( ) ;
310
270
}
311
271
312
- if ( isToolActive && gs . asset . chunkDataSize > 0 )
272
+ if ( isToolActive && gs . asset . chunkData != null )
313
273
{
314
274
EditorGUILayout . HelpBox ( "Splat move/rotate/scale tools need Very High splat quality preset" , MessageType . Warning ) ;
315
275
}
@@ -438,13 +398,13 @@ static unsafe void ExportPlyFile(GaussianSplatRenderer gs, bool bakeTransform)
438
398
if ( string . IsNullOrWhiteSpace ( path ) )
439
399
return ;
440
400
441
- int kSplatSize = UnsafeUtility . SizeOf < GaussianSplatAssetCreator . InputSplatData > ( ) ;
401
+ int kSplatSize = UnsafeUtility . SizeOf < Utils . InputSplatData > ( ) ;
442
402
using var gpuData = new GraphicsBuffer ( GraphicsBuffer . Target . Structured , gs . splatCount , kSplatSize ) ;
443
403
444
404
if ( ! gs . EditExportData ( gpuData , bakeTransform ) )
445
405
return ;
446
406
447
- GaussianSplatAssetCreator . InputSplatData [ ] data = new GaussianSplatAssetCreator . InputSplatData [ gpuData . count ] ;
407
+ Utils . InputSplatData [ ] data = new Utils . InputSplatData [ gpuData . count ] ;
448
408
gpuData . GetData ( data ) ;
449
409
450
410
var gpuDeleted = gs . GpuEditDeleted ;
0 commit comments