-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVertex.h
65 lines (52 loc) · 1.97 KB
/
Vertex.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include "MathBase.h"
namespace bmesh {
class Vertex;
typedef std::unique_ptr<Vertex> VertexBox;
typedef std::shared_ptr<Vertex> VertexRef;
class Vertex {
public:
Vertex() {}
Vertex & position(vec3 const & p) { mPosition = p; return *this; }
Vertex & normal(vec3 const & n) { mNormal = n; return *this; }
Vertex & color(vec3 const & c) { mColor = c; return *this; }
Vertex & tex(vec2 const & t) { mTexCoord0 = t; return *this; }
Vertex & tangent(vec3 const & t) { mTangent = t; return *this; }
Vertex & bitangent(vec3 const & t) { mBitangent = t; return *this; }
static VertexRef create() { return std::make_shared<Vertex>(); }
static VertexBox box() { return VertexBox(new Vertex()); }
static Vertex interpolate(Vertex const & v1, Vertex const & v2, float tval);
static Vertex interpolate(Vertex const & v1, Vertex const & v2, vec3 tvals);
vec3 mPosition;
vec3 mNormal;
vec3 mColor;
vec2 mTexCoord0;
vec3 mTangent;
vec3 mBitangent;
};
// Eventually, I want to get here, maybe?
// class Vertex {
// public:
// Vertex() {}
// Vertex & position(vec3 const & p) { mPosition = p; return *this; }
// Vertex & normal(vec3 const & n) { mNormal = n; return *this; }
// Vertex & color(vec4 const & c) { mColor = c; return *this; }
// Vertex & tex0(vec2 const & t) { mTexCoord0 = t; return *this; }
// Vertex & tangent(vec3 const & t) { mTangent = t; return *this; }
// Vertex & bitangent(vec3 const & b) { mBitangent = b; return *this; }
// Vertex & tex1(vec2 const & t) { mTexCoord1 = t; return *this; }
// Vertex & tex2(vec2 const & t) { mTexCoord2 = t; return *this; }
// Vertex & tex3(vec2 const & t) { mTexCoord3 = t; return *this; }
// static VertexRef create() { return std::make_shared<Vertex>(); }
// static VertexBox box() { return VertexBox(new Vertex()); }
// vec3 mPosition;
// vec3 mNormal;
// vec2 mTexCoord0;
// vec4 mColor;
// vec3 mTangent;
// vec3 mBitangent;
// vec2 mTexCoord1;
// vec2 mTexCoord2;
// vec2 mTexCoord3;
// };
} // namespace bmesh