Subversion Repository Public Repository

Divide-Dependencies

This repository has no backups
This repository's network speed is throttled to 100KB/sec

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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
//
// 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.



#include "ApexUsingNamespace.h"
#include "Apex.h"
#include "ApexLegacyModule.h"
#include "ApexRWLockable.h"

#define SAFE_MODULE_RELEASE(x) if ( x ) { ModuleIntl *m = mSdk->getInternalModule(x); PX_ASSERT(m); m->setParent(NULL); m->setCreateOk(false); x->release(); x = NULL; }

namespace nvidia
{
namespace apex
{

#if defined(_USRDLL) || PX_OSX || (PX_LINUX && APEX_LINUX_SHARED_LIBRARIES)
ApexSDKIntl* gApexSdk = 0;
ApexSDK* GetApexSDK()
{
	return gApexSdk;
}
ApexSDKIntl* GetInternalApexSDK()
{
	return gApexSdk;
}
#endif

namespace legacy
{

#define MODULE_CHECK(x) if ( x == module ) { x = NULL; }
#define SAFE_MODULE_NULL(x) if ( x ) { ModuleIntl *m = mSdk->getInternalModule(x); PX_ASSERT(m); m->setParent(NULL); x = NULL;}

class ModuleLegacy : public ApexLegacyModule, public ApexRWLockable
{
public:
	APEX_RW_LOCKABLE_BOILERPLATE

	ModuleLegacy(ApexSDKIntl* sdk);

	/**
	Notification from ApexSDK when a module has been released
	*/
	virtual void notifyChildGone(ModuleIntl* imodule)
	{
		Module* module = mSdk->getModule(imodule);
		PX_ASSERT(module);
		PX_UNUSED(module);
		// notifyChildGoneMarker
#if PX_PHYSICS_VERSION_MAJOR == 3
#if APEX_USE_PARTICLES
		MODULE_CHECK(mModuleParticlesLegacy);
		MODULE_CHECK(mModuleParticleIOSLegacy);
		MODULE_CHECK(mModuleForceFieldLegacy);
		MODULE_CHECK(mModuleBasicFSLegacy);
		MODULE_CHECK(mModuleTurbulenceFSLegacy);
		MODULE_CHECK(mModuleBasicIOSLegacy);
		MODULE_CHECK(mModuleEmitterLegacy);
		MODULE_CHECK(mModuleIOFXLegacy);
#endif
		MODULE_CHECK(mModuleDestructibleLegacy);
#endif
		MODULE_CHECK(mModuleClothingLegacy);
		MODULE_CHECK(mModuleCommonLegacy);
		MODULE_CHECK(mModuleFrameworkLegacy);
	};

	// This is a notification that the ApexSDK is being released.  During the shutdown process
	// the APEX SDK will automatically release all currently registered modules; therefore we are no longer
	// responsible for releasing these modules ourselves.
	virtual void notifyReleaseSDK()
	{
#if PX_PHYSICS_VERSION_MAJOR == 3
#if APEX_USE_PARTICLES
		// notifyReleaseSDKMarker
		SAFE_MODULE_NULL(mModuleBasicIOSLegacy);
		SAFE_MODULE_NULL(mModuleEmitterLegacy);
		SAFE_MODULE_NULL(mModuleIOFXLegacy);
		SAFE_MODULE_NULL(mModuleParticlesLegacy);
		SAFE_MODULE_NULL(mModuleParticleIOSLegacy);
		SAFE_MODULE_NULL(mModuleForceFieldLegacy);
		SAFE_MODULE_NULL(mModuleBasicFSLegacy);
		SAFE_MODULE_NULL(mModuleTurbulenceFSLegacy);
#endif
		SAFE_MODULE_NULL(mModuleDestructibleLegacy);
#endif
		SAFE_MODULE_NULL(mModuleClothingLegacy);
		SAFE_MODULE_NULL(mModuleCommonLegacy);
		SAFE_MODULE_NULL(mModuleFrameworkLegacy);
	}

protected:
	void releaseLegacyObjects();

private:
	// Add custom conversions here
	// ModulePointerDefinitionMarker
#if PX_PHYSICS_VERSION_MAJOR == 3
#if APEX_USE_PARTICLES
	nvidia::apex::Module*	mModuleBasicIOSLegacy;
	nvidia::apex::Module*	mModuleEmitterLegacy;
	nvidia::apex::Module*	mModuleIOFXLegacy;
	nvidia::apex::Module*	mModuleParticlesLegacy;
	nvidia::apex::Module*	mModuleParticleIOSLegacy;
	nvidia::apex::Module*	mModuleForceFieldLegacy;
	nvidia::apex::Module*	mModuleBasicFSLegacy;
	nvidia::apex::Module*	mModuleTurbulenceFSLegacy;
#endif
	nvidia::apex::Module*	mModuleDestructibleLegacy;
#endif
	nvidia::apex::Module*	mModuleClothingLegacy;
	nvidia::apex::Module*	mModuleCommonLegacy;
	nvidia::apex::Module*	mModuleFrameworkLegacy;
};

}
#if defined(_USRDLL) || PX_OSX || (PX_LINUX && APEX_LINUX_SHARED_LIBRARIES)

APEX_API Module*  CALL_CONV createModule(
    ApexSDKIntl* inSdk,
    ModuleIntl** niRef,
    uint32_t APEXsdkVersion,
    uint32_t PhysXsdkVersion,
    ApexCreateError* errorCode)
{
	if (APEXsdkVersion != APEX_SDK_VERSION)
	{
		if (errorCode)
		{
			*errorCode = APEX_CE_WRONG_VERSION;
		}
		return NULL;
	}

	if (PhysXsdkVersion != PX_PHYSICS_VERSION)
	{
		if (errorCode)
		{
			*errorCode = APEX_CE_WRONG_VERSION;
		}
		return NULL;
	}

	gApexSdk = inSdk;

	legacy::ModuleLegacy* impl = PX_NEW(legacy::ModuleLegacy)(inSdk);
	*niRef  = (ModuleIntl*) impl;
	return (Module*) impl;
}
#else
void instantiateModuleLegacy()
{
	ApexSDKIntl* sdk = GetInternalApexSDK();
	legacy::ModuleLegacy* impl = PX_NEW(legacy::ModuleLegacy)(sdk);
	sdk->registerExternalModule((Module*) impl, (ModuleIntl*) impl);
}
#endif

namespace legacy
{
#if PX_PHYSICS_VERSION_MAJOR == 3

#if APEX_USE_PARTICLES
// instantiateDefinitionMarker
void instantiateModuleBasicIOSLegacy();
void instantiateModuleEmitterLegacy();
void instantiateModuleIOFXLegacy();
void instantiateModuleParticlesLegacy();
void instantiateModuleParticleIOSLegacy();
void instantiateModuleForceFieldLegacy();
void instantiateModuleBasicFSLegacy();
void instantiateModuleTurbulenceFSLegacy();
#endif

void instantiateModuleDestructibleLegacy();
#endif

void instantiateModuleCommonLegacy();
void instantiateModuleFrameworkLegacy();
void instantiateModuleClothingLegacy();

#define MODULE_PARENT(x) if ( x ) { ModuleIntl *m = mSdk->getInternalModule(x); PX_ASSERT(m); m->setParent(this); }

ModuleLegacy::ModuleLegacy(ApexSDKIntl* inSdk)
{
	mName = "Legacy";
	mSdk = inSdk;
	mApiProxy = this;

	// Register legacy stuff

	NvParameterized::Traits* t = mSdk->getParameterizedTraits();
	if (!t)
	{
		return;
	}
#if PX_PHYSICS_VERSION_MAJOR == 3

#if APEX_USE_PARTICLES
	// instantiateCallMarker	
	
	instantiateModuleBasicIOSLegacy();
	mModuleBasicIOSLegacy = mSdk->createModule("BasicIOS_Legacy", NULL);
	PX_ASSERT(mModuleBasicIOSLegacy);
	MODULE_PARENT(mModuleBasicIOSLegacy);

	instantiateModuleEmitterLegacy();
	mModuleEmitterLegacy = mSdk->createModule("Emitter_Legacy", NULL);
	PX_ASSERT(mModuleEmitterLegacy);
	MODULE_PARENT(mModuleEmitterLegacy);

	instantiateModuleIOFXLegacy();
	mModuleIOFXLegacy = mSdk->createModule("IOFX_Legacy", NULL);
	PX_ASSERT(mModuleIOFXLegacy);
	MODULE_PARENT(mModuleIOFXLegacy);

	instantiateModuleParticlesLegacy();
	mModuleParticlesLegacy = mSdk->createModule("Particles_Legacy", NULL);
	PX_ASSERT(mModuleParticlesLegacy);
	MODULE_PARENT(mModuleParticlesLegacy);	
	
	instantiateModuleParticleIOSLegacy();
	mModuleParticleIOSLegacy = mSdk->createModule("ParticleIOS_Legacy", NULL);
	PX_ASSERT(mModuleParticleIOSLegacy);
	MODULE_PARENT(mModuleParticleIOSLegacy);

	instantiateModuleForceFieldLegacy();
	mModuleForceFieldLegacy = mSdk->createModule("ForceField_Legacy", NULL);
	PX_ASSERT(mModuleForceFieldLegacy);
	MODULE_PARENT(mModuleForceFieldLegacy);	

	instantiateModuleBasicFSLegacy();
	mModuleBasicFSLegacy = mSdk->createModule("BasicFS_Legacy", NULL);
	PX_ASSERT(mModuleBasicFSLegacy);
	MODULE_PARENT(mModuleBasicFSLegacy);	

	instantiateModuleTurbulenceFSLegacy();
	mModuleTurbulenceFSLegacy = mSdk->createModule("TurbulenceFS_Legacy", NULL);
	PX_ASSERT(mModuleTurbulenceFSLegacy);
	MODULE_PARENT(mModuleTurbulenceFSLegacy);
#endif
	
	instantiateModuleDestructibleLegacy();
	mModuleDestructibleLegacy = mSdk->createModule("Destructible_Legacy", NULL);
	PX_ASSERT(mModuleDestructibleLegacy);
	MODULE_PARENT(mModuleDestructibleLegacy);

#endif

	instantiateModuleCommonLegacy();
	mModuleCommonLegacy = mSdk->createModule("Common_Legacy", NULL);
	PX_ASSERT(mModuleCommonLegacy);
	MODULE_PARENT(mModuleCommonLegacy);
	
	instantiateModuleFrameworkLegacy();
	mModuleFrameworkLegacy = mSdk->createModule("Framework_Legacy", NULL);
	PX_ASSERT(mModuleFrameworkLegacy);
	MODULE_PARENT(mModuleFrameworkLegacy);

	instantiateModuleClothingLegacy();
	mModuleClothingLegacy = mSdk->createModule("Clothing_Legacy", NULL);
	PX_ASSERT(mModuleClothingLegacy);
	MODULE_PARENT(mModuleClothingLegacy);
}

void ModuleLegacy::releaseLegacyObjects()
{
	//Release legacy stuff

	NvParameterized::Traits* t = mSdk->getParameterizedTraits();
	if (!t)
	{
		return;
	}

#if PX_PHYSICS_VERSION_MAJOR == 3
#if APEX_USE_PARTICLES
		// releaseLegacyObjectsMarker
	SAFE_MODULE_RELEASE(mModuleBasicIOSLegacy);
	SAFE_MODULE_RELEASE(mModuleEmitterLegacy);
	SAFE_MODULE_RELEASE(mModuleIOFXLegacy);
	SAFE_MODULE_RELEASE(mModuleParticlesLegacy);
	SAFE_MODULE_RELEASE(mModuleParticleIOSLegacy);
	SAFE_MODULE_RELEASE(mModuleForceFieldLegacy);
	SAFE_MODULE_RELEASE(mModuleBasicFSLegacy);
	SAFE_MODULE_RELEASE(mModuleTurbulenceFSLegacy);
#endif

	SAFE_MODULE_RELEASE(mModuleDestructibleLegacy);
#endif
	SAFE_MODULE_RELEASE(mModuleCommonLegacy);
	SAFE_MODULE_RELEASE(mModuleFrameworkLegacy);
	SAFE_MODULE_RELEASE(mModuleClothingLegacy);
}

}
}
} // end namespace nvidia::apex

Commits for Divide-Dependencies/physx/APEX_1.4/module/legacy/src/ModuleLegacy.cpp

Diff revisions: vs.
Revision Author Commited Message
105 IonutCava picture IonutCava Tue 16 Apr, 2019 19:55:41 +0000

Forgot to actually add physx