Hi, how are you doing?
I’m kinda new at Panda3D and I still testing it trying to do a chessgame not in python but in Visual Studio
I could do most of major graphical things (I load the models, show them on screen and I could set the pieces in the correct squares), however there is a think I could not set yet and this is lightening. I’m following the chess sample in python that came with Panda3D, however there seems to be some differences…
When I try to use AmbientLight and DirectionalLight I get the following error
error C2514: ‘AmbientLight’ : class has no constructor
error C2514: ‘DirectionalLight’ : class has no constructor
This is the source code, so if you can give me a hand it would be great
void cWorld::SetupLights (void)
{
cWorld::m_oWindow->set_lighting(true);
PT(AmbientLight) ambientLight = new AmbientLight("ambientLight");
PT(DirectionalLight) directionalLight = new DirectionalLight("directionalLight");
ambientLight->set_color(LVecBase4f(.8, .8, .8, 1));
NodePath pambient = cWorld::m_oWindow->get_render().attach_new_node((PandaNode *)ambientLight->upcast_to_panda_node());
cWorld::m_oWindow->set_light(pdambient, 0);
directionalLight->set_direction(LVecBase3f(0, 45, -45));
directionalLight->set_color(LVecBase4f(.2, .2, .2, 1));
NodePath pdirectional = cWorld::m_oWindow->get_render().attach_new_node((PandaNode *)directionalLight->upcast_to_panda_node());
cWorld::m_oWindow->get_render().set_light(pdirectional, 0);
}
The error occurrs at the very begining of the code when I declare PT(AmbientLight) ambientLight = new AmbientLight(“ambientLight”); and
PT(DirectionalLight) directionalLight = new DirectionalLight(“directionalLight”);
Thanks in advance.