/
RenderVertex.h
47 lines (41 loc) · 1.17 KB
/
RenderVertex.h
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
#pragma once
#include "math/Vector2.h"
#include "math/Vector3.h"
#include "math/Vector4.h"
namespace render
{
/**
* Vertex as used in DarkRadiant's render system.
* It's based on single-precision floats for memory/performance.
*/
class RenderVertex
{
public:
Vector2f texcoord;
Vector3f normal;
Vector3f vertex;
Vector3f tangent;
Vector3f bitangent;
Vector4f colour;
/// Default constructor.
RenderVertex()
: tangent(0, 0, 0),
bitangent(0, 0, 0),
colour(1.0f, 1.0f, 1.0f, 1.0f)
{}
/// Construct and initialise all values
template <typename U = float, typename ColVector_T = BasicVector4<float>>
RenderVertex(const BasicVector3<U>& vertex_, const BasicVector3<U>& normal_,
const BasicVector2<U>& texcoord_,
const ColVector_T& colour_ = BasicVector4<float>(1, 1, 1, 1),
const BasicVector3<U>& tangent_ = BasicVector3<U>(0, 0, 0),
const BasicVector3<U>& bitangent_ = BasicVector3<U>(0, 0, 0))
: texcoord(texcoord_),
normal(normal_),
vertex(vertex_),
tangent(tangent_),
bitangent(bitangent_),
colour(colour_)
{}
};
}