live2d_cubism_core_sys/
lib.rs1#![allow(non_camel_case_types, non_upper_case_globals)]
12
13use std::os::raw::{c_char, c_float, c_int, c_uchar, c_uint, c_ushort, c_void};
14
15#[repr(C)]
19pub struct csmMoc {
20 _opaque: [u8; 0],
21}
22
23#[repr(C)]
25pub struct csmModel {
26 _opaque: [u8; 0],
27}
28
29pub type csmVersion = c_uint;
33
34pub type csmMocVersion = c_uint;
36
37pub type csmFlags = c_uchar;
39
40pub type csmParameterType = c_int;
42
43#[repr(C)]
47#[derive(Debug, Clone, Copy, Default)]
48pub struct csmVector2 {
49 pub x: c_float,
50 pub y: c_float,
51}
52
53#[repr(C)]
55#[derive(Debug, Clone, Copy, Default)]
56pub struct csmVector4 {
57 pub x: c_float,
58 pub y: c_float,
59 pub z: c_float,
60 pub w: c_float,
61}
62
63pub const ALIGN_OF_MOC: usize = 64;
67
68pub const ALIGN_OF_MODEL: usize = 16;
70
71pub const BLEND_ADDITIVE: csmFlags = 1 << 0;
73pub const BLEND_MULTIPLICATIVE: csmFlags = 1 << 1;
74pub const IS_DOUBLE_SIDED: csmFlags = 1 << 2;
75pub const IS_INVERTED_MASK: csmFlags = 1 << 3;
76
77pub const IS_VISIBLE: csmFlags = 1 << 0;
79pub const VISIBILITY_DID_CHANGE: csmFlags = 1 << 1;
80pub const OPACITY_DID_CHANGE: csmFlags = 1 << 2;
81pub const DRAW_ORDER_DID_CHANGE: csmFlags = 1 << 3;
82pub const RENDER_ORDER_DID_CHANGE: csmFlags = 1 << 4;
83pub const VERTEX_POSITIONS_DID_CHANGE: csmFlags = 1 << 5;
84pub const BLEND_COLOR_DID_CHANGE: csmFlags = 1 << 6;
85
86pub const MOC_VERSION_UNKNOWN: csmMocVersion = 0;
88pub const MOC_VERSION_30: csmMocVersion = 1;
89pub const MOC_VERSION_33: csmMocVersion = 2;
90pub const MOC_VERSION_40: csmMocVersion = 3;
91pub const MOC_VERSION_42: csmMocVersion = 4;
92pub const MOC_VERSION_50: csmMocVersion = 5;
93pub const MOC_VERSION_53: csmMocVersion = 6;
94
95pub const PARAMETER_TYPE_NORMAL: csmParameterType = 0;
97pub const PARAMETER_TYPE_BLEND_SHAPE: csmParameterType = 1;
98
99pub type csmLogFunction = Option<extern "C" fn(message: *const c_char)>;
101
102extern "C" {
105 pub fn csmGetVersion() -> csmVersion;
108 pub fn csmGetLatestMocVersion() -> csmMocVersion;
109 pub fn csmGetMocVersion(address: *const c_void, size: c_uint) -> csmMocVersion;
110
111 pub fn csmHasMocConsistency(address: *mut c_void, size: c_uint) -> c_int;
114
115 pub fn csmGetLogFunction() -> csmLogFunction;
118 pub fn csmSetLogFunction(handler: csmLogFunction);
119
120 pub fn csmReviveMocInPlace(address: *mut c_void, size: c_uint) -> *mut csmMoc;
123
124 pub fn csmGetSizeofModel(moc: *const csmMoc) -> c_uint;
127 pub fn csmInitializeModelInPlace(
128 moc: *const csmMoc,
129 address: *mut c_void,
130 size: c_uint,
131 ) -> *mut csmModel;
132 pub fn csmUpdateModel(model: *mut csmModel);
133
134 pub fn csmGetRenderOrders(model: *const csmModel) -> *const c_int;
136
137 pub fn csmReadCanvasInfo(
140 model: *const csmModel,
141 out_size_in_pixels: *mut csmVector2,
142 out_origin_in_pixels: *mut csmVector2,
143 out_pixels_per_unit: *mut c_float,
144 );
145
146 pub fn csmGetParameterCount(model: *const csmModel) -> c_int;
149 pub fn csmGetParameterIds(model: *const csmModel) -> *const *const c_char;
150 pub fn csmGetParameterTypes(model: *const csmModel) -> *const csmParameterType;
151 pub fn csmGetParameterMinimumValues(model: *const csmModel) -> *const c_float;
152 pub fn csmGetParameterMaximumValues(model: *const csmModel) -> *const c_float;
153 pub fn csmGetParameterDefaultValues(model: *const csmModel) -> *const c_float;
154 pub fn csmGetParameterValues(model: *mut csmModel) -> *mut c_float;
155 pub fn csmGetParameterRepeats(model: *const csmModel) -> *const c_int;
156 pub fn csmGetParameterKeyCounts(model: *const csmModel) -> *const c_int;
157 pub fn csmGetParameterKeyValues(model: *const csmModel) -> *const *const c_float;
158
159 pub fn csmGetPartCount(model: *const csmModel) -> c_int;
162 pub fn csmGetPartIds(model: *const csmModel) -> *const *const c_char;
163 pub fn csmGetPartOpacities(model: *mut csmModel) -> *mut c_float;
164 pub fn csmGetPartParentPartIndices(model: *const csmModel) -> *const c_int;
165 pub fn csmGetPartOffscreenIndices(model: *const csmModel) -> *const c_int;
166
167 pub fn csmGetDrawableCount(model: *const csmModel) -> c_int;
170 pub fn csmGetDrawableIds(model: *const csmModel) -> *const *const c_char;
171 pub fn csmGetDrawableConstantFlags(model: *const csmModel) -> *const csmFlags;
172 pub fn csmGetDrawableDynamicFlags(model: *const csmModel) -> *const csmFlags;
173 pub fn csmGetDrawableBlendModes(model: *const csmModel) -> *const c_int;
175 pub fn csmGetDrawableTextureIndices(model: *const csmModel) -> *const c_int;
176 pub fn csmGetDrawableDrawOrders(model: *const csmModel) -> *const c_int;
177 pub fn csmGetDrawableOpacities(model: *const csmModel) -> *const c_float;
178 pub fn csmGetDrawableMaskCounts(model: *const csmModel) -> *const c_int;
179 pub fn csmGetDrawableMasks(model: *const csmModel) -> *const *const c_int;
180 pub fn csmGetDrawableVertexCounts(model: *const csmModel) -> *const c_int;
181 pub fn csmGetDrawableVertexPositions(model: *const csmModel) -> *const *const csmVector2;
182 pub fn csmGetDrawableVertexUvs(model: *const csmModel) -> *const *const csmVector2;
183 pub fn csmGetDrawableIndexCounts(model: *const csmModel) -> *const c_int;
184 pub fn csmGetDrawableIndices(model: *const csmModel) -> *const *const c_ushort;
185 pub fn csmGetDrawableMultiplyColors(model: *const csmModel) -> *const csmVector4;
186 pub fn csmGetDrawableScreenColors(model: *const csmModel) -> *const csmVector4;
187 pub fn csmGetDrawableParentPartIndices(model: *const csmModel) -> *const c_int;
188 pub fn csmResetDrawableDynamicFlags(model: *mut csmModel);
189
190 pub fn csmGetOffscreenCount(model: *const csmModel) -> c_int;
193 pub fn csmGetOffscreenBlendModes(model: *const csmModel) -> *const c_int;
194 pub fn csmGetOffscreenOpacities(model: *const csmModel) -> *const c_float;
195 pub fn csmGetOffscreenOwnerIndices(model: *const csmModel) -> *const c_int;
196 pub fn csmGetOffscreenMultiplyColors(model: *const csmModel) -> *const csmVector4;
197 pub fn csmGetOffscreenScreenColors(model: *const csmModel) -> *const csmVector4;
198 pub fn csmGetOffscreenMaskCounts(model: *const csmModel) -> *const c_int;
199 pub fn csmGetOffscreenMasks(model: *const csmModel) -> *const *const c_int;
200 pub fn csmGetOffscreenConstantFlags(model: *const csmModel) -> *const csmFlags;
201}