Closed Davilarek closed 5 months ago
Looks like you're doing a lot of unnecessary work that librw should be doing. I guess I'm to blame for not documenting things properly. I have something similar here, but it looks like i wrote this before i implemented Geometry::unlock() so it calls buildMeshes directly. Just replace that with unlock: https://github.com/aap/librwgta/blob/master/tools/storiesview/main.cpp#L279
Also you the proper way to give an atomic a geometry would be atomic->setGeometry(geometry, 0)
The reason why it's black could be because you have no lights? Adding an ambient light might help.
I tried adding this to my 3d init function but sadly no result...
auto pAmbient = rw::Light::create(rw::Light::AMBIENT);
pAmbient->setColor(1.0f, 1.0f, 1.0f);
world->addLight(pAmbient);
Edit: I also replaced my code with the one you provided and changed Geometry::buildMeshes
with Geometry::unlock
, still the cube is black.
hm, or perhaps you need some geometry flags. LIGHT and MODULATE. Although without MODULATE the material color will be taken as white, but i think you indeed are missing LIGHT.
Looks like we are getting somewhere. Adding LIGHT flag made so I'm now affected by the issue that #125 fixes.
Program received signal SIGSEGV, Segmentation fault.
0x0000555555648366 in rw::World::enumerateLights (this=0x0, atomic=atomic@entry=0x5555561bf9e0, lightData=lightData@entry=0x7fffffffd580) at /home/davil/Projects/Engine3D_No_Name_/librw/src/world.cpp:160
160 FORLIST(lnk, this->globalLights){
(gdb) print this
$1 = (rw::World * const) 0x0
(gdb) bt
#0 0x0000555555648366 in rw::World::enumerateLights (this=0x0, atomic=atomic@entry=0x5555561bf9e0, lightData=lightData@entry=0x7fffffffd580) at /home/davil/Projects/Engine3D_No_Name_/librw/src/world.cpp:160
#1 0x0000555555655d72 in rw::gl3::lightingCB (atomic=atomic@entry=0x5555561bf9e0) at /home/davil/Projects/Engine3D_No_Name_/librw/src/gl/gl3render.cpp:125
#2 0x0000555555655e75 in rw::gl3::defaultRenderCB (atomic=0x5555561bf9e0, header=0x55555617d9e0) at /home/davil/Projects/Engine3D_No_Name_/librw/src/gl/gl3render.cpp:154
somehow the world
is gone?
Edit: world
was indeed gone. Fixed by setting camera
's world
property. Thank you for help.
I know I probably shouldn't be asking this in
Issues
but this project as far as I know doesn't have a discord or any other way of communication.This code renders the cube plain black