GteVertexFormat.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
10 #include <Graphics/GteDataFormat.h>
11 
12 namespace gte
13 {
14 
15 // Enumerations for DX11.
16 enum GTE_IMPEXP VASemantic
17 {
22  VA_NORMAL,
23  VA_PSIZE,
25  VA_TANGENT,
29  VA_COLOR,
30  VA_FOG,
31  VA_DEPTH,
32  VA_SAMPLE,
33  VA_NUM_SEMANTICS
34 };
35 
36 enum GTE_IMPEXP VAConstant
37 {
38  // TODO: Modify to the numbers for Shader Model 5 (DX11).
39 
40  // The maximum number of attributes for a vertex format.
42 
43  // The maximum number of texture coordinate units.
45 
46  // The maximum number of color units.
47  VA_MAX_COLOR_UNITS = 2
48 };
49 
51 {
52 public:
53  // Construction.
54  VertexFormat();
55 
56  // Create a packed vertex format, where all attributes are contiguous in
57  // memory. The order of the attributes is determined by the order of
58  // Bind calls.
59  bool Bind(VASemantic semantic, DFType type, unsigned int unit);
60 
61  // Member access. GetAttribute returns 'true' when the input i is
62  // such that 0 <= i < GetNumAttributes(), in which case the returned
63  // semantic, type, unit, and offset are valid.
64  unsigned int GetVertexSize() const;
65  int GetNumAttributes() const;
66  bool GetAttribute(int i, VASemantic& semantic, DFType& type,
67  unsigned int& unit, unsigned int& offset) const;
68 
69  // Determine whether a semantic/unit exists. If so, return the
70  // index i that can be used to obtain more information about the
71  // attribute by the functions after this. If not, return -1.
72  int GetIndex(VASemantic semantic, unsigned int unit) const;
73  DFType GetType(int i) const;
74  unsigned int GetOffset(int i) const;
75 
76 private:
78  {
79  public:
80  Attribute();
81  VASemantic semantic;
82  DFType type;
83  unsigned int unit;
84  unsigned int offset;
85  };
86 
88  unsigned int mVertexSize;
90 };
91 
92 }
VA_TEXCOORD
VA_NO_SEMANTIC
VA_MAX_TCOORD_UNITS
VA_NORMAL
VA_MAX_ATTRIBUTES
VA_BLENDWEIGHT
VA_BLENDINDICES
VA_SAMPLE
VA_FOG
VA_POSITION
VA_BINORMAL
VA_TESSFACTOR
VA_TANGENT
VA_COLOR
VA_POSITIONT
VA_DEPTH
GLintptr offset
Definition: glcorearb.h:660
VA_PSIZE
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:103
unsigned int mVertexSize


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:02