aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/include/emitter
diff options
context:
space:
mode:
Diffstat (limited to 'APEX_1.4/include/emitter')
-rw-r--r--APEX_1.4/include/emitter/EmitterActor.h178
-rw-r--r--APEX_1.4/include/emitter/EmitterAsset.h88
-rw-r--r--APEX_1.4/include/emitter/EmitterGeoms.h318
-rw-r--r--APEX_1.4/include/emitter/EmitterLodParamDesc.h100
-rw-r--r--APEX_1.4/include/emitter/EmitterPreview.h46
-rw-r--r--APEX_1.4/include/emitter/GroundEmitterActor.h160
-rw-r--r--APEX_1.4/include/emitter/GroundEmitterAsset.h81
-rw-r--r--APEX_1.4/include/emitter/GroundEmitterPreview.h45
-rw-r--r--APEX_1.4/include/emitter/ImpactEmitterActor.h60
-rw-r--r--APEX_1.4/include/emitter/ImpactEmitterAsset.h63
-rw-r--r--APEX_1.4/include/emitter/ImpactEmitterPreview.h42
-rw-r--r--APEX_1.4/include/emitter/ModuleEmitter.h71
12 files changed, 1252 insertions, 0 deletions
diff --git a/APEX_1.4/include/emitter/EmitterActor.h b/APEX_1.4/include/emitter/EmitterActor.h
new file mode 100644
index 00000000..f6dd83a0
--- /dev/null
+++ b/APEX_1.4/include/emitter/EmitterActor.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2008-2015, 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_ACTOR_H
+#define EMITTER_ACTOR_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+PX_PUSH_PACK_DEFAULT
+
+class EmitterAsset;
+class EmitterGeomExplicit;
+class EmitterLodParamDesc;
+class RenderVolume;
+
+/// Apex emitter actor class. Emits particles within a given shape.
+class EmitterActor : public Actor
+{
+protected:
+ virtual ~EmitterActor() {}
+
+public:
+
+ /// This is an optional user validation callback interface.
+ /// If the application wants to confirm/verify all emitted particles they can provide
+ /// this callback interface by using the setApexEmitterValidateCallback method.
+ class EmitterValidateCallback
+ {
+ public:
+ /**
+ \brief This application callback is used to verify an emitted particle position.
+
+ If the user returns false, then the particle will not be emitted. If the user returns true
+ if will be emitted but using the position value which is passed by reference. The application
+ can choose to leave the emitter position alone, or modify it to a new location. All locations
+ are in world space. For convenience to the application the world space emitter position is provided.
+ */
+ virtual bool validateEmitterPosition(const PxVec3 &emitterOrigin,PxVec3 &position) = 0;
+ };
+
+ /// Returns the asset the instance has been created from.
+ virtual EmitterAsset* getEmitterAsset() const = 0;
+
+ /// Returns the explicit geometry for THIS ACTOR only
+ virtual EmitterGeomExplicit* isExplicitGeom() = 0;
+
+ /// Gets the global pose
+ virtual PxMat44 getGlobalPose() const = 0;
+
+ /// Sets the curent pose of the emitter
+ virtual void setCurrentPose(const PxTransform& pose) = 0;
+
+ /// Sets the curent position of the emitter
+ virtual void setCurrentPosition(const PxVec3& pos) = 0;
+
+ /**
+ \brief PhysX SDK 3.X. Attaches the emitter to an actor
+
+ PxActor pointer can be NULL to detach existing actor
+ */
+ virtual void setAttachActor(PxActor*) = 0;
+
+ /// sets the relative pose of the emitter in the space of the actor to which it is attached
+ virtual void setAttachRelativePose(const PxTransform& pose) = 0;
+
+ /// PhysX SDK 3.X. Retrieves the actor, to which the emitter is attached. NULL is returned for an unattached emitter.
+ virtual const PxActor* getAttachActor() const = 0;
+
+ /// Retrieves the relative pose of the emitter in the space of the actor to which it is attached
+ virtual const PxMat44 getAttachRelativePose() const = 0;
+
+ /// Retrieves the particle radius
+ virtual float getObjectRadius() const = 0;
+
+ /// Sets collision groups used to reject particles that overlap the geometry
+ virtual void setOverlapTestCollisionGroups(uint32_t) = 0;
+
+ /**
+ \brief start emitting particles
+
+ If persistent is true, the emitter will emit every frame until stopEmit() is
+ called.
+ */
+ virtual void startEmit(bool persistent = true) = 0;
+
+ /// Stop emitting particles
+ virtual void stopEmit() = 0;
+
+ /// Returns true if the emitter is emitting particles
+ virtual bool isEmitting() const = 0;
+
+ /// Gets LOD settings
+ virtual const EmitterLodParamDesc& getLodParamDesc() const = 0;
+ /// Sets LOD settings
+ virtual void setLodParamDesc(const EmitterLodParamDesc&) = 0;
+
+ /** Override authored scalable parameters, if necessary */
+ /// Sets the range from which the density of particles within the volume is randomly chosen
+ virtual void setDensity(const float&) = 0;
+
+ /// Sets the range from which the emission rate is randomly chosen
+ virtual void setRate(const float&) = 0;
+
+ /// Sets the range from which the velocity of a particle is randomly chosen
+ virtual void setVelocityLow(const PxVec3&) = 0;
+
+ /// Sets the range from which the velocity of a particle is randomly chosen
+ virtual void setVelocityHigh(const PxVec3&) = 0;
+
+ /// Sets the range from which the lifetime of a particle is randomly chosen
+ virtual void setLifetimeLow(const float&) = 0;
+
+ /// Sets the range from which the lifetime of a particle is randomly chosen
+ virtual void setLifetimeHigh(const float&) = 0;
+
+ /// Sets whether or not authored asset particles are emitted
+ virtual void emitAssetParticles(bool enable) = 0;
+
+ /// Gets whether or not authored asset particles are emitted
+ virtual bool getEmitAssetParticles() const = 0;
+
+ /**
+ \brief Emitted particles are injected to specified render volume on initial frame.
+
+ This will work only if you have one renderVolume for each emitter.
+ Set to NULL to clear the preferred volume.
+ */
+ virtual void setPreferredRenderVolume(RenderVolume* volume) = 0;
+
+ /// Gets the range from which the emission rate is randomly chosen
+ virtual void getRate(float&) const = 0;
+
+ /// Returns the number of particles in simulation
+ virtual uint32_t getSimParticlesCount() const = 0;
+
+ /// Returns the number of particles still alive
+ virtual uint32_t getActiveParticleCount() const = 0;
+
+ /// Sets the origin of the density grid used by this emitter. Important, this density grid may be shared with lots of other emitters as well, it is based on the underlying IOS
+ virtual void setDensityGridPosition(const PxVec3 &pos) = 0;
+
+ /// Sets the ApexEmitterPosition validation callback interface
+ virtual void setApexEmitterValidateCallback(EmitterValidateCallback *callback) = 0;
+
+ /// Sets the uniform overall object scale
+ PX_DEPRECATED virtual void setObjectScale(float scale) = 0;
+
+ /// Retrieves the uniform overall object scale
+ PX_DEPRECATED virtual float getObjectScale(void) const = 0;
+
+ /// Sets the uniform overall object scale
+ virtual void setCurrentScale(float scale) = 0;
+
+ /// Retrieves the uniform overall object scale
+ virtual float getCurrentScale(void) const = 0;
+
+
+};
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // EMITTER_ACTOR_H
diff --git a/APEX_1.4/include/emitter/EmitterAsset.h b/APEX_1.4/include/emitter/EmitterAsset.h
new file mode 100644
index 00000000..bda503b1
--- /dev/null
+++ b/APEX_1.4/include/emitter/EmitterAsset.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2008-2015, 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_ASSET_H
+#define EMITTER_ASSET_H
+
+#include "Apex.h"
+#include "EmitterGeoms.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+PX_PUSH_PACK_DEFAULT
+
+#define EMITTER_AUTHORING_TYPE_NAME "ApexEmitterAsset"
+
+class EmitterActor;
+class EmitterPreview;
+class EmitterLodParamDesc;
+
+///APEX Emitter asset. Emits particles within some shape.
+class EmitterAsset : public Asset
+{
+protected:
+ virtual ~EmitterAsset() {}
+
+public:
+
+ /// Returns the explicit geometry for the all actors based on this asset if the asset is explicit, NULL otherwise
+ virtual EmitterGeomExplicit* isExplicitGeom() = 0;
+
+ /// Returns the geometry used for the all actors based on this asset
+ virtual const EmitterGeom* getGeom() const = 0;
+
+ /// Gets IOFX asset name that is used to visualize partices of this emitter
+ virtual const char* getInstancedObjectEffectsAssetName(void) const = 0;
+
+ /// Gets IOS asset name that is used to simulate partices of this emitter
+ virtual const char* getInstancedObjectSimulatorAssetName(void) const = 0;
+
+ /// Gets IOS asset class name that is used to simulate partices of this emitter
+ virtual const char* getInstancedObjectSimulatorTypeName(void) const = 0;
+
+ virtual const float & getDensity() const = 0; ///< Gets the range used to choose the density of particles
+ virtual const float & getRate() const = 0; ///< Gets the range used to choose the emission rate
+ virtual const PxVec3 & getVelocityLow() const = 0; ///< Gets the range used to choose the velocity of particles
+ virtual const PxVec3 & getVelocityHigh() const = 0; ///< Gets the range used to choose the velocity of particles
+ virtual const float & getLifetimeLow() const = 0; ///< Gets the range used to choose the lifetime of particles
+ virtual const float & getLifetimeHigh() const = 0; ///< Gets the range used to choose the lifetime of particles
+
+ /// For an explicit emitter, Max Samples is ignored. For shaped emitters, it is the maximum number of objects spawned in a step.
+ virtual uint32_t getMaxSamples() const = 0;
+
+ /**
+ \brief Gets the emitter duration in seconds
+ \note If EmitterActor::startEmit() is called with persistent=true, then this duration is ignored.
+ */
+ virtual float getEmitDuration() const = 0;
+
+ /// Gets LOD settings for this asset
+ virtual const EmitterLodParamDesc& getLodParamDesc() const = 0;
+
+};
+
+///APEX Emitter Asset Authoring. Used to create APEX Emitter assets.
+class EmitterAssetAuthoring : public AssetAuthoring
+{
+protected:
+ virtual ~EmitterAssetAuthoring() {}
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // EMITTER_ASSET_H
diff --git a/APEX_1.4/include/emitter/EmitterGeoms.h b/APEX_1.4/include/emitter/EmitterGeoms.h
new file mode 100644
index 00000000..f81f4ab8
--- /dev/null
+++ b/APEX_1.4/include/emitter/EmitterGeoms.h
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2008-2015, 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_GEOMS_H
+#define EMITTER_GEOMS_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+PX_PUSH_PACK_DEFAULT
+
+///Emitter type
+struct EmitterType
+{
+ ///Enum of emitter types
+ enum Enum
+ {
+ ET_RATE = 0, ///< use emittion rate to calculate the number of particles
+ ET_DENSITY_ONCE, ///< emit density particles at once
+ ET_DENSITY_BRUSH, ///< brush behavior: particles are emitted proportionally to the newly occupied vlume
+ ET_FILL, ///< fill the volume of the emitter with particles
+ ET_UNDEFINED,
+ };
+};
+
+class EmitterGeomBox;
+class EmitterGeomSphere;
+class EmitterGeomSphereShell;
+class EmitterGeomCylinder;
+class EmitterGeomExplicit;
+
+///Base class for all emitter shapes
+class EmitterGeom
+{
+public:
+ ///Sets the type of the emitter
+ virtual void setEmitterType(EmitterType::Enum) = 0;
+
+ ///Gets the type of the emitter
+ virtual EmitterType::Enum getEmitterType() const = 0;
+
+ ///If it is a box, cast to box class, return NULL otherwise
+ virtual const EmitterGeomBox* isBoxGeom() const
+ {
+ return NULL;
+ }
+
+ ///If it is a sphere, cast to sphere class, return NULL otherwise
+ virtual const EmitterGeomSphere* isSphereGeom() const
+ {
+ return NULL;
+ }
+
+ ///If it is a sphere shell, cast to sphere shell class, return NULL otherwise
+ virtual const EmitterGeomSphereShell* isSphereShellGeom() const
+ {
+ return NULL;
+ }
+
+ ///If it is a cylinder shell, cast to cylinder class, return NULL otherwise
+ virtual const EmitterGeomCylinder* isCylinderGeom() const
+ {
+ return NULL;
+ }
+
+ ///If it is an explicit geom, cast to explicit geom class, return NULL otherwise
+ virtual const EmitterGeomExplicit* isExplicitGeom() const
+ {
+ return NULL;
+ }
+};
+
+///Sphere shell shape for an emitter. It's a shape formed by the difference of two cocentered spheres.
+class EmitterGeomSphereShell : public EmitterGeom
+{
+public:
+
+ ///Set sphere shell radius
+ virtual void setRadius(float radius) = 0;
+
+ ///Get sphere shell radius
+ virtual float getRadius() const = 0;
+
+ ///Set sphere shell thickness
+ virtual void setShellThickness(float thickness) = 0;
+
+ ///Get sphere shell thickness
+ virtual float getShellThickness() const = 0;
+};
+
+///Spherical shape for an emitter.
+class EmitterGeomSphere : public EmitterGeom
+{
+public:
+
+ ///Set sphere radius
+ virtual void setRadius(float radius) = 0;
+
+ ///Get sphere radius
+ virtual float getRadius() const = 0;
+};
+
+///Cylindrical shape for an emitter.
+class EmitterGeomCylinder : public EmitterGeom
+{
+public:
+
+ ///Set cylinder radius
+ virtual void setRadius(float radius) = 0;
+
+ ///Get cylinder radius
+ virtual float getRadius() const = 0;
+
+ ///Set cylinder height
+ virtual void setHeight(float height) = 0;
+
+ ///Get cylinder height
+ virtual float getHeight() const = 0;
+};
+
+///Box shape for an emitter.
+class EmitterGeomBox : public EmitterGeom
+{
+public:
+
+ ///Set box extents
+ virtual void setExtents(const PxVec3& extents) = 0;
+
+ ///Get box extents
+ virtual PxVec3 getExtents() const = 0;
+};
+
+///Explicit geometry. Coordinates of each particle are given explicitly.
+class EmitterGeomExplicit : public EmitterGeom
+{
+public:
+
+ ///Point parameters
+ struct PointParams
+ {
+ PxVec3 position; ///< Point position
+ bool doDetectOverlaps; ///< Should detect overlap
+ };
+
+ ///Sphere prameters
+ struct SphereParams
+ {
+ PxVec3 center; ///< Sphere center
+ float radius; ///< Sphere radius
+ bool doDetectOverlaps; ///< Should detect overlap
+ };
+
+ ///Ellipsoid parameters
+ struct EllipsoidParams
+ {
+ PxVec3 center; ///< Ellipsoid center
+ float radius; ///< Ellipsoid radius
+ PxVec3 normal; ///< Ellipsoid normal
+ float polarRadius; ///< Ellipsoid polar radius
+ bool doDetectOverlaps; ///< Should detect overlap
+ };
+
+ ///Remove all shapes
+ virtual void resetParticleList() = 0;
+
+ /**
+ \brief Add particles to geometry to be emitted
+ \param [in] count - number of particles being added by this call
+ \param [in] params must be specified. When emitted, these relative positions are added to emitter actor position
+ \param [in] velocities if NULL, the geometry's velocity list will be padded with zero velocities and the asset's velocityRange will be used for velocity
+ */
+ virtual void addParticleList(uint32_t count,
+ const PointParams* params,
+ const PxVec3* velocities = 0) = 0;
+
+ /**
+ \brief Add particles to geometry to be emitted
+ \param [in] count - number of particles being added by this call
+ \param [in] positions must be specified. When emitted, these relative positions are added to emitter actor position
+ \param [in] velocities if NULL, the geometry's velocity list will be padded with zero velocities and the asset's velocityRange will be used for velocity
+ */
+ virtual void addParticleList(uint32_t count,
+ const PxVec3* positions,
+ const PxVec3* velocities = 0) = 0;
+
+ ///Structure contains positions, velocities and user data for particles
+ struct PointListData
+ {
+ const void* positionStart; ///< Pointer to first position
+ uint32_t positionStrideBytes; ///< The stride between position vectors
+ const void* velocityStart; ///< Pointer to first velocity
+ uint32_t velocityStrideBytes; ///< The stride between velocity vectors
+ const void* userDataStart; ///< Pointer to first instance of user data
+ uint32_t userDataStrideBytes; ///< The stride between instances of user data
+ };
+
+ /**
+ \brief Add particles to geometry to be emitted
+ \param [in] count - number of particles being added by this call
+ \param [in] data - particles data
+ \see EmitterGeomExplicit::PointListData
+ */
+ virtual void addParticleList(uint32_t count, const PointListData& data) = 0;
+
+ /**
+ \brief Add spheres to geometry to be emitted
+ \param [in] count - number of spheres being added by this call
+ \param [in] params - spheres parameters
+ \param [in] velocities if NULL, the geometry's velocity list will be padded with zero velocities and the asset's velocityRange will be used for velocity
+ \see EmitterGeomExplicit::SphereParams
+ */
+ virtual void addSphereList(uint32_t count,
+ const SphereParams* params,
+ const PxVec3* velocities = 0) = 0;
+
+ /**
+ \brief Add ellipsoids to geometry to be emitted
+ \param [in] count - number of ellipsoids being added by this call
+ \param [in] params - ellipsoids parameters
+ \param [in] velocities if NULL, the geometry's velocity list will be padded with zero velocities and the asset's velocityRange will be used for velocity
+ \see EmitterGeomExplicit::EellipsoidParams
+ */
+ virtual void addEllipsoidList(uint32_t count,
+ const EllipsoidParams* params,
+ const PxVec3* velocities = 0) = 0;
+
+ /**
+ \brief Access particles list
+ \param [out] params - particles coordinates
+ \param [out] numPoints - number of particles in list
+ \param [out] velocities - particles velocities
+ \param [out] numVelocities - number of particles velocities in list
+ \see EmitterGeomExplicit::PointParams
+ */
+ virtual void getParticleList(const PointParams* &params,
+ uint32_t& numPoints,
+ const PxVec3* &velocities,
+ uint32_t& numVelocities) const = 0;
+
+ /**
+ \brief Access spheres list
+ \param [out] params - spheres parameters
+ \param [out] numSpheres - number of spheres in list
+ \param [out] velocities - spheres velocities
+ \param [out] numVelocities - number of spheres velocities in list
+ \see EmitterGeomExplicit::SphereParams
+ */
+ virtual void getSphereList(const SphereParams* &params,
+ uint32_t& numSpheres,
+ const PxVec3* &velocities,
+ uint32_t& numVelocities) const = 0;
+
+ /**
+ \brief Access ellipsoids list
+ \param [out] params - ellipsoids parameters
+ \param [out] numEllipsoids - number of ellipsoids in list
+ \param [out] velocities - ellipsoids velocities
+ \param [out] numVelocities - number of ellipsoids velocities in list
+ \see EmitterGeomExplicit::EllipsoidParams
+ */
+ virtual void getEllipsoidList(const EllipsoidParams* &params,
+ uint32_t& numEllipsoids,
+ const PxVec3* &velocities,
+ uint32_t& numVelocities) const = 0;
+
+ ///Get the number of points
+ virtual uint32_t getParticleCount() const = 0;
+
+ ///Get the position of point
+ virtual PxVec3 getParticlePos(uint32_t index) const = 0;
+
+ ///Get the number of spheres
+ virtual uint32_t getSphereCount() const = 0;
+
+ ///Get the center of the sphere
+ virtual PxVec3 getSphereCenter(uint32_t index) const = 0;
+
+ ///Get the radius of the sphere
+ virtual float getSphereRadius(uint32_t index) const = 0;
+
+ ///Get the number of ellipsoids
+ virtual uint32_t getEllipsoidCount() const = 0;
+
+ ///Get the center of the ellipsoid
+ virtual PxVec3 getEllipsoidCenter(uint32_t index) const = 0;
+
+ ///Get the radius of the ellipsoid
+ virtual float getEllipsoidRadius(uint32_t index) const = 0;
+
+ ///Get the normal of the ellipsoid
+ virtual PxVec3 getEllipsoidNormal(uint32_t index) const = 0;
+
+ ///Get the polar radius of the ellipsoid
+ virtual float getEllipsoidPolarRadius(uint32_t index) const = 0;
+
+ ///Get average distance between particles
+ virtual float getDistance() const = 0;
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // EMITTER_GEOMS_H
diff --git a/APEX_1.4/include/emitter/EmitterLodParamDesc.h b/APEX_1.4/include/emitter/EmitterLodParamDesc.h
new file mode 100644
index 00000000..96d1e52e
--- /dev/null
+++ b/APEX_1.4/include/emitter/EmitterLodParamDesc.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2008-2015, 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_LOD_PARAM_DESC_H
+#define EMITTER_LOD_PARAM_DESC_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+///LOD parameters fro emitters
+class EmitterLodParamDesc : public ApexDesc
+{
+public:
+ float maxDistance; ///< Objects greater than this distance from the player will be culled more aggressively
+ float distanceWeight; ///< Weight given to distance parameter in LOD function
+ float speedWeight; ///< Weight given to velocity parameter in LOD function
+ float lifeWeight; ///< Weight given to life remain parameter in LOD function
+ float separationWeight; ///< Weight given to separation parameter in LOD function
+ float bias; ///< Bias given to objects spawned by this emitter, relative to other emitters in the same IOS
+
+ /**
+ \brief constructor sets to default.
+ */
+ PX_INLINE EmitterLodParamDesc() : ApexDesc()
+ {
+ init();
+ }
+
+ /**
+ \brief sets members to default values.
+ */
+ PX_INLINE void setToDefault()
+ {
+ ApexDesc::setToDefault();
+ init();
+ }
+
+ /**
+ \brief checks if this is a valid descriptor.
+ */
+ PX_INLINE bool isValid() const
+ {
+ if (distanceWeight < 0.0f || speedWeight < 0.0f || lifeWeight < 0.0f)
+ {
+ return false;
+ }
+ if (separationWeight < 0.0f || maxDistance < 0.0f || bias < 0.0f)
+ {
+ return false;
+ }
+ return ApexDesc::isValid();
+ }
+
+ /**
+ \brief enum of manifest versions
+ */
+ enum ManifestVersions
+ {
+ initial,
+
+ count,
+ current = count - 1
+ };
+
+private:
+
+ PX_INLINE void init()
+ {
+ // These defaults give you pure distance based LOD weighting
+ maxDistance = 0.0f;
+ distanceWeight = 1.0f;
+ speedWeight = 0.0f;
+ lifeWeight = 0.0f;
+ separationWeight = 0.0f;
+ bias = 1.0f;
+ }
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // EMITTER_LOD_PARAM_DESC_H
diff --git a/APEX_1.4/include/emitter/EmitterPreview.h b/APEX_1.4/include/emitter/EmitterPreview.h
new file mode 100644
index 00000000..616ae43a
--- /dev/null
+++ b/APEX_1.4/include/emitter/EmitterPreview.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2008-2015, 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_PREVIEW_H
+#define EMITTER_PREVIEW_H
+
+#include "Apex.h"
+#include "AssetPreview.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+PX_PUSH_PACK_DEFAULT
+
+/**
+ Preview class for ApexEmitter. Used for preview rendeing.
+*/
+class EmitterPreview : public AssetPreview
+{
+public:
+ ///Draws the emitter
+ virtual void drawEmitterPreview() = 0;
+ ///Sets the scaling factor of the renderable
+ virtual void setScale(float scale) = 0;
+
+protected:
+ EmitterPreview() {}
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // EMITTER_PREVIEW_H
diff --git a/APEX_1.4/include/emitter/GroundEmitterActor.h b/APEX_1.4/include/emitter/GroundEmitterActor.h
new file mode 100644
index 00000000..c0c3c685
--- /dev/null
+++ b/APEX_1.4/include/emitter/GroundEmitterActor.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2008-2015, 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 GROUND_EMITTER_ACTOR_H
+#define GROUND_EMITTER_ACTOR_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+class GroundEmitterAsset;
+class RenderVolume;
+
+/**
+ \brief a user calback interface used to map raycast hitpoints to material ID
+ * If an instance of this class is registered with a ground emitter actor, the actor will call
+ * requestMaterialLookups() in lieu of doing raycasts. The call will occur from within the scope
+ * of the ApexScene thread, so the callback must be thread safe.
+ */
+class MaterialLookupCallback
+{
+public:
+ /// Material request structure.
+ struct MaterialRequest
+ {
+ PxVec3 samplePosition; ///< test point position. This is filled by the emitter
+ uint32_t outMaterialID; ///< ID of the material at the hitpoint. This must be filled by the user
+ };
+
+ /**
+ \brief Submit the meterial lookup request. This method is called by the emitter and implemented by the user
+ \param requestCount [IN] number of requests
+ \param reqList [IN/OUT] the pointer to the requests. samplePosition is read and materialID is written to by the user.
+ */
+ virtual void requestMaterialLookups(uint32_t requestCount, MaterialRequest* reqList) = 0;
+
+ virtual ~MaterialLookupCallback() {}
+};
+
+///Ground Emitter actor. Uses raycasts against ground to spawn particles
+class GroundEmitterActor : public Actor
+{
+protected:
+ virtual ~GroundEmitterActor() {}
+
+public:
+ /**
+ \brief Returns the asset the instance has been created from.
+ */
+ virtual GroundEmitterAsset* getEmitterAsset() const = 0;
+
+ /**
+ \brief Returns the pose of the emitter
+ */
+ virtual const PxMat44 getPose() const = 0;
+ /**
+ \brief Sets the pose of the emitter
+ */
+ virtual void setPose(const PxMat44& pos) = 0;
+
+ /** \brief Set the material lookup callback method that replaces raycasts */
+ virtual void setMaterialLookupCallback(MaterialLookupCallback*) = 0;
+
+ /** \brief Get the material lookup callback method that replaces raycasts */
+ virtual MaterialLookupCallback* getMaterialLookupCallback() const = 0;
+
+ /**
+ \brief Attaches the emitter to an actor
+ PxActor pointer can be NULL to detach existing actor
+ */
+ virtual void setAttachActor(PxActor*) = 0;
+
+ /**
+ \brief sets the relative position of the emitter in the space of the actor to which it is attached
+ */
+ virtual void setAttachRelativePosition(const PxVec3& pos) = 0;
+
+ /**\brief PhysX SDK 3.X. Retrieves the actor, to which the emitter is attached. NULL is returned for an unattached emitter. */
+ virtual const PxActor* getAttachActor() const = 0;
+
+ /** \brief Retrieves the relative position of the emitter in the space of the actor to which it is attached. */
+ virtual const PxVec3& getAttachRelativePosition() const = 0;
+
+ /* Override some asset settings at run time */
+
+ ///Sets the range from which the density of particles within the volume is randomly chosen
+ virtual void setDensity(const float&) = 0;
+
+ ///Sets the radius. The ground emitter actor will create objects within a circle of size 'radius'.
+ virtual void setRadius(float) = 0;
+
+ ///Sets The maximum raycasts number per frame.
+ virtual void setMaxRaycastsPerFrame(uint32_t) = 0;
+
+ ///Sets the height from which the ground emitter will cast rays at terrain/objects opposite of the 'upDirection'.
+ virtual void setRaycastHeight(float) = 0;
+
+ /**
+ \brief Sets the height above the ground to emit particles.
+ If greater than 0, the ground emitter will refresh a disc above the player's position rather than
+ refreshing a circle around the player's position.
+
+ */
+ virtual void setSpawnHeight(float) = 0;
+
+ ///Gets the range from which the density of particles within the volume is randomly chosen
+ virtual const float & getDensity() const = 0;
+
+ ///Gets the radius. The ground emitter actor will create objects within a circle of size 'radius'.
+ virtual float getRadius() const = 0;
+
+ ///Gets The maximum raycasts number per frame.
+ virtual uint32_t getMaxRaycastsPerFrame() const = 0;
+
+ ///Gets the height from which the ground emitter will cast rays at terrain/objects opposite of the 'upDirection'.
+ virtual float getRaycastHeight() const = 0;
+
+ /**
+ \brief Gets the height above the ground to emit particles.
+ If greater than 0, the ground emitter will refresh a disc above the player's position rather than
+ refreshing a circle around the player's position.
+ */
+ virtual float getSpawnHeight() const = 0;
+
+ ///Sets collision groups used to cast rays
+ virtual void setRaycastCollisionGroups(uint32_t) = 0;
+
+ ///PHYSX SDK 3.X. Sets collision groups mask.
+ virtual void setRaycastCollisionGroupsMask(physx::PxFilterData*) = 0;
+
+
+ ///Gets collision groups used to cast rays
+ virtual uint32_t getRaycastCollisionGroups() const = 0;
+
+ ///Emitted particles are injected to specified render volume on initial frame.
+ ///Set to NULL to clear the preferred volume.
+ virtual void setPreferredRenderVolume(RenderVolume* volume) = 0;
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // GROUND_EMITTER_ACTOR_H
diff --git a/APEX_1.4/include/emitter/GroundEmitterAsset.h b/APEX_1.4/include/emitter/GroundEmitterAsset.h
new file mode 100644
index 00000000..d604fbe1
--- /dev/null
+++ b/APEX_1.4/include/emitter/GroundEmitterAsset.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2008-2015, 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 GROUND_EMITTER_ASSET_H
+#define GROUND_EMITTER_ASSET_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+#define GROUND_EMITTER_AUTHORING_TYPE_NAME "GroundEmitterAsset"
+
+///Ground emitter asset. Used to create Ground emitter actors with specific properties.
+class GroundEmitterAsset : public Asset
+{
+protected:
+ PX_INLINE GroundEmitterAsset() {}
+ virtual ~GroundEmitterAsset() {}
+
+public:
+
+ ///Gets the velocity range. The ground emitter actor will create objects with a random velocity within the velocity range.
+ virtual const PxVec3 & getVelocityLow() const = 0;
+
+ ///Gets the velocity range. The ground emitter actor will create objects with a random velocity within the velocity range.
+ virtual const PxVec3 & getVelocityHigh() const = 0;
+
+ ///Gets the lifetime range. The ground emitter actor will create objects with a random lifetime (in seconds) within the lifetime range.
+ virtual const float & getLifetimeLow() const = 0;
+
+ ///Gets the lifetime range. The ground emitter actor will create objects with a random lifetime (in seconds) within the lifetime range.
+ virtual const float & getLifetimeHigh() const = 0;
+
+ ///Gets the radius. The ground emitter actor will create objects within a circle of size 'radius'.
+ virtual float getRadius() const = 0;
+
+ ///Gets The maximum raycasts number per frame.
+ virtual uint32_t getMaxRaycastsPerFrame() const = 0;
+
+ ///Gets the height from which the ground emitter will cast rays at terrain/objects opposite of the 'upDirection'.
+ virtual float getRaycastHeight() const = 0;
+
+ /**
+ \brief Gets the height above the ground to emit particles.
+ If greater than 0, the ground emitter will refresh a disc above the player's position rather than
+ refreshing a circle around the player's position.
+ */
+ virtual float getSpawnHeight() const = 0;
+
+ /// Gets collision groups name used to cast rays
+ virtual const char* getRaycastCollisionGroupMaskName() const = 0;
+};
+
+///Ground emitter authoring class. Used to create Ground emitter assets.
+class GroundEmitterAssetAuthoring : public AssetAuthoring
+{
+protected:
+ virtual ~GroundEmitterAssetAuthoring() {}
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // GROUND_EMITTER_ASSET_H
diff --git a/APEX_1.4/include/emitter/GroundEmitterPreview.h b/APEX_1.4/include/emitter/GroundEmitterPreview.h
new file mode 100644
index 00000000..1cae7931
--- /dev/null
+++ b/APEX_1.4/include/emitter/GroundEmitterPreview.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008-2015, 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 GROUND_EMITTER_PREVIEW_H
+#define GROUND_EMITTER_PREVIEW_H
+
+#include "Apex.h"
+#include "AssetPreview.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+///Ground emitter preview class. Use for preview rendering
+class GroundEmitterPreview : public AssetPreview
+{
+public:
+ ///Does the drawing
+ virtual void drawEmitterPreview() = 0;
+ ///Sets the scale factor of the preview object
+ virtual void setScale(float scale) = 0;
+
+protected:
+ GroundEmitterPreview() {}
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // GROUND_EMITTER_PREVIEW_H
diff --git a/APEX_1.4/include/emitter/ImpactEmitterActor.h b/APEX_1.4/include/emitter/ImpactEmitterActor.h
new file mode 100644
index 00000000..31413807
--- /dev/null
+++ b/APEX_1.4/include/emitter/ImpactEmitterActor.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2008-2015, 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 IMPACT_EMITTER_ACTOR_H
+#define IMPACT_EMITTER_ACTOR_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+class ImpactEmitterAsset;
+class RenderVolume;
+
+///Impact emitter actor. Emits particles at impact places
+class ImpactEmitterActor : public Actor
+{
+protected:
+ virtual ~ImpactEmitterActor() {}
+
+public:
+ ///Gets the pointer to the underlying asset
+ virtual ImpactEmitterAsset* getEmitterAsset() const = 0;
+
+ /**
+ \brief Registers an impact in the queue
+
+ \param hitPos impact position
+ \param hitDir impact direction
+ \param surfNorm normal of the surface that is hit by the impact
+ \param setID - id for the event set which should be spawned. Specifies the behavior. \sa ImpactEmitterAsset::querySetID
+
+ */
+ virtual void registerImpact(const PxVec3& hitPos, const PxVec3& hitDir, const PxVec3& surfNorm, uint32_t setID) = 0;
+
+ ///Emitted particles are injected to specified render volume on initial frame.
+ ///Set to NULL to clear the preferred volume.
+ virtual void setPreferredRenderVolume(RenderVolume* volume) = 0;
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // IMPACT_EMITTER_ACTOR_H
diff --git a/APEX_1.4/include/emitter/ImpactEmitterAsset.h b/APEX_1.4/include/emitter/ImpactEmitterAsset.h
new file mode 100644
index 00000000..33211dc8
--- /dev/null
+++ b/APEX_1.4/include/emitter/ImpactEmitterAsset.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008-2015, 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 IMPACT_EMITTER_ASSET_H
+#define IMPACT_EMITTER_ASSET_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+#define IMPACT_EMITTER_AUTHORING_TYPE_NAME "ImpactEmitterAsset"
+
+class ImpactEmitterActor;
+
+///Impact emitter asset class
+class ImpactEmitterAsset : public Asset
+{
+protected:
+ PX_INLINE ImpactEmitterAsset() {}
+ virtual ~ImpactEmitterAsset() {}
+
+public:
+ /// Get the setID that corresponds to the set name \sa ImpactEmitterActor::registerImpact()
+ virtual uint32_t querySetID(const char* setName) = 0;
+
+ /**
+ \brief Get a list of the event set names. The name index in the outSetNames list is the setID.
+ \param [in,out] inOutSetNames An array of const char * with at least nameCount
+ \param [in,out] nameCount The size of setNames as input and output, set to -1 if setIDs > nameCount
+ */
+ virtual void getSetNames(const char** inOutSetNames, uint32_t& nameCount) const = 0;
+};
+
+///Impact emitter asset authoring. Used to create Impact Emitter assets
+class ImpactEmitterAssetAuthoring : public AssetAuthoring
+{
+protected:
+ virtual ~ImpactEmitterAssetAuthoring() {}
+
+public:
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // IMPACT_EMITTER_ASSET_H
diff --git a/APEX_1.4/include/emitter/ImpactEmitterPreview.h b/APEX_1.4/include/emitter/ImpactEmitterPreview.h
new file mode 100644
index 00000000..e3760970
--- /dev/null
+++ b/APEX_1.4/include/emitter/ImpactEmitterPreview.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008-2015, 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 IMPACT_EMITTER_PREVIEW_H
+#define IMPACT_EMITTER_PREVIEW_H
+
+#include "Apex.h"
+#include "AssetPreview.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+///Impact emitter preview. Used for preview rendering of the emitter actors.
+class ImpactEmitterPreview : public AssetPreview
+{
+public:
+ /* No need to add any functionality here */
+
+protected:
+ ImpactEmitterPreview() {}
+};
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // IMPACT_EMITTER_PREVIEW_H
diff --git a/APEX_1.4/include/emitter/ModuleEmitter.h b/APEX_1.4/include/emitter/ModuleEmitter.h
new file mode 100644
index 00000000..e26dd615
--- /dev/null
+++ b/APEX_1.4/include/emitter/ModuleEmitter.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2008-2015, 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 MODULE_EMITTER_H
+#define MODULE_EMITTER_H
+
+#include "Apex.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+
+PX_PUSH_PACK_DEFAULT
+
+class EmitterAsset;
+class EmitterAssetAuthoring;
+
+class GroundEmitterAsset;
+class GroundEmitterAssetAuthoring;
+
+class ImpactEmitterAsset;
+class ImpactEmitterAssetAuthoring;
+
+
+/**
+\brief An APEX Module that provides generic Emitter classes
+*/
+class ModuleEmitter : public Module
+{
+protected:
+ virtual ~ModuleEmitter() {}
+
+public:
+
+ /// get rate scale. Rate parameter in all emitters will be multiplied by rate scale.
+ virtual float getRateScale() const = 0;
+
+ /// get density scale. Density parameter in all emitters except ground emitters will be multiplied by density scale.
+ virtual float getDensityScale() const = 0;
+
+ /// get ground density scale. Density parameter in all ground emitters will be multiplied by ground density scale.
+ virtual float getGroundDensityScale() const = 0;
+
+ /// set rate scale. Rate parameter in all module emitters will be multiplied by rate scale.
+ virtual void setRateScale(float rateScale) = 0;
+
+ /// set density scale. Density parameter in all emitters except ground emitters will be multiplied by density scale.
+ virtual void setDensityScale(float densityScale) = 0;
+
+ /// set ground density scale. Density parameter in all ground emitters will be multiplied by ground density scale.
+ virtual void setGroundDensityScale(float groundDensityScale) = 0;
+};
+
+
+
+PX_POP_PACK
+
+}
+} // end namespace nvidia
+
+#endif // MODULE_EMITTER_H