summaryrefslogtreecommitdiff
path: root/include/celeritas.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/celeritas.h')
-rw-r--r--include/celeritas.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/celeritas.h b/include/celeritas.h
index 0b56bf5..979e8c4 100644
--- a/include/celeritas.h
+++ b/include/celeritas.h
@@ -264,7 +264,7 @@ inlined vec3 vec3_add(vec3 u, vec3 v);
inlined vec3 vec3_sub(vec3 u, vec3 v);
inlined vec3 vec3_mult(vec3 u, f32 s);
inlined vec3 vec3_div(vec3 u, f32 s);
-inlined vec3 vec3_len_squared(vec3 a);
+inlined f32 vec3_len_squared(vec3 a);
inlined f32 vec3_len(vec3 a);
inlined vec3 vec3_negate(vec3 a);
inlined vec3 vec3_normalise(vec3 a);
@@ -275,11 +275,13 @@ inlined vec4 vec4_create(f32 x, f32 y, f32 z, f32 w);
// quaternion functions
inlined quat quat_ident();
+quat quat_normalise(quat a);
+f32 quat_dot(quat a, quat b);
quat quat_from_axis_angle(vec3 axis, f32 angle, bool normalise);
quat quat_slerp(quat a, quat b, f32 percentage);
// matrix functions
-inlined mat4 mat4_ident();
+mat4 mat4_ident();
mat4 mat4_translation(vec3 position);
mat4 mat4_scale(vec3 scale);
mat4 mat4_rotation(quat rotation);
@@ -366,9 +368,18 @@ typedef struct vertex_desc {
u32 padding;
} vertex_desc;
+typedef struct static_3d_vert {
+ vec4 pos;
+ vec4 norm;
+ vec2 uv;
+ vec2 pad;
+} static_3d_vert;
+
// Some default formats
vertex_desc static_3d_vertex_format();
+void print_static_3d_vert(static_3d_vert* vertex_data);
+
typedef enum shader_binding_type {
BINDING_BYTES,
BINDING_BUFFER,
@@ -437,6 +448,7 @@ typedef struct render_pass_desc {
// Resources
buf_handle ral_buffer_create(u64 size, const void* data);
void ral_buffer_destroy(buf_handle handle);
+void ral_buffer_upload_data(buf_handle, u64 size, const void* data);
tex_handle ral_texture_create(texture_desc desc, bool create_view, const void* data);
tex_handle ral_texture_load_from_file(const char* filepath);
@@ -460,9 +472,11 @@ void ral_compute_pipeline_destroy(compute_pipeline_handle handle);
// Encoding
void ral_encode_bind_pipeline(gpu_encoder* enc, pipeline_handle pipeline);
+void ral_set_default_settings(gpu_encoder* enc);
void ral_encode_set_vertex_buf(gpu_encoder* enc, buf_handle vbuf);
void ral_encode_set_index_buf(gpu_encoder* enc, buf_handle ibuf);
void ral_encode_set_texture(gpu_encoder* enc, tex_handle texture, u32 slot);
+void ral_bind_buffer(gpu_encoder* enc, buf_handle, u32 index);
void ral_encode_draw_tris(gpu_encoder* enc, size_t start, size_t count);
// Backend lifecycle
@@ -491,6 +505,8 @@ DEFINE_HANDLE(model_handle);
typedef struct geometry {
vertex_desc vertex_format;
void* vertex_data;
+ size_t data_length;
+ size_t n_vertices;
bool has_indices; // When this is false indexed drawing is not used
u32_darray* indices;
} geometry;