I have a scene exported from Blender as fbx file.
I use the tool AssetImport and I get an XML scene.
I loaded in the test application, I get really strange results, I thought there is an error in fbx file, or in blender, to my surprise when I loaded the scene in Urho3D Editor, everything look normal.
What I do in the test application, I just load the scene and use standard rendering path “Forward.xml”, which come with Urho3d, here is what I do:
Urho3D::SharedPtr<Urho3D::ResourceCache> ps_cache(pr_application->GetSubsystem<Urho3D::ResourceCache>());
Urho3D::SharedPtr<Urho3D::Renderer> ps_renderer(pr_application->GetSubsystem<Urho3D::Renderer>());
ps_cache->AddResourceDir("urho/simple_objects");
pr_scene->CreateComponent<Urho3D::Octree>();
pr_scene->CreateComponent<Urho3D::DebugRenderer>();
auto ps_scene_file = ps_cache->GetFile("simple_objects.xml");
if(pr_scene->LoadXML( *ps_scene_file ) == false ) {
throw std::runtime_error("could not load the scene");
}
auto pr_context = pr_application->GetContext( );
// camera settings
Urho3D::SharedPtr<Urho3D::Node> camera_node( pr_scene->GetChild("Camera", true) );
if( camera_node == nullptr ) {
camera_node = pr_scene->CreateChild("Camera");
}
Urho3D::Camera* pr_camera = camera_node->CreateComponent<Urho3D::Camera>( );
Urho3D::SharedPtr<Urho3D::Viewport> viewport(new Urho3D::Viewport(
pr_context,
pr_scene,
pr_camera));
auto ps_render_path_file = ps_cache->GetResource<Urho3D::XMLFile>("RenderPaths/Forward.xml");
Urho3D::SharedPtr<Urho3D::RenderPath> render_path ( new Urho3D::RenderPath( ) );
render_path->Load( ps_render_path_file );
viewport->SetRenderPath( render_path );
ps_renderer->SetViewport(0, viewport);