package core:engine
Index
Types (58)
- MEM_BUFFER
- VULKAN_VERSION
- android_api_level
- android_platform_version
- base_resource
- buffer_create_option
- buffer_resource
- buffer_type
- button_idx
- camera
- color_transform
- command_buffer
- descriptor_pool_mem
- descriptor_pool_size
- descriptor_set
- descriptor_set_layout_binding
- descriptor_type
- general_input_buttons
- general_input_state
- graphics_size
- i_descriptor_set
- icon_image
- image
- image_center_pt_pos
- iobject
- iobject_vtable
- itransform_object
- key_code
- layer
- linux_platform_version
- monitor_info
- object_draw_method
- object_draw_type
- object_pipeline
- p_descriptor_set
- projection
- resource_range
- resource_usage
- screen_mode
- screen_orientation
- shader_code
- shader_lang
- texture
- texture_array
- texture_create_option
- texture_fmt
- texture_resource
- texture_type
- texture_usage
- texture_usages
- tile_texture_array
- union_resource
- v_sync
- vertex_input_attribute_description
- vertex_input_binding_description
- viewport
- windows_platform_version
- windows_version
Constants (4)
Variables (29)
- activate
- closing
- descriptor_pool_size__animate_img_uniform_pool
- descriptor_pool_size__base_uniform_pool
- descriptor_pool_size__single_sampler_pool
- descriptor_pool_size__single_storage_pool
- descriptor_pool_size__single_uniform_pool
- descriptor_set_binding__animate_img_uniform_pool
- descriptor_set_binding__base_uniform_pool
- descriptor_set_binding__single_pool
- destroy
- general_input_callback
- general_input_change_callback
- init
- key_down
- key_repeat
- key_up
- linux_platform
- mouse_button_down
- mouse_button_up
- mouse_in
- mouse_move
- mouse_out
- mouse_scroll
- pointer_down
- pointer_move
- pointer_up
- size
- update
Procedures (167)
- activated
- allocate_command_buffers
- android_get_asset_manager
- android_get_device_height
- android_get_device_width
- android_get_internal_data_path
- android_print_current_config
- animate_img_descriptor_set_layout
- base_descriptor_set_layout
- buffer_resource_copy_update
- buffer_resource_create_buffer
- buffer_resource_create_texture
- buffer_resource_deinit
- buffer_resource_map_update_slice
- camera_deinit
- camera_init
- camera_init_matrix_raw
- camera_update
- camera_update_matrix_raw
- close
- color_fmt_convert_default
- color_fmt_convert_default_overlap
- color_transform_deinit
- color_transform_init_matrix_raw
- color_transform_update_matrix_raw
- convert_mouse_pos
- create_graphics_pipeline
- create_random_texture
- create_random_texture_grey
- custom_object_pipeline_init
- def_camera
- def_color_transform
- def_projection
- def_viewport
- default_color_fmt
- default_multisample_state
- default_render_pass
- dt
- dt_u64
- engine_main
- exiting
- free_command_buffers
- get_animate_img_pipeline
- get_default_linear_sampler
- get_default_nearest_sampler
- get_fps
- get_graphics_origin_format
- get_img_pipeline
- get_linear_sampler
- get_max_frame
- get_monitor_from_window
- get_monitors
- get_nearest_sampler
- get_platform_version
- get_primary_monitor
- get_processor_core_len
- get_screen_mode
- get_shape_pipeline
- get_v_sync
- get_vulkan_version
- graphics_cmd_bind_descriptor_sets
- graphics_cmd_bind_index_buffer
- graphics_cmd_bind_pipeline
- graphics_cmd_bind_vertex_buffers
- graphics_cmd_draw
- graphics_cmd_draw_indexed
- graphics_destriptor_set_layout_init
- graphics_device
- graphics_get_resource
- graphics_get_resource_draw
- image_binding_sets_and_draw
- image_change_color_transform
- image_init
- image_update_texture
- image_update_transform
- image_update_transform_matrix_raw
- img_descriptor_set_layout
- iobject_deinit
- iobject_draw
- iobject_init
- iobject_size
- iobject_update
- is_main_thread
- is_mouse_out
- itransform_object_change_color_transform
- itransform_object_cvt_area_window_coord
- itransform_object_init
- itransform_object_update_transform
- itransform_object_update_transform_matrix_raw
- layer_add_object
- layer_add_objects
- layer_change_scene
- layer_deinit
- layer_get_object
- layer_get_object_idx
- layer_get_object_len
- layer_has_object
- layer_hide
- layer_init
- layer_remove_all
- layer_remove_object
- layer_show
- layer_size_all
- monitor_lock
- monitor_try_lock
- monitor_unlock
- mouse_pos
- object_pipeline_deinit
- paused
- projection_deinit
- projection_init_matrix_ortho
- projection_init_matrix_ortho_window
- projection_init_matrix_perspective
- projection_init_matrix_raw
- projection_size
- projection_update_matrix_raw
- projection_update_ortho
- projection_update_ortho_window
- projection_update_perspective
- r_2d_matrix
- render_guard
- render_lock
- render_try_lock
- render_unlock
- rt_2d_matrix
- s_2d_matrix
- second_to_nano_second
- second_to_nano_second2
- set_full_screen_mode
- set_max_frame
- set_render_clear_color
- set_uniform_resources_transform_object
- set_v_sync
- set_window_icon
- set_window_mode
- sr_2d_matrix
- sr_2d_matrix2
- src_2d_matrix
- srt_2d_matrix
- srt_2d_matrix2
- srtc_2d_matrix
- st_2d_matrix
- start_console
- t_2d_matrix
- texture_array_deinit
- texture_array_init
- texture_deinit
- texture_fmt_bit_size
- texture_fmt_is_depth
- texture_fmt_to_color_fmt
- texture_init
- texture_init_depth_stencil
- texture_init_grey
- texture_init_msaa
- texture_pixel_perfect_point
- texture_point_in
- update_descriptor_set
- viewport_descriptor_set_layout
- viewport_init_update
- webgl_create_context
- webgl_destroy
- webgl_start
- window_height
- window_width
- window_x
- window_y
- windows_set_res_icon
Procedure Groups (0)
This section is empty.
Types
MEM_BUFFER ¶
MEM_BUFFER :: distinct rawptr
VULKAN_VERSION ¶
Related Procedures With Returns
android_api_level ¶
android_api_level :: enum u32 { Nougat = 24, Nougat_MR1 = 25, Oreo = 26, Oreo_MR1 = 27, Pie = 28, Q = 29, R = 30, S = 31, S_V2 = 32, Tiramisu = 33, UpsideDownCake = 34, VanillaIceCream = 35, Baklava = 36, Unknown = 0, }
android_platform_version ¶
android_platform_version :: struct { api_level: android_api_level, }
base_resource ¶
base_resource :: struct { g_uniform_indices: [4]vulkan.DeviceSize, idx: rawptr, // unused uniform buffer mem_buffer: MEM_BUFFER, completed: bool, }
buffer_create_option ¶
buffer_create_option :: struct { size: vulkan.DeviceSize, type: buffer_type, resource_usage: resource_usage, single: bool, use_gcpu_mem: bool, }
Related Procedures With Parameters
buffer_resource ¶
buffer_resource :: struct { using _: base_resource, self: ^buffer_resource, option: buffer_create_option, __resource: vulkan.Buffer, }
Related Procedures With Parameters
buffer_type ¶
buffer_type :: enum int { VERTEX, INDEX, UNIFORM, STORAGE, __STAGING, }
button_idx ¶
button_idx :: enum int { LEFT = 0, MIDDLE = 1, RIGHT = 2, }
camera ¶
camera :: struct { using _: __matrix_in, }
Camera structure for view matrix management
Contains the view matrix and uniform buffer for rendering
Related Procedures With Parameters
Related Procedures With Returns
color_transform ¶
color_transform :: struct { mat: matrix[4, 4]f32, }
Related Procedures With Parameters
Related Procedures With Returns
command_buffer ¶
command_buffer :: struct #packed { __handle: vulkan.CommandBuffer, }
descriptor_pool_mem ¶
descriptor_pool_mem :: struct { pool: vulkan.DescriptorPool, cnt: u32, }
descriptor_pool_size ¶
descriptor_pool_size :: struct { type: descriptor_type, cnt: u32, }
descriptor_set ¶
descriptor_set :: struct($N: int) { … // See source for fields }
descriptor_set_layout_binding ¶
descriptor_set_layout_binding :: vulkan.DescriptorSetLayoutBinding
descriptor_type ¶
descriptor_type :: enum int { SAMPLER, // vk.DescriptorType.COMBINED_IMAGE_SAMPLER UNIFORM_DYNAMIC, // vk.DescriptorType.UNIFORM_BUFFER_DYNAMIC UNIFORM, // vk.DescriptorType.UNIFORM_BUFFER STORAGE, STORAGE_IMAGE, // TODO (xfitgd) }
i_descriptor_set ¶
i_descriptor_set :: struct { layout: vulkan.DescriptorSetLayout, // / created inside update_descriptor_set call __set: vulkan.DescriptorSet, size: []descriptor_pool_size, bindings: []u32, num_resources: u32, }
Related Procedures With Parameters
icon_image ¶
icon_image :: glfw_bindings.Image
image ¶
image :: struct { using _: itransform_object, src: ^texture, }
Image object structure for rendering textures
Extends iobject with texture source data
Related Procedures With Parameters
Procedures Through `using` From itransform_object
Procedures Through `using` From iobject
image_center_pt_pos ¶
image_center_pt_pos :: enum int { Center, Left, Right, TopLeft, Top, TopRight, BottomLeft, Bottom, BottomRight, }
Related Procedures With Parameters
iobject ¶
iobject :: struct { actual_type: typeid, vtable: ^iobject_vtable, }
Base object interface structure for all renderable objects
Contains vtable for polymorphic behavior
Related Procedures With Parameters
Related Procedures With Returns
iobject_vtable ¶
iobject_vtable :: struct { draw: proc(self: ^iobject, cmd: command_buffer, viewport: ^viewport), deinit: proc(self: ^iobject), update: proc(self: ^iobject), size: proc(self: ^iobject), }
Related Procedures With Parameters
itransform_object ¶
itransform_object :: struct { using _: iobject, using _: __matrix_in, set: descriptor_set($N=2), color_transform: ^color_transform, }
Transformable object interface structure for all renderable objects
Contains transformation matrix, descriptor set for polymorphic behavior
Related Procedures With Parameters
Procedures Through `using` From iobject
key_code ¶
key_code :: enum i32 { KEY_SPACE = 32, KEY_APOSTROPHE = 39, // ' KEY_COMMA = 44, // , KEY_MINUS = 45, // - KEY_PERIOD = 46, // . KEY_SLASH = 47, // / KEY_SEMICOLON = 59, // ; KEY_EQUAL = 61, // = KEY_LEFT_BRACKET = 91, // [ KEY_BACKSLASH = 92, // \ KEY_RIGHT_BRACKET = 93, // ] KEY_GRAVE_ACCENT = 96, // ` KEY_WORLD_1 = 161, // non-US #1 KEY_WORLD_2 = 162, // non-US #2 // Alphanumeric characters KEY_0 = 48, KEY_1 = 49, KEY_2 = 50, KEY_3 = 51, KEY_4 = 52, KEY_5 = 53, KEY_6 = 54, KEY_7 = 55, KEY_8 = 56, KEY_9 = 57, KEY_A = 65, KEY_B = 66, KEY_C = 67, KEY_D = 68, KEY_E = 69, KEY_F = 70, KEY_G = 71, KEY_H = 72, KEY_I = 73, KEY_J = 74, KEY_K = 75, KEY_L = 76, KEY_M = 77, KEY_N = 78, KEY_O = 79, KEY_P = 80, KEY_Q = 81, KEY_R = 82, KEY_S = 83, KEY_T = 84, KEY_U = 85, KEY_V = 86, KEY_W = 87, KEY_X = 88, KEY_Y = 89, KEY_Z = 90, // Function keys KEY_ESCAPE = 256, KEY_ENTER = 257, KEY_TAB = 258, KEY_BACKSPACE = 259, KEY_INSERT = 260, KEY_DELETE = 261, KEY_RIGHT = 262, KEY_LEFT = 263, KEY_DOWN = 264, KEY_UP = 265, KEY_PAGE_UP = 266, KEY_PAGE_DOWN = 267, KEY_HOME = 268, KEY_END = 269, KEY_CAPS_LOCK = 280, KEY_SCROLL_LOCK = 281, KEY_NUM_LOCK = 282, KEY_PRINT_SCREEN = 283, KEY_PAUSE = 284, // Function keys KEY_F1 = 290, KEY_F2 = 291, KEY_F3 = 292, KEY_F4 = 293, KEY_F5 = 294, KEY_F6 = 295, KEY_F7 = 296, KEY_F8 = 297, KEY_F9 = 298, KEY_F10 = 299, KEY_F11 = 300, KEY_F12 = 301, KEY_F13 = 302, KEY_F14 = 303, KEY_F15 = 304, KEY_F16 = 305, KEY_F17 = 306, KEY_F18 = 307, KEY_F19 = 308, KEY_F20 = 309, KEY_F21 = 310, KEY_F22 = 311, KEY_F23 = 312, KEY_F24 = 313, KEY_F25 = 314, // Keypad numbers KEY_NUM_0 = 320, KEY_NUM_1 = 321, KEY_NUM_2 = 322, KEY_NUM_3 = 323, KEY_NUM_4 = 324, KEY_NUM_5 = 325, KEY_NUM_6 = 326, KEY_NUM_7 = 327, KEY_NUM_8 = 328, KEY_NUM_9 = 329, // Keypad named function keys KEY_NUM_DOT = 330, KEY_NUM_DIVIDE = 331, KEY_NUM_MULTIPLY = 332, KEY_NUM_SUBTRACT = 333, KEY_NUM_ADD = 334, KEY_NUM_ENTER = 335, KEY_NUM_EQUAL = 336, // Modifier keys KEY_LEFT_SHIFT = 340, KEY_LEFT_CONTROL = 341, KEY_LEFT_ALT = 342, KEY_LEFT_SUPER = 343, KEY_RIGHT_SHIFT = 344, KEY_RIGHT_CONTROL = 345, KEY_RIGHT_ALT = 346, KEY_RIGHT_SUPER = 347, KEY_MENU = 348, }
layer ¶
layer :: struct { scene: ^[dynamic]^iobject, cmd: [2]command_buffer, cmd_pool: vulkan.CommandPool, creation_allocator: runtime.Allocator, visible: bool, }
Render command structure for managing render objects
Manages a collection of objects to be rendered and their command buffers
Related Procedures With Parameters
Related Procedures With Returns
linux_platform_version ¶
linux_platform_version :: struct { sys_name: string, node_name: string, release: string, version: string, machine: string, }
Related Procedures With Returns
monitor_info ¶
monitor_info :: struct { rect: linalg.Rect_($T=i32), name: string, refresh_rate: u32, is_primary: bool, }
Related Procedures With Parameters
Related Procedures With Returns
object_draw_method ¶
object_draw_method :: struct { type: object_draw_type, vertex_count: u32, instance_count: u32, index_count: u32, using _: struct #raw_union { first_vertex: u32, vertex_offset: i32, }, first_instance: u32, first_index: u32, }
Related Procedures With Parameters
object_draw_type ¶
object_draw_type :: enum int { Draw, DrawIndexed, }
object_pipeline ¶
object_pipeline :: struct { __pipeline: vulkan.Pipeline, __pipeline_layout: vulkan.PipelineLayout, __descriptor_set_layouts: []vulkan.DescriptorSetLayout, draw_method: object_draw_method, allocator: runtime.Allocator, }
Related Procedures With Parameters
Related Procedures With Returns
p_descriptor_set ¶
p_descriptor_set :: struct { using _: i_descriptor_set, __resources: [1]union_resource, }
Procedures Through `using` From i_descriptor_set
projection ¶
projection :: struct { using _: __matrix_in, ortho_canvas_width: f32, // canvas width for ortho projection (if 0, not set; if set, projection_update_ortho_window is called when window size changes) ortho_canvas_height: f32, }
Projection structure for projection matrix management
Contains the projection matrix and uniform buffer for rendering
Related Procedures With Parameters
Related Procedures With Returns
resource_range ¶
resource_range :: rawptr
screen_mode ¶
screen_mode :: enum int { Window, Fullscreen, }
Related Procedures With Parameters
Related Procedures With Returns
screen_orientation ¶
screen_orientation :: enum int { Unknown, Landscape90, Landscape270, Vertical180, Vertical360, }
texture ¶
texture :: struct { set: descriptor_set($N=1), sampler: vulkan.Sampler, pixel_data: []u8, width: u32, height: u32, }
texture_array ¶
Related Procedures With Parameters
texture_create_option ¶
texture_create_option :: struct { len: u32, width: u32, height: u32, type: texture_type, texture_usage: bit_set[texture_usage], resource_usage: resource_usage, format: texture_fmt, samples: u8, single: bool, use_gcpu_mem: bool, }
Related Procedures With Parameters
texture_fmt ¶
texture_fmt :: enum int { DefaultColor, DefaultDepth, R8G8B8A8Unorm, B8G8R8A8Unorm, // B8G8R8A8Srgb, // R8G8B8A8Srgb, D24UnormS8Uint, D32SfloatS8Uint, D16UnormS8Uint, R8Unorm, }
Related Procedures With Parameters
texture_resource ¶
texture_resource :: struct { using _: base_resource, self: ^texture_resource, img_view: vulkan.ImageView, sampler: vulkan.Sampler, option: texture_create_option, __resource: vulkan.Image, }
texture_type ¶
texture_type :: enum int { TEX2D, }
texture_usage ¶
texture_usage :: enum int { IMAGE_RESOURCE, FRAME_BUFFER, __INPUT_ATTACHMENT, __TRANSIENT_ATTACHMENT, __STORAGE_IMAGE, }
texture_usages ¶
texture_usages :: bit_set[texture_usage]
union_resource ¶
union_resource :: union { ^buffer_resource, ^texture_resource, }
Related Procedures With Returns
v_sync ¶
v_sync :: enum int { Double, Triple, None, }
Related Procedures With Parameters
Related Procedures With Returns
vertex_input_attribute_description ¶
vertex_input_attribute_description :: vulkan.VertexInputAttributeDescription
vertex_input_binding_description ¶
vertex_input_binding_description :: vulkan.VertexInputBindingDescription
viewport ¶
viewport :: struct { camera: ^camera, projection: ^projection, set: descriptor_set($N=2), viewport_area: runtime.Maybe($T=Rect_($T=f32)), }
Viewport structure for managing rendering areas and camera/projection settings
Contains: camera: Pointer to the camera for view transformations projection: Pointer to the projection for projection transformations set: Descriptor set for uniform resources viewport_area: Optional rectangle defining the viewport area (default: nil means window size)
Related Procedures With Parameters
Related Procedures With Returns
windows_platform_version ¶
windows_platform_version :: struct { version: windows_version, build_number: u32, service_pack: u32, }
windows_version ¶
windows_version :: enum int { Windows7, WindowsServer2008R2, Windows8, WindowsServer2012, Windows8Point1, WindowsServer2012R2, Windows10, WindowsServer2016, Windows11, WindowsServer2019, WindowsServer2022, Unknown, }
Constants
MAX_FRAMES_IN_FLIGHT ¶
MAX_FRAMES_IN_FLIGHT: int : #config(MAX_FRAMES_IN_FLIGHT, 2)
is_android ¶
is_android: bool : ODIN_PLATFORM_SUBTARGET == .Android
is_mobile ¶
is_mobile: bool : is_android
Variables
activate ¶
activate: proc "contextless" () = …
descriptor_pool_size__animate_img_uniform_pool ¶
@(rodata) descriptor_pool_size__animate_img_uniform_pool: [1]descriptor_pool_size = …
descriptor_pool_size__base_uniform_pool ¶
@(rodata) descriptor_pool_size__base_uniform_pool: [1]descriptor_pool_size = …
descriptor_pool_size__single_sampler_pool ¶
@(rodata) descriptor_pool_size__single_sampler_pool: [1]descriptor_pool_size = …
descriptor_pool_size__single_storage_pool ¶
@(rodata) descriptor_pool_size__single_storage_pool: [1]descriptor_pool_size = …
descriptor_pool_size__single_uniform_pool ¶
@(rodata) descriptor_pool_size__single_uniform_pool: [1]descriptor_pool_size = …
descriptor_set_binding__animate_img_uniform_pool ¶
@(rodata) descriptor_set_binding__animate_img_uniform_pool: [1]u32 = …
descriptor_set_binding__base_uniform_pool ¶
@(rodata) descriptor_set_binding__base_uniform_pool: [1]u32 = …
descriptor_set_binding__single_pool ¶
@(rodata) descriptor_set_binding__single_pool: [1]u32 = …
general_input_callback ¶
general_input_callback: proc(state: general_input_state) = …
key_down ¶
key_down: proc(keycode: key_code) = …
key_repeat ¶
key_repeat: proc(keycode: key_code) = …
linux_platform ¶
linux_platform: linux_platform_version
mouse_button_down ¶
mouse_button_down: proc(_button_idx: button_idx, x: f32, y: f32) = …
mouse_button_up ¶
mouse_button_up: proc(_button_idx: button_idx, x: f32, y: f32) = …
mouse_in ¶
mouse_in: proc() = …
mouse_out ¶
mouse_out: proc() = …
mouse_scroll ¶
mouse_scroll: proc(dt: int) = …
Procedures
activated ¶
activated :: proc "contextless" () -> bool {…}
Checks if the window is activated
Returns:true if activated, false otherwise
allocate_command_buffers ¶
allocate_command_buffers :: proc(p_cmd_buffer: [^]command_buffer, count: u32, cmd_pool: vulkan.CommandPool) {…}
android_get_asset_manager ¶
android_get_asset_manager :: proc "contextless" () -> ^android.AAssetManager {…}
Gets the Android asset manager
Returns:
Pointer to the Android asset manager
android_get_device_height ¶
android_get_device_height :: proc "contextless" () -> u32 {…}
Gets the device height in pixels
Returns:
Device height in pixels
android_get_device_width ¶
android_get_device_width :: proc "contextless" () -> u32 {…}
Gets the device width in pixels
Returns:
Device width in pixels
android_get_internal_data_path ¶
android_get_internal_data_path :: proc "contextless" () -> string {…}
Gets the internal data path for the Android app
Returns:
Internal data path as a string
android_print_current_config ¶
android_print_current_config :: proc() {…}
animate_img_descriptor_set_layout ¶
animate_img_descriptor_set_layout :: proc() -> vulkan.DescriptorSetLayout {…}
base_descriptor_set_layout ¶
base_descriptor_set_layout :: proc "contextless" () -> vulkan.DescriptorSetLayout {…}
buffer_resource_create_buffer ¶
buffer_resource_create_buffer :: proc(self: rawptr, option: buffer_create_option, data: []u8, is_copy: bool = false, allocator: runtime.Maybe($T=Allocator) = nil) {…}
buffer_resource_deinit ¶
buffer_resource_deinit :: proc(self: rawptr) {…}
camera_deinit ¶
camera_deinit :: proc(self: ^camera) {…}
Deinitializes and cleans up camera resources
Inputs:
self: Pointer to the camera to deinitialize
Returns:
None
camera_init ¶
camera_init :: proc(self: ^camera, eye_vec: [3]f32 = {0, 0, -1}, focus_vec: [3]f32 = {0, 0, 0}, up_vec: [3]f32 = {0, 1, 0}) {…}
Initializes a camera with the specified view parameters
Inputs:
self: Pointer to the camera to initialize
eye_vec: The position of the camera (default: {0, 0, -1})
focus_vec: The point the camera is looking at (default: {0, 0, 0})
up_vec: The up vector for the camera (default: {0, 1, 0})
Returns:
None
camera_init_matrix_raw ¶
Initializes a camera with a raw matrix
Inputs:
self: Pointer to the camera to initialize
mat: The view matrix to use
Returns:
None
camera_update ¶
camera_update :: proc(self: ^camera, eye_vec: [3]f32 = {0, 0, -1}, focus_vec: [3]f32 = {0, 0, 0}, up_vec: [3]f32 = {0, 0, 1}) {…}
Updates the camera view matrix with new parameters
Inputs:
self: Pointer to the camera to update
eye_vec: The new position of the camera (default: {0, 0, -1})
focus_vec: The new point the camera is looking at (default: {0, 0, 0})
up_vec: The new up vector for the camera (default: {0, 0, 1})
Returns:
None
camera_update_matrix_raw ¶
Updates the camera with a raw matrix
Inputs:
self: Pointer to the camera to update
_mat: The new view matrix
Returns:
None
color_fmt_convert_default ¶
Converts pixel format to the default graphics format
Inputs:
pixels: Input pixel data
out: Output buffer for converted pixels
inPixelFmt: Input pixel format (default: .RGBA)
Returns:
None
color_fmt_convert_default_overlap ¶
color_fmt_convert_default_overlap :: proc(pixels: []u8, out: []u8, inPixelFmt: image.color_fmt = .RGBA) {…}
Converts pixel format to the default graphics format (in-place conversion)
Inputs:
pixels: Input pixel data
out: Output buffer for converted pixels (can overlap with input)
inPixelFmt: Input pixel format (default: .RGBA)
Returns:
None
color_transform_deinit ¶
color_transform_deinit :: proc(self: ^color_transform) {…}
Deinitializes and cleans up color transform resources
Inputs:
self: Pointer to the color transform to deinitialize
Returns:
None
color_transform_init_matrix_raw ¶
color_transform_init_matrix_raw :: proc(self: ^color_transform, mat: matrix[4, 4]f32 = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}) {…}
color_transform_update_matrix_raw ¶
color_transform_update_matrix_raw :: proc(self: ^color_transform, _mat: matrix[4, 4]f32) {…}
Updates the color transform with a raw matrix
Inputs:
self: Pointer to the color transform to update
_mat: The new color transform matrix
Returns:
None
convert_mouse_pos ¶
Converts mouse position from window coordinates to centered coordinates
Inputs:
pos: Mouse position in window coordinates
Returns:
Mouse position in centered coordinates (origin at window center)
create_graphics_pipeline ¶
create_graphics_pipeline :: proc( self: ^object_pipeline, stages: []vulkan.PipelineShaderStageCreateInfo, depth_stencil_state: vulkan.PipelineDepthStencilStateCreateInfo, viewport_state: vulkan.PipelineViewportStateCreateInfo, pVertex_input_state: ^vulkan.PipelineVertexInputStateCreateInfo, color_blend_state: vulkan.PipelineColorBlendStateCreateInfo, ) -> bool {…}
create_random_texture ¶
create_random_texture :: proc(width, height: u32, out_texture: ^texture, allocator := context.allocator) {…}
Creates a random RGBA texture with the specified dimensions
Inputs:
width: The width of the texture in pixels
height: The height of the texture in pixels
out_texture: Pointer to the texture structure to initialize
allocator: The allocator to use for the texture data
Returns:
None
create_random_texture_grey ¶
create_random_texture_grey :: proc(width, height: u32, out_texture: ^texture, allocator := context.allocator) {…}
Creates a random grayscale texture with the specified dimensions
Inputs:
width: The width of the texture in pixels
height: The height of the texture in pixels
out_texture: Pointer to the texture structure to initialize
allocator: The allocator to use for the texture data
Returns:
None
custom_object_pipeline_init ¶
custom_object_pipeline_init :: proc( self: ^object_pipeline, descriptor_set_layouts: []vulkan.DescriptorSetLayout, vertex_input_binding: runtime.Maybe($T=[]VertexInputBindingDescription), vertex_input_attribute: runtime.Maybe($T=[]VertexInputAttributeDescription), draw_method: object_draw_method, vertex_shader: runtime.Maybe($T=shader_code), pixel_shader: runtime.Maybe($T=shader_code), geometry_shader: runtime.Maybe($T=shader_code) = nil, depth_stencil_state: runtime.Maybe($T=PipelineDepthStencilStateCreateInfo) = nil, color_blend_state: runtime.Maybe($T=PipelineColorBlendStateCreateInfo) = nil, shader_lang: shader_lang = .GLSL, allocator := context.allocator, ) -> bool {…}
def_camera ¶
def_camera :: proc() -> ^camera {…}
Returns a pointer to the default camera
Returns:
Pointer to the default camera
def_color_transform ¶
def_color_transform :: proc "contextless" () -> ^color_transform {…}
def_projection ¶
def_projection :: proc() -> ^projection {…}
Returns a pointer to the default projection
Returns:
Pointer to the default projection
def_viewport ¶
def_viewport :: proc "contextless" () -> ^viewport {…}
default_color_fmt ¶
default_color_fmt :: proc() -> image.color_fmt {…}
Returns the default color format based on the graphics origin format
Returns:
The default color format for the current graphics system
default_multisample_state ¶
default_multisample_state :: proc "contextless" () -> ^vulkan.PipelineMultisampleStateCreateInfo {…}
default_render_pass ¶
default_render_pass :: proc "contextless" () -> vulkan.RenderPass {…}
engine_main ¶
engine_main :: proc( window_title: cstring = "SpaceEngine", window_x: runtime.Maybe($T=int) = nil, window_y: runtime.Maybe($T=int) = nil, window_width: runtime.Maybe($T=int) = nil, window_height: runtime.Maybe($T=int) = nil, v_sync: v_sync = .Double, screen_mode: screen_mode = .Window, screen_idx: int = 0, ) {…}
Main entry point for the engine
Initializes the engine, creates a window, and runs the main loop
Inputs:
window_title: Title of the window (default: "SpaceEngine")
window_x: X position of the window (default: nil)
window_y: Y position of the window (default: nil)
window_width: Width of the window (default: nil)
window_height: Height of the window (default: nil)
v_sync: Vertical sync mode (default: .Double)
screen_mode: Screen mode (default: .Window)
screen_idx: Screen index (default: 0)
Returns:
None
free_command_buffers ¶
free_command_buffers :: proc(p_cmd_buffer: [^]command_buffer, count: u32, cmd_pool: vulkan.CommandPool) {…}
get_animate_img_pipeline ¶
get_animate_img_pipeline :: proc "contextless" () -> ^object_pipeline {…}
get_default_linear_sampler ¶
get_default_linear_sampler :: proc "contextless" () -> vulkan.Sampler {…}
Gets the default linear sampler
Returns:
The default linear sampler
get_default_nearest_sampler ¶
get_default_nearest_sampler :: proc "contextless" () -> vulkan.Sampler {…}
Gets the default nearest sampler
Returns:
The default nearest sampler
get_fps ¶
get_fps :: proc "contextless" () -> f64 {…}
Gets the current frames per second
Returns:
Current FPS, or 0 if delta time is 0
get_graphics_origin_format ¶
get_graphics_origin_format :: proc "contextless" () -> vulkan.Format {…}
Gets the graphics origin format
Returns:
The Vulkan format used as the graphics origin format
get_img_pipeline ¶
get_img_pipeline :: proc "contextless" () -> ^object_pipeline {…}
get_linear_sampler ¶
get_linear_sampler :: proc "contextless" () -> vulkan.Sampler {…}
get_max_frame ¶
get_max_frame :: proc "contextless" () -> f64 {…}
get_monitor_from_window ¶
get_monitor_from_window :: proc "contextless" () -> ^monitor_info {…}
get_monitors ¶
get_monitors :: proc "contextless" () -> []monitor_info {…}
get_nearest_sampler ¶
get_nearest_sampler :: proc "contextless" () -> vulkan.Sampler {…}
get_platform_version ¶
get_platform_version :: proc "contextless" () -> linux_platform_version {…}
get_primary_monitor ¶
get_primary_monitor :: proc "contextless" () -> ^monitor_info {…}
get_processor_core_len ¶
get_processor_core_len :: proc "contextless" () -> int {…}
get_screen_mode ¶
get_screen_mode :: proc "contextless" () -> screen_mode {…}
get_shape_pipeline ¶
get_shape_pipeline :: proc "contextless" () -> ^object_pipeline {…}
get_v_sync ¶
get_v_sync :: proc "contextless" () -> v_sync {…}
Gets the current vertical sync mode
Returns:
The current vertical sync mode
get_vulkan_version ¶
get_vulkan_version :: proc "contextless" () -> VULKAN_VERSION {…}
graphics_cmd_bind_descriptor_sets ¶
graphics_cmd_bind_descriptor_sets :: proc "contextless" ( cmd: command_buffer, pipeline_bind_point: vulkan.PipelineBindPoint, layout: vulkan.PipelineLayout, first_set: u32, descriptor_set_count: u32, p_descriptor_sets: ^vulkan.DescriptorSet, dynamic_offset_count: u32, p_dynamic_offsets: ^u32, ) {…}
graphics_cmd_bind_index_buffer ¶
graphics_cmd_bind_index_buffer :: proc "contextless" (cmd: command_buffer, buffer: ^buffer_resource, offset: vulkan.DeviceSize, index_type: vulkan.IndexType) {…}
graphics_cmd_bind_pipeline ¶
graphics_cmd_bind_pipeline :: proc "contextless" (cmd: command_buffer, pipeline_bind_point: vulkan.PipelineBindPoint, pipeline: vulkan.Pipeline) {…}
graphics_cmd_bind_vertex_buffers ¶
graphics_cmd_bind_vertex_buffers :: proc(cmd: command_buffer, first_binding: u32, binding_count: u32, p_buffers: []^buffer_resource, p_offsets: ^vulkan.DeviceSize) {…}
graphics_cmd_draw ¶
graphics_cmd_draw :: proc "contextless" (cmd: command_buffer, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32) {…}
graphics_destriptor_set_layout_init ¶
graphics_destriptor_set_layout_init :: proc(bindings: []vulkan.DescriptorSetLayoutBinding) -> vulkan.DescriptorSetLayout {…}
graphics_device ¶
graphics_device :: proc "contextless" () -> vulkan.Device {…}
graphics_get_resource ¶
graphics_get_resource :: proc "contextless" (self: rawptr) -> union_resource {…}
Get last resource from stack (most recently created)
graphics_get_resource_draw ¶
graphics_get_resource_draw :: proc "contextless" (self: rawptr) -> union_resource {…}
Get first resource from stack (for rendering - oldest)
image_binding_sets_and_draw ¶
image_binding_sets_and_draw :: proc "contextless" (cmd: command_buffer, imageSet: ^i_descriptor_set, viewSet: ^i_descriptor_set, textureSet: ^i_descriptor_set) {…}
Binds descriptor sets and draws an image
Inputs:
cmd: Command buffer to record draw commands
imageSet: Descriptor set for the image transform uniforms
textureSet: Descriptor set for the texture
Returns:
None
image_change_color_transform ¶
image_change_color_transform :: proc(self: ^image, colorTransform: ^color_transform) {…}
image_init ¶
image_init :: proc(self: ^image, src: ^texture, colorTransform: ^color_transform = nil, vtable: ^iobject_vtable = nil) {…}
image_update_texture ¶
image_update_camera :: #force_inline proc(self:^image, camera:^camera) { iobject_update_camera(self, camera) } image_update_projection :: #force_inline proc(self:^image, projection:^projection) { iobject_update_projection(self, projection) }
img_descriptor_set_layout ¶
img_descriptor_set_layout :: proc "contextless" () -> vulkan.DescriptorSetLayout {…}
iobject_deinit ¶
iobject_deinit :: proc(self: ^iobject) {…}
Deinitializes and cleans up object resources
Inputs:
self: Pointer to the object to deinitialize
Returns:
None
iobject_draw ¶
iobject_draw :: proc(self: ^iobject, cmd: command_buffer, viewport: ^viewport) {…}
Draws the object using its vtable draw function
Inputs:
self: Pointer to the object
cmd: Command buffer to record draw commands
viewport: viewport to draw the object. you can use multiple viewports to perform a draw call for each element in the viewport array.
Returns:
None
iobject_init ¶
iobject_init :: proc(self: ^iobject) {…}
iobject_size ¶
iobject_size :: proc(self: ^iobject) {…}
iobject_update ¶
iobject_update :: proc(self: ^iobject) {…}
is_main_thread ¶
is_main_thread :: proc "contextless" () -> bool {…}
is_mouse_out ¶
is_mouse_out :: proc "contextless" () -> bool {…}
Checks if the mouse is outside the window
Returns:true if the mouse is outside the window, false otherwise
itransform_object_change_color_transform ¶
itransform_object_change_color_transform :: proc(self: ^itransform_object, _color_transform: ^color_transform) {…}
itransform_object_cvt_area_window_coord ¶
itransform_object_cvt_area_window_coord :: proc(self: ^itransform_object, area: linalg.Area($T=f32), viewport: ^viewport, allocator := context.allocator) -> linalg.Area($T=f32) {…}
Converts the area to window coordinate. window coordinate is top-left origin and bottom-right is (window_width(), window_height()).
Note: if result area is [][2]f32, it allocates memory for the result area.
Inputs:
self: Pointer to the object
area: Area to convert
viewport: The viewport to which self belongs. If nil, the default viewport will be used.
allocator: Allocator to use for the result area.
Returns:
Area in window coordinates
itransform_object_init ¶
itransform_object_init :: proc(self: ^itransform_object, _color_transform: ^color_transform = nil, vtable: ^iobject_vtable = nil) {…}
itransform_object_update_transform ¶
itransform_object_update_transform :: proc(self: ^itransform_object, pos: [3]f32, rotation: f32 = 0.0, scale: [2]f32 = {1.0, 1.0}, pivot: [2]f32 = {0.0, 0.0}) {…}
itransform_object_update_transform_matrix_raw ¶
itransform_object_update_transform_matrix_raw :: proc(self: ^itransform_object, _mat: matrix[4, 4]f32) {…}
layer_add_object ¶
Adds an object to the render command's scene
Inputs:
cmd: Pointer to the render command
obj: Pointer to the object to add
Returns:
None
layer_add_objects ¶
Adds multiple objects to the render command's scene
Inputs:
cmd: Pointer to the render command
objs: Variable number of object pointers to add
Returns:
None
layer_change_scene ¶
Changes the scene of the render command
layer_deinit ¶
layer_deinit :: proc(cmd: ^layer) {…}
Deinitializes and cleans up render command resources
Inputs:
cmd: Pointer to the render command to deinitialize
Returns:
None
layer_get_object ¶
Gets an object from the render command's scene by index
Inputs:
cmd: Pointer to the render command
index: The index of the object to get
Returns:
Pointer to the object at the specified index
layer_get_object_idx ¶
Gets the index of an object in the render command's scene
Inputs:
cmd: Pointer to the render command
obj: Pointer to the object to find
Returns:
The index of the object, or -1 if not found
layer_get_object_len ¶
Gets the number of objects in the render command's scene
Inputs:
cmd: Pointer to the render command
Returns:
The number of objects in the scene
layer_has_object ¶
Checks if an object is in the render command's scene
Inputs:
cmd: Pointer to the render command
obj: Pointer to the object to check
Returns:true if the object is in the scene, false otherwise
layer_hide ¶
Sets the render command as hidden
Inputs:
_cmd: Pointer to the render command to hide
Returns:true if successful, false if the command was not found
layer_init ¶
layer_init :: proc(_scene: ^[dynamic]^iobject, allocator := context.allocator) -> (cmd: ^layer, err: runtime.Allocator_Error) #optional_ok {…}
Initializes a new render command structure
Make layer.scene manually. _scene can be nil
Returns:
Pointer to the initialized render command
Allocator error if allocation failed
layer_remove_all ¶
layer_remove_all :: proc(cmd: ^layer) {…}
Removes all objects from the render command's scene
Inputs:
cmd: Pointer to the render command
Returns:
None
layer_remove_object ¶
Removes an object from the render command's scene
Inputs:
cmd: Pointer to the render command
obj: Pointer to the object to remove
Returns:
None
layer_show ¶
layer_show :: proc(_cmd: ^layer) {…}
Sets the render command as visible
Inputs:
_cmd: Pointer to the render command to set visible
Returns:true if successful, false if the command was not found
layer_size_all ¶
layer_size_all :: proc() {…}
size update all render commands' projection (only ortho windowprojection)
Inputs:
None
Returns:
None
monitor_lock ¶
monitor_lock :: proc "contextless" () {…}
monitor_try_lock ¶
monitor_try_lock :: proc "contextless" () -> bool {…}
monitor_unlock ¶
monitor_unlock :: proc "contextless" () {…}
mouse_pos ¶
mouse_pos :: proc "contextless" () -> [2]f32 {…}
Gets the current mouse position
Returns:
Current mouse position in window coordinates
object_pipeline_deinit ¶
object_pipeline_deinit :: proc(self: ^object_pipeline) {…}
paused ¶
paused :: proc "contextless" () -> bool {…}
Checks if the engine is paused
Returns:true if paused, false otherwise
projection_deinit ¶
projection_deinit :: proc(self: ^projection) {…}
Deinitializes and cleans up projection resources
Inputs:
self: Pointer to the projection to deinitialize
Returns:
None
projection_init_matrix_ortho ¶
projection_init_matrix_ortho :: proc( self: ^projection, left: f32, right: f32, bottom: f32, top: f32, near: f32 = 0.1, far: f32 = 100, flip_z_axis_for_vulkan: bool = true, ) {…}
Initializes an orthographic projection matrix
Inputs:
self: Pointer to the projection to initialize
left: Left plane coordinate
right: Right plane coordinate
bottom: Bottom plane coordinate
top: Top plane coordinate
near: Near plane distance (default: 0.1)
far: Far plane distance (default: 100)
flip_z_axis_for_vulkan: Whether to flip Z axis for Vulkan (default: true)
Returns:
None
projection_init_matrix_ortho_window ¶
projection_init_matrix_ortho_window :: proc( self: ^projection, width: f32, height: f32, near: f32 = 0.1, far: f32 = 100, flip_z_axis_for_vulkan: bool = true, ) {…}
Initializes an orthographic projection matrix based on window dimensions
Inputs:
self: Pointer to the projection to initialize
width: Window width
height: Window height
near: Near plane distance (default: 0.1)
far: Far plane distance (default: 100)
flip_z_axis_for_vulkan: Whether to flip Z axis for Vulkan (default: true)
Returns:
None
projection_init_matrix_perspective ¶
projection_init_matrix_perspective :: proc( self: ^projection, fov: f32, aspect: f32 = 0, near: f32 = 0.1, far: f32 = 100, flip_z_axis_for_vulkan: bool = true, ) {…}
Initializes a perspective projection matrix
Note: If aspect is 0, the window aspect ratio will be used
Inputs:
self: Pointer to the projection to initialize
fov: Field of view angle in radians
aspect: Aspect ratio (width/height). If 0, uses window aspect (default: 0)
near: Near plane distance (default: 0.1)
far: Far plane distance (default: 100)
flip_z_axis_for_vulkan: Whether to flip Z axis for Vulkan (default: true)
Returns:
None
projection_init_matrix_raw ¶
projection_init_matrix_raw :: proc(self: ^projection, mat: matrix[4, 4]f32) {…}
Initializes a projection with a raw matrix
Inputs:
self: Pointer to the projection to initialize
mat: The projection matrix to use
Returns:
None
projection_size ¶
projection_size :: proc(self: ^projection) {…}
projection size update (automatically called when window size changes)
Inputs:
self: Pointer to the projection to update
Returns:
None
projection_update_matrix_raw ¶
projection_update_matrix_raw :: proc(self: ^projection, _mat: matrix[4, 4]f32) {…}
Updates the projection with a raw matrix
Inputs:
self: Pointer to the projection to update
_mat: The new projection matrix
Returns:
None
projection_update_ortho ¶
projection_update_ortho :: proc( self: ^projection, left: f32, right: f32, bottom: f32, top: f32, near: f32 = 0.1, far: f32 = 100, flip_z_axis_for_vulkan: bool = true, ) {…}
Updates an orthographic projection matrix
Inputs:
self: Pointer to the projection to update
left: Left plane coordinate
right: Right plane coordinate
bottom: Bottom plane coordinate
top: Top plane coordinate
near: Near plane distance (default: 0.1)
far: Far plane distance (default: 100)
flip_z_axis_for_vulkan: Whether to flip Z axis for Vulkan (default: true)
Returns:
None
projection_update_ortho_window ¶
projection_update_ortho_window :: proc( self: ^projection, width: f32, height: f32, near: f32 = 0.1, far: f32 = 100, flip_z_axis_for_vulkan: bool = true, ) {…}
Updates an orthographic projection matrix based on window dimensions
Inputs:
self: Pointer to the projection to update
width: Window width
height: Window height
near: Near plane distance (default: 0.1)
far: Far plane distance (default: 100)
flip_z_axis_for_vulkan: Whether to flip Z axis for Vulkan (default: true)
Returns:
None
projection_update_perspective ¶
projection_update_perspective :: proc( self: ^projection, fov: f32, aspect: f32 = 0, near: f32 = 0.1, far: f32 = 100, flip_axis_for_vulkan: bool = true, ) {…}
Updates a perspective projection matrix
Inputs:
self: Pointer to the projection to update
fov: Field of view angle in radians
aspect: Aspect ratio (width/height). If 0, uses window aspect (default: 0)
near: Near plane distance (default: 0.1)
far: Far plane distance (default: 100)
flip_axis_for_vulkan: Whether to flip axis for Vulkan (default: true)
Returns:
None
render_guard ¶
render_guard :: proc "contextless" () -> bool {…}
!DO NOT CALL THIS FROM WITHIN ENGINE CALLBACKS
render_lock ¶
render_lock :: proc "contextless" () {…}
!DO NOT CALL THIS FROM WITHIN ENGINE CALLBACKS
render_try_lock ¶
render_try_lock :: proc "contextless" () -> bool {…}
!DO NOT CALL THIS FROM WITHIN ENGINE CALLBACKS
render_unlock ¶
render_unlock :: proc "contextless" () {…}
!DO NOT CALL THIS FROM WITHIN ENGINE CALLBACKS
second_to_nano_second ¶
second_to_nano_second :: proc "contextless" (_int: $T, _dec: $T) -> $T {…}
_int * 1000000000 + _dec
second_to_nano_second2 ¶
second_to_nano_second2 :: proc "contextless" (_sec: $T, _milisec: $T, _usec: $T, _nsec: $T) -> $T {…}
set_full_screen_mode ¶
set_full_screen_mode :: proc "contextless" (monitor: ^monitor_info) {…}
Sets the window to fullscreen mode on the specified monitor
Inputs:
monitor: Pointer to the monitor to use for fullscreen
Returns:
None
set_max_frame ¶
set_max_frame :: proc "contextless" (_maxframe: f64) {…}
set_render_clear_color ¶
set_render_clear_color :: proc "contextless" (_color: [4]f32) {…}
set_uniform_resources_transform_object ¶
set_uniform_resources_transform_object :: proc(self: ^itransform_object, resources: []union_resource) {…}
set_v_sync ¶
set_v_sync :: proc "contextless" (v_sync: v_sync) {…}
Sets the vertical sync mode
Inputs:
v_sync: The vertical sync mode to set
Returns:
None
set_window_icon ¶
set_window_icon :: proc "contextless" (icons: []glfw_bindings.Image) {…}
set_window_mode ¶
set_window_mode :: proc "contextless" () {…}
Sets the window to windowed mode
Returns:
None
start_console ¶
start_console :: proc() {…}
texture_array_deinit ¶
texture_array_deinit :: proc(self: ^texture_array) {…}
texture_array_init ¶
texture_array_init :: proc( self: ^texture_array, width: u32, height: u32, count: u32, pixels: []u8, sampler: vulkan.Sampler = 0, inPixelFmt: image.color_fmt = .RGBA, ) {…}
Initializes a texture array with multiple textures
Inputs:
self: Pointer to the texture array to initialize
width: Width of each texture
height: Height of each texture
count: Number of textures in the array
pixels: Pixel data for all textures
sampler: Sampler to use (default: 0, uses default linear sampler)
inPixelFmt: Input pixel format (default: .RGBA)
Returns:
None
texture_deinit ¶
texture_deinit :: proc(self: ^texture) {…}
texture_fmt_bit_size ¶
texture_fmt_bit_size :: proc(fmt: texture_fmt) -> u32 {…}
Returns the bit size of the given texture format
Inputs:
fmt: The texture format to get the bit size for
Returns:
The number of bits per pixel for the given format
texture_fmt_is_depth ¶
texture_fmt_is_depth :: proc "contextless" (t: texture_fmt) -> bool {…}
Checks if the given texture format is a depth format
Inputs:
t: The texture format to check
Returns:true if the format is a depth format, false otherwise
texture_fmt_to_color_fmt ¶
texture_fmt_to_color_fmt :: proc(t: texture_fmt) -> image.color_fmt {…}
Converts a texture format to a color format
Inputs:
t: The texture format to convert
Returns:
The corresponding color format, or .Unknown if unsupported
texture_init ¶
texture_init :: proc( self: ^texture, width: u32, height: u32, pixels: []u8, pixels_allocator: runtime.Maybe($T=Allocator) = nil, sampler: vulkan.Sampler = 0, resource_usage: resource_usage = .GPU, in_pixel_fmt: image.color_fmt = .RGBA, ) {…}
Initializes a texture with the given width, height, pixels, and sampler
Note: pixels_allocator is used to delete pixels when texture init is done. (async) If pixels_allocator is nil, not delete pixels.
if you pixel allocated with any image_converter, you should make custom allocator to destory this image_converter.
Inputs:
self: Pointer to the texture to initialize
width: Width of the texture
height: Height of the texture
pixels: Pixels of the texture
pixels_allocator: The allocator to use for the pixels
sampler: The sampler to use for the texture
resource_usage: The resource usage to use for the texture
in_pixel_fmt: The pixel format to use for the texture
Returns:
None
Example:
package image_test
import "core:debug/trace"
import "base:runtime"
import "core:engine"
import "core:log"
panda_img : []u8 = #load("res/panda.qoi")
panda_img_allocator_proc :: proc(allocator_data:rawptr, mode: runtime.Allocator_Mode, size:int, alignment:int, old_memory:rawptr, old_size:int, loc := #caller_location) -> ([]byte, runtime.Allocator_Error) {
#partial switch mode {
case .Free:
qoiD :^qoi_converter = auto_cast allocator_data
qoi_converter_deinit(qoiD)
free(qoiD, def_allocator())
}
return nil, nil
}
init :: proc() {
qoiD := new(qoi_converter, def_allocator())
imgData, errCode := image_converter_load(qoiD, panda_img, .RGBA)
if errCode != nil {
log.panicf("image_converter_load : %s\n", errCode)
}
texture_init(&texture,
u32(image_converter_width(qoiD)), u32(image_converter_height(qoiD)), imgData,
runtime.Allocator{
procedure = panda_img_allocator_proc,
data = auto_cast qoiD,
})
}
texture_pixel_perfect_point ¶
texture_pixel_perfect_point :: proc "contextless" (tex: ^texture, p: [2]f32, canvasW: f32, canvasH: f32, pivot: image_center_pt_pos) -> [2]f32 {…}
Calculates pixel-perfect point position for a texture
Inputs:
tex: Pointer to texture
p: Point to adjust
canvasW: Canvas width
canvasH: Canvas height
pivot: Pivot position for the image
Returns:
Adjusted point for pixel-perfect rendering
texture_point_in ¶
texture_point_in :: proc(texture: ^texture, point: [2]f32, mat: matrix[4, 4]f32, ref_viewport: ^viewport = nil) -> bool {…}
Checks if a window-space point hits the textured quad (with optional alpha test). Uses same transform as image shader: proj view model * scale(tex_width, tex_height, 1).
Inputs:
texture: Texture to test (used for size and pixel_data alpha).
point: Window coordinates (0,0 top-left to window_size bottom-right).
mat: Model matrix of the quad.
ref_viewport: Viewport for proj/camera; if nil, def_viewport() is used.
alpha_threshold: Pixels with alpha >= this are considered hit; use 0 to skip alpha test when pixel_data is set.
Returns:
true if point is inside the quad and (if pixel_data present) alpha >= alpha_threshold.
update_descriptor_set ¶
update_descriptor_set :: proc(descriptor_sets: ^i_descriptor_set) {…}
viewport_descriptor_set_layout ¶
viewport_descriptor_set_layout :: proc "contextless" () -> vulkan.DescriptorSetLayout {…}
viewport_init_update ¶
viewport_init_update :: proc(self: ^viewport) {…}
Initializes or updates the viewport's descriptor set. You should call this function after changing the camera, projection pointer or initializing the viewport.
Inputs:
self: Pointer to the viewport to initialize and update
Returns:
None
webgl_create_context ¶
webgl_create_context :: proc() {…}
webgl_destroy ¶
webgl_destroy :: proc() {…}
webgl_start ¶
webgl_start :: proc() {…}
window_height ¶
window_height :: proc "contextless" () -> int {…}
Gets the window height
Returns:
Window height in pixels
window_width ¶
window_width :: proc "contextless" () -> int {…}
Gets the window width
Returns:
Window width in pixels
window_x ¶
window_x :: proc "contextless" () -> int {…}
Gets the window X position
Returns:
Window X position in pixels
window_y ¶
window_y :: proc "contextless" () -> int {…}
Gets the window Y position
Returns:
Window Y position in pixels
windows_set_res_icon ¶
windows_set_res_icon :: proc "contextless" (icon_resource_number: int) {…}
Procedure Groups
This section is empty.
Source Files
- android.odin
- camera.odin
- glfw.odin
- graphics_api.odin
- graphics_pipeline.odin
- graphics_template.odin
- image.odin
- input.odin
- layer.odin
- object.odin
- projection.odin
- system.odin
- viewport.odin
- vk_allocator.odin
- vk_allocator_types.odin
- vk_descriptor.odin
- vk_device.odin
- vk_frame.odin
- vk_instance.odin
- vk_mem_buffer.odin
- vk_render_pass.odin
- vk_resource.odin
- vk_swapchain.odin
- vk_types.odin
- vk_uniform.odin
- vulkan.odin
- webgl.odin
- window.odin
Generation Information
Generated with odin version dev-v0.0.1 (vendor "odin") Linux_amd64 @ 2026-01-30 10:23:15.863590443 +0000 UTC