Hey guys, I have this code on my game:
CScreen::Init();
//Setar a Scene na conexão com a Game Server
if( SOCKETG )
SOCKETG->SetScene( pScene );
//Criar a Cena
CreateScene();
On CreateScene() function, if I make the code manually (I mean for coding), like this:
pScene->CreateComponent<Octree>( LOCAL );
pScene->CreateComponent<PhysicsWorld>( LOCAL );
pScene->CreateComponent<DebugRenderer>( LOCAL );
Node* zoneNode = pScene->CreateChild( "Zone", LOCAL );
auto* zone = zoneNode->CreateComponent<Zone>();
zone->SetBoundingBox( BoundingBox( -1000.0f, 1000.0f ) );
zone->SetAmbientColor( Color( 0.1f, 0.1f, 0.1f ) );
zone->SetFogStart( 100.0f );
zone->SetFogEnd( 300.0f );
// Create a directional light without shadows
Node* lightNode = pScene->CreateChild( "DirectionalLight", LOCAL );
lightNode->SetDirection( Vector3( 0.5f, -1.0f, 0.5f ) );
auto* light = lightNode->CreateComponent<Light>();
light->SetLightType( LIGHT_DIRECTIONAL );
light->SetColor( Color( 1, 1, 1 ) );
light->SetCastShadows( true );
light->SetSpecularIntensity( 1.0f );
Node* floorNode = pScene->CreateChild( "FloorTile", LOCAL );
floorNode->SetPosition( Vector3( 0, 0, 0 ) );
floorNode->SetScale( Vector3( 100.0f, 1.0f, 100.0f ) );
auto* floorObject = floorNode->CreateComponent<StaticModel>();
floorObject->SetCastShadows( true );
floorObject->SetModel( RESOURCECACHE->GetResource<Model>( "Models/Box.mdl" ) );
floorObject->SetMaterial( RESOURCECACHE->GetResource<Material>( "Materials/Test/dae.xml" ) );
auto* body = floorNode->CreateComponent<RigidBody>();
body->SetFriction( 1.0f );
auto* shape = floorNode->CreateComponent<CollisionShape>();
shape->SetBox( Vector3::ONE );
All works good, but if I create this way, loading from XML, don’t.
XMLFile * pXMLFile = RESOURCECACHE->GetResource<XMLFile>( "Scenes/World.xml" );
if( pXMLFile )
pScene->LoadXML( pXMLFile->GetRoot() );
Window stay black, nothing is rendered and I got this:
No Octree component in scene, drawable will not render
Ok, now if I create components manually (Octree,Render,PhysicsWorld), nothing from XML its on Scene… I believe that is something on SetScene(), but dno what.
@Scene XML File
https://puu.sh/A3atk/d280efe4e9.txt
Anybody knows what can be?
Thanks.