Lugdunum
0.1.0
include
lug
Graphics
Render
View.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
#include <memory>
5
#include <
lug/Graphics/Export.hpp
>
6
#include <
lug/Graphics/Render/Camera/Camera.hpp
>
7
8
namespace
lug
{
9
namespace
Graphics {
10
namespace
Render {
11
12
namespace
Camera {
13
class
Camera;
14
}
// Camera
15
16
class
Target;
17
18
class
LUG_GRAPHICS_API
View
{
19
public
:
20
// x, y, width, height => percentage of the screen
21
// TODO: Declare offset and extent outside
22
class
Viewport
{
23
public
:
24
struct
{
25
float
x
;
26
float
y
;
27
} offset;
28
29
struct
{
30
float
width
;
31
float
height
;
32
} extent;
33
34
float
minDepth
;
35
float
maxDepth
;
36
37
inline
float
getRatio()
const
;
38
};
39
40
struct
Scissor
{
41
struct
{
42
float
x
;
43
float
y
;
44
} offset;
45
46
struct
{
47
float
width
;
48
float
height
;
49
} extent;
50
};
51
52
struct
InitInfo
{
53
Viewport
viewport
;
54
Scissor
scissor
;
55
Resource::SharedPtr<Camera::Camera>
camera
;
56
// TODO: Clear color
57
};
58
59
public
:
60
View
(
const
Target
* renderTarget);
61
62
View
(
const
View
&) =
delete
;
63
View
(
View
&&) =
delete
;
64
65
View
& operator=(
const
View
&) =
delete
;
66
View
& operator=(
View
&&) =
delete
;
67
68
virtual
~
View
() =
default
;
69
70
void
init(
InitInfo
& initInfo);
71
72
InitInfo
& getInfo();
73
const
InitInfo
& getInfo()
const
;
74
75
const
Viewport
& getViewport()
const
;
76
const
Scissor
& getScissor()
const
;
77
78
const
Math::Vec3f& getClearColor()
const
;
79
void
setClearColor(
const
Math::Vec3f& color);
80
81
void
attachCamera(
Resource::SharedPtr<Camera::Camera>
camera);
82
Resource::SharedPtr<Camera::Camera>
getCamera()
const
;
83
84
void
update();
85
86
virtual
void
destroy() = 0;
87
virtual
bool
endFrame() = 0;
88
89
protected
:
90
const
Target
*
_renderTarget
;
91
InitInfo
_info
;
92
93
Viewport
_viewport{};
94
Scissor
_scissor{};
95
Math::Vec3f _clearColor{0.0f, 0.0f, 0.0f};
96
Resource::SharedPtr<Camera::Camera>
_camera{
nullptr
};
97
};
98
99
#include <
lug/Graphics/Render/View.inl
>
100
101
}
// Render
102
}
// Graphics
103
}
// lug
Camera.hpp
lug::Graphics::Render::View::Viewport::width
float width
Definition:
View.hpp:30
lug::Graphics::Render::View::InitInfo
Definition:
View.hpp:52
lug::Graphics::Render::View::Scissor::y
float y
Definition:
View.hpp:43
lug::Graphics::Render::View::InitInfo::scissor
Scissor scissor
Definition:
View.hpp:54
lug::Graphics::Render::View::Viewport::x
float x
Definition:
View.hpp:25
lug::Graphics::Render::View::Viewport::height
float height
Definition:
View.hpp:31
LUG_GRAPHICS_API
#define LUG_GRAPHICS_API
Definition:
Export.hpp:11
lug::Graphics::Render::View::_renderTarget
const Target * _renderTarget
Definition:
View.hpp:90
lug::Graphics::Render::View::Viewport::minDepth
float minDepth
Definition:
View.hpp:34
lug::Graphics::Render::View::Viewport::y
float y
Definition:
View.hpp:26
lug::Graphics::Resource::SharedPtr
Dummy class for a shared pointer.
Definition:
Resource.hpp:66
lug::Graphics::Render::Target
Definition:
Target.hpp:10
lug::Graphics::Render::View::_info
InitInfo _info
Definition:
View.hpp:91
lug::Graphics::Render::View::InitInfo::camera
Resource::SharedPtr< Camera::Camera > camera
Definition:
View.hpp:55
lug::Graphics::Render::View::Viewport
Definition:
View.hpp:22
lug::Graphics::Render::View
Definition:
View.hpp:18
lug::Graphics::Render::View::Scissor::height
float height
Definition:
View.hpp:48
lug
Definition:
Application.hpp:11
lug::Graphics::Render::View::Viewport::maxDepth
float maxDepth
Definition:
View.hpp:35
lug::Graphics::Render::View::Scissor
Definition:
View.hpp:40
lug::Graphics::Render::View::Scissor::width
float width
Definition:
View.hpp:47
lug::Graphics::Render::View::InitInfo::viewport
Viewport viewport
Definition:
View.hpp:53
Export.hpp
View.inl
lug::Graphics::Render::View::Scissor::x
float x
Definition:
View.hpp:42
Generated by
1.8.13