A bit legacy, as we don't want to set textures based on index anymore, but sampler names.
| 501 | |
| 502 | // A bit legacy, as we don't want to set textures based on index anymore, but sampler names. |
| 503 | static TextureResource* GetTextureResource(const ModelComponent* component, uint32_t material_index, uint32_t material_texture_index) |
| 504 | { |
| 505 | MaterialResource* material = GetMaterialResource(component, component->m_Resource, material_index); |
| 506 | MaterialInfo* material_info = &component->m_Resource->m_Materials[material_index]; |
| 507 | |
| 508 | TextureResource* texture_res = component->m_Textures[material_texture_index]; // Check if it's overridden |
| 509 | if (!texture_res && material_texture_index < material_info->m_TexturesCount) |
| 510 | { |
| 511 | texture_res = material_info->m_Textures[material_texture_index].m_Texture; // Check if the model has a texture |
| 512 | } |
| 513 | if (!texture_res && material_texture_index < material->m_NumTextures) |
| 514 | { |
| 515 | texture_res = material->m_Textures[material_texture_index]; // Check if the material has a texture |
| 516 | } |
| 517 | return texture_res; |
| 518 | } |
| 519 | |
| 520 | static int32_t FillTextures(dmRender::RenderObject* ro, const ModelComponent* component, uint32_t material_index) |
| 521 | { |
no test coverage detected