ClothingActor.h
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 
00030 #ifndef CLOTHING_ACTOR_H
00031 #define CLOTHING_ACTOR_H
00032 
00033 #include "Actor.h"
00034 #include "Renderable.h"
00035 #include "ClothingAsset.h"
00036 
00037 namespace NvParameterized
00038 {
00039 class Interface;
00040 }
00041 
00042 namespace nvidia
00043 {
00044 namespace apex
00045 {
00046 
00047 PX_PUSH_PACK_DEFAULT
00048 
00049 class ClothingVelocityCallback;
00050 class ClothingPlane;
00051 class ClothingConvex;
00052 class ClothingSphere;
00053 class ClothingCapsule;
00054 class ClothingTriangleMesh;
00055 class ClothingRenderProxy;
00056 
00057 
00061 struct ClothingTeleportMode
00062 {
00064     enum Enum
00065     {
00069         Continuous,
00070 
00076         Teleport,
00077 
00083         TeleportAndReset,
00084     };
00085 };
00086 
00087 
00088 
00092 class ClothingActor : public Actor, public Renderable
00093 {
00094 protected:
00095     virtual ~ClothingActor() {}
00096 public:
00097 
00103     virtual ::NvParameterized::Interface* getActorDesc() = 0;
00104 
00117     virtual void updateState(const PxMat44& globalPose, const PxMat44* newBoneMatrices, uint32_t boneMatricesByteStride, uint32_t numBoneMatrices, ClothingTeleportMode::Enum teleportMode) = 0;
00118 
00125     virtual void updateMaxDistanceScale(float scale, bool multipliable) = 0;
00126 
00130     virtual const PxMat44& getGlobalPose() const = 0;
00131 
00142     virtual void setWind(float windAdaption, const PxVec3& windVelocity) = 0;
00143 
00152     virtual void setMaxDistanceBlendTime(float blendTime) = 0;
00153 
00159     virtual float getMaxDistanceBlendTime() const = 0;
00160 
00168     virtual void setVisible(bool enable) = 0;
00169 
00174     virtual bool isVisible() const = 0;
00175 
00179     virtual void setFrozen(bool enable) = 0;
00180 
00184     virtual bool isFrozen() const = 0;
00185 
00189     virtual ClothSolverMode::Enum getClothSolverMode() const = 0;
00190 
00201     virtual void setGraphicalLOD(uint32_t lod) = 0;
00202 
00207     virtual uint32_t getGraphicalLod() = 0;
00208 
00220     virtual bool rayCast(const PxVec3& worldOrigin, const PxVec3& worldDirection, float& time, PxVec3& normal, uint32_t& vertexIndex) = 0;
00221 
00225     virtual void attachVertexToGlobalPosition(uint32_t vertexIndex, const PxVec3& globalPosition) = 0;
00226 
00230     virtual void freeVertex(uint32_t vertexIndex) = 0;
00231 
00235     virtual uint32_t getClothingMaterial() const = 0;
00236 
00240     virtual void setClothingMaterial(uint32_t index) = 0;
00241 
00245     virtual void setOverrideMaterial(uint32_t submeshIndex, const char* overrideMaterialName) = 0;
00246 
00250     virtual void setVelocityCallback(ClothingVelocityCallback* callback) = 0;
00251 
00261     virtual void getPhysicalMeshPositions(void* buffer, uint32_t byteStride) = 0;
00262 
00272     virtual void getPhysicalMeshNormals(void* buffer, uint32_t byteStride) = 0;
00273 
00277     virtual float getMaximumSimulationBudget() const = 0;
00278 
00287     virtual uint32_t getNumSimulationVertices() const = 0;
00288 
00289     
00297     virtual const PxVec3* getSimulationPositions() = 0;
00298 
00306     virtual const PxVec3* getSimulationNormals() = 0;
00307 
00317     virtual bool getSimulationVelocities(PxVec3* velocities) = 0;
00318 
00326     virtual uint32_t getNumGraphicalVerticesActive(uint32_t submeshIndex) const = 0;
00327 
00333     virtual PxMat44 getRenderGlobalPose() const = 0;
00334 
00341     virtual const PxMat44* getCurrentBoneSkinningMatrices() const = 0;
00342 
00343 
00349     virtual bool isHalfPrecisionAllowed() const = 0;
00350 
00360     virtual void setHalfPrecision(bool isAllowed) = 0;
00361 
00362 
00366     virtual ClothingPlane* createCollisionPlane(const PxPlane& plane) = 0;
00367 
00371     virtual ClothingConvex* createCollisionConvex(ClothingPlane** planes, uint32_t numPlanes) = 0;
00372 
00376     virtual ClothingSphere* createCollisionSphere(const PxVec3& position, float radius) = 0;
00377 
00381     virtual ClothingCapsule* createCollisionCapsule(ClothingSphere& sphere1, ClothingSphere& sphere2) = 0;
00382 
00386     virtual ClothingTriangleMesh* createCollisionTriangleMesh() = 0;
00387 
00404     virtual ClothingRenderProxy* acquireRenderProxy() = 0;
00405 
00406 #if APEX_UE4
00407 
00408     virtual void simulate(PxF32 dt) = 0;
00409 #endif
00410 };
00411 
00412 PX_POP_PACK
00413 
00414 }
00415 } // namespace nvidia
00416 
00417 #endif // CLOTHING_ACTOR_H

Generated on Sat Dec 1 2018 15:52:05

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