summaryrefslogtreecommitdiff
path: root/game/physical.h
blob: 44af5e628bcf3636266ae54479d97edddb2db07a (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
#ifndef PHYSICAL_H
#define PHYSICAL_H

#include <gfx/gl/transform.h>
#include <gfx/renderable.h>
#include <glm/glm.hpp>
#include <memory>
#include <string>

class Shader;
class Mesh;
class Texture;
template<typename Obj> class Cache;

class Physical : public Renderable {
public:
	Physical(glm::vec3 where, const std::string & m, const std::string & t);

	void render(const Shader & shader) const override;

	[[nodiscard]] const auto &
	getPosition() const
	{
		return location.GetPos();
	}

protected:
	Transform location;

	std::shared_ptr<Mesh> mesh;
	std::shared_ptr<Texture> texture;

private:
	static Cache<Mesh> cachedMesh;
	static Cache<Texture> cachedTexture;
};

#endif