gdk-graphics  1b6d84e044c2c953fd7c9501e628a67e80f4da0d
webgl1es2_camera.h
1 // © Joseph Cameron - All Rights Reserved
2 
3 #ifndef GDK_GFX_WEBGL1ES2_CAMERA_H
4 #define GDK_GFX_WEBGL1ES2_CAMERA_H
5 
6 #include <gdk/camera.h>
7 #include <gdk/color.h>
8 #include <gdk/graphics_types.h>
9 #include <gdk/webgl1es2_texture.h>
10 
11 #include <jfc/unique_handle.h>
12 
13 #include <memory>
14 #include <vector>
15 
16 namespace gdk
17 {
18  class entity;
19 
22  {
23  public:
26  //
28  graphics_mat4x4_type get_view_matrix() const;
29 
31  graphics_mat4x4_type get_projection_matrix() const;
32 
35  webgl1es2_camera(const webgl1es2_camera& a) = default;
37  webgl1es2_camera& operator=(const webgl1es2_camera & a) = default;
38 
43 
46 
47  virtual ~webgl1es2_camera() = default;
48 
49  protected:
52  //
53  void set_perspective_projection(const float aFieldOfView,
54  const float aNearClippingPlane,
55  const float aFarClippingPlane,
56  const float aViewportAspectRatio);
57 
58  void set_orthographic_projection(const float aWidth,
59  const float aHeight,
60  const float aNearClippingPlane,
61  const float aFarClippingPlane,
62  const float aViewportAspectRatio);
63 
64  void set_clear_color(const gdk::color& acolor);
65 
66  void set_clear_mode(const gdk::camera::clear_mode aClearMode);
67 
68  void set_view_matrix(const gdk::graphics_vector3_type& aWorldPos,
69  const gdk::graphics_quaternion_type& aRotation);
70 
71  void activate_clear_mode() const;
72 
73  camera::clear_mode get_clearmode() const;
74  gdk::color get_clearcolor() const;
76 
77  private:
78  graphics_mat4x4_type m_ViewMatrix = graphics_mat4x4_type::Identity;
79  graphics_mat4x4_type m_ProjectionMatrix = graphics_mat4x4_type::Identity;
80 
82  gdk::color m_ClearColor = color::CornflowerBlue;
83  };
84 }
85 
86 #endif
87 
graphics_mat4x4_type get_view_matrix() const
gets the view matrix
Definition: camera.h:9
static const color CornflowerBlue
an opaque pastel blue color
Definition: color.h:61
webgl1es2_camera & operator=(const webgl1es2_camera &a)=default
copy semantics
Clear the color and depth buffers.
webgl1es2_camera()
constructs with reasonable default values
clear_mode
Describes camera clear behaviour: which buffers in the current FBO should be cleared?
Definition: camera.h:16
webgl1es2_camera implementation of camera
Definition: webgl1es2_camera.h:21
graphics_mat4x4_type get_projection_matrix() const
gets the projection matrix
Represents a 4 channel color: {Red, Green, Blue, Alpha}.
Definition: color.h:11