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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
#ifndef MODULE_H
#define MODULE_H
/*!
\file
\brief APEX Module API
*/
#include "ApexInterface.h"
#include "ApexSDK.h"
#include "foundation/PxSimpleTypes.h"
namespace nvidia
{
namespace apex
{
PX_PUSH_PACK_DEFAULT
class RenderableIterator;
/**
\brief Render lock modes. These are used per-module to determine how render locking is done.
*/
struct RenderLockMode
{
/**
\brief Enum of render lock modes
*/
enum Enum
{
/**
\brief Disables render locking in the module scene.
*/
NO_RENDER_LOCK = 0,
/**
\brief Locks all apex actors in the module scene individually.
*/
PER_ACTOR_RENDER_LOCK = 1,
/**
\brief Locks an entire module scene with one lock.
*/
PER_MODULE_SCENE_RENDER_LOCK = 2,
};
};
/**
\brief A structure that holds two templated values, a min and a max
*/
template <typename T>
struct Range
{
Range() {};
/**
\brief Constructor, sets min amd max values
*/
Range(T inMin, T inMax) : minimum(inMin), maximum(inMax) {};
/**
\brief operator ==
*/
bool operator== (const Range& r) const
{
return minimum == r.minimum && maximum == r.maximum;
}
/**
\brief Minimal value
*/
T minimum;
/**
\brief Maximal value
*/
T maximum;
};
/**
\brief base class of all APEX modules
It describes the LODParameters and weights defined by the module.
*/
class Module : public ApexInterface
{
public:
/**
\brief Initialize the module
\param[in] desc use Module::getDefaultModuleDesc() to get the descriptor necessary for initializing the module
*/
virtual void init(::NvParameterized::Interface& desc) = 0;
/**
\brief Returns the name of the module
*/
virtual const char* getName() const = 0;
/**
\brief Returns the unique ID of the module
*/
virtual AuthObjTypeID getModuleID() const = 0;
/**
\brief Returns the NvParameterized interface that contains module initialization parameters
\note The module itself owns this object, so there's no need for the application to destroy it
*/
virtual ::NvParameterized::Interface* getDefaultModuleDesc()
{
return NULL;
}
/**
\brief Allocate a renderable iterator
Returns an Renderable iterator instance for the specified Scene. The iterator
will return pointers to renderables in this scene that were generated by this module. This
is the preferred method for rendering IOFX actors.
*/
virtual RenderableIterator* createRenderableIterator(const Scene&) = 0;
/**
\brief Choose the locking mode for the module scene. See RenderLockMode.
Returns true if successful.
*/
virtual bool setRenderLockMode(RenderLockMode::Enum, Scene&) { return false; }
/**
\brief Returns the current render lock mode for the module scene.
*/
virtual RenderLockMode::Enum getRenderLockMode(const Scene&) const { return RenderLockMode::NO_RENDER_LOCK; }
/**
\brief Sets a render lock for the module scene. Used when the SDK render lock mode is RenderLockMode::PER_MODULE_SCENE_RENDER_LOCK. See ApexSDK::setRenderLockMode().
Returns true iff successful.
*/
virtual bool lockModuleSceneRenderLock(Scene&) { return false; }
/**
\brief Releases the render lock for the module scene. See lockModuleSceneRenderLock().
Returns true iff successful.
*/
virtual bool unlockModuleSceneRenderLock(Scene&) { return false; }
};
PX_POP_PACK
}
} // end namespace nvidia::apex
#endif // MODULE_H
|