openwallpaper
Loading...
Searching...
No Matches
openwallpaper.h File Reference

Data Structures

struct  ow_vertex_buffer_id
struct  ow_index_buffer_id
struct  ow_texture_id
struct  ow_sampler_id
struct  ow_vertex_shader_id
struct  ow_fragment_shader_id
struct  ow_pipeline_id
struct  ow_render_pass_info
struct  ow_texture_info
struct  ow_texture_update_destination
struct  ow_sampler_info
struct  ow_vertex_binding_info
struct  ow_vertex_attribute
struct  ow_blend_mode
struct  ow_pipeline_info
struct  ow_texture_binding
struct  ow_bindings_info

Enumerations

enum  ow_msaa_samples { OW_MSAA_OFF , OW_MSAA_2X , OW_MSAA_4X , OW_MSAA_8X }
enum  ow_texture_format {
  OW_TEXTURE_SWAPCHAIN , OW_TEXTURE_RGBA8_UNORM , OW_TEXTURE_RGBA8_UNORM_SRGB , OW_TEXTURE_RGBA16_FLOAT ,
  OW_TEXTURE_R8_UNORM , OW_TEXTURE_DEPTH16_UNORM
}
enum  ow_wrap_mode { OW_WRAP_CLAMP , OW_WRAP_REPEAT , OW_WRAP_MIRROR }
enum  ow_filter_mode { OW_FILTER_NEAREST , OW_FILTER_LINEAR }
enum  ow_buffer_type { OW_BUFFER_VERTEX , OW_BUFFER_INDEX16 , OW_BUFFER_INDEX32 }
enum  ow_attribute_type {
  OW_ATTRIBUTE_INT , OW_ATTRIBUTE_INT2 , OW_ATTRIBUTE_INT3 , OW_ATTRIBUTE_INT4 ,
  OW_ATTRIBUTE_UINT , OW_ATTRIBUTE_UINT2 , OW_ATTRIBUTE_UINT3 , OW_ATTRIBUTE_UINT4 ,
  OW_ATTRIBUTE_FLOAT , OW_ATTRIBUTE_FLOAT2 , OW_ATTRIBUTE_FLOAT3 , OW_ATTRIBUTE_FLOAT4 ,
  OW_ATTRIBUTE_BYTE2 , OW_ATTRIBUTE_BYTE4 , OW_ATTRIBUTE_UBYTE2 , OW_ATTRIBUTE_UBYTE4 ,
  OW_ATTRIBUTE_UBYTE2_NORM , OW_ATTRIBUTE_UBYTE4_NORM , OW_ATTRIBUTE_SHORT2 , OW_ATTRIBUTE_SHORT4 ,
  OW_ATTRIBUTE_USHORT2 , OW_ATTRIBUTE_USHORT4 , OW_ATTRIBUTE_SHORT2_NORM , OW_ATTRIBUTE_SHORT4_NORM ,
  OW_ATTRIBUTE_USHORT2_NORM , OW_ATTRIBUTE_USHORT4_NORM , OW_ATTRIBUTE_HALF2 , OW_ATTRIBUTE_HALF4
}
enum  ow_blend_factor {
  OW_BLENDFACTOR_ZERO , OW_BLENDFACTOR_ONE , OW_BLENDFACTOR_SRC_COLOR , OW_BLENDFACTOR_ONE_MINUS_SRC_COLOR ,
  OW_BLENDFACTOR_DST_COLOR , OW_BLENDFACTOR_ONE_MINUS_DST_COLOR , OW_BLENDFACTOR_SRC_ALPHA , OW_BLENDFACTOR_ONE_MINUS_SRC_ALPHA ,
  OW_BLENDFACTOR_DST_ALPHA , OW_BLENDFACTOR_ONE_MINUS_DST_ALPHA
}
enum  ow_blend_operator {
  OW_BLENDOP_ADD , OW_BLENDOP_SUBTRACT , OW_BLENDOP_REVERSE_SUBTRACT , OW_BLENDOP_MIN ,
  OW_BLENDOP_MAX
}
enum  ow_depth_test_mode {
  OW_DEPTHTEST_DISABLED , OW_DEPTHTEST_ALWAYS , OW_DEPTHTEST_LESS , OW_DEPTHTEST_LESS_EQUAL ,
  OW_DEPTHTEST_GREATER , OW_DEPTHTEST_GREATER_EQUAL , OW_DEPTHTEST_EQUAL , OW_DEPTHTEST_NOT_EQUAL
}
enum  ow_topology { OW_TOPOLOGY_TRIANGLES , OW_TOPOLOGY_TRIANGLES_STRIP , OW_TOPOLOGY_LINES , OW_TOPOLOGY_LINES_STRIP }
enum  ow_cull_mode { OW_CULL_NONE , OW_CULL_FRONT , OW_CULL_BACK }
enum  ow_mouse_button {
  OW_BUTTON_LEFT = (1 << 0) , OW_BUTTON_RIGHT = (1 << 1) , OW_BUTTON_MIDDLE = (1 << 2) , OW_BUTTON_X1 = (1 << 3) ,
  OW_BUTTON_X2 = (1 << 4)
}

Functions

void init ()
void update (float delta)
void ow_load_file (const char *path, uint8_t **data, size_t *size)
void ow_begin_copy_pass ()
void ow_end_copy_pass ()
void ow_begin_render_pass (const ow_render_pass_info *info)
void ow_end_render_pass ()
ow_vertex_buffer_id ow_create_vertex_buffer (uint32_t size)
ow_index_buffer_id ow_create_index_buffer (uint32_t size, bool wide)
void ow_update_vertex_buffer (ow_vertex_buffer_id buffer, uint32_t offset, const void *data, uint32_t size)
void ow_update_index_buffer (ow_index_buffer_id buffer, uint32_t offset, const void *data, uint32_t size)
ow_texture_id ow_create_texture (const ow_texture_info *info)
ow_texture_id ow_create_texture_from_image (const char *path, const ow_texture_info *info)
void ow_update_texture (const void *data, uint32_t pixels_per_row, const ow_texture_update_destination *dest)
void ow_generate_mipmaps (ow_texture_id texture)
ow_sampler_id ow_create_sampler (const ow_sampler_info *info)
ow_vertex_shader_id ow_create_vertex_shader_from_bytecode (const uint8_t *bytecode, size_t size)
ow_vertex_shader_id ow_create_vertex_shader_from_file (const char *path)
ow_fragment_shader_id ow_create_fragment_shader_from_bytecode (const uint8_t *bytecode, size_t size)
ow_fragment_shader_id ow_create_fragment_shader_from_file (const char *path)
ow_pipeline_id ow_create_pipeline (const ow_pipeline_info *info)
void ow_push_vertex_uniform_data (uint32_t slot, const void *data, uint32_t size)
void ow_push_fragment_uniform_data (uint32_t slot, const void *data, uint32_t size)
void ow_render_geometry (ow_pipeline_id pipeline, const ow_bindings_info *bindings, uint32_t vertex_offset, uint32_t vertex_count, uint32_t instance_count)
void ow_render_geometry_indexed (ow_pipeline_id pipeline, const ow_bindings_info *bindings, uint32_t index_offset, uint32_t index_count, uint32_t vertex_offset, uint32_t instance_count)
void ow_get_screen_size (uint32_t *width, uint32_t *height)
uint32_t ow_get_mouse_state (float *x, float *y)
void ow_get_audio_spectrum (float *data, size_t length)
const char * ow_get_option (const char *name)
void ow_free_vertex_buffer (ow_vertex_buffer_id id)
void ow_free_index_buffer (ow_index_buffer_id id)
void ow_free_texture (ow_texture_id id)
void ow_free_sampler (ow_sampler_id id)
void ow_free_vertex_shader (ow_vertex_shader_id id)
void ow_free_fragment_shader (ow_fragment_shader_id id)
void ow_free_pipeline (ow_pipeline_id id)

Data Structure Documentation

◆ ow_vertex_buffer_id

struct ow_vertex_buffer_id

A handle pointing to host-managed vertex buffer. Existing vertex buffer's id is never zero, this value is reserved to act as non-existent object.

See also
ow_free_vertex_buffer
Data Fields
uint32_t id

◆ ow_index_buffer_id

struct ow_index_buffer_id

A handle pointing to host-managed index buffer. Existing index buffer's id is never zero, this value is reserved to act as non-existent object.

See also
ow_free_index_buffer
Data Fields
uint32_t id

◆ ow_texture_id

struct ow_texture_id

A handle pointing to host-managed GPU texture. Existing texture's id is never zero, this value is reserved to act as non-existent object.

See also
ow_free_texture
Data Fields
uint32_t id

◆ ow_sampler_id

struct ow_sampler_id

A handle pointing to host-managed GPU sampler. Existing sampler's id is never zero, this value is reserved to act as non-existent object.

See also
ow_free_sampler
Data Fields
uint32_t id

◆ ow_vertex_shader_id

struct ow_vertex_shader_id

A handle pointing to host-managed vertex shader. Existing vertex shader's id is never zero, this value is reserved to act as non-existent object.

See also
ow_free_vertex_shader
Data Fields
uint32_t id

◆ ow_fragment_shader_id

struct ow_fragment_shader_id

A handle pointing to host-managed fragment shader. Existing fragment shader's id is never zero, this value is reserved to act as non-existent object.

See also
ow_free_fragment_shader
Data Fields
uint32_t id

◆ ow_pipeline_id

struct ow_pipeline_id

A handle pointing to host-managed GPU pipeline object. Existing pipeline's id is never zero, this value is reserved to act as non-existent object.

See also
ow_free_pipeline
Data Fields
uint32_t id

◆ ow_render_pass_info

struct ow_render_pass_info

A structure specifying render pass parameters.

Data Fields
bool clear_color

If true, render pass will clear color target with clear_color_rgba. If false, texture target keeps its previous data, screen target data is undefined

float clear_color_rgba[4] RGBA color to clear color target with.
bool clear_depth

If true, render pass will clear depth target with clear_depth_value. If false, target keeps its previous data

float clear_depth_value Value to clear depth target with.
ow_texture_id color_target ID of color target texture. Setting it to 0 means render target is screen.
ow_texture_id depth_target ID of depth target texture.

◆ ow_texture_info

struct ow_texture_info

A structure specifying texture parameters.

Data Fields
ow_texture_format format Pixel format of texture.
uint32_t height Height of texture in pixels.
uint32_t mip_levels Number of mip levels.
bool render_target If true, texture can be used as render target.
ow_msaa_samples samples Number of MSAA samples.
uint32_t width Width of texture in pixels.

◆ ow_texture_update_destination

struct ow_texture_update_destination

A structure specifying rectangular texture fragment to update in ow_update_texture.

Data Fields
uint32_t h Height of destination rectangle.
uint32_t mip_level Mip level to update, must be less than texture's mip_levels.
ow_texture_id texture ID of texture to update.
uint32_t w Width of destination rectangle.
uint32_t x Left offset of destination rectangle.
uint32_t y Top offset of destination rectangle.

◆ ow_sampler_info

struct ow_sampler_info

A structure specifying sampler parameters.

Data Fields
uint32_t anisotropy Anisotropy level, clamped to the maximum supported value.
ow_filter_mode mag_filter Magnification filter.
ow_filter_mode min_filter Minification filter.
ow_filter_mode mip_filter Mipmap filter.
ow_wrap_mode wrap_x Wrap mode for X axis.
ow_wrap_mode wrap_y Wrap mode for Y axis.

◆ ow_vertex_binding_info

struct ow_vertex_binding_info

A structure specifying vertex buffer binding info.

Data Fields
bool per_instance If true, this buffer is used per instance, otherwise it is bound per vertex.
uint32_t slot The binding slot of the vertex buffer.
size_t stride

The stride of the vertex buffer in bytes (the size of a single element + the offset between elements)

◆ ow_vertex_attribute

struct ow_vertex_attribute

A structure specifying vertex attribute.

Data Fields
uint32_t location The location of the attribute in vertex shader.
size_t offset The offset of the attribute in bytes from the start of the vertex element.
uint32_t slot The binding slot of the associated vertex buffer.
ow_attribute_type type The type of the attribute.

◆ ow_blend_mode

struct ow_blend_mode

A structure specifying blend mode of a color target.

Data Fields
ow_blend_operator alpha_operator Alpha blending operator.
ow_blend_operator color_operator Color blending operator.
ow_blend_factor dst_alpha_factor Value to be multiplied by the destination alpha value.
ow_blend_factor dst_color_factor Value to be multiplied by the destination RGB value.
bool enabled Whether blending is enabled.
ow_blend_factor src_alpha_factor Value to be multiplied by the source alpha value.
ow_blend_factor src_color_factor Value to be multiplied by the source RGB value.

◆ ow_pipeline_info

struct ow_pipeline_info

A structure specifying pipeline parameters.

Data Fields
ow_blend_mode blend_mode The blend mode to use.
ow_texture_format color_target_format The pixel format of the color target texture.
ow_cull_mode cull_mode The cull mode to use.
ow_depth_test_mode depth_test_mode The depth test mode to use.
bool depth_write If true, depth test will update the depth target texture.
ow_fragment_shader_id fragment_shader ID of fragment shader to use.
ow_topology topology The vertex topology to use.
const ow_vertex_attribute * vertex_attributes A pointer to an array of vertex attributes.
uint32_t vertex_attributes_count The number of vertex attributes in the array.
const ow_vertex_binding_info * vertex_bindings A pointer to an array of vertex buffer bindings.
uint32_t vertex_bindings_count The number of vertex buffer bindings in the array.
ow_vertex_shader_id vertex_shader ID of vertex shader to use.

◆ ow_texture_binding

struct ow_texture_binding

A structure specifying a texture binding.

Data Fields
ow_sampler_id sampler ID of the sampler to use for this texture.
uint32_t slot The slot of the texture in shader.
ow_texture_id texture ID of the texture to bind.

◆ ow_bindings_info

struct ow_bindings_info

A structure specifying bindings for draw call.

Data Fields
ow_index_buffer_id index_buffer ID of the index buffer.
const ow_texture_binding * texture_bindings A pointer to an array of texture bindings.
uint32_t texture_bindings_count The number of texture bindings in the array.
const ow_vertex_buffer_id * vertex_buffers A pointer to an array of vertex buffer IDs.
uint32_t vertex_buffers_count The number of vertex buffer IDs in the array.

Enumeration Type Documentation

◆ ow_attribute_type

Enumerator
OW_ATTRIBUTE_INT 
OW_ATTRIBUTE_INT2 
OW_ATTRIBUTE_INT3 
OW_ATTRIBUTE_INT4 
OW_ATTRIBUTE_UINT 
OW_ATTRIBUTE_UINT2 
OW_ATTRIBUTE_UINT3 
OW_ATTRIBUTE_UINT4 
OW_ATTRIBUTE_FLOAT 
OW_ATTRIBUTE_FLOAT2 
OW_ATTRIBUTE_FLOAT3 
OW_ATTRIBUTE_FLOAT4 
OW_ATTRIBUTE_BYTE2 
OW_ATTRIBUTE_BYTE4 
OW_ATTRIBUTE_UBYTE2 
OW_ATTRIBUTE_UBYTE4 
OW_ATTRIBUTE_UBYTE2_NORM 
OW_ATTRIBUTE_UBYTE4_NORM 
OW_ATTRIBUTE_SHORT2 
OW_ATTRIBUTE_SHORT4 
OW_ATTRIBUTE_USHORT2 
OW_ATTRIBUTE_USHORT4 
OW_ATTRIBUTE_SHORT2_NORM 
OW_ATTRIBUTE_SHORT4_NORM 
OW_ATTRIBUTE_USHORT2_NORM 
OW_ATTRIBUTE_USHORT4_NORM 
OW_ATTRIBUTE_HALF2 
OW_ATTRIBUTE_HALF4 

◆ ow_blend_factor

Enumerator
OW_BLENDFACTOR_ZERO 
OW_BLENDFACTOR_ONE 
OW_BLENDFACTOR_SRC_COLOR 
OW_BLENDFACTOR_ONE_MINUS_SRC_COLOR 
OW_BLENDFACTOR_DST_COLOR 
OW_BLENDFACTOR_ONE_MINUS_DST_COLOR 
OW_BLENDFACTOR_SRC_ALPHA 
OW_BLENDFACTOR_ONE_MINUS_SRC_ALPHA 
OW_BLENDFACTOR_DST_ALPHA 
OW_BLENDFACTOR_ONE_MINUS_DST_ALPHA 

◆ ow_blend_operator

Enumerator
OW_BLENDOP_ADD 
OW_BLENDOP_SUBTRACT 
OW_BLENDOP_REVERSE_SUBTRACT 
OW_BLENDOP_MIN 
OW_BLENDOP_MAX 

◆ ow_buffer_type

Enumerator
OW_BUFFER_VERTEX 
OW_BUFFER_INDEX16 
OW_BUFFER_INDEX32 

◆ ow_cull_mode

Enumerator
OW_CULL_NONE 
OW_CULL_FRONT 
OW_CULL_BACK 

◆ ow_depth_test_mode

Enumerator
OW_DEPTHTEST_DISABLED 
OW_DEPTHTEST_ALWAYS 
OW_DEPTHTEST_LESS 
OW_DEPTHTEST_LESS_EQUAL 
OW_DEPTHTEST_GREATER 
OW_DEPTHTEST_GREATER_EQUAL 
OW_DEPTHTEST_EQUAL 
OW_DEPTHTEST_NOT_EQUAL 

◆ ow_filter_mode

Enumerator
OW_FILTER_NEAREST 
OW_FILTER_LINEAR 

◆ ow_mouse_button

Enumerator
OW_BUTTON_LEFT 
OW_BUTTON_RIGHT 
OW_BUTTON_MIDDLE 
OW_BUTTON_X1 
OW_BUTTON_X2 

◆ ow_msaa_samples

Enumerator
OW_MSAA_OFF 
OW_MSAA_2X 
OW_MSAA_4X 
OW_MSAA_8X 

◆ ow_texture_format

Enumerator
OW_TEXTURE_SWAPCHAIN 
OW_TEXTURE_RGBA8_UNORM 
OW_TEXTURE_RGBA8_UNORM_SRGB 
OW_TEXTURE_RGBA16_FLOAT 
OW_TEXTURE_R8_UNORM 
OW_TEXTURE_DEPTH16_UNORM 

◆ ow_topology

Enumerator
OW_TOPOLOGY_TRIANGLES 
OW_TOPOLOGY_TRIANGLES_STRIP 
OW_TOPOLOGY_LINES 
OW_TOPOLOGY_LINES_STRIP 

◆ ow_wrap_mode

Enumerator
OW_WRAP_CLAMP 
OW_WRAP_REPEAT 
OW_WRAP_MIRROR 

Function Documentation

◆ init()

void init ( )

A user-implemented function that is called once when scene is initializing.

◆ ow_begin_copy_pass()

void ow_begin_copy_pass ( )
extern

Begins a copy pass. Can be called only if no pass is currently active, panics elsewhere.

◆ ow_begin_render_pass()

void ow_begin_render_pass ( const ow_render_pass_info * info)
extern

Begins a render pass. Can be called only if no pass is currently active, panics elsewhere.

Parameters
infoRender pass parameters

◆ ow_create_fragment_shader_from_bytecode()

ow_fragment_shader_id ow_create_fragment_shader_from_bytecode ( const uint8_t * bytecode,
size_t size )
extern

Creates a fragment shader from SPIR-V bytecode.

Parameters
bytecodePointer to the bytecode
sizeSize of the bytecode in bytes
Returns
ID of created fragment shader

◆ ow_create_fragment_shader_from_file()

ow_fragment_shader_id ow_create_fragment_shader_from_file ( const char * path)
extern

Creates a fragment shader from a SPIR-V bytecode file from the scene archive. Panics if file is not found.

Parameters
pathPath to the file to load, absolute in the scene archive. A null-terminated byte string
Returns
ID of created fragment shader

◆ ow_create_index_buffer()

ow_index_buffer_id ow_create_index_buffer ( uint32_t size,
bool wide )
extern

Creates an index buffer of given size. If wide is true, the buffer will be created with 32-bit indices, otherwise with 16-bit indices.

Parameters
sizeBuffer size in bytes
wideWhether to use 32-bit indices
Returns
ID of created buffer

◆ ow_create_pipeline()

ow_pipeline_id ow_create_pipeline ( const ow_pipeline_info * info)
extern

Creates a graphics pipeline.

Parameters
infoPipeline parameters
Returns
ID of created pipeline

◆ ow_create_sampler()

ow_sampler_id ow_create_sampler ( const ow_sampler_info * info)
extern

Creates a sampler.

Parameters
infoSampler parameters
Returns
ID of created sampler

◆ ow_create_texture()

ow_texture_id ow_create_texture ( const ow_texture_info * info)
extern

Creates a texture.

Parameters
infoTexture parameters
Returns
ID of created texture

◆ ow_create_texture_from_image()

ow_texture_id ow_create_texture_from_image ( const char * path,
const ow_texture_info * info )
extern

Creates a texture from a PNG or WEBP image file from the scene archive. Panics if file is not found.

Parameters
pathPath to the file to load, absolute in the scene archive. A null-terminated byte string
infoTexture parameters
Returns
ID of created texture

◆ ow_create_vertex_buffer()

ow_vertex_buffer_id ow_create_vertex_buffer ( uint32_t size)
extern

Creates a vertex buffer of given size.

Parameters
sizeBuffer size in bytes
Returns
ID of created buffer

◆ ow_create_vertex_shader_from_bytecode()

ow_vertex_shader_id ow_create_vertex_shader_from_bytecode ( const uint8_t * bytecode,
size_t size )
extern

Creates a vertex shader from SPIR-V bytecode.

Parameters
bytecodePointer to the bytecode
sizeSize of the bytecode in bytes
Returns
ID of created vertex shader

◆ ow_create_vertex_shader_from_file()

ow_vertex_shader_id ow_create_vertex_shader_from_file ( const char * path)
extern

Creates a vertex shader from a SPIR-V bytecode file from the scene archive. Panics if file is not found.

Parameters
pathPath to the file to load, absolute in the scene archive. A null-terminated byte string
Returns
ID of created vertex shader

◆ ow_end_copy_pass()

void ow_end_copy_pass ( )
extern

Ends a copy pass. Can be called only if a copy pass is currently active, panics elsewhere.

◆ ow_end_render_pass()

void ow_end_render_pass ( )
extern

Ends a render pass. Can be called only if a render pass is currently active, panics elsewhere.

◆ ow_free_fragment_shader()

void ow_free_fragment_shader ( ow_fragment_shader_id id)
extern

Frees a fragment shader by ID. Panics if fragment shader is not found or is already freed. Does nothing if id is 0.

Parameters
idFragment shader ID to free
See also
ow_create_sampler

◆ ow_free_index_buffer()

void ow_free_index_buffer ( ow_index_buffer_id id)
extern

Frees an index buffer by ID. Panics if index buffer is not found or is already freed. Does nothing if id is 0.

Parameters
idIndex buffer ID to free
See also
ow_create_index_buffer

◆ ow_free_pipeline()

void ow_free_pipeline ( ow_pipeline_id id)
extern

Frees a pipeline by ID. Panics if pipeline is not found or is already freed. Does nothing if id is 0.

Parameters
idPipeline ID to free
See also
ow_create_pipeline

◆ ow_free_sampler()

void ow_free_sampler ( ow_sampler_id id)
extern

Frees a sampler by ID. Panics if sampler is not found or is already freed. Does nothing if id is 0.

Parameters
idSampler ID to free
See also
ow_create_sampler

◆ ow_free_texture()

void ow_free_texture ( ow_texture_id id)
extern

Frees a texture by ID. Panics if texture is not found or is already freed. Does nothing if id is 0.

Parameters
idTexture ID to free
See also
ow_create_texture
ow_create_texture_from_image

◆ ow_free_vertex_buffer()

void ow_free_vertex_buffer ( ow_vertex_buffer_id id)
extern

Frees a vertex buffer by ID. Panics if vertex buffer is not found or is already freed. Does nothing if id is 0.

Parameters
idVertex buffer ID to free
See also
ow_create_vertex_buffer

◆ ow_free_vertex_shader()

void ow_free_vertex_shader ( ow_vertex_shader_id id)
extern

Frees a vertex shader by ID. Panics if vertex shader is not found or is already freed. Does nothing if id is 0.

Parameters
idVertex shader ID to free
See also
ow_create_sampler

◆ ow_generate_mipmaps()

void ow_generate_mipmaps ( ow_texture_id texture)
extern

Generates mipmaps for a texture.

Parameters
textureTexture ID to generate mipmaps for.

◆ ow_get_audio_spectrum()

void ow_get_audio_spectrum ( float * data,
size_t length )
extern

Gets audio spectrum data for visualization. Output data is a normalized array of floats in the range [0, 1] of length length.

Parameters
dataPointer to the array to store spectrum data
lengthLength of the array

◆ ow_get_mouse_state()

uint32_t ow_get_mouse_state ( float * x,
float * y )
extern

Gets cursor position and mouse buttons state. The cooordinate system for cursor position is x: [0, width] and y: [0, height] where (0, 0) is a top left corner.

Parameters
xPointer to the variable to store the X coordinate in pixels
yPointer to the variable to store the Y coordinate in pixels
Returns
Mask with pressed mouse buttons (see enum ow_mouse_button)

◆ ow_get_option()

const char * ow_get_option ( const char * name)
extern

Gets a wallpaper option value by name. Returns NULL if wallpaper option with given name is unspecified. Returns an empty string if wallpaper option with given name is specified, but has no value. The returned string is owned by the host application and must not be freed.

Parameters
nameName of the option to get
Returns
Value of the option, a null-terminated byte string

◆ ow_get_screen_size()

void ow_get_screen_size ( uint32_t * width,
uint32_t * height )
extern

Gets the screen size in pixels.

Parameters
widthPointer to the variable to store the width in pixels
heightPointer to the variable to store the height in pixels

◆ ow_load_file()

void ow_load_file ( const char * path,
uint8_t ** data,
size_t * size )
extern

Loads a file from the scene archive into module memory. Panics if file is not found. Memory for loaded data is allocated by the host application during function call, and after that owned by user.

Parameters
pathPath to the file to load, absolute in the scene archive. A null-terminated byte string
dataLoaded data
sizeSize of loaded data in bytes

◆ ow_push_fragment_uniform_data()

void ow_push_fragment_uniform_data ( uint32_t slot,
const void * data,
uint32_t size )
extern

Pushes fragment shader uniform data for given slot. Subsequent ow_render_geometry and ow_render_geometry_indexed calls will use this data until overwritten or render pass ends. The pushed data must respect std140 layout conventions. Can be called only if render pass is currently active, panics elsewhere.

Parameters
slotTarget uniform slot
dataPointer to the data to push
sizeSize of the data in bytes

◆ ow_push_vertex_uniform_data()

void ow_push_vertex_uniform_data ( uint32_t slot,
const void * data,
uint32_t size )
extern

Pushes vertex shader uniform data for given slot. Subsequent ow_render_geometry and ow_render_geometry_indexed calls will use this data until overwritten or render pass ends. The pushed data must respect std140 layout conventions. Can be called only if render pass is currently active, panics elsewhere.

Parameters
slotTarget uniform slot
dataPointer to the data to push
sizeSize of the data in bytes

◆ ow_render_geometry()

void ow_render_geometry ( ow_pipeline_id pipeline,
const ow_bindings_info * bindings,
uint32_t vertex_offset,
uint32_t vertex_count,
uint32_t instance_count )
extern

Renders geometry primitives.

Parameters
pipelinePipeline ID to use
bindingsPointer to the bindings info
vertex_offsetOffset in vertices to start rendering from
vertex_countNumber of vertices to render
instance_countNumber of instances

◆ ow_render_geometry_indexed()

void ow_render_geometry_indexed ( ow_pipeline_id pipeline,
const ow_bindings_info * bindings,
uint32_t index_offset,
uint32_t index_count,
uint32_t vertex_offset,
uint32_t instance_count )
extern

Renders geometry primitives with indices from an index buffer.

Parameters
pipelinePipeline ID to use
bindingsPointer to the bindings info
index_offsetOffset in indices to start rendering from
index_countNumber of indices to render
vertex_offsetOffset in vertices to start rendering from
instance_countNumber of instances

◆ ow_update_index_buffer()

void ow_update_index_buffer ( ow_index_buffer_id buffer,
uint32_t offset,
const void * data,
uint32_t size )
extern

Overwrites index buffer data subsegment beginning at offset with size bytes from data. Can be called only if copy pass is currently active, panics elsewhere.

Parameters
bufferIndex buffer ID to update
offsetOffset in bytes from the start of the buffer
dataPointer to the source data
sizeSize of subsegment to update in bytes

◆ ow_update_texture()

void ow_update_texture ( const void * data,
uint32_t pixels_per_row,
const ow_texture_update_destination * dest )
extern

Updates a dest texture region with data from data

Parameters
dataPointer to the source data
pixels_per_rowNumber of pixels per row in the source data
destPointer to the destination texture region

◆ ow_update_vertex_buffer()

void ow_update_vertex_buffer ( ow_vertex_buffer_id buffer,
uint32_t offset,
const void * data,
uint32_t size )
extern

Overwrites vertex buffer data subsegment beginning at offset with size bytes from data. Can be called only if copy pass is currently active, panics elsewhere.

Parameters
bufferVertex buffer ID to update
offsetOffset in bytes from the start of the buffer
dataPointer to the source data
sizeSize of subsegment to update in bytes

◆ update()

void update ( float delta)

A user-implemented function that is called each frame and should update/redraw the scene.

Parameters
deltaTime elapsed since the last frame in seconds. You should multiply all the scene movements by this value in order to make your scene framerate independent