vengi-voxel / vengi

free and open source voxel art tools - editor, thumbnailer and format converter
http://vengi-voxel.github.io/vengi/
Other
1.05k stars 87 forks source link

VOXCONVERT: assert when rotating by 30 degrees #269

Closed mgerhardy closed 1 year ago

mgerhardy commented 1 year ago

shitdog.obj.zip

vengi-voxconvert.exe -set voxformat_scale 30 --rotate x:30 --input shitdog.obj --output test_rot_30.vox

rotating by 90 or 180 works fine.

assert-voxconvert-rotate-30

RROR: (0) Stack trace (most recent call last):
ERROR: (0) #12   Object "", at 0xffffffffffffffff, in 
ERROR: (0) #11   Object "/home/mgerhardy/dev/engine/build/Debug/voxconvert/vengi-voxconvert", at 0x5645a6f31d00, in _start
ERROR: (0) #10   Source "../csu/libc-start.c", line 381, in __libc_start_main_impl
ERROR: (0) #9    Source "../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main
ERROR: (0) #8    Source "/home/mgerhardy/dev/engine/src/tools/voxconvert/VoxConvert.cpp", line 739, in main
ERROR: (0)         736:     const io::FilesystemPtr& filesystem = core::make_shared<io::Filesystem>();
ERROR: (0)         737:     const core::TimeProviderPtr& timeProvider = core::make_shared<core::TimeProvider>();
ERROR: (0)         738:     VoxConvert app(filesystem, timeProvider);
ERROR: (0)       > 739:     return app.startMainLoop(argc, argv);
ERROR: (0)         740: }
ERROR: (0) #7    Source "/home/mgerhardy/dev/engine/src/modules/app/App.cpp", line 105, in startMainLoop
ERROR: (0)         102:     emscripten_set_main_loop(runFrameEmscripten, 0, 1);
ERROR: (0)         103: #else
ERROR: (0)         104:     while (AppState::InvalidAppState != _curState) {
ERROR: (0)       > 105:         onFrame();
ERROR: (0)         106:     }
ERROR: (0)         107: #endif
ERROR: (0)         108:     return _exitCode;
ERROR: (0) #6    Source "/home/mgerhardy/dev/engine/src/modules/app/App.cpp", line 165, in onFrame
ERROR: (0)         162:             Log::debug("AppState::BeforeInit");
ERROR: (0)         163:             onBeforeInit();
ERROR: (0)         164:             Log::debug("AppState::Init");
ERROR: (0)       > 165:             _nextState = onInit();
ERROR: (0)         166:             Log::debug("AppState::AfterInit");
ERROR: (0)         167:             onAfterInit();
ERROR: (0)         168:             Log::debug("AppState::Init done");
ERROR: (0) #5    Source "/home/mgerhardy/dev/engine/src/tools/voxconvert/VoxConvert.cpp", line 354, in onInit
ERROR: (0)         351:     }
ERROR: (0)         352: 
ERROR: (0)         353:     if (_rotateVolumes) {
ERROR: (0)       > 354:         rotate(getArgVal("--rotate"), sceneGraph);
ERROR: (0)         355:     }
ERROR: (0)         356: 
ERROR: (0)         357:     if (_translateVolumes) {
ERROR: (0) #4    Source "/home/mgerhardy/dev/engine/src/tools/voxconvert/VoxConvert.cpp", line 722, in rotate
ERROR: (0)         719:     for (scenegraph::SceneGraphNode &node : sceneGraph) {
ERROR: (0)         720:         glm::vec3 rotVec{0.0f};
ERROR: (0)         721:         rotVec[math::getIndexForAxis(axis)] = degree;
ERROR: (0)       > 722:         node.setVolume(voxelutil::rotateVolume(node.volume(), rotVec, glm::vec3(0.5f)), true);
ERROR: (0)         723:     }
ERROR: (0)         724: }
ERROR: (0) #3    Source "/home/mgerhardy/dev/engine/src/modules/voxelutil/VolumeRotator.cpp", line 52, in rotateVolume
ERROR: (0)          49:                     const glm::ivec3 destPos(x, y, z);
ERROR: (0)          50:                     const glm::ivec3 &volumePos = transform(mat, destPos, pivot);
ERROR: (0)          51:                     destSampler.setPosition(volumePos);
ERROR: (0)       >  52:                     core_assert_msg(region.containsPoint(volumePos), "volumepos %i:%i:%i is not part of the rotated region %s", volumePos.x, volumePos.y, volumePos.z, region.toString().c_str());
ERROR: (0)          53:                     destSampler.setVoxel(voxel);
ERROR: (0)          54:                 }
ERROR: (0)          55:                 srcSampler.movePositiveX();
ERROR: (0) #2    Source "/home/mgerhardy/dev/engine/src/modules/core/Assert.cpp", line 36, in core_stacktrace
ERROR: (0)          33: #ifdef HAVE_BACKWARD
ERROR: (0)          34:     std::ostringstream os;
ERROR: (0)          35:     backward::StackTrace st;
ERROR: (0)       >  36:     st.load_here(32);
ERROR: (0)          37:     backward::Printer printer;
ERROR: (0)          38:     printer.print(st, os);
ERROR: (0)          39:     std::string stacktrace = os.str();
ERROR: (0) #1    Source "/home/mgerhardy/dev/engine/contrib/libs/backward/backward.h", line 878, in load_here
ERROR: (0)         875:       return 0;
ERROR: (0)         876:     }
ERROR: (0)         877:     _stacktrace.resize(depth);
ERROR: (0)       > 878:     size_t trace_cnt = details::unwind(callback(*this), depth);
ERROR: (0)         879:     _stacktrace.resize(trace_cnt);
ERROR: (0)         880:     skip_n_firsts(0);
ERROR: (0)         881:     return size();
ERROR: (0) #0    Source "/home/mgerhardy/dev/engine/contrib/libs/backward/backward.h", line 860, in unwind<backward::StackTraceImpl<backward::system_tag::linux_tag>::callback>
ERROR: (0)         858: template <typename F> size_t unwind(F f, size_t depth) {
ERROR: (0)         859:   Unwinder<F> unwinder;
ERROR: (0)       > 860:   return unwinder(f, depth);
ERROR: (0)         861: }
ERROR: (0)         862: 
ERROR: (0)         863: } // namespace details
mgerhardy commented 1 year ago

Should be fixed now.