File tree Expand file tree Collapse file tree
OpenVDBForUnity/Assets/OpenVDB Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,16 @@ public override void OnInspectorGUI()
8989 var property = serializedObject . FindProperty ( pathSettings + "extractTextures" ) ;
9090 var disabled = property . boolValue ;
9191 EditorGUI . BeginDisabledGroup ( disabled ) ;
92+
93+ // Max Texture Size
94+ {
95+ var property2 = serializedObject . FindProperty ( pathSettings + "textureMaxSize" ) ;
96+ var textureMaxSize = property2 . intValue ;
97+ EditorGUILayout . BeginHorizontal ( ) ;
98+ EditorGUILayout . PrefixLabel ( "Texture Max Size" ) ;
99+ property2 . intValue = EditorGUILayout . IntField ( textureMaxSize ) ;
100+ EditorGUILayout . EndHorizontal ( ) ;
101+ }
92102 EditorGUILayout . BeginHorizontal ( ) ;
93103 EditorGUILayout . PrefixLabel ( "Textures" ) ;
94104 if ( GUILayout . Button ( "Extract Textures" ) )
Original file line number Diff line number Diff line change @@ -7,10 +7,12 @@ namespace OpenVDB
77 public struct oiConfig
88 {
99 public float scaleFactor ;
10+ public int textureMaxSize ;
1011
1112 public void SetDefaults ( )
1213 {
1314 scaleFactor = 0.01f ;
15+ textureMaxSize = 0 ;
1416 }
1517 }
1618
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ public bool Load()
4747 var config = new oiConfig ( ) ;
4848 config . SetDefaults ( ) ;
4949 config . scaleFactor = settings . scaleFactor ;
50+ config . textureMaxSize = settings . textureMaxSize ;
5051
5152 context . SetConfig ( ref config ) ;
5253 var path = Path . Combine ( Application . streamingAssetsPath , m_streamDescriptor . pathToVDB ) ;
Original file line number Diff line number Diff line change @@ -18,5 +18,7 @@ public class OpenVDBStreamSettings
1818 [ SerializeField ] public Texture [ ] textures = new Texture [ 0 ] ;
1919
2020 [ SerializeField ] public Material [ ] materials = new Material [ 0 ] ;
21+
22+ [ SerializeField ] public int textureMaxSize = 256 ;
2123 }
2224}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ class oiVolume;
66struct oiConfig
77{
88 float scale_factor = 1 .0f ;
9+ int max_texture_size = 0 ;
910};
1011
1112struct oiVolumeSummary
Original file line number Diff line number Diff line change @@ -153,7 +153,10 @@ bool oiContext::load(const char *in_path)
153153 return true ;
154154 }
155155 m_grid = openvdb::gridConstPtrCast<openvdb::FloatGrid>(allGrids[0 ]);
156-
156+ if (m_config.max_texture_size != 0 )
157+ {
158+ m_extents.reset (m_config.max_texture_size );
159+ }
157160 m_volume = new oiVolume (*m_grid, m_extents);
158161 m_volume->setScaleFactor (m_config.scale_factor );
159162 return true ;
You can’t perform that action at this time.
0 commit comments