summaryrefslogtreecommitdiff
path: root/gfx/gl/bufferedLocation.h
blob: cf7afedf8074d7666295544de1ebb3f9703ce61d (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
#pragma once

#include "instanceVertices.h"
#include "location.hpp"
#include <glm/mat4x4.hpp>
#include <glm/vec3.hpp>

class BufferedLocation {
public:
	BufferedLocation(InstanceVertices<glm::mat4> &, glm::vec3 = {}, glm::vec3 = {});
	BufferedLocation(InstanceVertices<glm::mat4> &, const Location &);

	BufferedLocation & operator=(const Location &);

	operator const Location &() const;

	glm::vec3 position() const;
	glm::vec3 rotation() const;
	void setPosition(glm::vec3, bool update = true);
	void setRotation(glm::vec3, bool update = true);
	void setLocation(glm::vec3, glm::vec3);

	glm::mat4 getTransform() const;

private:
	void updateBuffer();

	Location loc;
	InstanceVertices<glm::mat4>::InstanceProxy buffer;
};