MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / RegisterMaterial

Method RegisterMaterial

SDK/src/NDK/Components/GraphicsComponent.cpp:121–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

endMethod · 0.45
ConnectMethod · 0.45

Tested by

no test coverage detected