VertexFormat.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 VERTEX_FORMAT_H
00031 #define VERTEX_FORMAT_H
00032 
00038 #include "ApexUsingNamespace.h"
00039 #include "UserRenderResourceManager.h"
00040 #include "UserRenderVertexBufferDesc.h"
00041 
00042 namespace nvidia
00043 {
00044 namespace apex
00045 {
00046 
00047 PX_PUSH_PACK_DEFAULT
00048 
00052 struct ColorRGBA
00053 {
00055     ColorRGBA() : r(0xFF), g(0xFF), b(0xFF), a(0xFF) {}
00057     ColorRGBA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {}
00058 
00060     uint8_t r;
00062     uint8_t g;
00064     uint8_t b;
00066     uint8_t a;
00067 };
00068 
00072 struct RenderDataAccess
00073 {
00077     enum Enum
00078     {
00079         STATIC = 0,
00080         DYNAMIC,
00081         STREAMING,
00082 
00083         ACCESS_TYPE_COUNT
00084     };
00085 };
00086 
00090 class VertexFormat
00091 {
00092 public:
00093 
00094     enum
00095     {
00096         MAX_UV_COUNT = 4,
00097         MAX_BONE_PER_VERTEX_COUNT = 4,
00098     };
00099 
00101     typedef uint32_t BufferID;
00102 
00103 
00105     virtual void                            reset() = 0;
00106 
00107 
00109     virtual void                            setWinding(RenderCullMode::Enum winding) = 0;
00110 
00112     virtual void                            setHasSeparateBoneBuffer(bool hasSeparateBoneBuffer) = 0;
00113 
00115     virtual RenderCullMode::Enum            getWinding() const = 0;
00116 
00118     virtual bool                            hasSeparateBoneBuffer() const = 0;
00119 
00120 
00122     virtual const char*                     getSemanticName(RenderVertexSemantic::Enum semantic) const = 0;
00123 
00125     virtual BufferID                        getSemanticID(RenderVertexSemantic::Enum semantic) const = 0;
00126 
00129     virtual BufferID                        getID(const char* name) const = 0;
00130 
00131 
00136     virtual int32_t                         addBuffer(const char* name) = 0;
00137 
00142     virtual bool                            bufferReplaceWithLast(uint32_t index) = 0;
00143 
00144 
00148     virtual bool                            setBufferFormat(uint32_t index, RenderDataFormat::Enum format) = 0;
00149 
00153     virtual bool                            setBufferAccess(uint32_t index, RenderDataAccess::Enum access) = 0;
00154 
00158     virtual bool                            setBufferSerialize(uint32_t index, bool serialize) = 0;
00159 
00160 
00164     virtual const char*                     getBufferName(uint32_t index) const = 0;
00165 
00169     virtual RenderVertexSemantic::Enum      getBufferSemantic(uint32_t index) const = 0;
00170 
00174     virtual BufferID                        getBufferID(uint32_t index) const = 0;
00175 
00179     virtual RenderDataFormat::Enum          getBufferFormat(uint32_t index) const = 0;
00180 
00184     virtual RenderDataAccess::Enum          getBufferAccess(uint32_t index) const = 0;
00185 
00189     virtual bool                            getBufferSerialize(uint32_t index) const = 0;
00190 
00191 
00193     virtual uint32_t                        getBufferCount() const = 0;
00194 
00196     virtual uint32_t                        getCustomBufferCount() const = 0;
00197 
00201     virtual int32_t                         getBufferIndexFromID(BufferID id) const = 0;
00202 
00203 
00204 protected:
00205     VertexFormat()  {}
00206     virtual                                 ~VertexFormat() {}
00207 };
00208 
00209 PX_POP_PACK
00210 
00211 }
00212 } // end namespace nvidia::apex
00213 
00214 #endif // VERTEX_FORMAT_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.