Skip to content

Commit 0e7dfe5

Browse files
committed
ogt_vox: added version to scene
we need to be able to handle some version related things differently (like the mentioned instance order)
1 parent 6001be3 commit 0e7dfe5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

demo/tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ static void testMetaChunk(void) {
1818
ASSERT_NE_NULLPTR(scene);
1919
EXPECT_EQ_INT(7, (int)scene->anim_range_start);
2020
EXPECT_EQ_INT(36, (int)scene->anim_range_end);
21+
EXPECT_EQ_INT(150, (int)scene->file_version);
2122
}
2223

2324
int main(int argc, char *argv[]) {

src/ogt_vox.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
instance has a transform that determines its position and orientation within the scene,
9696
but it also has an index that specifies which model the instance uses for its shape. It
9797
is expected that there is a many-to-one mapping of instances to models.
98+
Instances can overlap. For file version 200 (or perhaps higher) lower instance numbers are
99+
more important and would overwrite existing voxels on merging, for version < 200 the higher
100+
numbers are more important.
98101
99102
An ogt_vox_layer is used to conceptually group instances. Each instance indexes the
100103
layer that it belongs to, but the layer itself has its own name and hidden/shown state.
@@ -418,6 +421,7 @@
418421
// the scene parsed from a .vox file.
419422
typedef struct ogt_vox_scene
420423
{
424+
uint32_t file_version; // version of the .vox file format.
421425
uint32_t num_models; // number of models within the scene.
422426
uint32_t num_instances; // number of instances in the scene (on anim frame 0)
423427
uint32_t num_layers; // number of layers in the scene
@@ -2408,6 +2412,7 @@
24082412

24092413
scene->anim_range_start = anim_range_start;
24102414
scene->anim_range_end = anim_range_end;
2415+
scene->file_version = file_version;
24112416

24122417
if (g_progress_callback_func) {
24132418
// we indicate progress as complete, but don't check for cancel as finished

0 commit comments

Comments
 (0)