Skip to content

Commit d490602

Browse files
authored
Merge pull request #12 from karasusan/texture-max-size
Add Parameter "TextureMaxSize"
2 parents a240049 + e39b9bd commit d490602

6 files changed

Lines changed: 20 additions & 1 deletion

File tree

OpenVDBForUnity/Assets/OpenVDB/Editor/Importer/OpenVDBImporterEditor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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"))

OpenVDBForUnity/Assets/OpenVDB/Scripts/Importer/OpenVDBAPI.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

OpenVDBForUnity/Assets/OpenVDB/Scripts/Importer/OpenVDBStream.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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);

OpenVDBForUnity/Assets/OpenVDB/Scripts/Importer/OpenVDBStreamSettings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

Plugin/openvdbi/Importer/OpenVDBImporter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class oiVolume;
66
struct oiConfig
77
{
88
float scale_factor = 1.0f;
9+
int max_texture_size = 0;
910
};
1011

1112
struct oiVolumeSummary

Plugin/openvdbi/Importer/oiContext.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)