1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/*
* Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#ifndef __EMITTER_SCENE_H__
#define __EMITTER_SCENE_H__
#include "Apex.h"
#include "ModuleEmitterImpl.h"
#include "ApexSDKIntl.h"
#include "ModuleIntl.h"
#include "ApexContext.h"
#include "ApexSDKHelpers.h"
#include "ApexActor.h"
#include "DebugRenderParams.h"
#include "EmitterDebugRenderParams.h"
#include "PxTask.h"
namespace nvidia
{
namespace apex
{
class SceneIntl;
}
namespace emitter
{
class ModuleEmitterImpl;
/* Each Emitter Actor should derive this class, so the scene can deal with it */
class EmitterActorBase : public ApexActor
{
public:
virtual bool isValid()
{
return mValid;
}
virtual void tick() = 0;
virtual void visualize(RenderDebugInterface& renderDebug) = 0;
virtual void submitTasks() = 0;
virtual void setTaskDependencies() = 0;
virtual void fetchResults() = 0;
protected:
EmitterActorBase() : mValid(false) {}
bool mValid;
};
class EmitterScene : public ModuleSceneIntl, public ApexContext, public ApexResourceInterface, public ApexResource
{
public:
EmitterScene(ModuleEmitterImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list);
~EmitterScene();
/* ModuleSceneIntl */
void visualize();
void setModulePhysXScene(PxScene* s);
PxScene* getModulePhysXScene() const
{
return mPhysXScene;
}
PxScene* mPhysXScene;
Module* getModule()
{
return mModule;
}
void fetchResults();
virtual SceneStats* getStats()
{
return 0;
}
bool lockRenderResources()
{
renderLockAllActors(); // Lock options not implemented yet
return true;
}
bool unlockRenderResources()
{
renderUnLockAllActors(); // Lock options not implemented yet
return true;
}
/* ApexResourceInterface */
uint32_t getListIndex() const
{
return m_listIndex;
}
void setListIndex(ResourceList& list, uint32_t index)
{
m_listIndex = index;
m_list = &list;
}
void release()
{
mModule->releaseModuleSceneIntl(*this);
}
void submitTasks(float elapsedTime, float substepSize, uint32_t numSubSteps);
void setTaskDependencies();
protected:
void destroy();
ModuleEmitterImpl* mModule;
SceneIntl* mApexScene;
float mSumBenefit;
private:
RenderDebugInterface* mDebugRender;
DebugRenderParams* mDebugRenderParams;
EmitterDebugRenderParams* mEmitterDebugRenderParams;
friend class ModuleEmitterImpl;
friend class EmitterActorImpl;
friend class GroundEmitterActorImpl;
friend class ImpactEmitterActorImpl;
};
}
} // end namespace nvidia
#endif
|