Kore
Loading...
Searching...
No Matches
rendertarget.h File Reference

Provides functions for handling render-targets. More...

#include <kinc/global.h>
#include <kinc/backend/graphics4/rendertarget.h>
#include "textureunit.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  kinc_g4_render_target

Typedefs

typedef enum kinc_g4_render_target_format kinc_g4_render_target_format_t
typedef struct kinc_g4_render_target kinc_g4_render_target_t

Enumerations

enum  kinc_g4_render_target_format {
  KINC_G4_RENDER_TARGET_FORMAT_32BIT , KINC_G4_RENDER_TARGET_FORMAT_64BIT_FLOAT , KINC_G4_RENDER_TARGET_FORMAT_32BIT_RED_FLOAT , KINC_G4_RENDER_TARGET_FORMAT_128BIT_FLOAT ,
  KINC_G4_RENDER_TARGET_FORMAT_16BIT_DEPTH , KINC_G4_RENDER_TARGET_FORMAT_8BIT_RED , KINC_G4_RENDER_TARGET_FORMAT_16BIT_RED_FLOAT , KINC_G4_RENDER_TARGET_FORMAT_64BIT_INTEGER
}

Functions

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.
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 regular render-target. The contents of the render-target are undefined.
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.
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-sampled cube-map. The contents of the render-target are undefined.
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_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_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_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_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_generate_mipmaps (kinc_g4_render_target_t *renderTarget, int levels)
 Generates the mipmap-chain for a render-target.

Detailed Description

Provides functions for handling render-targets.

Function Documentation

◆ kinc_g4_render_target_destroy()

KINC_FUNC void kinc_g4_render_target_destroy ( kinc_g4_render_target_t * renderTarget)

Deallocates and destroys a render-target.

Parameters
renderTargetThe render-target to destroy

◆ kinc_g4_render_target_generate_mipmaps()

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.

Parameters
renderTargetThe render-target to create the mipmaps for
levelsThe number of mipmap-levels to generate

◆ kinc_g4_render_target_get_pixels()

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.

Parameters
renderTargetThe render-target to copy the color-data from
dataA pointer to where the data will be copied to

◆ kinc_g4_render_target_init()

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.

Parameters
renderTarget
width
height
format
depthBufferBits
stencilBufferBits

◆ kinc_g4_render_target_init_cube()

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.

Parameters
renderTarget
cubeMapSize
format
depthBufferBits
stencilBufferBits

◆ kinc_g4_render_target_init_cube_with_multisampling()

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-sampled cube-map. The contents of the render-target are undefined.

Parameters
renderTarget
cubeMapSize
format
depthBufferBits
stencilBufferBits
samples_per_pixel

◆ kinc_g4_render_target_init_with_multisampling()

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 regular render-target. The contents of the render-target are undefined.

Parameters
renderTarget
width
height
format
depthBufferBits
stencilBufferBits
samples_per_pixel

◆ kinc_g4_render_target_set_depth_stencil_from()

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.

Parameters
renderTargetThe render-target to copy the data into
sourceThe render-target from which to copy the data
Returns

◆ kinc_g4_render_target_use_color_as_texture()

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.

Parameters
renderTargetThe render-target to use
unitThe texture-unit to assign the render-target to

◆ kinc_g4_render_target_use_depth_as_texture()

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.

Parameters
renderTargetThe render-target to use
unitThe texture-unit to assign the render-target to