Comments (5)
Hey @mgerhardy, thanks for the report. Not sure if this reserved field will be used in the future, so having the assert is useful to alert us when a new feature supported by MV is possibly being used within a given .vox file.
That being said, not sure it will be used -- MV development appears to have slowed down a lot so perhaps it's fine.
Can you confirm that the voxedit.io model is loadable by MV?
from opengametools.
Yes. Sorry for not mentioning it. The model loads fine in magicavoxel
from opengametools.
maybe another thing for the context object - hand in a warn or error function to log these things. But asserting would prevent loading these models - even if everything else would be fine.
from opengametools.
But asserting would prevent loading these models - even if everything else would be fine
It is possible for clients of the library to skip specific asserts if they need to by checking the message passed to the assert:.
void _vox_assert_msg(bool condition, const char * msg_str) {
// condition wasn't violated? exit
if (condition)
return;
// ignore specific asserts.
if (strcmp(msg_str, "unexpected value for reserved_id in LAYR chunk") == 0)
return;
fprintf(stderr, "%s", msg_str);
raise(SIGTRAP);
}
#define ogt_assert(cond, msg_str) do { _vox_assert_msg(cond, msg_str); } while(0)
#include "ogt_vox.h"
...but I do sympathize. This sort of assert is really a warning of potential forward compatibility issues. I wonder if we should add an ogt_assert_warn so the library client can distinguish between fatal asserts and warning asserts, and then independently override them. eg
// implement a fatal assert
#define ogt_assert(cond, msg) do { \
if ( !cond ) { \
fprintf( stderr, "%s", msg_str ) \
raise(SIGTRAP); \
} while( 0 )
// implement a warning assert
#define ogt_assert_warn(cond, msg) do { \
if ( !cond ) \
fprintf( stderr, "WARNING: %s", msg_str ); \
} while( 0 )
#include "ogt_vox.h"
...of course, we'd just turn these reserved_id asserts into ogt_assert_warn, and if ogt_assert_warn wasn't overridden by the client, ogt_vox would define it itself. eg.
// user didn't override warning assert? just map it to ogt_assert
#ifndef ogt_assert_warn
#define ogt_assert_warn ogt_assert
#endif
@mgerhardy if you think this is a good direction, feel free to put together a PR - otherwise, it may take me a while to get to it.
from opengametools.
@jpaver there we go - a PR is made. But the locations of the ogt_warn usage are still open for discussion I think. I'm not sure if I hit all locations or maybe even hit too many. Feedback welcome.
from opengametools.
Related Issues (20)
- ogt_vox: material chunk is only loaded - but not saved
- ogt_vox: getting access to the dict key/value entries
- ogt_vox: expose animation looping status HOT 2
- ogt_vox: parse _color field from LAYR chunk dictionary and expose for read/merge/write in ogt_vox_layer HOT 1
- Any writing of voxels object to Wavefront obj? HOT 3
- ogt_vox: group instances are not preserved when writing scenes
- ogt_vox: group references broken by commit: flatten animations ... HOT 1
- ogt_vox : add formal test cases HOT 2
- ogt_vox : materials are not merged correctly HOT 1
- ogt_vox: instance order differences between file versions HOT 5
- ogt_vox: Compiler warnings in release mode HOT 1
- ogt_vox: setting k_read_scene_flags_groups false looses hidden and layer information HOT 2
- ogt_vox: assert hit on invalid node id HOT 1
- ogt_vox: looks like the transforms are not yet correctly handled HOT 4
- ogt_vox: specify the target coordinate system and do the conversions inside the lib HOT 4
- ogt_vox: segfault when accessing invalid group indices HOT 2
- An instances layer_index can be 0xFFFFFFFF (k_invalid_group_index)
- Crashes due to unaligned memory access HOT 2
- ogt_vox: material property _media_type not handled yet
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opengametools.