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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
//
// 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 MODIFIER_H
#define MODIFIER_H

#include "Apex.h"
#include "Curve.h"
#include "IofxAsset.h"
#include "IofxRenderCallback.h"

#include "ModifierDefs.h"

namespace nvidia
{
namespace apex
{

PX_PUSH_PACK_DEFAULT

/// Converts ModifierStage to bitmap
inline uint32_t ModifierUsageFromStage(ModifierStage stage)
{
	return 1u << stage;
}

// Disable the unused arguments warning for this header.
#pragma warning( disable: 4100 )

/**
\brief Modifier contains all of the data necessary to apply a single modifier type to a particle system.

Generally this combines some physical transformation with parameters specified at authoring time
to modify the look of the final effect.
*/
class Modifier
{
public:

	/// getModifierType returns the enumerated type associated with this class.
	virtual ModifierTypeEnum getModifierType() const = 0;

	/// getModifierUsage returns the usage scenarios allowed for a particular modifier.
	virtual uint32_t getModifierUsage() const = 0;

	/// returns a bitmap that includes every sprite semantic that the modifier updates
	virtual uint32_t getModifierSpriteSemantics()
	{
		return 0;
	}
	
	/// returns a bitmap that includes every mesh(instance) semantic that the modifier updates
	virtual uint32_t getModifierMeshSemantics()
	{
		return 0;
	}

	virtual ~Modifier() { }

};

/**
\brief ModifierT is a helper class to handle the mapping of Type->Enum and Enum->Type.

This imposes some structure on the subclasses--they all now
expect to have a const static field called ModifierType.
*/
template <typename T>
class ModifierT : public Modifier
{
public:
	
	/// Returns ModifierType for typename T
	virtual ModifierTypeEnum getModifierType() const
	{
		return T::ModifierType;
	}
	
	/// Returns ModifierUsage for typename T
	virtual uint32_t getModifierUsage() const
	{
		return T::ModifierUsage;
	}
};


/**
\brief RotationModifier applies rotation to the particles using one of several rotation models.
*/
class RotationModifier : public ModifierT<RotationModifier>
{
public:
	
	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_Rotation;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
	        | ModifierUsage_Mesh;


	/// get the roll model
	virtual ApexMeshParticleRollType::Enum getRollType() const = 0;
	
	/// set the roll model
	virtual void setRollType(ApexMeshParticleRollType::Enum rollType) = 0;
	
	/// get the maximum allowed settle rate per second
	virtual float getMaxSettleRate() const = 0;
	
	/// set the maximum allowed settle rate per second
	virtual void setMaxSettleRate(float settleRate) = 0;
	
	/// get the maximum allowed rotation rate per second
	virtual float getMaxRotationRate() const = 0;
	
	/// set the maximum allowed rotation rate per second
	virtual void setMaxRotationRate(float rotationRate) = 0;

};

/**
 \brief SimpleScaleModifier just applies a simple scale factor to each of the X, Y and Z aspects of the model. Each scalefactor can be
		applied independently.
*/
class SimpleScaleModifier : public ModifierT<SimpleScaleModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_SimpleScale;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the vector of scale factors along the three axes
	virtual PxVec3 getScaleFactor() const = 0;
	
	/// set the vector of scale factors along the three axes
	virtual void setScaleFactor(const PxVec3& s) = 0;
};

/**
\brief ScaleByMassModifier scales by mass of the particle.
*/
class ScaleByMassModifier : public ModifierT<ScaleByMassModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ScaleByMass;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;
};

/**
 \brief RandomScaleModifier applies a random scale uniformly to all three dimensions. Currently, the
		scale is a uniform in the range specified.
*/
class RandomScaleModifier : public ModifierT<RandomScaleModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_RandomScale;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the range of scale factors along the three axes
	virtual Range<float> getScaleFactor() const = 0;
	
	/// set the range of scale factors along the three axes
	virtual void setScaleFactor(const Range<float>& s) = 0;
};

/**
 \brief ColorVsLifeModifier modifies the color constants associated with a particle
		depending on the life remaining of the particle.
*/
class ColorVsLifeModifier : public ModifierT<ColorVsLifeModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ColorVsLife;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the affected color channel
	virtual ColorChannel getColorChannel() const = 0;
	
	/// set the affected color channel
	virtual void setColorChannel(ColorChannel colorChannel) = 0;
	
	/// get the curve that sets the dependency between the lifetime and the color
	virtual const Curve* getFunction() const = 0;
	
	/// set the curve that sets the dependency between the lifetime and the color
	virtual void setFunction(const Curve* f) = 0;
};

/**
 \brief ColorVsDensityModifier modifies the color constants associated with a particle
		depending on the density of the particle.
*/
class ColorVsDensityModifier : public ModifierT<ColorVsDensityModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ColorVsDensity;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the affected color channel
	virtual ColorChannel getColorChannel() const = 0;
	
	/// set the affected color channel
	virtual void setColorChannel(ColorChannel colorChannel) = 0;
	
	/// get the curve that sets the dependency between the density and the color
	virtual const Curve* getFunction() const = 0;
	
	/// set the curve that sets the dependency between the density and the color
	virtual void setFunction(const Curve* f) = 0;
};

/**
 \brief SubtextureVsLifeModifier is a modifier to adjust the subtexture id versus the life remaining of a particular particle.

 Interpretation of the subtexture id over time is up to the application.
 */
class SubtextureVsLifeModifier : public ModifierT<SubtextureVsLifeModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_SubtextureVsLife;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite;


	/// get the curve that sets the dependency between the life remaining and the subtexture id
	virtual const Curve* getFunction() const = 0;
	
	/// set the curve that sets the dependency between the life remaining and the subtexture id
	virtual void setFunction(const Curve* f) = 0;
};

/**
 \brief OrientAlongVelocity is a modifier to orient a mesh so that a particular axis coincides with the velocity vector.
 */
class OrientAlongVelocityModifier : public ModifierT<OrientAlongVelocityModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_OrientAlongVelocity;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Mesh;


	/// get the object-space vector that will coincide with the velocity vector
	virtual PxVec3 getModelForward() const = 0;
	
	/// set the object-space vector that will coincide with the velocity vector
	virtual void setModelForward(const PxVec3& s) = 0;
};


/**
 \brief ScaleAlongVelocityModifier is a modifier to apply a scale factor along the current velocity vector.

 Note that without applying an OrientAlongVelocity modifier first, the results for this will be 'odd.'
 */
class ScaleAlongVelocityModifier : public ModifierT<ScaleAlongVelocityModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ScaleAlongVelocity;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Mesh;


	/// get the scale factor
	virtual float getScaleFactor() const = 0;
	
	/// set the scale factor
	virtual void setScaleFactor(const float& s) = 0;
};

/**
 \brief RandomSubtextureModifier generates a random subtexture ID and places it in the subTextureId field.
 */
class RandomSubtextureModifier : public ModifierT<RandomSubtextureModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_RandomSubtexture;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn
	        | ModifierUsage_Sprite;


	///get the range for subtexture values
	virtual Range<float> getSubtextureRange() const = 0;
	
	///set the range for subtexture values
	virtual void setSubtextureRange(const Range<float>& s) = 0;
};

/**
 \brief RandomRotationModifier will choose a random orientation for a sprite particle within the range as specified below.

 The values in the range are interpreted as radians. Please keep in mind that all the sprites are coplanar to the screen.
 */
class RandomRotationModifier : public ModifierT<RandomRotationModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_RandomRotation;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn
	        | ModifierUsage_Sprite;


	///get the range of orientations, in radians.
	virtual Range<float> getRotationRange() const = 0;
	
	///set the range of orientations, in radians.
	virtual void setRotationRange(const Range<float>& s) = 0;
};

/**
 \brief ScaleVsLifeModifier applies a scale factor function against a single axis versus the life remaining.
 */
class ScaleVsLifeModifier : public ModifierT<ScaleVsLifeModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ScaleVsLife;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the axis along which the scale factor will be applied
	virtual ScaleAxis getScaleAxis() const = 0;
	
	/// set the axis along which the scale factor will be applied
	virtual void setScaleAxis(ScaleAxis a) = 0;
	
	/// get the the curve that defines the dependency between the life remaining and the scale factor
	virtual const Curve* getFunction() const = 0;
	
	/// set the the curve that defines the dependency between the life remaining and the scale factor
	virtual void setFunction(const Curve* f) = 0;
};

/**
 \brief ScaleVsDensityModifier applies a scale factor function against a single axis versus the density of the particle.
 */
class ScaleVsDensityModifier : public ModifierT<ScaleVsDensityModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ScaleVsDensity;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the axis along which the scale factor will be applied
	virtual ScaleAxis getScaleAxis() const = 0;
	
	/// set the axis along which the scale factor will be applied
	virtual void setScaleAxis(ScaleAxis a) = 0;
	
	/// get the the curve that defines the dependency between the density and the scale factor
	virtual const Curve* getFunction() const = 0;
	
	/// set the the curve that defines the dependency between the density and the scale factor
	virtual void setFunction(const Curve* f) = 0;
};

/**
 \brief ScaleVsCameraDistance applies a scale factor against a specific axis based on distance from the camera to the particle.
 */
class ScaleVsCameraDistanceModifier : public ModifierT<ScaleVsCameraDistanceModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ScaleVsCameraDistance;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the axis along which the scale factor will be applied
	virtual ScaleAxis getScaleAxis() const = 0;
	
	/// set the axis along which the scale factor will be applied
	virtual void setScaleAxis(ScaleAxis a) = 0;
	
	/// get the the curve that defines the dependency between the camera distance and the scale factor
	virtual const Curve* getFunction() const = 0;
	
	/// set the the curve that defines the dependency between the camera distance and the scale factor
	virtual void setFunction(const Curve* f) = 0;
};

/**
 \brief ViewDirectionSortingModifier sorts sprite particles along view direction back to front.
 */
class ViewDirectionSortingModifier : public ModifierT<ViewDirectionSortingModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ViewDirectionSorting;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite;

};

/**
 \brief RotationRateModifier is a modifier to apply a continuous rotation for sprites.
 */
class RotationRateModifier : public ModifierT<RotationRateModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_RotationRate;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite;


	/// set the rotation rate
	virtual float getRotationRate() const = 0;
	
	/// get the rotation rate
	virtual void setRotationRate(const float& rate) = 0;
};

/**
 \brief RotationRateVsLifeModifier is a modifier to adjust the rotation rate versus the life remaining of a particular particle.
 */
class RotationRateVsLifeModifier : public ModifierT<RotationRateVsLifeModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_RotationRateVsLife;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite;


	/// get the curve that sets the dependency between the life remaining and the rotation rate
	virtual const Curve* getFunction() const = 0;
	
	/// set the curve that sets the dependency between the life remaining and the rotation rate
	virtual void setFunction(const Curve* f) = 0;
};

/**
 \brief OrientScaleAlongScreenVelocityModifier is a modifier to orient & scale sprites along the current screen velocity vector.
 */
class OrientScaleAlongScreenVelocityModifier : public ModifierT<OrientScaleAlongScreenVelocityModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_OrientScaleAlongScreenVelocity;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Continuous
	        | ModifierUsage_Sprite;


	/// get the scale per velocity
	virtual float getScalePerVelocity() const = 0;
	
	/// set the scale per velocity
	virtual void setScalePerVelocity(const float& s) = 0;

	/// get the scale change limit
	virtual float getScaleChangeLimit() const = 0;
	
	/// set the scale change limit
	virtual void setScaleChangeLimit(const float& s) = 0;

	/// get the scale change delay
	virtual float getScaleChangeDelay() const = 0;
	
	/// set the scale change delay
	virtual void setScaleChangeDelay(const float& s) = 0;
};

/**
 \brief ColorVsVelocityModifier modifies the color constants associated with a particle
		depending on the velocity of the particle.
*/
class ColorVsVelocityModifier : public ModifierT<ColorVsVelocityModifier>
{
public:

	/// ModifierType
	static const ModifierTypeEnum ModifierType = ModifierType_ColorVsVelocity;
	
	/// ModifierUsage
	static const uint32_t ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
	        | ModifierUsage_Sprite | ModifierUsage_Mesh;


	/// get the affected color channel
	virtual ColorChannel getColorChannel() const = 0;
	
	/// set the affected color channel
	virtual void setColorChannel(ColorChannel colorChannel) = 0;
	
	/// get the curve that sets the dependency between the lifetime and the color
	virtual const Curve* getFunction() const = 0;
	
	/// set the curve that sets the dependency between the lifetime and the color
	virtual void setFunction(const Curve* f) = 0;

	/// get velocity0
	virtual float getVelocity0() const = 0;
	
	/// set velocity0
	virtual void setVelocity0(float value) = 0;

	/// get velocity1
	virtual float getVelocity1() const = 0;
	
	/// set velocity1
	virtual void setVelocity1(float value) = 0;
};

#pragma warning( default: 4100 )

PX_POP_PACK

}
} // namespace nvidia

#endif // MODIFIER_H

Commits for Divide-Dependencies/physx/APEX_1.4/include/iofx/Modifier.h

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

Forgot to actually add physx