| 119 | } |
| 120 | |
| 121 | void GraphicsComponent::RegisterMaterial(Nz::Material* material, std::size_t count) |
| 122 | { |
| 123 | auto it = m_materialEntries.find(material); |
| 124 | if (it == m_materialEntries.end()) |
| 125 | { |
| 126 | MaterialEntry matEntry; |
| 127 | matEntry.reflectionModelChangeSlot.Connect(material->OnMaterialReflectionModeChange, this, &GraphicsComponent::OnMaterialReflectionChange); |
| 128 | matEntry.renderableCounter = count; |
| 129 | |
| 130 | if (material->GetReflectionMode() == Nz::ReflectionMode_RealTime) |
| 131 | { |
| 132 | if (m_reflectiveMaterialCount++ == 0) |
| 133 | InvalidateReflectionMap(); |
| 134 | } |
| 135 | |
| 136 | m_materialEntries.emplace(material, std::move(matEntry)); |
| 137 | } |
| 138 | else |
| 139 | it->second.renderableCounter += count; |
| 140 | } |
| 141 | |
| 142 | /*! |
| 143 | * \brief Operation to perform when component is attached to an entity |