Skip to content

Commit

Permalink
cg.load_vox: allow palette only files
Browse files Browse the repository at this point in the history
  • Loading branch information
aardappel committed Sep 27, 2023
1 parent 0405707 commit 159008e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dev/src/cubegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,11 @@ nfr("load_vox", "name,material_palette", "SI?", "R:voxels]S?",
voxels = NewWorld(size, default_palette_idx);
voxvec->Push(vm, Value(vm.NewResource(&voxel_type, voxels)));
} else if (!strncmp(id, "RGBA", 4)) {
if (!voxels) return errf(".vox file RGBA chunk in wrong order");
if (!voxels) {
// This may be a palette-only file, add dummy geom.
voxels = NewWorld(int3_0, default_palette_idx);
voxvec->Push(vm, Value(vm.NewResource(&voxel_type, voxels)));
}
if (!palette.empty()) return errf(".vox file contains >1 palette");
palette.push_back(byte4_0);
if (p.size() < 256) return erreof();
Expand Down

0 comments on commit 159008e

Please sign in to comment.