Hi guys,
I've been following the user's manual and there is something I don't get.
The online user's manual for creating an iThing mesh (
http://www.crystalspace3d.org/docs/online/manual-1.0/cs_4.10.4.php#4.10.4)
has the following example code:
csRef<iMeshWrapper> walls = engine->CreateThingMesh (room, "cube"));
csRef<iThingState> ws = scfQueryInterface<iThingState> (walls->GetMeshObject ());
iMeshObject* walls_object = walls->GetMeshObject ();
iMeshObjectFactory* walls_factory = walls->GetFactory();
csRef<iThingFactoryState> walls_state = scfQueryInterface<iThingFactoryState> (walls_factory);
walls_state->AddQuad (
csVector3 (-.5, .5, -.5),
csVector3 (.5, .5, -.5),
csVector3 (.5, .5, .5),
csVector3 (-.5, .5, .5));
Now, could someone please tell me whether the above c++ code should do the same thing as the following
python code:
walls = engine.CreateThingMesh(room, "cube")
ws = cspace.SCF_QUERY_INTERFACE_SAFE(walls.GetMeshObject(), cspace.iThingState)
walls_object = walls.GetMeshObject()
walls_factory = walls.GetFactory()
walls_state = cspace.SCF_QUERY_INTERFACE_SAFE(walls_factory, cspace.iThingFactoryState)
walls_state.AddQuad(cspace.csVector3(-0.5, 0.5, -0.5),
cspace.csVector3(0.5, 0.5, -0.5),
cspace.csVector3(0.5, 0.5, 0.5),
cspace.csVector3(-0.5, 0.5, 0.5))
I'm asking here because that the 5th line of the python code:
walls_state = cspace.SCF_QUERY_INTERFACE_SAFE(walls_factory, cspace.iThingFactoryState)
would return a None object.
Furthermore, if the function cspace.SCF_QUERY_INTERFACE was used instead of
cspace.SCF_QUERY_INTERFACE_SAFE, I would get an immediate segfault.
So ... what am I doing wrong?
Any help would be greatly appreciated.
Thanks a lot.
-D