I have an fbx model which I loading in engine, but when I try to apply texture programmatically on this model it doesn't work, but it works on primitive object like cube.
This is what I do
auto fileLoaderComplete = sceneManager->assets()->loader()->complete()->connect([&](file::Loader::Ptr loader)
{
auto chair = sceneManager->assets()->symbol(FBX_MODEL_FILENAME);
//chair->addComponent(Transform::create());
auto chairMaterial = material::BasicMaterial::create();
chairMaterial->diffuseMap(sceneManager->assets()->texture(TEXTURE_FILENAME));
chair->addComponent(Surface::create(
geometry::QuadGeometry::create(sceneManager->assets()->context()),
chairMaterial,
sceneManager->assets()->effect("effect/Basic.effect")
));
chair->component<Transform>()->matrix(chair->component<Transform>()->matrix() * math::scale(math::vec3(0.005f)));
// Add the symbol to the scene
root->addChild(chair);
});
But no any texture applied on the model. How to make it work properly?