RenderMeshActor.h
Go to the documentation of this file.
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 RENDER_MESH_ACTOR_H
00031 #define RENDER_MESH_ACTOR_H
00032 
00038 #include "Actor.h"
00039 #include "Renderable.h"
00040 #include "UserRenderResourceManager.h"  // For RenderCullMode
00041 #include "foundation/PxVec3.h"
00042 
00043 namespace nvidia
00044 {
00045 namespace apex
00046 {
00047 
00048 PX_PUSH_PACK_DEFAULT
00049 
00050 class UserRenderInstanceBuffer;
00051 
00055 struct RenderMeshActorRaycastFlags
00056 {
00060     enum Enum
00061     {
00062         VISIBLE_PARTS = (1 << 0),
00063         INVISIBLE_PARTS =   (1 << 1),
00064 
00065         ALL_PARTS =         VISIBLE_PARTS | INVISIBLE_PARTS
00066     };
00067 };
00068 
00072 struct RenderMeshActorRaycastHitData
00073 {
00077     float       time;
00078 
00082     uint32_t    partIndex;
00083 
00087     uint32_t    submeshIndex;
00088 
00092     uint32_t    vertexIndices[3];
00093 
00097     PxVec3      normal;
00098 
00102     PxVec3      tangent;
00103 
00107     PxVec3      binormal;
00108 };
00109 
00110 
00114 class RenderMeshActor : public Actor, public Renderable
00115 {
00116 public:
00117 
00118     enum
00119     {
00120         InvalidInstanceID = 0xFFFFFFFF
00121     };
00122 
00131     virtual bool                    getVisibilities(uint8_t* visibilityArray, uint32_t visibilityArraySize) const = 0;
00132 
00136     virtual bool                    setVisibility(bool visible, uint16_t partIndex = 0) = 0;
00137 
00141     virtual bool                    isVisible(uint16_t partIndex = 0) const = 0;
00142 
00146     virtual uint32_t                visiblePartCount() const = 0;
00147 
00154     virtual const uint32_t*         getVisibleParts() const = 0;
00155 
00159     virtual uint32_t                getBoneCount() const = 0;
00160 
00164     virtual void                    setTM(const PxMat44& tm, uint32_t boneIndex = 0) = 0;
00165 
00173     virtual void                    setTM(const PxMat44& tm, const PxVec3& scale, uint32_t boneIndex = 0) = 0;
00174 
00178     virtual void                    updateBounds() = 0;
00179 
00183     virtual const PxMat44           getTM(uint32_t boneIndex = 0) const = 0;
00184 
00189     virtual void                    setReleaseResourcesIfNothingToRender(bool value) = 0;
00190 
00194     virtual void                    setBufferVisibility(bool bufferVisibility) = 0;
00195 
00199     virtual void                    setOverrideMaterial(uint32_t submeshIndex, const char* overrideMaterialName) = 0;
00200 
00208     virtual void                    syncVisibility(bool useLock = true) = 0;
00209 
00213     virtual UserRenderInstanceBuffer* getInstanceBuffer() const = 0;
00217     virtual void                    setInstanceBuffer(UserRenderInstanceBuffer* instBuf) = 0;
00221     virtual void                    setMaxInstanceCount(uint32_t count) = 0;
00228     virtual void                    setInstanceBufferRange(uint32_t from, uint32_t count) = 0;
00229 
00247     virtual bool                    rayCast(RenderMeshActorRaycastHitData& hitData,
00248                                             const PxVec3& worldOrig, const PxVec3& worldDisp,
00249                                             RenderMeshActorRaycastFlags::Enum flags = RenderMeshActorRaycastFlags::VISIBLE_PARTS,
00250                                             RenderCullMode::Enum winding = RenderCullMode::CLOCKWISE,
00251                                             int32_t partIndex = -1) const = 0;
00252 
00253 protected:
00254 
00255     virtual                         ~RenderMeshActor() {}
00256 };
00257 
00258 PX_POP_PACK
00259 
00260 }
00261 } // end namespace nvidia::apex
00262 
00263 #endif // RENDER_MESH_ACTOR_H

Generated on Sat Dec 1 2018 15:52:06

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