opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
graphics.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <cstddef>
9#include <optional>
10
11namespace osc { class Camera; }
12namespace osc { class Cubemap; }
13namespace osc { class Material; }
14namespace osc { class RenderQueue; }
15namespace osc { class RenderTarget; }
16namespace osc { class RenderTexture; }
17namespace osc { class SharedDepthStencilRenderBuffer; }
18namespace osc { class Texture2D; }
19
20// rendering functions
21//
22// these perform the necessary backend steps to get something useful done
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& = {});
29
30 // Blits the `Texture` to the `RenderTexture`.
31 void blit(
32 const Texture2D&,
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.
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.
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
75 const Texture2D&,
76 const Rect&
77 );
78
79 // copy: copy a GPU texture to a (potentially, CPU-accessible) texture
80
82 const RenderTexture&,
84 );
85
87 const RenderTexture&,
88 Texture2D&,
90 );
91
93 const RenderTexture&,
94 Cubemap&,
95 size_t mipmap_level
96 );
97}
Definition camera.h:21
Definition cubemap.h:29
Definition flags.h:20
Definition material.h:21
Definition rect.h:17
Definition render_queue.h:27
Definition render_target.h:14
Definition render_texture.h:18
Definition shared_depth_stencil_render_buffer.h:49
Definition texture2d.h:22
Definition graphics.h:24
void copy_texture(const RenderTexture &, Texture2D &)
void render_to_main_window(const RenderQueue &, const Camera &, const RenderPassConfig &={})
void blit_to_main_window(const RenderTexture &render_texture, std::optional< Rect > destination_screen_rect=std::nullopt, BlitFlags={})
void render_to(RenderTexture &, const RenderQueue &, const Camera &, const RenderPassConfig &={})
void blit(const Texture2D &, RenderTexture &)
Definition custom_decoration_generator.h:5
CubemapFace
Definition cubemap_face.h:5
Represents the top-level configuration options for a single render pass.
Definition render_pass_config.h:12