Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
ProjectManager.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_SCENE_MANAGER_H
34#define DVD_SCENE_MANAGER_H
35
38
45
46namespace Divide
47{
48
50 {
51 public:
52 static bool loadScene( Scene* activeScene );
53 static bool saveScene( Scene* activeScene, bool toCache, const DELEGATE<void, std::string_view>& msgCallback, const DELEGATE<void, bool>& finishCallback );
54
55 static bool saveNodeToXML( Scene* activeScene, const SceneGraphNode* node );
56 static bool loadNodeFromXML( Scene* activeScene, SceneGraphNode* node );
57 };
58
59 enum class RenderStage : U8;
60 namespace Attorney
61 {
62 class ProjectScenePool;
63 class ProjectManagerProject;
64
65 class ProjectManagerScene;
66 class ProjectManagerEditor;
67 class ProjectManagerKernel;
68 class ProjectManagerRenderPass;
69 class ProjectManagerSSRAccessor;
70 class ProjectManagerCameraAccessor;
71 };
72
73 namespace AI
74 {
75 namespace Navigation
76 {
78 };
79 };
80
81 namespace Time
82 {
83 class ProfileTimer;
84 };
85
86 namespace GFX
87 {
88 struct MemoryBarrierCommand;
89 };
90
91 class Editor;
92 class Texture;
93 class ShadowMap;
94 class UnitComponent;
95 class RenderPassExecutor;
96 class ShaderComputeQueue;
97 class SSRPreRenderOperator;
98 class DirectionalLightSystem;
99 class ContentExplorerWindow;
100 class SolutionExplorerWindow;
101 class GUIConsoleCommandParser;
102
103 struct CameraSnapshot;
104 struct SizeChangeParams;
105
107
108 [[nodiscard]] bool operator==(const SceneEntry& lhs, const SceneEntry& rhs) noexcept;
109
111 {
112 U64 _guid{ 0u };
114 };
115
117
119 {
124 bool _createIfNotExist = false;
125 };
126
128 {
130 };
131
132 [[nodiscard]] inline bool IsSet( const SwitchSceneTarget& target ) noexcept
133 {
134 return !target._targetScene._name.empty();
135 }
136
137 [[nodiscard]] inline bool IsSet( const SwitchProjectTarget& target ) noexcept
138 {
139 return !target._targetProject._name.empty();
140 }
141
142
144 {
147
148 public:
149 [[nodiscard]] static bool CreateNewProject( const ProjectID& projectID );
150 [[nodiscard]] static bool CreateNewScene( const SceneEntry& scene, const ProjectID& projectID );
151
152 public:
153
154 explicit Project( ProjectManager& parentMgr, const ProjectID& name );
155 ~Project();
156
157 [[nodiscard]] Scene* getActiveScene() const noexcept;
158
159 void setActiveScene( Scene* scene );
160 [[nodiscard]] bool switchScene( const SwitchSceneTarget& scene );
161
162 [[nodiscard]] inline const SceneEntries& getSceneEntries() const noexcept { return _sceneEntries; }
163
164 [[nodiscard]] inline ProjectManager& parent() noexcept { return _parentManager; }
165
167
169
170 protected:
171 [[nodiscard]] bool switchSceneInternal();
172 [[nodiscard]] Scene* loadScene( const SceneEntry& sceneEntry );
173 [[nodiscard]] bool unloadScene( Scene* scene );
174
175 void idle();
176 bool onFrameStart();
177 bool onFrameEnd();
178
179 private:
180
183
185 };
186
188
189 class ProjectManager final : public FrameListener,
191 public KernelComponent
192 {
193
196
203
204 public:
205 static bool OnStartup( PlatformContext& context );
206 static bool OnShutdown( PlatformContext& context );
207
208 explicit ProjectManager( Kernel& parentKernel );
209 ~ProjectManager() override;
210
211 void idle();
212
213 void destroy();
214
215 [[nodiscard]] ErrorCode loadProject( const ProjectID& targetProject, bool deferToStartOfFrame );
216
217 // returns selection callback id
218 size_t addSelectionCallback( const DELEGATE<void, U8, const vector<SceneGraphNode*>&>& selectionCallback )
219 {
220 static std::atomic_size_t index = 0u;
221
222 const size_t idx = index.fetch_add( 1u );
223 _selectionChangeCallbacks.push_back( std::make_pair( idx, selectionCallback ) );
224 return idx;
225 }
226
227 bool removeSelectionCallback( const size_t idx )
228 {
229 return dvd_erase_if( _selectionChangeCallbacks, [idx]( const auto& entry ) noexcept
230 {
231 return entry.first == idx;
232 } );
233 }
234
235 [[nodiscard]] bool resetSelection( PlayerIndex idx, const bool resetIfLocked );
236 void setSelected( PlayerIndex idx, const vector<SceneGraphNode*>& SGNs, bool recursive );
237 void onNodeDestroy( Scene* parentScene, SceneGraphNode* node );
239 void cullSceneGraph( const NodeCullParams& cullParams, const U16 cullFlags, VisibleNodeList<>& nodesOut );
241 void findNode( const vec3<F32>& cameraEye, const I64 nodeGUID, VisibleNodeList<>& nodesOut );
243 void initDefaultCullValues( RenderStage stage, NodeCullParams& cullParamsInOut ) noexcept;
245 void getSortedReflectiveNodes( const Camera* camera, RenderStage stage, bool inView, VisibleNodeList<>& nodesOut ) const;
247 void getSortedRefractiveNodes( const Camera* camera, RenderStage stage, bool inView, VisibleNodeList<>& nodesOut ) const;
248
249 const VisibleNodeList<>& getRenderedNodeList() const noexcept;
250
251 void onChangeFocus( bool hasFocus );
252
254 [[nodiscard]] bool loadComplete() const noexcept;
256 void updateSceneState( U64 deltaGameTimeUS, U64 deltaAppTimeUS );
257
258 void onResolutionChange( const SizeChangeParams& params );
259
260 [[nodiscard]] U8 playerPass() const noexcept
261 {
262 return _currentPlayerPass;
263 }
264
265 [[nodiscard]] bool saveActiveScene( bool toCache, bool deferred, const DELEGATE<void, std::string_view>& msgCallback = {}, const DELEGATE<void, bool>& finishCallback = {} );
266
267 [[nodiscard]] AI::Navigation::DivideRecast* recast() const noexcept
268 {
269 return _recast.get();
270 }
271
272 [[nodiscard]] SceneEnvironmentProbePool* getEnvProbes() const noexcept;
273
274 [[nodiscard]] U8 activePlayerCount() const noexcept;
275
276 public:
278 [[nodiscard]] bool onKeyDown( const Input::KeyEvent& key ) override;
280 [[nodiscard]] bool onKeyUp( const Input::KeyEvent& key ) override;
282 [[nodiscard]] bool joystickAxisMoved( const Input::JoystickEvent& arg ) override;
284 [[nodiscard]] bool joystickPovMoved( const Input::JoystickEvent& arg ) override;
286 [[nodiscard]] bool joystickButtonPressed( const Input::JoystickEvent& arg ) override;
288 [[nodiscard]] bool joystickButtonReleased( const Input::JoystickEvent& arg ) override;
289 [[nodiscard]] bool joystickBallMoved( const Input::JoystickEvent& arg ) override;
290 // return true if input was consumed
291 [[nodiscard]] bool joystickAddRemove( const Input::JoystickEvent& arg ) override;
292 [[nodiscard]] bool joystickRemap( const Input::JoystickEvent& arg ) override;
294 [[nodiscard]] bool mouseMoved( const Input::MouseMoveEvent& arg ) override;
296 [[nodiscard]] bool mouseButtonPressed( const Input::MouseButtonEvent& arg ) override;
298 [[nodiscard]] bool mouseButtonReleased( const Input::MouseButtonEvent& arg ) override;
299
300 [[nodiscard]] bool onTextEvent( const Input::TextEvent& arg ) override;
301
304 void mouseMovedExternally( const Input::MouseMoveEvent& arg );
305
306 PROPERTY_RW( bool, wantsMouse, false );
307 PROPERTY_R_IW(ProjectIDs, availableProjects);
308 PROPERTY_R(Project_uptr, activeProject, nullptr);
309
310 [[nodiscard]] const PlatformContext& platformContext() const noexcept;
311 [[nodiscard]] PlatformContext& platformContext() noexcept;
312
313 protected:
314 bool networkUpdate( U64 frameCount );
315
316 protected:
317 ProjectIDs& init( );
318 void initPostLoadState() noexcept;
319
320 // Add a new player to the simulation
321 void addPlayerInternal( Scene* parentScene, SceneGraphNode* playerNode );
322 // Removes the specified player from the active simulation
323 // Returns true if the player was previously registered
324 // On success, player pointer will be reset
325 void removePlayerInternal( Scene* parentScene, SceneGraphNode* playerNode );
326
327 // Add a new player to the simulation
328 void addPlayer( Scene* parentScene, SceneGraphNode* playerNode, bool queue );
329 // Removes the specified player from the active simulation
330 // Returns true if the player was previously registered
331 // On success, player pointer will be reset
332 void removePlayer( Scene* parentScene, SceneGraphNode* playerNode, bool queue );
333 void getNodesInScreenRect( const Rect<I32>& screenRect, const Camera& camera, vector<SceneGraphNode*>& nodesOut ) const;
334
335 void waitForSaveTask();
336
337 protected:
338 [[nodiscard]] bool frameStarted( const FrameEvent& evt ) override;
339 [[nodiscard]] bool frameEnded( const FrameEvent& evt ) override;
340
341 void drawCustomUI( const Rect<I32>& targetViewport, GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut );
342 void postRender( GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut );
343 void debugDraw( GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut );
344 void prepareLightData( RenderStage stage, const CameraSnapshot& cameraSnapshot, GFX::MemoryBarrierCommand& memCmdInOut );
345 [[nodiscard]] Camera* playerCamera( bool skipOverride = false ) const noexcept;
346 [[nodiscard]] Camera* playerCamera( PlayerIndex idx, bool skipOverride = false ) const noexcept;
347 void editorPreviewNode( const I64 editorPreviewNode ) noexcept;
348 void currentPlayerPass( PlayerIndex idx );
349 BoundingSphere moveCameraToNode( Camera* camera, const SceneGraphNode* targetNode ) const;
350 bool saveNode( const SceneGraphNode* targetNode ) const;
351 bool loadNode( SceneGraphNode* targetNode ) const;
353 [[nodiscard]] ErrorCode loadProjectInternal();
354
355 private:
356 bool _init = false;
357 bool _processInput = false;
358
359 Task* _saveTask = nullptr;
366
367 std::array<Time::ProfileTimer*, to_base( RenderStage::COUNT )> _sceneGraphCullTimers;
368
369 bool _playerQueueDirty = false;
372 AI::Navigation::DivideRecast_uptr _recast;
373
375
376 vector<std::pair<size_t, DELEGATE<void, U8 /*player index*/, const vector<SceneGraphNode*>& /*nodes*/>> > _selectionChangeCallbacks;
378
379 };
380
381 namespace Attorney
382 {
384 {
385 static bool unloadScene( Divide::Project& project, Scene* scene )
386 {
387 return project.unloadScene( scene );
388 }
389
390 friend class Divide::ScenePool;
391 };
392
394 {
396 {
397 mgr.waitForSaveTask();
398 }
399
400 static void idle( Divide::Project& project )
401 {
402 project.idle();
403 }
404
405 [[nodiscard]] static bool onFrameStart( Divide::Project& project )
406 {
407 return project.onFrameStart();
408 }
409
410 [[nodiscard]] static bool onFrameEnd( Divide::Project& project )
411 {
412 return project.onFrameEnd();
413 }
414
415 friend class Divide::Project;
417 };
418
420 {
421 static void addPlayer( Divide::ProjectManager& manager, Scene* parentScene, SceneGraphNode* playerNode, const bool queue )
422 {
423 manager.addPlayer( parentScene, playerNode, queue );
424 }
425
426 static void removePlayer( Divide::ProjectManager& manager, Scene* parentScene, SceneGraphNode* playerNode, const bool queue )
427 {
428 manager.removePlayer( parentScene, playerNode, queue );
429 }
430
431 static void getNodesInScreenRect( const Divide::ProjectManager& manager, const Rect<I32>& screenRect, const Camera& camera, vector<SceneGraphNode*>& nodesOut )
432 {
433 manager.getNodesInScreenRect( screenRect, camera, nodesOut );
434 }
435
436 friend class Divide::Scene;
437 };
438
440 {
442 {
443 return manager->init();
444 }
445
446 static void initPostLoadState( Divide::ProjectManager* manager ) noexcept
447 {
448 manager->initPostLoadState();
449 }
450
451 static void currentPlayerPass( Divide::ProjectManager* manager, const PlayerIndex idx )
452 {
453 manager->currentPlayerPass( idx );
454 }
455
456 static bool networkUpdate( Divide::ProjectManager* manager, const U64 frameCount )
457 {
458 return manager->networkUpdate( frameCount );
459 }
460
461 friend class Divide::Kernel;
462 };
463
465 {
467 {
468 return manager->getEnvProbes();
469 }
470
471 static bool saveNode( const Divide::ProjectManager* mgr, const SceneGraphNode* targetNode )
472 {
473 return mgr->saveNode( targetNode );
474 }
475
476 static bool loadNode( const Divide::ProjectManager* mgr, SceneGraphNode* targetNode )
477 {
478 return mgr->loadNode( targetNode );
479 }
480
481 static Camera* playerCamera( const Divide::ProjectManager* mgr, bool skipOverride = false ) noexcept
482 {
483 return mgr->playerCamera( skipOverride );
484 }
485
486 static Camera* playerCamera( const Divide::ProjectManager* mgr, PlayerIndex idx, bool skipOverride = false ) noexcept
487 {
488 return mgr->playerCamera( idx, skipOverride );
489 }
490
492 {
494 }
495 friend class Divide::Editor;
496 };
497
499 {
500
501 static std::pair<Handle<Texture>, SamplerDescriptor> getSkyTexture( const Divide::ProjectManager* mgr )
502 {
503 return mgr->getSkyTexture();
504 }
505
507 };
508
510 {
511 static Camera* playerCamera( const Divide::ProjectManager* mgr, const bool skipOverride = false ) noexcept
512 {
513 return mgr->playerCamera( skipOverride );
514 }
515
516 static Camera* playerCamera( const Divide::ProjectManager& mgr, const bool skipOverride = false ) noexcept
517 {
518 return mgr.playerCamera( skipOverride );
519 }
520
521 static Camera* playerCamera( const Divide::ProjectManager* mgr, const PlayerIndex idx, const bool skipOverride = false ) noexcept
522 {
523 return mgr->playerCamera( idx, skipOverride );
524 }
525
526 static Camera* playerCamera( const Divide::ProjectManager& mgr, const PlayerIndex idx, const bool skipOverride = false ) noexcept
527 {
528 return mgr.playerCamera( idx, skipOverride );
529 }
530
531 static BoundingSphere moveCameraToNode( const Divide::ProjectManager* mgr, Camera* camera, const SceneGraphNode* targetNode )
532 {
533 return mgr->moveCameraToNode( camera, targetNode );
534 }
535
536 friend class Divide::Scene;
537 friend class Divide::Editor;
538 friend class Divide::ShadowMap;
539 friend class Divide::RenderPass;
544 };
545
547 {
548 static void cullScene( Divide::ProjectManager* mgr, const NodeCullParams& cullParams, const U16 cullFlags, VisibleNodeList<>& nodesOut )
549 {
550 mgr->cullSceneGraph( cullParams, cullFlags, nodesOut );
551 }
552
553 static void findNode( Divide::ProjectManager* mgr, const vec3<F32>& cameraEye, const I64 nodeGUID, VisibleNodeList<>& nodesOut )
554 {
555 mgr->findNode( cameraEye, nodeGUID, nodesOut );
556 }
557
558 static void initDefaultCullValues( Divide::ProjectManager* mgr, const RenderStage stage, NodeCullParams& cullParamsInOut ) noexcept
559 {
560 mgr->initDefaultCullValues( stage, cullParamsInOut );
561 }
562
563 static void prepareLightData( Divide::ProjectManager* mgr, const RenderStage stage, const CameraSnapshot& cameraSnapshot, GFX::MemoryBarrierCommand& memCmdInOut )
564 {
565 mgr->prepareLightData( stage, cameraSnapshot, memCmdInOut );
566 }
567
568 static void debugDraw( Divide::ProjectManager* mgr, GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut )
569 {
570 mgr->debugDraw( bufferInOut, memCmdInOut );
571 }
572
573 static void drawCustomUI( Divide::ProjectManager* mgr, const Rect<I32>& targetViewport, GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut )
574 {
575 mgr->drawCustomUI( targetViewport, bufferInOut, memCmdInOut );
576 }
577
579 {
580 mgr->postRender(bufferInOut, memCmdInOut);
581 }
582
583 static const Camera* playerCamera( const Divide::ProjectManager* mgr ) noexcept
584 {
585 return mgr->playerCamera();
586 }
587
588 static const SceneStatePerPlayer& playerState( const Divide::ProjectManager* mgr ) noexcept
589 {
590 return mgr->activeProject()->getActiveScene()->state()->playerState();
591 }
592
594 {
595 return *mgr->activeProject()->getActiveScene()->lightPool();
596 }
597
599 {
600 return mgr->activeProject()->getActiveScene()->state()->renderState();
601 }
602
603 friend class Divide::RenderPass;
606 };
607
608 }; // namespace Attorney
609
610}; // namespace Divide
611
612#endif //DVD_SCENE_MANAGER_H
#define PROPERTY_RW(...)
Convenience method to add a class member with public read access and write access.
#define PROPERTY_R(...)
Convenience method to add a class member with public read access but protected write access.
#define PROPERTY_R_IW(...)
Convenience method to add a class member with public read access but protected write access including...
#define FWD_DECLARE_MANAGED_CLASS(T)
static Camera * playerCamera(const Divide::ProjectManager *mgr, const PlayerIndex idx, const bool skipOverride=false) noexcept
static Camera * playerCamera(const Divide::ProjectManager &mgr, const PlayerIndex idx, const bool skipOverride=false) noexcept
static BoundingSphere moveCameraToNode(const Divide::ProjectManager *mgr, Camera *camera, const SceneGraphNode *targetNode)
static Camera * playerCamera(const Divide::ProjectManager &mgr, const bool skipOverride=false) noexcept
static Camera * playerCamera(const Divide::ProjectManager *mgr, const bool skipOverride=false) noexcept
static bool saveNode(const Divide::ProjectManager *mgr, const SceneGraphNode *targetNode)
static Camera * playerCamera(const Divide::ProjectManager *mgr, PlayerIndex idx, bool skipOverride=false) noexcept
static bool loadNode(const Divide::ProjectManager *mgr, SceneGraphNode *targetNode)
static void editorPreviewNode(Divide::ProjectManager *mgr, const I64 editorPreviewNode)
static Camera * playerCamera(const Divide::ProjectManager *mgr, bool skipOverride=false) noexcept
static SceneEnvironmentProbePool * getEnvProbes(const Divide::ProjectManager *manager) noexcept
static bool networkUpdate(Divide::ProjectManager *manager, const U64 frameCount)
static ProjectIDs & init(Divide::ProjectManager *manager)
static void currentPlayerPass(Divide::ProjectManager *manager, const PlayerIndex idx)
static void initPostLoadState(Divide::ProjectManager *manager) noexcept
static bool onFrameStart(Divide::Project &project)
static void idle(Divide::Project &project)
static void waitForSaveTask(Divide::ProjectManager &mgr)
static bool onFrameEnd(Divide::Project &project)
static void drawCustomUI(Divide::ProjectManager *mgr, const Rect< I32 > &targetViewport, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
static SceneRenderState & renderState(Divide::ProjectManager *mgr) noexcept
static const SceneStatePerPlayer & playerState(const Divide::ProjectManager *mgr) noexcept
static const Camera * playerCamera(const Divide::ProjectManager *mgr) noexcept
static LightPool & lightPool(Divide::ProjectManager *mgr)
static void postRender(Divide::ProjectManager *mgr, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
static void prepareLightData(Divide::ProjectManager *mgr, const RenderStage stage, const CameraSnapshot &cameraSnapshot, GFX::MemoryBarrierCommand &memCmdInOut)
static void cullScene(Divide::ProjectManager *mgr, const NodeCullParams &cullParams, const U16 cullFlags, VisibleNodeList<> &nodesOut)
static void initDefaultCullValues(Divide::ProjectManager *mgr, const RenderStage stage, NodeCullParams &cullParamsInOut) noexcept
static void findNode(Divide::ProjectManager *mgr, const vec3< F32 > &cameraEye, const I64 nodeGUID, VisibleNodeList<> &nodesOut)
static void debugDraw(Divide::ProjectManager *mgr, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
static std::pair< Handle< Texture >, SamplerDescriptor > getSkyTexture(const Divide::ProjectManager *mgr)
static void removePlayer(Divide::ProjectManager &manager, Scene *parentScene, SceneGraphNode *playerNode, const bool queue)
static void getNodesInScreenRect(const Divide::ProjectManager &manager, const Rect< I32 > &screenRect, const Camera &camera, vector< SceneGraphNode * > &nodesOut)
static void addPlayer(Divide::ProjectManager &manager, Scene *parentScene, SceneGraphNode *playerNode, const bool queue)
static bool unloadScene(Divide::Project &project, Scene *scene)
The kernel is the main system that connects all of our various systems: windows, gfx,...
Definition: Kernel.h:81
static bool saveNodeToXML(Scene *activeScene, const SceneGraphNode *node)
static bool saveScene(Scene *activeScene, bool toCache, const DELEGATE< void, std::string_view > &msgCallback, const DELEGATE< void, bool > &finishCallback)
static bool loadNodeFromXML(Scene *activeScene, SceneGraphNode *node)
static bool loadScene(Scene *activeScene)
User controlled Unit.
Definition: Player.h:45
void setActiveScene(Scene *scene)
Scene * getActiveScene() const noexcept
PROPERTY_R_IW(ProjectID, id)
SwitchSceneTarget _sceneSwitchTarget
bool unloadScene(Scene *scene)
PROPERTY_R(ScenePool, scenePool)
ProjectManager & _parentManager
vector< SceneEntry > _sceneEntries
const SceneEntries & getSceneEntries() const noexcept
static bool CreateNewScene(const SceneEntry &scene, const ProjectID &projectID)
static bool CreateNewProject(const ProjectID &projectID)
bool switchScene(const SwitchSceneTarget &scene)
Scene * loadScene(const SceneEntry &sceneEntry)
ProjectManager & parent() noexcept
bool loadComplete() const noexcept
Check if the scene was loaded properly.
void addPlayerInternal(Scene *parentScene, SceneGraphNode *playerNode)
SwitchProjectTarget _projectSwitchTarget
bool joystickPovMoved(const Input::JoystickEvent &arg) override
Joystick direction change: return true if input was consumed.
bool mouseButtonPressed(const Input::MouseButtonEvent &arg) override
Mouse button pressed: return true if input was consumed.
bool saveActiveScene(bool toCache, bool deferred, const DELEGATE< void, std::string_view > &msgCallback={}, const DELEGATE< void, bool > &finishCallback={})
bool joystickBallMoved(const Input::JoystickEvent &arg) override
void initPostLoadState() noexcept
bool mouseButtonReleased(const Input::MouseButtonEvent &arg) override
Mouse button released: return true if input was consumed.
vector< std::pair< size_t, DELEGATE< void, U8, const vector< SceneGraphNode * > & > > > _selectionChangeCallbacks
void getSortedReflectiveNodes(const Camera *camera, RenderStage stage, bool inView, VisibleNodeList<> &nodesOut) const
get the full list of reflective nodes
static bool OnStartup(PlatformContext &context)
void setSelected(PlayerIndex idx, const vector< SceneGraphNode * > &SGNs, bool recursive)
bool frameStarted(const FrameEvent &evt) override
void drawCustomUI(const Rect< I32 > &targetViewport, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
void findNode(const vec3< F32 > &cameraEye, const I64 nodeGUID, VisibleNodeList<> &nodesOut)
Searches the scenegraph for the specified nodeGUID and, if found, adds it to nodesOut.
U8 playerPass() const noexcept
VisibleNodeList _recentlyRenderedNodes
eastl::queue< std::pair< Scene *, SceneGraphNode * > > _playerAddQueue
void getSortedRefractiveNodes(const Camera *camera, RenderStage stage, bool inView, VisibleNodeList<> &nodesOut) const
get the full list of refractive nodes
void editorPreviewNode(const I64 editorPreviewNode) noexcept
void removePlayerInternal(Scene *parentScene, SceneGraphNode *playerNode)
bool onKeyDown(const Input::KeyEvent &key) override
Key pressed: return true if input was consumed.
eastl::queue< std::pair< Scene *, SceneGraphNode * > > _playerRemoveQueue
std::pair< Handle< Texture >, SamplerDescriptor > getSkyTexture() const
Camera * playerCamera(bool skipOverride=false) const noexcept
bool networkUpdate(U64 frameCount)
const PlatformContext & platformContext() const noexcept
bool joystickRemap(const Input::JoystickEvent &arg) override
bool saveNode(const SceneGraphNode *targetNode) const
void removePlayer(Scene *parentScene, SceneGraphNode *playerNode, bool queue)
void addPlayer(Scene *parentScene, SceneGraphNode *playerNode, bool queue)
void prepareLightData(RenderStage stage, const CameraSnapshot &cameraSnapshot, GFX::MemoryBarrierCommand &memCmdInOut)
bool joystickButtonPressed(const Input::JoystickEvent &arg) override
Joystick button pressed: return true if input was consumed.
ErrorCode loadProject(const ProjectID &targetProject, bool deferToStartOfFrame)
bool joystickAddRemove(const Input::JoystickEvent &arg) override
bool frameEnded(const FrameEvent &evt) override
frameEnded is called after the buffers have been swapped
size_t addSelectionCallback(const DELEGATE< void, U8, const vector< SceneGraphNode * > & > &selectionCallback)
const VisibleNodeList & getRenderedNodeList() const noexcept
std::array< Time::ProfileTimer *, to_base(RenderStage::COUNT)> _sceneGraphCullTimers
void postRender(GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
void getNodesInScreenRect(const Rect< I32 > &screenRect, const Camera &camera, vector< SceneGraphNode * > &nodesOut) const
void debugDraw(GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
void initDefaultCullValues(RenderStage stage, NodeCullParams &cullParamsInOut) noexcept
init default culling values like max cull distance and other scene related states
bool joystickAxisMoved(const Input::JoystickEvent &arg) override
Joystick axis change: return true if input was consumed.
void cullSceneGraph(const NodeCullParams &cullParams, const U16 cullFlags, VisibleNodeList<> &nodesOut)
cull the SceneGraph against the current view frustum.
bool onKeyUp(const Input::KeyEvent &key) override
Key released: return true if input was consumed.
bool mouseMoved(const Input::MouseMoveEvent &arg) override
Mouse moved: return true if input was consumed.
PlayerIndex _currentPlayerPass
bool removeSelectionCallback(const size_t idx)
void onResolutionChange(const SizeChangeParams &params)
void onNodeDestroy(Scene *parentScene, SceneGraphNode *node)
void currentPlayerPass(PlayerIndex idx)
bool resetSelection(PlayerIndex idx, const bool resetIfLocked)
SceneEnvironmentProbePool * getEnvProbes() const noexcept
void mouseMovedExternally(const Input::MouseMoveEvent &arg)
bool loadNode(SceneGraphNode *targetNode) const
U8 activePlayerCount() const noexcept
AI::Navigation::DivideRecast * recast() const noexcept
void onChangeFocus(bool hasFocus)
AI::Navigation::DivideRecast_uptr _recast
static bool OnShutdown(PlatformContext &context)
BoundingSphere moveCameraToNode(Camera *camera, const SceneGraphNode *targetNode) const
bool joystickButtonReleased(const Input::JoystickEvent &arg) override
Joystick button released: return true if input was consumed.
void updateSceneState(U64 deltaGameTimeUS, U64 deltaAppTimeUS)
Update animations, network data, sounds, triggers etc.
bool onTextEvent(const Input::TextEvent &arg) override
All the information needed for a single light's shadowmap.
Definition: ShadowMap.h:88
An API-independent representation of a texture.
Definition: Texture.h:83
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
DELEGATE_STD< Ret, Args... > DELEGATE
vector< SceneEntry > SceneEntries
Definition: Scene.h:116
int32_t I32
vector< ProjectID > ProjectIDs
uint8_t U8
eastl::vector< Type > vector
Definition: Vector.h:42
bool IsSet(const SwitchSceneTarget &target) noexcept
uint16_t U16
bool operator==(const DisplayManager::OutputDisplayProperties &lhs, const DisplayManager::OutputDisplayProperties &rhs) noexcept
Definition: Application.inl:37
bool dvd_erase_if(eastl::vector< T, A > &vec, Predicate &&pred)
Definition: Vector.h:109
int64_t I64
uint32_t U32
Project const SceneEntry & entry
Definition: DefaultScene.h:41
uint64_t U64
constexpr auto to_base(const Type value) -> Type
Definition: Scene.h:112