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

Method AddActor

Source/Engine/Level/Scene/SceneRendering.cpp:164–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void SceneRendering::AddActor(Actor* a, int32& key)
165{
166 if (key != -1)
167 return;
168 PROFILE_MEM(Graphics);
169 CHECK_SCENE_EDIT_ACCESS();
170 const int32 category = a->_drawCategory;
171 ScopeWriteLock lock(Locker);
172 auto& list = Actors[category];
173 if (FreeActors[category].HasItems())
174 {
175 // Use existing item
176 key = FreeActors[category].Pop();
177 }
178 else
179 {
180 // Add a new item
181 key = list.Count();
182 list.AddOne();
183 }
184 auto& e = list[key];
185 e.Actor = a;
186 e.LayerMask = a->GetLayerMask();
187 e.Bounds = a->GetSphere();
188 e.NoCulling = a->_drawNoCulling;
189 for (auto* listener : _listeners)
190 listener->OnSceneRenderingAddActor(a);
191}
192
193void SceneRendering::UpdateActor(Actor* a, int32& key, ISceneRenderingListener::UpdateFlags flags)
194{

Callers 15

OnEnableMethod · 0.45
OnEnableMethod · 0.45
AddActorToSceneRenderingFunction · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45
OnEnableMethod · 0.45

Calls 6

AddOneMethod · 0.80
GetSphereMethod · 0.80
HasItemsMethod · 0.45
PopMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected