gdk-graphics  1b6d84e044c2c953fd7c9501e628a67e80f4da0d
webgl1es2_screen_camera.h
1 // © Joseph Cameron - All Rights Reserved
2 
3 #ifndef GDK_GFX_WEBGL1ES2_SCREEN_CAMERA_H
4 #define GDK_GFX_WEBGL1ES2_SCREEN_CAMERA_H
5 
6 #include <gdk/screen_camera.h>
7 #include <gdk/color.h>
8 #include <gdk/graphics_types.h>
9 #include <gdk/webgl1es2_texture.h>
10 #include <gdk/webgl1es2_camera.h>
11 
12 #include <jfc/unique_handle.h>
13 
14 #include <memory>
15 #include <vector>
16 
17 namespace gdk
18 {
19  class entity;
20 
23  {
24  public:
27  //
29  virtual void set_viewport(const float aX,
30  const float aY,
31  const float aWidth,
32  const float aHeight) override;
33 
35  virtual void set_perspective_projection(const float aFieldOfView,
36  const float aNearClippingPlane,
37  const float aFarClippingPlane,
38  const float aViewportAspectRatio) override;
39 
41  virtual void set_orthographic_projection(const float aWidth,
42  const float aHeight,
43  const float aNearClippingPlane,
44  const float aFarClippingPlane,
45  const float aViewportAspectRatio) override;
46 
48  virtual void set_view_matrix(const gdk::graphics_vector3_type &aWorldPos,
49  const gdk::graphics_quaternion_type &aRotation) override;
50 
52  virtual void set_clear_color(const gdk::color &acolor) override;
53 
55  virtual void set_clear_mode(const gdk::camera::clear_mode aClearMode) override;
57 
60  //
62  void activate(const gdk::graphics_intvector2_type& aFrameBufferSize) const;
64 
69 
74 
77 
78  virtual ~webgl1es2_screen_camera() = default;
79 
80  private:
81  graphics_vector2_type m_ViewportPosition = graphics_vector2_type::Zero;
82  graphics_vector2_type m_ViewportSize = graphics_vector2_type(1, 1);
83  };
84 }
85 
86 #endif
87 
virtual void set_clear_color(const gdk::color &acolor) override
sets the clear color, used to fill color buffer after it is cleared.
Definition: camera.h:9
webgl1es2_screen_camera implementation of camera
Definition: webgl1es2_screen_camera.h:22
virtual void set_viewport(const float aX, const float aY, const float aWidth, const float aHeight) override
sets the normalized size and position of the viewport within of the window
webgl1es2_screen_camera & operator=(const webgl1es2_screen_camera &a)=default
copy semantics
void activate(const gdk::graphics_intvector2_type &aFrameBufferSize) const
activates this camera; mutates gl according to this camera&#39;s state
virtual void set_perspective_projection(const float aFieldOfView, const float aNearClippingPlane, const float aFarClippingPlane, const float aViewportAspectRatio) override
sets the projection matrix to a perspective projection
Position, orientation and perspective from which entity(s) are drawn.
Definition: screen_camera.h:16
virtual void set_view_matrix(const gdk::graphics_vector3_type &aWorldPos, const gdk::graphics_quaternion_type &aRotation) override
rebuilds the view matrix from a 3d position and rotation
virtual void set_clear_mode(const gdk::camera::clear_mode aClearMode) override
clear mode decides which buffers to clear. see enum
virtual void set_orthographic_projection(const float aWidth, const float aHeight, const float aNearClippingPlane, const float aFarClippingPlane, const float aViewportAspectRatio) override
sets the projection matrix to an orthographic projection
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
webgl1es2_screen_camera()
constructs with reasonable default values
Represents a 4 channel color: {Red, Green, Blue, Alpha}.
Definition: color.h:11