NxModifier.h
Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved.
00027 
00028 #ifndef NX_MODIFIER_H
00029 #define NX_MODIFIER_H
00030 
00031 #include "NxApex.h"
00032 #include "NxCurve.h"
00033 #include "NxIofxAsset.h"
00034 #include "NxUserRenderSpriteBufferDesc.h"
00035 
00036 #include "NxModifierDefs.h"
00037 
00038 namespace physx
00039 {
00040 namespace apex
00041 {
00042 
00043 PX_PUSH_PACK_DEFAULT
00044 
00045 inline physx::PxU32 ModifierUsageFromStage(ModifierStage stage)
00046 {
00047     return 1 << stage;
00048 }
00049 
00050 class NiIosObjectData;
00051 
00052 // Disable the unused arguments warning for this header.
00053 #pragma warning( disable: 4100 )
00054 
00060 class NxModifier
00061 {
00062 public:
00066     virtual ModifierTypeEnum getModifierType() const = 0;
00067 
00071     virtual physx::PxU32 getModifierUsage() const = 0;
00072 
00076     virtual physx::PxU32 getModifierSpriteSemantics()
00077     {
00078         return 0;
00079     }
00083     virtual physx::PxU32 getModifierMeshSemantics()
00084     {
00085         return 0;
00086     }
00087 
00088 
00089     virtual ~NxModifier() { }
00090 
00091 
00092 };
00093 
00099 template <typename T>
00100 class NxModifierT : public NxModifier
00101 {
00102 public:
00103     virtual ModifierTypeEnum getModifierType() const
00104     {
00105         return T::ModifierType;
00106     }
00107     virtual physx::PxU32 getModifierUsage() const
00108     {
00109         return T::ModifierUsage;
00110     }
00111 };
00112 
00113 
00117 class NxRotationModifier : public NxModifierT<NxRotationModifier>
00118 {
00119 public:
00120     static const ModifierTypeEnum ModifierType = ModifierType_Rotation;
00121     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
00122             | ModifierUsage_Mesh;
00123 
00124 
00126     virtual NxApexMeshParticleRollType::Enum getRollType() const = 0;
00128     virtual void setRollType(NxApexMeshParticleRollType::Enum rollType) = 0;
00130     virtual physx::PxF32 getMaxSettleRate() const = 0;
00132     virtual void setMaxSettleRate(physx::PxF32 settleRate) = 0;
00134     virtual physx::PxF32 getMaxRotationRate() const = 0;
00136     virtual void setMaxRotationRate(physx::PxF32 rotationRate) = 0;
00137 
00138 };
00139 
00144 class NxSimpleScaleModifier : public NxModifierT<NxSimpleScaleModifier>
00145 {
00146 public:
00147     static const ModifierTypeEnum ModifierType = ModifierType_SimpleScale;
00148     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
00149             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00150 
00151 
00153     virtual physx::PxVec3 getScaleFactor() const = 0;
00155     virtual void setScaleFactor(const physx::PxVec3& s) = 0;
00156 };
00157 
00161 class NxScaleByMassModifier : public NxModifierT<NxScaleByMassModifier>
00162 {
00163 public:
00164     static const ModifierTypeEnum ModifierType = ModifierType_ScaleByMass;
00165     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
00166             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00167 };
00168 
00173 class NxRandomScaleModifier : public NxModifierT<NxRandomScaleModifier>
00174 {
00175 public:
00176     static const ModifierTypeEnum ModifierType = ModifierType_RandomScale;
00177     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn
00178             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00179 
00180 
00182     virtual NxRange<physx::PxF32> getScaleFactor() const = 0;
00184     virtual void setScaleFactor(const NxRange<physx::PxF32>& s) = 0;
00185 };
00186 
00191 class NxColorVsLifeModifier : public NxModifierT<NxColorVsLifeModifier>
00192 {
00193 public:
00194     static const ModifierTypeEnum ModifierType = ModifierType_ColorVsLife;
00195     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
00196             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00197 
00198 
00200     virtual ColorChannel getColorChannel() const = 0;
00202     virtual void setColorChannel(ColorChannel colorChannel) = 0;
00204     virtual const NxCurve* getFunction() const = 0;
00206     virtual void setFunction(const NxCurve* f) = 0;
00207 };
00208 
00213 class NxColorVsDensityModifier : public NxModifierT<NxColorVsDensityModifier>
00214 {
00215 public:
00216     static const ModifierTypeEnum ModifierType = ModifierType_ColorVsDensity;
00217     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00218             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00219 
00220 
00222     virtual ColorChannel getColorChannel() const = 0;
00224     virtual void setColorChannel(ColorChannel colorChannel) = 0;
00226     virtual const NxCurve* getFunction() const = 0;
00228     virtual void setFunction(const NxCurve* f) = 0;
00229 };
00230 
00236 class NxSubtextureVsLifeModifier : public NxModifierT<NxSubtextureVsLifeModifier>
00237 {
00238 public:
00239     static const ModifierTypeEnum ModifierType = ModifierType_SubtextureVsLife;
00240     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00241             | ModifierUsage_Sprite;
00242 
00243 
00245     virtual const NxCurve* getFunction() const = 0;
00247     virtual void setFunction(const NxCurve* f) = 0;
00248 };
00249 
00253 class NxOrientAlongVelocityModifier : public NxModifierT<NxOrientAlongVelocityModifier>
00254 {
00255 public:
00256     static const ModifierTypeEnum ModifierType = ModifierType_OrientAlongVelocity;
00257     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00258             | ModifierUsage_Mesh;
00259 
00260 
00262     virtual physx::PxVec3 getModelForward() const = 0;
00264     virtual void setModelForward(const physx::PxVec3& s) = 0;
00265 };
00266 
00267 
00273 class NxScaleAlongVelocityModifier : public NxModifierT<NxScaleAlongVelocityModifier>
00274 {
00275 public:
00276     static const ModifierTypeEnum ModifierType = ModifierType_ScaleAlongVelocity;
00277     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00278             | ModifierUsage_Mesh;
00279 
00280 
00282     virtual physx::PxF32 getScaleFactor() const = 0;
00284     virtual void setScaleFactor(const physx::PxF32& s) = 0;
00285 };
00286 
00290 class NxRandomSubtextureModifier : public NxModifierT<NxRandomSubtextureModifier>
00291 {
00292 public:
00293     static const ModifierTypeEnum ModifierType = ModifierType_RandomSubtexture;
00294     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn
00295             | ModifierUsage_Sprite;
00296 
00297 
00299     virtual NxRange<physx::PxF32> getSubtextureRange() const = 0;
00301     virtual void setSubtextureRange(const NxRange<physx::PxF32>& s) = 0;
00302 };
00303 
00309 class NxRandomRotationModifier : public NxModifierT<NxRandomRotationModifier>
00310 {
00311 public:
00312     static const ModifierTypeEnum ModifierType = ModifierType_RandomRotation;
00313     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn
00314             | ModifierUsage_Sprite;
00315 
00316 
00318     virtual NxRange<physx::PxF32> getRotationRange() const = 0;
00320     virtual void setRotationRange(const NxRange<physx::PxF32>& s) = 0;
00321 };
00322 
00326 class NxScaleVsLifeModifier : public NxModifierT<NxScaleVsLifeModifier>
00327 {
00328 public:
00329     static const ModifierTypeEnum ModifierType = ModifierType_ScaleVsLife;
00330     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00331             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00332 
00333 
00335     virtual ScaleAxis getScaleAxis() const = 0;
00337     virtual void setScaleAxis(ScaleAxis a) = 0;
00339     virtual const NxCurve* getFunction() const = 0;
00341     virtual void setFunction(const NxCurve* f) = 0;
00342 };
00343 
00347 class NxScaleVsDensityModifier : public NxModifierT<NxScaleVsDensityModifier>
00348 {
00349 public:
00350     static const ModifierTypeEnum ModifierType = ModifierType_ScaleVsDensity;
00351     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00352             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00353 
00354 
00356     virtual ScaleAxis getScaleAxis() const = 0;
00358     virtual void setScaleAxis(ScaleAxis a) = 0;
00360     virtual const NxCurve* getFunction() const = 0;
00362     virtual void setFunction(const NxCurve* f) = 0;
00363 };
00364 
00368 class NxScaleVsCameraDistanceModifier : public NxModifierT<NxScaleVsCameraDistanceModifier>
00369 {
00370 public:
00371     static const ModifierTypeEnum ModifierType = ModifierType_ScaleVsCameraDistance;
00372     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00373             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00374 
00375 
00377     virtual ScaleAxis getScaleAxis() const = 0;
00379     virtual void setScaleAxis(ScaleAxis a) = 0;
00381     virtual const NxCurve* getFunction() const = 0;
00383     virtual void setFunction(const NxCurve* f) = 0;
00384 };
00385 
00389 class NxViewDirectionSortingModifier : public NxModifierT<NxViewDirectionSortingModifier>
00390 {
00391 public:
00392     static const ModifierTypeEnum ModifierType = ModifierType_ViewDirectionSorting;
00393     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00394             | ModifierUsage_Sprite;
00395 
00396     // Access to expected data members
00397 };
00398 
00402 class NxRotationRateModifier : public NxModifierT<NxRotationRateModifier>
00403 {
00404 public:
00405     static const ModifierTypeEnum ModifierType = ModifierType_RotationRate;
00406     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00407             | ModifierUsage_Sprite;
00408 
00409 
00411     virtual physx::PxF32 getRotationRate() const = 0;
00413     virtual void setRotationRate(const physx::PxF32& rate) = 0;
00414 };
00415 
00419 class NxRotationRateVsLifeModifier : public NxModifierT<NxRotationRateVsLifeModifier>
00420 {
00421 public:
00422     static const ModifierTypeEnum ModifierType = ModifierType_RotationRateVsLife;
00423     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00424             | ModifierUsage_Sprite;
00425 
00426 
00428     virtual const NxCurve* getFunction() const = 0;
00430     virtual void setFunction(const NxCurve* f) = 0;
00431 };
00432 
00436 class NxOrientScaleAlongScreenVelocityModifier : public NxModifierT<NxOrientScaleAlongScreenVelocityModifier>
00437 {
00438 public:
00439     static const ModifierTypeEnum ModifierType = ModifierType_OrientScaleAlongScreenVelocity;
00440     static const physx::PxU32 ModifierUsage = ModifierUsage_Continuous
00441             | ModifierUsage_Sprite;
00442 
00443 
00445     virtual physx::PxF32 getScalePerVelocity() const = 0;
00447     virtual void setScalePerVelocity(const physx::PxF32& s) = 0;
00448 };
00449 
00454 class NxColorVsVelocityModifier : public NxModifierT<NxColorVsVelocityModifier>
00455 {
00456 public:
00457     static const ModifierTypeEnum ModifierType = ModifierType_ColorVsVelocity;
00458     static const physx::PxU32 ModifierUsage = ModifierUsage_Spawn | ModifierUsage_Continuous
00459             | ModifierUsage_Sprite | ModifierUsage_Mesh;
00460 
00461 
00463     virtual ColorChannel getColorChannel() const = 0;
00465     virtual void setColorChannel(ColorChannel colorChannel) = 0;
00467     virtual const NxCurve* getFunction() const = 0;
00469     virtual void setFunction(const NxCurve* f) = 0;
00470 
00471     virtual physx::PxF32 getVelocity0() const = 0;
00472     virtual void setVelocity0(physx::PxF32 value) = 0;
00473 
00474     virtual physx::PxF32 getVelocity1() const = 0;
00475     virtual void setVelocity1(physx::PxF32 value) = 0;
00476 };
00477 
00478 #pragma warning( default: 4100 )
00479 
00480 PX_POP_PACK
00481 
00482 }
00483 } // namespace apex
00484 
00485 #endif // NX_MODIFIER_H

Generated on Mon Apr 28 2014 08:01:49

Copyright © 2012-2014 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.