Kore
Loading...
Searching...
No Matches
rendertarget.h
Go to the documentation of this file.
1#pragma once
2
3#include <kinc/global.h>
4
5#include <kinc/backend/graphics4/rendertarget.h>
6
7#include "textureunit.h"
8
9#include <stdint.h>
10
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19typedef enum kinc_g4_render_target_format {
20 KINC_G4_RENDER_TARGET_FORMAT_32BIT,
21 KINC_G4_RENDER_TARGET_FORMAT_64BIT_FLOAT,
22 KINC_G4_RENDER_TARGET_FORMAT_32BIT_RED_FLOAT,
23 KINC_G4_RENDER_TARGET_FORMAT_128BIT_FLOAT,
24 KINC_G4_RENDER_TARGET_FORMAT_16BIT_DEPTH,
25 KINC_G4_RENDER_TARGET_FORMAT_8BIT_RED,
26 KINC_G4_RENDER_TARGET_FORMAT_16BIT_RED_FLOAT,
27 KINC_G4_RENDER_TARGET_FORMAT_64BIT_INTEGER
28} kinc_g4_render_target_format_t;
29
30typedef struct kinc_g4_render_target {
31 int width;
32 int height;
33 int texWidth;
34 int texHeight;
35 bool isCubeMap;
36 bool isDepthAttachment;
37
38 kinc_g4_render_target_impl_t impl;
39} kinc_g4_render_target_t;
40
50KINC_FUNC void kinc_g4_render_target_init(kinc_g4_render_target_t *renderTarget, int width, int height, kinc_g4_render_target_format_t format,
51 int depthBufferBits, int stencilBufferBits);
52
64KINC_FUNC void kinc_g4_render_target_init_with_multisampling(kinc_g4_render_target_t *renderTarget, int width, int height,
65 kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits,
66 int samples_per_pixel);
67
76KINC_FUNC void kinc_g4_render_target_init_cube(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format,
77 int depthBufferBits, int stencilBufferBits);
78
89KINC_FUNC void kinc_g4_render_target_init_cube_with_multisampling(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format,
90 int depthBufferBits, int stencilBufferBits, int samples_per_pixel);
91
96KINC_FUNC void kinc_g4_render_target_destroy(kinc_g4_render_target_t *renderTarget);
97
103KINC_FUNC void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit);
104
110KINC_FUNC void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit);
111
118KINC_FUNC void kinc_g4_render_target_set_depth_stencil_from(kinc_g4_render_target_t *renderTarget, kinc_g4_render_target_t *source);
119
125KINC_FUNC void kinc_g4_render_target_get_pixels(kinc_g4_render_target_t *renderTarget, uint8_t *data);
126
132KINC_FUNC void kinc_g4_render_target_generate_mipmaps(kinc_g4_render_target_t *renderTarget, int levels);
133
134#ifdef __cplusplus
135}
136#endif
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
KINC_FUNC void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit)
Uses the depth-component of a render-target as a texture.
KINC_FUNC void kinc_g4_render_target_init(kinc_g4_render_target_t *renderTarget, int width, int height, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits)
Allocates and initializes a regular render-target. The contents of the render-target are undefined.
Definition rendertarget.c.h:3
KINC_FUNC void kinc_g4_render_target_set_depth_stencil_from(kinc_g4_render_target_t *renderTarget, kinc_g4_render_target_t *source)
Copies the depth and stencil-components of one render-target into another one.
KINC_FUNC void kinc_g4_render_target_destroy(kinc_g4_render_target_t *renderTarget)
Deallocates and destroys a render-target.
KINC_FUNC void kinc_g4_render_target_init_cube_with_multisampling(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits, int samples_per_pixel)
Allocates and initializes a multi-sampled render-target-cube-map. Can fall back to a non-multi-sample...
KINC_FUNC void kinc_g4_render_target_generate_mipmaps(kinc_g4_render_target_t *renderTarget, int levels)
Generates the mipmap-chain for a render-target.
KINC_FUNC void kinc_g4_render_target_get_pixels(kinc_g4_render_target_t *renderTarget, uint8_t *data)
Copies out the color-data from a render-target. Beware, this is very slow.
KINC_FUNC void kinc_g4_render_target_init_with_multisampling(kinc_g4_render_target_t *renderTarget, int width, int height, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits, int samples_per_pixel)
Allocates and initializes a multi-sampled render-target if possible - otherwise it falls back to a re...
KINC_FUNC void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit)
Uses the color-component of a render-target as a texture.
KINC_FUNC void kinc_g4_render_target_init_cube(kinc_g4_render_target_t *renderTarget, int cubeMapSize, kinc_g4_render_target_format_t format, int depthBufferBits, int stencilBufferBits)
Allocates and initializes a render-target-cube-map. The contents of the render-target are undefined.
Definition rendertarget.c.h:8
Provides a texture-unit-struct which is used for setting textures in a shader.
Definition rendertarget.h:30