Kohi Game Engine
render_type_utils.h File Reference

Go to the source code of this file.

Functions

KAPI b8 uniform_type_is_sampler (shader_uniform_type type)
 Indicates if the given shader uniform type is a sampler. More...
 
KAPI b8 uniform_type_is_texture (shader_uniform_type type)
 Indicates if the given shader uniform type is a texture. More...
 
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_uniform_type_to_string (shader_uniform_type type)
 Returns the string representation of the given shader uniform type. More...
 
KAPI shader_uniform_type string_to_shader_uniform_type (const char *str)
 Converts the given string into a shader uniform type. Case-insensitive. More...
 
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 * shader_update_frequency_to_string (shader_update_frequency frequency)
 Returns the string representation of the given shader update frequency. More...
 
KAPI shader_update_frequency string_to_shader_update_frequency (const char *str)
 Converts the given string into a shader update frequency. 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 u16 size_from_shader_uniform_type (shader_uniform_type type)
 Returns the size in bytes of the uniform 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 b8 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...
 

Function Documentation

◆ calculate_mip_levels_from_dimension()

KAPI b8 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.

◆ 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.

◆ 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_stage_to_string()

KAPI const char* shader_stage_to_string ( shader_stage  stage)

Returns the string representation of the given shader stage.

◆ shader_uniform_type_to_string()

KAPI const char* shader_uniform_type_to_string ( shader_uniform_type  type)

Returns the string representation of the given shader uniform type.

◆ shader_update_frequency_to_string()

KAPI const char* shader_update_frequency_to_string ( shader_update_frequency  frequency)

Returns the string representation of the given shader update frequency.

◆ 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.

◆ size_from_shader_uniform_type()

KAPI u16 size_from_shader_uniform_type ( shader_uniform_type  type)

Returns the size in bytes of the uniform 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_shader_uniform_type()

KAPI shader_uniform_type string_to_shader_uniform_type ( const char *  str)

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

◆ string_to_shader_update_frequency()

KAPI shader_update_frequency string_to_shader_update_frequency ( const char *  str)

Converts the given string into a shader update frequency. 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.

◆ uniform_type_is_sampler()

KAPI b8 uniform_type_is_sampler ( shader_uniform_type  type)

Indicates if the given shader uniform type is a sampler.

Parameters
Thetype to examine.
Returns
True if a sampler; otherwise false.

◆ uniform_type_is_texture()

KAPI b8 uniform_type_is_texture ( shader_uniform_type  type)

Indicates if the given shader uniform type is a texture.

Parameters
Thetype to examine.
Returns
True if a texture; otherwise false.