gdk-graphics 0b051eb9b5c1eaa0658babaa4463dd7a80aa9d2c
Loading...
Searching...
No Matches
webgl1es2_entity.h
1// © Joseph Cameron - All Rights Reserved
2
3#ifndef GDK_GFX_WEBGL1ES2_ENTITY_H
4#define GDK_GFX_WEBGL1ES2_ENTITY_H
5
6#include <gdk/entity.h>
7#include <gdk/graphics_types.h>
8#include <gdk/webgl1es2_material.h>
9#include <gdk/webgl1es2_texture.h>
10#include <jfc/default_ptr.h>
11
12#include <iosfwd>
13#include <memory>
14#include <string_view>
15
16namespace gdk
17{
18 class webgl1es2_model;
20
25 class webgl1es2_entity final : public entity {
26 public:
29 //
31 virtual void hide() override;
32
34 virtual void show() override;
35
37 virtual bool is_hidden() const override;
38
40 virtual void set_transform(const graphics_vector3_type &aWorldPos,
41 const graphics_quaternion_type &aRotation,
42 const graphics_vector3_type &aScale = graphics_vector3_type::one) override;
43
44 virtual void set_transform(const graphics_matrix4x4_type& a) override;
46
48 virtual std::shared_ptr<model> getModel() const;
49
51 virtual std::shared_ptr<material> getMaterial() const;
52
56 void draw(const graphics_matrix4x4_type &aViewMatrix, const graphics_matrix4x4_type &aProjectionMatrix) const;
57
59 const graphics_matrix4x4_type &getModelMatrix() const;
60
65
70
72 webgl1es2_entity(const std::shared_ptr<webgl1es2_model>, const std::shared_ptr<webgl1es2_material>);
73
75 ~webgl1es2_entity() = default;
76
77 private:
79 std::shared_ptr<webgl1es2_model> m_model;
80
82 std::shared_ptr<webgl1es2_material> m_Material;
83
85 graphics_matrix4x4_type m_ModelMatrix;
86
88 bool m_IsHidden = false;
89 };
90}
91
92#endif
represents an observable 3d object.
Definition entity.h:13
virtual std::shared_ptr< model > getModel() const
get the model
~webgl1es2_entity()=default
trivial destructor
virtual void show() override
allow this entity to be drawn
webgl1es2_entity(const std::shared_ptr< webgl1es2_model >, const std::shared_ptr< webgl1es2_material >)
standard constructor. requires a model and a material
webgl1es2_entity(webgl1es2_entity &&)=default
move semantics
webgl1es2_entity & operator=(webgl1es2_entity &&)=default
move semantics
virtual std::shared_ptr< material > getMaterial() const
get the material
const graphics_matrix4x4_type & getModelMatrix() const
returns a const ref to the model matrix
virtual void hide() override
do not allow this entity to be drawn
webgl1es2_entity & operator=(const webgl1es2_entity &)=default
copy semantics
virtual void set_transform(const graphics_matrix4x4_type &a) override
set the model matrix using a matrix
void draw(const graphics_matrix4x4_type &aViewMatrix, const graphics_matrix4x4_type &aProjectionMatrix) const
draws the webgl1es2_entity at its current world position, with respect to a view and projection matri...
virtual void set_transform(const graphics_vector3_type &aWorldPos, const graphics_quaternion_type &aRotation, const graphics_vector3_type &aScale=graphics_vector3_type::one) override
sets the model matrix using a vec3 position, quat rotation, vec3 scale
webgl1es2_entity(const webgl1es2_entity &)=default
copy semantics
virtual bool is_hidden() const override
check if the entity is hidden
Vertex data representing a 3D graphical object.
Definition webgl1es2_model.h:20
Specifies drawing behaviours at the two programmable stages in the OpenGL ES 2.0/WebGL 1....
Definition webgl1es2_shader_program.h:23