| 518 | } |
| 519 | |
| 520 | static int32_t FillTextures(dmRender::RenderObject* ro, const ModelComponent* component, uint32_t material_index) |
| 521 | { |
| 522 | MaterialResource* material = GetMaterialResource(component, component->m_Resource, material_index); |
| 523 | |
| 524 | int32_t first_free_index = -1; |
| 525 | bool first_free_index_set = false; |
| 526 | |
| 527 | for(uint32_t i = 0; i < dmRender::RenderObject::MAX_TEXTURE_COUNT; ++i) |
| 528 | { |
| 529 | TextureResource* texture_res = component->m_Textures[i]; |
| 530 | if (!texture_res) |
| 531 | { |
| 532 | texture_res = GetTextureFromSamplerNameHash(&component->m_Resource->m_Materials[material_index], material, i, material->m_SamplerNames[i]); |
| 533 | } |
| 534 | |
| 535 | ro->m_Textures[i] = texture_res ? texture_res->m_Texture : 0; |
| 536 | |
| 537 | if (ro->m_Textures[i] == 0 && !first_free_index_set) |
| 538 | { |
| 539 | first_free_index_set = true; |
| 540 | first_free_index = i; |
| 541 | } |
| 542 | } |
| 543 | return first_free_index; |
| 544 | } |
| 545 | |
| 546 | static void HashMaterial(HashState32* state, const dmGameSystem::MaterialResource* material) |
| 547 | { |
no test coverage detected