Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ name = "cargo-build_sk_rs"

[build-dependencies]
cmake = "0.1.54"
system-deps = "2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
Expand Down Expand Up @@ -94,6 +95,9 @@ name = "main_tests"
path = "tests/main_tests.rs"
harness = false

[package.metadata.system-deps]
StereoKitC = "0.3.11"

[package.metadata.android]
package = "com.stereokit.rust_binding.demos"
build_targets = ["aarch64-linux-android"]
Expand Down
1 change: 0 additions & 1 deletion StereoKit
Submodule StereoKit deleted from ed84f3
338 changes: 3 additions & 335 deletions build.rs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ bitflags::bitflags! {
const Stability = 2;
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn anchor_find(asset_id_utf8: *const c_char) -> AnchorT;
pub fn anchor_create(pose: Pose) -> AnchorT;
Expand Down
1 change: 1 addition & 0 deletions src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub struct _FontT {
/// StereoKit ffi type.
pub type FontT = *mut _FontT;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn font_find(id: *const c_char) -> FontT;
pub fn font_create(file_utf8: *const c_char) -> FontT;
Expand Down
1 change: 1 addition & 0 deletions src/interactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub enum DefaultInteractors {
None = 1,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
// Interactor functions
pub fn interactor_create(
Expand Down
3 changes: 3 additions & 0 deletions src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pub struct _MaterialT {
/// StereoKit ffi type.
pub type MaterialT = *mut _MaterialT;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn material_find(id: *const c_char) -> MaterialT;
pub fn material_create(shader: ShaderT) -> MaterialT;
Expand Down Expand Up @@ -1472,6 +1473,7 @@ pub struct ParamInfos<'a> {
index: i32,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn material_set_float(material: MaterialT, name: *const c_char, value: f32);
pub fn material_set_vector2(material: MaterialT, name: *const c_char, value: Vec2);
Expand Down Expand Up @@ -2363,6 +2365,7 @@ impl ParamInfo {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn material_buffer_create(size: i32) -> MaterialBufferT;
pub fn material_buffer_addref(buffer: MaterialBufferT);
Expand Down
7 changes: 7 additions & 0 deletions src/maths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ impl PartialEq for Vec3 {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn vec3_cross(a: *const Vec3, b: *const Vec3) -> Vec3;
}
Expand Down Expand Up @@ -2569,6 +2570,7 @@ impl PartialEq for Quat {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn quat_difference(a: *const Quat, b: *const Quat) -> Quat;
pub fn quat_lookat(from: *const Vec3, at: *const Vec3) -> Quat;
Expand Down Expand Up @@ -3225,6 +3227,7 @@ impl PartialEq for Matrix {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn pose_matrix_out(pose: *const Pose, out_result: *mut Matrix, scale: Vec3);
pub fn matrix_inverse(a: *const Matrix, out_Matrix: *mut Matrix);
Expand Down Expand Up @@ -4718,6 +4721,7 @@ impl AsRef<Bounds> for Bounds {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn bounds_ray_intersect(bounds: Bounds, ray: Ray, out_pt: *mut Vec3) -> Bool32T;
pub fn bounds_point_contains(bounds: Bounds, pt: Vec3) -> Bool32T;
Expand Down Expand Up @@ -5328,6 +5332,7 @@ impl PartialEq for Plane {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn plane_from_points(p1: Vec3, p2: Vec3, p3: Vec3) -> Plane;
pub fn plane_from_ray(ray: Ray) -> Plane;
Expand Down Expand Up @@ -5809,6 +5814,7 @@ impl AsRef<Sphere> for Sphere {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn sphere_ray_intersect(sphere: Sphere, ray: Ray, out_pt: *mut Vec3) -> Bool32T;
pub fn sphere_point_contains(sphere: Sphere, pt: Vec3) -> Bool32T;
Expand Down Expand Up @@ -5976,6 +5982,7 @@ pub struct Ray {
pub direction: Vec3,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn ray_intersect_plane(ray: Ray, plane_pt: Vec3, plane_normal: Vec3, out_t: *mut f32) -> Bool32T;
pub fn ray_from_mouse(screen_pixel_pos: Vec2, out_ray: *mut Ray) -> Bool32T;
Expand Down
1 change: 1 addition & 0 deletions src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ pub type MeshT = *mut _MeshT;
/// StereoKit ffi type.
pub type VindT = u32;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn mesh_find(name: *const c_char) -> MeshT;
pub fn mesh_create() -> MeshT;
Expand Down
2 changes: 2 additions & 0 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub struct _ModelT {
/// StereoKit ffi type.
pub type ModelT = *mut _ModelT;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn model_find(id: *const c_char) -> ModelT;
pub fn model_copy(model: ModelT) -> ModelT;
Expand Down Expand Up @@ -1371,6 +1372,7 @@ pub struct Nodes<'a> {
model: &'a Model,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn model_subset_count(model: ModelT) -> i32;
pub fn model_node_add(
Expand Down
1 change: 1 addition & 0 deletions src/permission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl fmt::Display for PermissionState {
}
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn permission_state(permission: PermissionType) -> PermissionState;
pub fn permission_is_interactive(permission: PermissionType) -> Bool32T;
Expand Down
1 change: 1 addition & 0 deletions src/render_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub struct _RenderListT {
/// StereoKit ffi type.
pub type RenderListT = *mut _RenderListT;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn render_list_find(id: *const c_char) -> RenderListT;
pub fn render_list_set_id(render_list: RenderListT, id: *const c_char);
Expand Down
2 changes: 2 additions & 0 deletions src/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub struct _ShaderT {
}
/// StereoKit ffi type.
pub type ShaderT = *mut _ShaderT;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn shader_find(id: *const ::std::os::raw::c_char) -> ShaderT;
pub fn shader_create_file(filename_utf8: *const ::std::os::raw::c_char) -> ShaderT;
Expand Down
1 change: 1 addition & 0 deletions src/sk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ pub enum StandbyMode {
None = 3,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn sk_init(settings: SkSettings) -> Bool32T;
pub fn sk_set_window(window: *mut c_void);
Expand Down
2 changes: 2 additions & 0 deletions src/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub type SoundT = *mut _SoundT;
unsafe impl Send for Sound {}
unsafe impl Sync for Sound {}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn sound_find(id: *const c_char) -> SoundT;
pub fn sound_set_id(sound: SoundT, id: *const c_char);
Expand Down Expand Up @@ -790,6 +791,7 @@ pub struct SoundInst {
pub _slot: i16,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn sound_inst_stop(sound_inst: SoundInst);
pub fn sound_inst_is_playing(sound_inst: SoundInst) -> Bool32T;
Expand Down
1 change: 1 addition & 0 deletions src/sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub struct _SpriteT {
/// StereoKit ffi type.
pub type SpriteT = *mut _SpriteT;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn sprite_find(id: *const c_char) -> SpriteT;
pub fn sprite_create(sprite: TexT, type_: SpriteType, atlas_id: *const c_char) -> SpriteT;
Expand Down
13 changes: 13 additions & 0 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pub struct Assets;

pub type AssetT = *mut c_void;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn assets_releaseref_threadsafe(asset: *mut c_void);
pub fn assets_current_task() -> i32;
Expand Down Expand Up @@ -545,6 +546,7 @@ pub struct Backend;

pub type VoidFunction = unsafe extern "system" fn();

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn backend_xr_get_type() -> BackendXRType;
pub fn backend_openxr_get_instance() -> OpenXRHandleT;
Expand Down Expand Up @@ -1343,6 +1345,7 @@ pub enum HierarchyParent {
/// <img src="https://raw.githubusercontent.com/mvvvv/StereoKit-rust/refs/heads/master/screenshots/hierarchy.jpeg" alt="screenshot" width="200">
pub struct Hierarchy;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn hierarchy_push(transform: *const Matrix, parent_behavior: HierarchyParent);
pub fn hierarchy_push_pose(pose: *const Pose, parent_behavior: HierarchyParent);
Expand Down Expand Up @@ -2597,6 +2600,7 @@ pub enum Key {
/// ```
pub struct Input;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn input_pointer_count(filter: InputSource) -> i32;
pub fn input_pointer(index: i32, filter: InputSource) -> Pointer;
Expand Down Expand Up @@ -3524,6 +3528,7 @@ impl LinePoint {
/// <img src="https://raw.githubusercontent.com/mvvvv/StereoKit-rust/refs/heads/master/screenshots/lines.jpeg" alt="screenshot" width="200">
pub struct Lines;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn line_add(start: Vec3, end: Vec3, color_start: Color32, color_end: Color32, thickness: f32);
pub fn line_addv(start: LinePoint, end: LinePoint);
Expand Down Expand Up @@ -3783,6 +3788,7 @@ pub struct LogItem {
/// ```
pub struct Log;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn log_diag(text: *const c_char);
//pub fn log_diagf(text: *const c_char, ...);
Expand All @@ -3809,6 +3815,7 @@ unsafe extern "C" {
/// Log subscribe trampoline
///
/// see also [`Log::subscribe`]
#[link(name = "StereoKitC")]
unsafe extern "C" fn log_trampoline<'a, F: FnMut(LogLevel, &str) + 'a>(
context: *mut c_void,
log_level: LogLevel,
Expand Down Expand Up @@ -4048,6 +4055,7 @@ pub struct Microphone {
sound: Sound,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn mic_get_stream() -> SoundT;
pub fn mic_is_recording() -> Bool32T;
Expand Down Expand Up @@ -4268,6 +4276,7 @@ pub enum Projection {
/// <img src="https://raw.githubusercontent.com/mvvvv/StereoKit-rust/refs/heads/master/screenshots/renderer.jpeg" alt="screenshot" width="200">
pub struct Renderer;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn render_set_clip(near_plane: f32, far_plane: f32);
pub fn render_get_clip(out_near_plane: *mut f32, out_far_plane: *mut f32);
Expand Down Expand Up @@ -4381,6 +4390,7 @@ unsafe extern "C" {
/// screenshot_capture trampoline
///
/// see also [`Renderer::screenshot_capture`]
#[link(name = "StereoKitC")]
unsafe extern "C" fn sc_capture_trampoline<F: FnMut(&[Color32], usize, usize)>(
color_buffer: *mut Color32,
width: i32,
Expand Down Expand Up @@ -5587,6 +5597,7 @@ pub struct TextStyle {
_id: u32,
}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn text_make_style(font: FontT, layout_height: f32, color_gamma: Color128) -> TextStyle;
pub fn text_make_style_shader(font: FontT, layout_height: f32, shader: ShaderT, color_gamma: Color128)
Expand Down Expand Up @@ -6090,6 +6101,7 @@ pub enum TextContext {
/// <img src="https://raw.githubusercontent.com/mvvvv/StereoKit-rust/refs/heads/master/screenshots/text.jpeg" alt="screenshot" width="200">
pub struct Text;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn text_add_at(
text_utf8: *const c_char,
Expand Down Expand Up @@ -6613,6 +6625,7 @@ pub enum SpatialNodeType {
/// <https://stereokit.net/Pages/StereoKit/World.html>
pub struct World;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn world_has_bounds() -> Bool32T;
pub fn world_get_bounds_size() -> Vec2;
Expand Down
1 change: 1 addition & 0 deletions src/tex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ pub type TexT = *mut _TexT;
unsafe impl Send for Tex {}
unsafe impl Sync for Tex {}

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn tex_find(id: *const c_char) -> TexT;
pub fn tex_create(type_: TexType, format: TexFormat) -> TexT;
Expand Down
1 change: 1 addition & 0 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ pub struct UiSliderData {
/// <img src="https://raw.githubusercontent.com/mvvvv/StereoKit-rust/refs/heads/master/screenshots/ui.jpeg" alt="screenshot" width="200">
pub struct Ui;

#[link(name = "StereoKitC")]
unsafe extern "C" {
pub fn ui_quadrant_size_verts(ref_vertices: *mut Vertex, vertex_count: i32, overflow_percent: f32);
pub fn ui_quadrant_size_mesh(ref_mesh: MeshT, overflow_percent: f32);
Expand Down
Loading