NxApexRenderDataFormat.h
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_APEX_RENDER_DATA_FORMAT_H
00029 #define NX_APEX_RENDER_DATA_FORMAT_H
00030 
00031 #include "NxApexUsingNamespace.h"
00032 #include "foundation/PxAssert.h"
00033 #include "foundation/PxMat33.h"
00034 
00035 namespace physx
00036 {
00037 namespace apex
00038 {
00039 
00040 PX_PUSH_PACK_DEFAULT
00041 
00047 struct NxRenderDataFormat
00048 {
00050     enum Enum
00051     {
00052         UNSPECIFIED =           0,  
00053 
00055         UBYTE1 =                1,  
00056         UBYTE2 =                2,  
00057         UBYTE3 =                3,  
00058         UBYTE4 =                4,  
00059 
00060         USHORT1 =               5,  
00061         USHORT2 =               6,  
00062         USHORT3 =               7,  
00063         USHORT4 =               8,  
00064 
00065         SHORT1 =                9,  
00066         SHORT2 =                10, 
00067         SHORT3 =                11, 
00068         SHORT4 =                12, 
00069 
00070         UINT1 =                 13, 
00071         UINT2 =                 14, 
00072         UINT3 =                 15, 
00073         UINT4 =                 16, 
00074 
00076         R8G8B8A8 =              17, 
00077         B8G8R8A8 =              18, 
00078         R32G32B32A32_FLOAT =    19, 
00079         B32G32R32A32_FLOAT =    20, 
00080 
00082         BYTE_UNORM1 =           21, 
00083         BYTE_UNORM2 =           22, 
00084         BYTE_UNORM3 =           23, 
00085         BYTE_UNORM4 =           24, 
00086 
00087         SHORT_UNORM1 =          25, 
00088         SHORT_UNORM2 =          26, 
00089         SHORT_UNORM3 =          27, 
00090         SHORT_UNORM4 =          28, 
00091 
00092         BYTE_SNORM1 =           29, 
00093         BYTE_SNORM2 =           30, 
00094         BYTE_SNORM3 =           31, 
00095         BYTE_SNORM4 =           32, 
00096 
00097         SHORT_SNORM1 =          33, 
00098         SHORT_SNORM2 =          34, 
00099         SHORT_SNORM3 =          35, 
00100         SHORT_SNORM4 =          36, 
00101 
00103         HALF1 =                 37, 
00104         HALF2 =                 38, 
00105         HALF3 =                 39, 
00106         HALF4 =                 40, 
00107 
00108         FLOAT1 =                41, 
00109         FLOAT2 =                42, 
00110         FLOAT3 =                43, 
00111         FLOAT4 =                44, 
00112 
00113         FLOAT3x4 =              45, 
00114         FLOAT3x3 =              46, 
00115 
00116         FLOAT4_QUAT =           47, 
00117         BYTE_SNORM4_QUATXYZW =  48, 
00118         SHORT_SNORM4_QUATXYZW = 49, 
00119 
00120         NUM_FORMATS
00121     };
00122 
00124     static PX_INLINE physx::PxU32 getFormatDataSize(Enum format)
00125     {
00126         switch (format)
00127         {
00128         default:
00129             PX_ALWAYS_ASSERT();
00130         case UNSPECIFIED:
00131             return 0;
00132 
00133         case UBYTE1:
00134         case BYTE_UNORM1:
00135         case BYTE_SNORM1:
00136             return sizeof(physx::PxU8);
00137         case UBYTE2:
00138         case BYTE_UNORM2:
00139         case BYTE_SNORM2:
00140             return sizeof(physx::PxU8) * 2;
00141         case UBYTE3:
00142         case BYTE_UNORM3:
00143         case BYTE_SNORM3:
00144             return sizeof(physx::PxU8) * 3;
00145         case UBYTE4:
00146         case BYTE_UNORM4:
00147         case BYTE_SNORM4:
00148         case BYTE_SNORM4_QUATXYZW:
00149             return sizeof(physx::PxU8) * 4;
00150 
00151         case USHORT1:
00152         case SHORT1:
00153         case HALF1:
00154         case SHORT_UNORM1:
00155         case SHORT_SNORM1:
00156             return sizeof(physx::PxU16);
00157         case USHORT2:
00158         case SHORT2:
00159         case HALF2:
00160         case SHORT_UNORM2:
00161         case SHORT_SNORM2:
00162             return sizeof(physx::PxU16) * 2;
00163         case USHORT3:
00164         case SHORT3:
00165         case HALF3:
00166         case SHORT_UNORM3:
00167         case SHORT_SNORM3:
00168             return sizeof(physx::PxU16) * 3;
00169         case USHORT4:
00170         case SHORT4:
00171         case HALF4:
00172         case SHORT_UNORM4:
00173         case SHORT_SNORM4:
00174         case SHORT_SNORM4_QUATXYZW:
00175             return sizeof(physx::PxU16) * 4;
00176 
00177         case UINT1:
00178             return sizeof(physx::PxU32);
00179         case UINT2:
00180             return sizeof(physx::PxU32) * 2;
00181         case UINT3:
00182             return sizeof(physx::PxU32) * 3;
00183         case UINT4:
00184             return sizeof(physx::PxU32) * 4;
00185 
00186         case R8G8B8A8:
00187         case B8G8R8A8:
00188             return sizeof(physx::PxU8) * 4;
00189 
00190         case R32G32B32A32_FLOAT:
00191         case B32G32R32A32_FLOAT:
00192             return sizeof(physx::PxF32) * 4;
00193 
00194         case FLOAT1:
00195             return sizeof(physx::PxF32);
00196         case FLOAT2:
00197             return sizeof(physx::PxF32) * 2;
00198         case FLOAT3:
00199             return sizeof(physx::PxF32) * 3;
00200         case FLOAT4:
00201             return sizeof(physx::PxF32) * 4;
00202 
00203         case FLOAT3x4:
00204             return sizeof(physx::PxF32) * 12;
00205 
00206         case FLOAT3x3:
00207             return sizeof(physx::PxMat33);
00208 
00209         case FLOAT4_QUAT:
00210             return sizeof(physx::PxQuat);
00211         }
00212     }
00213 };
00214 
00215 PX_POP_PACK
00216 
00217 }
00218 } // end namespace physx::apex
00219 
00220 #endif  // NX_APEX_RENDER_DATA_FORMAT_H

Generated on Mon Apr 28 2014 08:01:35

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