MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / updateEntries

Method updateEntries

Source/Engine/ShadowsOfMordor/Builder.Entries.cpp:159–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void ShadowsOfMordor::Builder::updateEntries()
160{
161 auto scene = _scenes[_workerActiveSceneIndex];
162
163 reportProgress(BuildProgressStep::UpdateEntries, 0.0f);
164 scene->EntriesLocker.Lock();
165
166 // Update entries (and cache entries list per lightmap as linear array instead of tree structure)
167 ScopeLock lock(Level::ScenesLock); // TODO: maybe don;t lock scene?
168 const int32 entriesCount = scene->Entries.Count();
169 for (int32 i = 0; i < entriesCount; i++)
170 {
171 auto& e = scene->Entries[i];
172 if (e.ChartIndex == INVALID_INDEX)
173 {
174 // Removed previously baked lightmap info
175 LightmapEntry emptyEntry;
176 switch (e.Type)
177 {
178 case GeometryType::StaticModel:
179 {
180 auto staticModel = e.AsStaticModel.Actor;
181 if (staticModel)
182 staticModel->Lightmap = emptyEntry;
183 }
184 break;
185 case GeometryType::Terrain:
186 {
187 auto terrain = e.AsTerrain.Actor;
188 if (terrain)
189 terrain->GetPatch(e.AsTerrain.PatchIndex)->Chunks[e.AsTerrain.ChunkIndex].Lightmap = emptyEntry;
190 }
191 break;
192 case GeometryType::Foliage:
193 {
194 auto foliage = e.AsFoliage.Actor;
195 if (foliage)
196 foliage->Instances[e.AsFoliage.InstanceIndex].Lightmap = emptyEntry;
197 }
198 break;
199 }
200 continue;
201 }
202 auto& chart = scene->Charts[e.ChartIndex];
203
204 // Update result uvs by taking into account lightmap uvs box
205 chart.Result.UVsArea.Size /= e.UVsBox.Size;
206 chart.Result.UVsArea.Location += e.UVsBox.Location * chart.Result.UVsArea.Size;
207
208 switch (e.Type)
209 {
210 case GeometryType::StaticModel:
211 {
212 auto staticModel = e.AsStaticModel.Actor;
213 if (staticModel)
214 {
215 // Update data
216 staticModel->Lightmap = chart.Result;

Callers

nothing calls this directly

Calls 5

LockMethod · 0.80
GetPatchMethod · 0.80
UnlockMethod · 0.80
CountMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected