Kohi Game Engine
render_type_utils.h File Reference

Go to the source code of this file.

Functions

KAPI const char * texture_repeat_to_string (texture_repeat repeat)
 Returns the string representation of the given texture repeat. More...
 
KAPI texture_repeat string_to_texture_repeat (const char *str)
 Converts the given string into a texture repeat. Case-insensitive. More...
 
KAPI const char * texture_filter_mode_to_string (texture_filter filter)
 Returns the string representation of the given texture filter. More...
 
KAPI texture_filter string_to_texture_filter_mode (const char *str)
 Converts the given string into a texture filter. Case-insensitive. More...
 
KAPI const char * texture_channel_to_string (texture_channel channel)
 
KAPI texture_channel string_to_texture_channel (const char *str)
 
KAPI const char * shader_attribute_type_to_string (shader_attribute_type type)
 Returns the string representation of the given shader attribute type. More...
 
KAPI shader_attribute_type string_to_shader_attribute_type (const char *str)
 Converts the given string into a shader attribute type. Case-insensitive. More...
 
KAPI const char * shader_stage_to_string (shader_stage stage)
 Returns the string representation of the given shader stage. More...
 
KAPI shader_stage string_to_shader_stage (const char *str)
 Converts the given string into a shader stage. Case-insensitive. More...
 
KAPI const char * face_cull_mode_to_string (face_cull_mode mode)
 Returns the string representation of the given cull mode. More...
 
KAPI face_cull_mode string_to_face_cull_mode (const char *str)
 Converts the given string to a face cull mode. More...
 
KAPI const char * topology_type_to_string (primitive_topology_type_bits type)
 Returns the string representation of the given primitive topology type. More...
 
KAPI primitive_topology_type_bits string_to_topology_type (const char *str)
 Converts the given string to a primitive topology type. More...
 
KAPI u16 size_from_shader_attribute_type (shader_attribute_type type)
 Returns the size in bytes of the attribute type. More...
 
KAPI b8 pixel_data_has_transparency (const void *pixels, u32 pixel_count, kpixel_format format)
 Determines if any pixel has an alpha less than opaque. More...
 
KAPI u8 channel_count_from_pixel_format (kpixel_format format)
 
KAPI const char * string_from_kpixel_format (kpixel_format format)
 Returns the string representation of the given kpixel_format. More...
 
KAPI kpixel_format string_to_kpixel_format (const char *str)
 Converts the given string into a kpixel_format. Case-insensitive. More...
 
KAPI u8 calculate_mip_levels_from_dimension (u32 width, u32 height)
 Calculate mip levels based on the given dimensions. More...
 
KAPI const char * kmaterial_type_to_string (kmaterial_type type)
 Returns the string representation of the given material type. More...
 
KAPI kmaterial_type string_to_kmaterial_type (const char *str)
 Converts the given string into a material type. Case-insensitive. More...
 
KAPI const char * kmaterial_model_to_string (kmaterial_model model)
 Returns the string representation of the given material model. More...
 
KAPI kmaterial_model string_to_kmaterial_model (const char *str)
 Converts the given string into a material model. Case-insensitive. More...
 
KAPI mat4 generate_projection_matrix (rect_2di rect, f32 fov, f32 near_clip, f32 far_clip, projection_matrix_type matrix_type)
 
KAPI shader_binding_type shader_binding_type_from_string (const char *str)
 
KAPI const char * shader_binding_type_to_string (shader_binding_type type)
 
KAPI ktexture_type ktexture_type_from_string (const char *str)
 
KAPI const char * ktexture_type_to_string (ktexture_type type)
 
KAPI shader_sampler_type shader_sampler_type_from_string (const char *str)
 
KAPI const char * shader_sampler_type_to_string (shader_sampler_type type)
 

Function Documentation

◆ calculate_mip_levels_from_dimension()

KAPI u8 calculate_mip_levels_from_dimension ( u32  width,
u32  height 
)

Calculate mip levels based on the given dimensions.

The number of mip levels is calculated by first taking the largest dimension (either width or height), figuring out how many times that number can be divided by 2, taking the floor value (rounding down) and adding 1 to represent the base level. This always leaves a value of at least 1.

Parameters
widthThe image width.
heightThe image height.
Returns
The number of mip levels.

◆ channel_count_from_pixel_format()

KAPI u8 channel_count_from_pixel_format ( kpixel_format  format)

Returns the number of channels for the given pixel format.

Parameters
formatThe pixel format.
Returns
The number of channels for the format, or INVALID_ID_U8 if format is invalid/unknown.

◆ face_cull_mode_to_string()

KAPI const char* face_cull_mode_to_string ( face_cull_mode  mode)

Returns the string representation of the given cull mode.

◆ generate_projection_matrix()

KAPI mat4 generate_projection_matrix ( rect_2di  rect,
f32  fov,
f32  near_clip,
f32  far_clip,
projection_matrix_type  matrix_type 
)

◆ kmaterial_model_to_string()

KAPI const char* kmaterial_model_to_string ( kmaterial_model  model)

Returns the string representation of the given material model.

◆ kmaterial_type_to_string()

KAPI const char* kmaterial_type_to_string ( kmaterial_type  type)

Returns the string representation of the given material type.

◆ ktexture_type_from_string()

KAPI ktexture_type ktexture_type_from_string ( const char *  str)

◆ ktexture_type_to_string()

KAPI const char* ktexture_type_to_string ( ktexture_type  type)

◆ pixel_data_has_transparency()

KAPI b8 pixel_data_has_transparency ( const void *  pixels,
u32  pixel_count,
kpixel_format  format 
)

Determines if any pixel has an alpha less than opaque.

Parameters
pixelsA constant array of pixel data. Channel size determined by format. @pixel_count The number of pixels in the array.
formatThe pixel format.
Returns
True if any pixel is even slightly transparent; otherwise false.

◆ shader_attribute_type_to_string()

KAPI const char* shader_attribute_type_to_string ( shader_attribute_type  type)

Returns the string representation of the given shader attribute type.

◆ shader_binding_type_from_string()

KAPI shader_binding_type shader_binding_type_from_string ( const char *  str)

◆ shader_binding_type_to_string()

KAPI const char* shader_binding_type_to_string ( shader_binding_type  type)

◆ shader_sampler_type_from_string()

KAPI shader_sampler_type shader_sampler_type_from_string ( const char *  str)

◆ shader_sampler_type_to_string()

KAPI const char* shader_sampler_type_to_string ( shader_sampler_type  type)

◆ shader_stage_to_string()

KAPI const char* shader_stage_to_string ( shader_stage  stage)

Returns the string representation of the given shader stage.

◆ size_from_shader_attribute_type()

KAPI u16 size_from_shader_attribute_type ( shader_attribute_type  type)

Returns the size in bytes of the attribute type.

◆ string_from_kpixel_format()

KAPI const char* string_from_kpixel_format ( kpixel_format  format)

Returns the string representation of the given kpixel_format.

◆ string_to_face_cull_mode()

KAPI face_cull_mode string_to_face_cull_mode ( const char *  str)

Converts the given string to a face cull mode.

◆ string_to_kmaterial_model()

KAPI kmaterial_model string_to_kmaterial_model ( const char *  str)

Converts the given string into a material model. Case-insensitive.

◆ string_to_kmaterial_type()

KAPI kmaterial_type string_to_kmaterial_type ( const char *  str)

Converts the given string into a material type. Case-insensitive.

◆ string_to_kpixel_format()

KAPI kpixel_format string_to_kpixel_format ( const char *  str)

Converts the given string into a kpixel_format. Case-insensitive.

◆ string_to_shader_attribute_type()

KAPI shader_attribute_type string_to_shader_attribute_type ( const char *  str)

Converts the given string into a shader attribute type. Case-insensitive.

◆ string_to_shader_stage()

KAPI shader_stage string_to_shader_stage ( const char *  str)

Converts the given string into a shader stage. Case-insensitive.

◆ string_to_texture_channel()

KAPI texture_channel string_to_texture_channel ( const char *  str)

◆ string_to_texture_filter_mode()

KAPI texture_filter string_to_texture_filter_mode ( const char *  str)

Converts the given string into a texture filter. Case-insensitive.

◆ string_to_texture_repeat()

KAPI texture_repeat string_to_texture_repeat ( const char *  str)

Converts the given string into a texture repeat. Case-insensitive.

◆ string_to_topology_type()

KAPI primitive_topology_type_bits string_to_topology_type ( const char *  str)

Converts the given string to a primitive topology type.

◆ texture_channel_to_string()

KAPI const char* texture_channel_to_string ( texture_channel  channel)

◆ texture_filter_mode_to_string()

KAPI const char* texture_filter_mode_to_string ( texture_filter  filter)

Returns the string representation of the given texture filter.

◆ texture_repeat_to_string()

KAPI const char* texture_repeat_to_string ( texture_repeat  repeat)

Returns the string representation of the given texture repeat.

◆ topology_type_to_string()

KAPI const char* topology_type_to_string ( primitive_topology_type_bits  type)

Returns the string representation of the given primitive topology type.