34 void Update(
float deltaTime);
39 Camera3D* FindCameraForScreen(uint8_t targetScreen);
40 Node3D* GetAudioReceiver();
42 void SetActiveCamera(
Camera3D* activeCamera);
48 void EnsureFallbackCamera();
52 void SetAudioReceiver(
Node3D* newReceiver);
54 Node* SpawnNode(
TypeId actorType, glm::vec3 position = {});
55 Node* SpawnNode(
const char* typeName, glm::vec3 position = {});
56 Node* SpawnScene(
const char* sceneName, glm::vec3 position = {});
57 Node* SpawnScene(
Scene* scene, glm::vec3 position = {});
58 void DespawnScene(
Node* sceneRoot);
62 template<
class NodeClass>
65 return (NodeClass*)SpawnNode(NodeClass::GetStaticType(), position);
69 void SetRootNode(
Node* node);
71 void DestroyRootNode();
72 Node* FindNode(
const std::string& name);
74 std::vector<Node*> FindNodesWithTag(
const char* tag);
75 std::vector<Node*> FindNodesWithName(
const char* name);
76 std::vector<Node*> GatherNodes();
77 void GatherNodes(std::vector<Node*>& outNodes);
81 Node* FindNodeByUuid(uint64_t uuid);
82 void RegisterNodeUuid(
Node* node);
83 void UnregisterNodeUuid(
Node* node);
85 bool FindNavPath(glm::vec3 start, glm::vec3 end, std::vector<glm::vec3>& outPath);
86 bool FindRandomNavPoint(glm::vec3& outPoint);
87 bool FindClosestNavPoint(glm::vec3 inPoint, glm::vec3& outPoint);
88 void BuildNavigationData();
89 void EnableAutoNavRebuild(
bool enable);
90 bool IsAutoNavRebuildEnabled()
const;
91 void InvalidateNavMesh();
94 int32_t GetIndex()
const;
96 void AddLine(
const Line& line);
97 void RemoveLine(
const Line& line);
98 void RemoveAllLines();
99 const std::vector<Line>& GetLines()
const;
101 const std::vector<class Light3D*>& GetLights();
102 std::vector<FadingLight>& GetFadingLights();
104 void SetAmbientLightColor(glm::vec4 color);
105 glm::vec4 GetAmbientLightColor()
const;
107 void SetShadowColor(glm::vec4 shadowColor);
108 glm::vec4 GetShadowColor()
const;
114 void SetOcclusionData(
const OcclusionData* data,
bool enabled);
116 bool IsOcclusionCullingEnabled()
const;
117 bool IsOcclusionDataStale()
const;
118 float GetOcclusionMoveEpsilon2()
const;
119 void RequestOccludeeResolve();
120 bool IsOccludeeResolvePending()
const;
121 void ResolveOccludees();
131 void GetSeenByCamera(std::vector<Node3D*>& outNodes,
const std::vector<std::string>* tags =
nullptr,
Camera3D* camera =
nullptr);
133 void SetGravity(glm::vec3 gravity);
134 glm::vec3 GetGravity()
const;
136 btDynamicsWorld* GetDynamicsWorld();
137 btDbvtBroadphase* GetBroadphase();
143 uint8_t collisionMask,
145 uint32_t numIgnoredObjects = 0,
146 btCollisionObject** ignoreObjects =
nullptr,
147 bool ignorePureOverlap =
true);
152 uint8_t collisionMask,
153 bool ignorePureOverlap,
160 uint8_t collisionMask,
164 btConvexShape* convexShape,
168 uint8_t collisionMask,
170 uint32_t numIgnoreObjects = 0,
171 btCollisionObject** ignoreObjects =
nullptr);
173 void RegisterNode(
Node* node,
bool subRoot);
174 void UnregisterNode(
Node* node,
bool subRoot);
175 const std::vector<Audio3D*>& GetAudios()
const;
177 void LoadScene(
const char* name,
bool instant);
178 void QueueRootScene(
const char* name);
179 void QueueRootNode(
Node* node);
181 void GetLoadedSceneNames(std::vector<std::string>& outNames);
183 void EnableInternalEdgeSmoothing(
bool enable);
184 bool IsInternalEdgeSmoothingEnabled()
const;
186 void DirtyAllWidgets();
188 void UpdateRenderSettings();
189 void AddNewlyRegisteredNode(
Node* node);
192 Node* SpawnDefaultRoot();
193 void PlaceNewlySpawnedNode(
NodePtr node, glm::vec3 position);
195 void OverrideDynamicsWorld(btDiscreteDynamicsWorld* world);
196 void RestoreDynamicsWorld();
203 auto typedNodeFind = [&](
Node* node) ->
bool
205 if (node->Is(T::ClassRuntimeId()))
207 ret =
static_cast<T*
>(node);
214 if (mRootNode !=
nullptr)
216 mRootNode->ForEach(typedNodeFind);
225 auto typedNodeGather = [&](
Node* node) ->
bool
227 if (node->Is(T::ClassRuntimeId()))
229 outNodes.push_back(
static_cast<T*
>(node));
235 if (mRootNode !=
nullptr)
237 mRootNode->Traverse(typedNodeGather);
243 void UpdateLines(
float deltaTime);
244 void ExtractPersistingNodes();
248 static std::unordered_set<NodePtrWeak> sNewlyRegisteredNodes;
251 std::vector<NodePtr> mPersistingNodes;
252 std::vector<Line> mLines;
253 std::vector<class Light3D*> mLights;
254 std::vector<class Audio3D*> mAudios;
255 std::vector<FadingLight> mFadingLights;
257 std::string mLoadedSceneName;
258 std::string mQueuedSceneName;
259 glm::vec4 mAmbientLightColor;
260 glm::vec4 mShadowColor;
263 bool mOcclusionEnabled =
false;
264 bool mOcclusionStale =
false;
265 bool mOcclusionResolvePending =
false;
266 float mOcclusionMoveEps2 = 0.0f;
268 Camera3D* mCameraOverride =
nullptr;
271 Camera3D* mFallbackCamera =
nullptr;
273 bool mPendingClear =
false;
274 bool mAutoNavRebuild =
false;
277 btDefaultCollisionConfiguration* mCollisionConfig =
nullptr;
278 btCollisionDispatcher* mCollisionDispatcher =
nullptr;
279 btDbvtBroadphase* mBroadphase =
nullptr;
280 btSequentialImpulseConstraintSolver* mSolver =
nullptr;
281 btDiscreteDynamicsWorld* mDynamicsWorld =
nullptr;
282 btDiscreteDynamicsWorld* mDefaultDynamicsWorld =
nullptr;;
283 std::vector<PrimitivePair> mCurrentOverlaps;
284 std::vector<PrimitivePair> mPreviousOverlaps;
287 std::unordered_map<uint64_t, Node*> mUuidMap;
Definition Particle3d.h:34
Definition ParticleSystem.h:66