/
RenderableVertex.h
51 lines (38 loc) · 1.17 KB
/
RenderableVertex.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
#pragma once
#include "../VertexInstance.h"
#include "../EntitySettings.h"
#include "render/RenderableGeometry.h"
namespace entity
{
class RenderableVertex :
public render::RenderableGeometry
{
private:
const VertexInstance& _instance;
const Matrix4& _localToWorld;
bool _needsUpdate;
public:
RenderableVertex(const VertexInstance& instance, const Matrix4& localToWorld) :
_instance(instance),
_localToWorld(localToWorld),
_needsUpdate(true)
{}
void queueUpdate()
{
_needsUpdate = true;
}
protected:
void updateGeometry() override
{
if (!_needsUpdate) return;
_needsUpdate = false;
std::vector<MeshVertex> vertices;
static std::vector<unsigned int> Indices = { 0 };
auto colour = entity::EntitySettings::InstancePtr()->getLightVertexColour(
_instance.isSelected() ? LightEditVertexType::Selected : LightEditVertexType::Deselected
);
vertices.push_back(MeshVertex(_localToWorld * _instance.getVertex(), { 0,0,0 }, { 0,0 }, colour));
RenderableGeometry::updateGeometryWithData(render::GeometryType::Points, vertices, Indices);
}
};
}