opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
liboscar
graphics
graphics.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
liboscar/graphics/blit_flags.h
>
4
#include <
liboscar/graphics/cubemap_face.h
>
5
#include <
liboscar/graphics/material_property_block.h
>
6
#include <
liboscar/maths/matrix4x4.h
>
7
#include <
liboscar/maths/rect.h
>
8
9
#include <cstddef>
10
#include <optional>
11
12
namespace
osc
{
class
Camera; }
13
namespace
osc
{
class
Cubemap; }
14
namespace
osc
{
class
Material; }
15
namespace
osc
{
class
Mesh; }
16
namespace
osc
{
class
Rect; }
17
namespace
osc
{
class
RenderTexture; }
18
namespace
osc
{
class
Texture2D; }
19
namespace
osc
{
struct
Transform; }
20
21
// rendering functions
22
//
23
// these perform the necessary backend steps to get something useful done
24
namespace
osc::graphics
25
{
26
// Queues the given `Mesh` + `Transform` + `Material` + extras against
27
// the `Camera`.
28
//
29
// Once everything is queued against the `Camera`, the caller should call
30
// `Camera::render()` or `Camera::render_to()` to flush the queue.
31
void
draw
(
const
Mesh
&,
const
Transform
&,
const
Material
&,
Camera
&);
32
void
draw
(
const
Mesh
&,
const
Transform
&,
const
Material
&,
Camera
&,
const
MaterialPropertyBlock
&);
33
void
draw
(
const
Mesh
&,
const
Transform
&,
const
Material
&,
Camera
&,
size_t
submesh_index
);
34
void
draw
(
const
Mesh
&,
const
Transform
&,
const
Material
&,
Camera
&,
const
MaterialPropertyBlock
&,
size_t
submesh_index
);
35
36
// Queues the given `Mesh` + `Matrix4x4` + `Material` + extras against
37
// the `Camera`.
38
//
39
// Once everything is queued against the `Camera`, the caller should call
40
// `Camera::render()` or `Camera::render_to()` to flush the queue.
41
void
draw
(
const
Mesh
&,
const
Matrix4x4
&,
const
Material
&,
Camera
&);
42
void
draw
(
const
Mesh
&,
const
Matrix4x4
&,
const
Material
&,
Camera
&,
const
MaterialPropertyBlock
&);
43
void
draw
(
const
Mesh
&,
const
Matrix4x4
&,
const
Material
&,
Camera
&,
size_t
submesh_index
);
44
void
draw
(
const
Mesh
&,
const
Matrix4x4
&,
const
Material
&,
Camera
&,
const
MaterialPropertyBlock
&,
size_t
submesh_index
);
45
46
// Blits the `Texture` to the `RenderTexture`.
47
void
blit
(
48
const
Texture2D
&,
49
RenderTexture
&
50
);
51
52
// Blits `render_texture` into a rectangular region of the main window.
53
//
54
// If provided, `destination_screen_rect` should be defined in screen space
55
// and device-independent pixels. Screen space starts in the bottom-left
56
// corner and ends in the top-right corner. If it is not provided, the
57
// destination region will be the entire contents of the main window.
58
void
blit_to_main_window
(
59
const
RenderTexture
&
render_texture
,
60
std::optional<Rect>
destination_screen_rect
= std::nullopt,
61
BlitFlags
= {}
62
);
63
64
// Renders `render_texture` as a quad using `material` into a rectangular region
65
// of the main window.
66
//
67
// `material` should have a `sampler2D` or `samplerCube` property called
68
// "uTexture". `texture` will be assigned to this property. `texture`'s
69
// `dimensionality()` dictates whether a `sampler2D` or `samplerCube` is
70
// required in the shader.
71
//
72
// If provided, `destination_screen_rect` should be defined in screen space
73
// and device-independent pixels. Screen space starts in the bottom-left
74
// corner and ends in the top-right corner. If it is not provided, the
75
// destination region will be the entire contents of the main window.
76
void
blit_to_main_window
(
77
const
RenderTexture
&
render_texture
,
78
const
Material
&
material
,
79
std::optional<Rect>
destination_screen_rect
= std::nullopt,
80
BlitFlags
= {}
81
);
82
83
// Blits the texture into a rectangular region in the main window.
84
//
85
// The rectangle should be defined in screen space, which:
86
//
87
// - Is measured in device-independent pixels
88
// - Starts in the bottom-left corner
89
// - Ends in the top-right corner
90
void
blit_to_main_window
(
91
const
Texture2D
&,
92
const
Rect
&
93
);
94
95
// copy: copy a GPU texture to a (potentially, CPU-accessible) texture
96
97
void
copy_texture
(
98
const
RenderTexture
&,
99
Texture2D
&
100
);
101
102
void
copy_texture
(
103
const
RenderTexture
&,
104
Texture2D
&,
105
CubemapFace
106
);
107
108
void
copy_texture
(
109
const
RenderTexture
&,
110
Cubemap
&,
111
size_t
mipmap_level
112
);
113
}
blit_flags.h
osc::Camera
Definition
camera.h:27
osc::Cubemap
Definition
cubemap.h:29
osc::Flags
Definition
flags.h:20
osc::MaterialPropertyBlock
Definition
material_property_block.h:20
osc::Material
Definition
material.h:21
osc::Mesh
Definition
mesh.h:33
osc::Rect
Definition
rect.h:17
osc::RenderTexture
Definition
render_texture.h:18
osc::Texture2D
Definition
texture2d.h:22
cubemap_face.h
material_property_block.h
matrix4x4.h
osc::graphics
Definition
graphics.h:25
osc::graphics::copy_texture
void copy_texture(const RenderTexture &, Texture2D &)
osc::graphics::blit_to_main_window
void blit_to_main_window(const RenderTexture &render_texture, std::optional< Rect > destination_screen_rect=std::nullopt, BlitFlags={})
osc::graphics::draw
void draw(const Mesh &, const Transform &, const Material &, Camera &)
osc::graphics::blit
void blit(const Texture2D &, RenderTexture &)
osc
Definition
custom_decoration_generator.h:5
osc::to
constexpr U to(T &&value)
Definition
conversion.h:56
osc::CubemapFace
CubemapFace
Definition
cubemap_face.h:5
rect.h
osc::Matrix< float, 4, 4 >
osc::Transform
Definition
transform.h:11
Generated by
1.9.8