3 #ifndef GDK_GFX_WEBGL1ES2_ENTITY_H 4 #define GDK_GFX_WEBGL1ES2_ENTITY_H 6 #include <gdk/graphics_types.h> 7 #include <gdk/webgl1es2_texture.h> 8 #include <gdk/webgl1es2_material.h> 9 #include <jfc/default_ptr.h> 10 #include <gdk/entity.h> 14 #include <string_view> 18 class webgl1es2_model;
19 class webgl1es2_shader_program;
31 std::shared_ptr<webgl1es2_model> m_model;
34 std::shared_ptr<webgl1es2_material> m_Material;
37 graphics_mat4x4_type m_ModelMatrix;
40 bool m_IsHidden =
false;
44 virtual void hide()
override;
47 virtual void show()
override;
50 virtual bool isHidden()
const override;
53 virtual std::shared_ptr<model>
getModel()
const;
56 virtual std::shared_ptr<material>
getMaterial()
const;
62 void draw(
const graphics_mat4x4_type &aViewMatrix,
const graphics_mat4x4_type &aProjectionMatrix)
const;
65 virtual void set_model(
const std::shared_ptr<model> a)
override;
70 const graphics_quaternion_type &aRotation,
71 const graphics_vector3_type &aScale = graphics_vector3_type::One)
override;
89 webgl1es2_entity(
const std::shared_ptr<webgl1es2_model>,
const std::shared_ptr<webgl1es2_material>);
const graphics_mat4x4_type & getModelMatrix() const
returns a const ref to the model matrix
represents an observable 3d object.
Definition: entity.h:14
~webgl1es2_entity()=default
trivial destructor
Represents an observable 3D object.
Definition: webgl1es2_entity.h:27
virtual void set_model(const std::shared_ptr< model > a) override
sets this entity's model.
virtual std::shared_ptr< material > getMaterial() const
get the material
virtual void hide() override
do not allow this entity to be drawn
void draw(const graphics_mat4x4_type &aViewMatrix, const graphics_mat4x4_type &aProjectionMatrix) const
draws the webgl1es2_entity at its current world position, with respect to a view and projection matri...
virtual void set_model_matrix(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
virtual void show() override
allow this entity to be drawn
webgl1es2_entity & operator=(const webgl1es2_entity &)=default
copy semantics
virtual std::shared_ptr< model > getModel() const
get the model
virtual bool isHidden() const override
check if the entity is hidden
webgl1es2_entity(const webgl1es2_entity &)=default
copy semantics