Welcome to mirror list, hosted at ThFree Co, Russian Federation.

vertex_decl.hpp « graphics - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ed8b9583856042e226d40e98b9fca92bd12d4154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "defines.hpp"
#include "vertex_stream.hpp"

#include "../std/vector.hpp"
#include "../std/string.hpp"

namespace graphics
{
  struct VertexStream;
  /// Single attribute of vertex.
  struct VertexAttrib
  {
    ESemantic m_semantic;
    size_t m_offset;
    EDataType m_elemType;
    size_t m_elemCount;
    size_t m_stride;

    VertexAttrib(ESemantic semantic,
                 size_t offset,
                 EDataType elemType,
                 size_t elemCount,
                 size_t stride);

    void initStream(VertexStream * vs,
                    unsigned char * v,
                    unsigned stride) const;
  };

  /// Vertex structure declaration.
  class VertexDecl
  {
  private:
    vector<VertexAttrib> m_attrs;
    size_t m_elemSize;
  public:
    /// constructor.
    VertexDecl(VertexAttrib const * attrs, size_t cnt);
    /// get the number of attributes.
    size_t attrCount() const;
    /// get vertex attribute.
    VertexAttrib const * getAttr(size_t i) const;
    /// size of single element.
    size_t elemSize() const;
    /// initialize vertex stream
    void initStream(VertexStream * vs, unsigned char * v) const;
  };
}