Kohi Game Engine
render_view Struct Reference

A render view instance, responsible for the generation of view packets based on internal logic and given config. More...

#include <renderer_types.h>

Data Fields

const char * name
 The name of the view. More...
 
u16 width
 The current width of this view. More...
 
u16 height
 The current height of this view. More...
 
u8 renderpass_count
 The number of renderpasses used by this view. More...
 
renderpasspasses
 An array of renderpasses used by this view. More...
 
const char * custom_shader_name
 The name of the custom shader used by this view, if there is one. More...
 
void * internal_data
 The internal, view-specific data for this view. More...
 
b8(* on_registered )(struct render_view *self)
 A pointer to a function to be called when this view is registered with the view system. More...
 
void(* on_destroy )(struct render_view *self)
 A pointer to a function to be called when this view is destroyed. More...
 
void(* on_resize )(struct render_view *self, u32 width, u32 height)
 A pointer to a function to be called when the owner of this view (such as the window) is resized. More...
 
b8(* on_packet_build )(const struct render_view *self, struct frame_data *p_frame_data, struct viewport *v, struct camera *c, void *data, struct render_view_packet *out_packet)
 Builds a render view packet using the provided view and meshes. More...
 
void(* on_packet_destroy )(const struct render_view *self, struct render_view_packet *packet)
 Destroys a render view packet. More...
 
b8(* on_render )(const struct render_view *self, const struct render_view_packet *packet, struct frame_data *p_frame_data)
 Uses the given view and packet to render the contents therein. More...
 
b8(* attachment_target_regenerate )(struct render_view *self, u32 pass_index, struct render_target_attachment *attachment)
 Regenerates the resources for the given attachment at the provided pass index. More...
 

Detailed Description

A render view instance, responsible for the generation of view packets based on internal logic and given config.

Field Documentation

◆ attachment_target_regenerate

b8(* attachment_target_regenerate) (struct render_view *self, u32 pass_index, struct render_target_attachment *attachment)

Regenerates the resources for the given attachment at the provided pass index.

Parameters
selfA pointer to the view to use.
pass_indexThe index of the renderpass to generate for.
attachmentA pointer to the attachment whose resources are to be regenerated.
Returns
True on success; otherwise false.

◆ custom_shader_name

const char* custom_shader_name

The name of the custom shader used by this view, if there is one.

◆ height

u16 height

The current height of this view.

◆ internal_data

void* internal_data

The internal, view-specific data for this view.

◆ name

const char* name

The name of the view.

◆ on_destroy

void(* on_destroy) (struct render_view *self)

A pointer to a function to be called when this view is destroyed.

Parameters
selfA pointer to the view being destroyed.

◆ on_packet_build

b8(* on_packet_build) (const struct render_view *self, struct frame_data *p_frame_data, struct viewport *v, struct camera *c, void *data, struct render_view_packet *out_packet)

Builds a render view packet using the provided view and meshes.

Parameters
selfA pointer to the view to use.
frame_dataA pointer to the current frame's data.
vA pointer to the viewport to be used.
cA pointer to the camera to be used.
dataFreeform data used to build the packet.
out_packetA pointer to hold the generated packet.
Returns
True on success; otherwise false.

◆ on_packet_destroy

void(* on_packet_destroy) (const struct render_view *self, struct render_view_packet *packet)

Destroys a render view packet.

Parameters
selfA pointer to the view to use.
packetA pointer to the packet to be destroyed.

◆ on_registered

b8(* on_registered) (struct render_view *self)

A pointer to a function to be called when this view is registered with the view system.

Parameters
selfA pointer to the view being registered.
Returns
True on success; otherwise false.

◆ on_render

b8(* on_render) (const struct render_view *self, const struct render_view_packet *packet, struct frame_data *p_frame_data)

Uses the given view and packet to render the contents therein.

Parameters
selfA pointer to the view to use.
packetA pointer to the packet whose data is to be rendered.
p_frame_dataA pointer to the current frame's data.
Returns
True on success; otherwise false.

◆ on_resize

void(* on_resize) (struct render_view *self, u32 width, u32 height)

A pointer to a function to be called when the owner of this view (such as the window) is resized.

Parameters
selfA pointer to the view being resized.
widthThe new width in pixels.
widthThe new height in pixels.

◆ passes

renderpass* passes

An array of renderpasses used by this view.

◆ renderpass_count

u8 renderpass_count

The number of renderpasses used by this view.

◆ width

u16 width

The current width of this view.


The documentation for this struct was generated from the following file: