UserRenderVertexBufferDesc.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 USER_RENDER_VERTEX_BUFFER_DESC_H
00031 #define USER_RENDER_VERTEX_BUFFER_DESC_H
00032 
00038 #include "ApexUsingNamespace.h"
00039 #include "UserRenderResourceManager.h"
00040 #include "RenderDataFormat.h"
00041 #include "ApexSDK.h"
00042 
00043 namespace physx
00044 {
00045     class PxCudaContextManager;
00046 };
00047 
00048 namespace nvidia
00049 {
00050 namespace apex
00051 {
00052 
00053 PX_PUSH_PACK_DEFAULT
00054 
00058 struct RenderVertexSemantic
00059 {
00063     enum Enum
00064     {
00065         CUSTOM = -1,            
00066 
00067         POSITION = 0,           
00068         NORMAL,                 
00069         TANGENT,                
00070         BINORMAL,               
00071         COLOR,                  
00072         TEXCOORD0,              
00073         TEXCOORD1,              
00074         TEXCOORD2,              
00075         TEXCOORD3,              
00076         BONE_INDEX,             
00077         BONE_WEIGHT,            
00078 
00079         DISPLACEMENT_TEXCOORD,  
00080         DISPLACEMENT_FLAGS,     
00081 
00082         NUM_SEMANTICS           
00083     };
00084 };
00085 
00089 struct TextureUVOrigin
00090 {
00094     enum Enum
00095     {
00096         ORIGIN_TOP_LEFT = 0,        
00097         ORIGIN_TOP_RIGHT = 1,       
00098         ORIGIN_BOTTOM_LEFT = 2,     
00099         ORIGIN_BOTTOM_RIGHT = 3,    
00100 
00101         ORIGIN_UNKNOWN = 0xFFFFFFFF 
00102     };
00103 };
00104 
00105 
00109 class UserRenderVertexBufferDesc
00110 {
00111 public:
00112     UserRenderVertexBufferDesc(void)
00113     {
00114         interopContext = 0;
00115         registerInCUDA = false;
00116         maxVerts = 0;
00117         hint     = RenderBufferHint::STATIC;
00118         for (uint32_t i = 0; i < RenderVertexSemantic::NUM_SEMANTICS; i++)
00119         {
00120             buffersRequest[i] = RenderDataFormat::UNSPECIFIED;
00121         }
00122         moduleIdentifier = 0;
00123         numCustomBuffers = 0;
00124         customBuffersIdents = NULL;
00125         customBuffersRequest = NULL;
00126         uvOrigin         = TextureUVOrigin::ORIGIN_TOP_LEFT;
00127         canBeShared      = true;
00128     }
00129 
00133     bool isValid(void) const
00134     {
00135         uint32_t numFailed = 0;
00136         if (maxVerts == 0)
00137         {
00138             numFailed++;
00139         }
00140         if (!customBuffersRequest)
00141         {
00142             uint32_t vertexSize = 0;
00143             for (uint32_t i = 0; i < RenderVertexSemantic::NUM_SEMANTICS; i++)
00144             {
00145                 vertexSize += RenderDataFormat::getFormatDataSize(buffersRequest[i]);
00146             }
00147             if (vertexSize == 0)
00148             {
00149                 numFailed++;
00150             }
00151         }
00152         return (numFailed == 0);
00153     }
00154 
00155 public:
00159     uint32_t                    maxVerts;
00160 
00164     RenderBufferHint::Enum      hint;
00165 
00171     RenderDataFormat::Enum      buffersRequest[RenderVertexSemantic::NUM_SEMANTICS];
00172 
00180     uint32_t                    numCustomBuffers;
00181 
00185     void**                      customBuffersIdents;
00186 
00190     RenderDataFormat::Enum*     customBuffersRequest;
00191 
00195     AuthObjTypeID               moduleIdentifier;
00196 
00200     TextureUVOrigin::Enum       uvOrigin;
00201 
00205     bool                        canBeShared;
00206     
00210     bool                        registerInCUDA;
00211 
00218     PxCudaContextManager*       interopContext;
00219 };
00220 
00221 PX_POP_PACK
00222 
00223 }
00224 } // end namespace nvidia::apex
00225 
00226 #endif // USER_RENDER_VERTEX_BUFFER_DESC_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.