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/render_pass_config.h
>
6
#include <
liboscar/maths/rect.h
>
7
8
#include <cstddef>
9
#include <optional>
10
11
namespace
osc
{
class
Camera; }
12
namespace
osc
{
class
Cubemap; }
13
namespace
osc
{
class
Material; }
14
namespace
osc
{
class
RenderQueue; }
15
namespace
osc
{
class
RenderTarget; }
16
namespace
osc
{
class
RenderTexture; }
17
namespace
osc
{
class
SharedDepthStencilRenderBuffer; }
18
namespace
osc
{
class
Texture2D; }
19
20
// rendering functions
21
//
22
// these perform the necessary backend steps to get something useful done
23
namespace
osc::graphics
24
{
25
void
render_to_main_window
(
const
RenderQueue
&,
const
Camera
&,
const
RenderPassConfig
& = {});
26
void
render_to
(
RenderTexture
&,
const
RenderQueue
&,
const
Camera
&,
const
RenderPassConfig
& = {});
27
void
render_to
(
const
RenderTarget
&,
const
RenderQueue
&,
const
Camera
&,
const
RenderPassConfig
& = {});
28
void
render_to
(
SharedDepthStencilRenderBuffer
&,
const
RenderQueue
&,
const
Camera
&,
const
RenderPassConfig
& = {});
29
30
// Blits the `Texture` to the `RenderTexture`.
31
void
blit
(
32
const
Texture2D
&,
33
RenderTexture
&
34
);
35
36
// Blits `render_texture` into a rectangular region of the main window.
37
//
38
// If provided, `destination_screen_rect` should be defined in screen space
39
// and device-independent pixels. Screen space starts in the bottom-left
40
// corner and ends in the top-right corner. If it is not provided, the
41
// destination region will be the entire contents of the main window.
42
void
blit_to_main_window
(
43
const
RenderTexture
& render_texture,
44
std::optional<Rect> destination_screen_rect = std::nullopt,
45
BlitFlags
= {}
46
);
47
48
// Renders `render_texture` as a quad using `material` into a rectangular region
49
// of the main window.
50
//
51
// `material` should have a `sampler2D` or `samplerCube` property called
52
// "uTexture". `texture` will be assigned to this property. `texture`'s
53
// `dimensionality()` dictates whether a `sampler2D` or `samplerCube` is
54
// required in the shader.
55
//
56
// If provided, `destination_screen_rect` should be defined in screen space
57
// and device-independent pixels. Screen space starts in the bottom-left
58
// corner and ends in the top-right corner. If it is not provided, the
59
// destination region will be the entire contents of the main window.
60
void
blit_to_main_window
(
61
const
RenderTexture
& render_texture,
62
const
Material
& material,
63
std::optional<Rect> destination_screen_rect = std::nullopt,
64
BlitFlags
= {}
65
);
66
67
// Blits the texture into a rectangular region in the main window.
68
//
69
// The rectangle should be defined in screen space, which:
70
//
71
// - Is measured in device-independent pixels
72
// - Starts in the bottom-left corner
73
// - Ends in the top-right corner
74
void
blit_to_main_window
(
75
const
Texture2D
&,
76
const
Rect
&
77
);
78
79
// copy: copy a GPU texture to a (potentially, CPU-accessible) texture
80
81
void
copy_texture
(
82
const
RenderTexture
&,
83
Texture2D
&
84
);
85
86
void
copy_texture
(
87
const
RenderTexture
&,
88
Texture2D
&,
89
CubemapFace
90
);
91
92
void
copy_texture
(
93
const
RenderTexture
&,
94
Cubemap
&,
95
size_t
mipmap_level
96
);
97
}
blit_flags.h
osc::Camera
Definition
camera.h:21
osc::Cubemap
Definition
cubemap.h:29
osc::Flags
Definition
flags.h:20
osc::Material
Definition
material.h:21
osc::Rect
Definition
rect.h:17
osc::RenderQueue
Definition
render_queue.h:27
osc::RenderTarget
Definition
render_target.h:14
osc::RenderTexture
Definition
render_texture.h:18
osc::SharedDepthStencilRenderBuffer
Definition
shared_depth_stencil_render_buffer.h:49
osc::Texture2D
Definition
texture2d.h:22
cubemap_face.h
osc::graphics
Definition
graphics.h:24
osc::graphics::copy_texture
void copy_texture(const RenderTexture &, Texture2D &)
osc::graphics::render_to_main_window
void render_to_main_window(const RenderQueue &, const Camera &, const RenderPassConfig &={})
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::render_to
void render_to(RenderTexture &, const RenderQueue &, const Camera &, const RenderPassConfig &={})
osc::graphics::blit
void blit(const Texture2D &, RenderTexture &)
osc
Definition
custom_decoration_generator.h:5
osc::CubemapFace
CubemapFace
Definition
cubemap_face.h:5
rect.h
render_pass_config.h
osc::RenderPassConfig
Represents the top-level configuration options for a single render pass.
Definition
render_pass_config.h:12
Generated by
1.9.8