1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
use std::os::raw::{c_char, c_float, c_int, c_uint, c_void};

use cfileio::*;
use importerdesc::*;
use postprocess::*;
use scene::*;
use types::*;

pub type AiLogStreamCallback = Option<unsafe extern "system" fn(*const c_char, *mut c_char)>;

#[repr(C)]
pub struct AiLogStream {
    pub callback: AiLogStreamCallback,
    pub user: *mut c_void,
}

#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct AiPropertyStore {
    pub sentinel: c_char,
}

pub type AiBool = c_int;
pub const AI_FALSE: AiBool = 0;
pub const AI_TRUE: AiBool = 1;

extern {
    pub fn aiImportFile(
        file: *const c_char,
        flags: AiPostProcessSteps) -> *const AiScene;

    pub fn aiImportFileEx(
        file: *const c_char,
        flags: AiPostProcessSteps,
        fs: *mut AiFileIO) -> *const AiScene;

    pub fn aiImportFileExWithProperties(
        file: *const c_char,
        flags: AiPostProcessSteps,
        fs: *mut AiFileIO,
        props: *const AiPropertyStore) -> *const AiScene;

    pub fn aiImportFileFromMemory(
        buffer: *const c_char,
        length: c_uint,
        flags: AiPostProcessSteps,
        hint: *const c_char) -> *const AiScene;

    pub fn aiImportFileFromMemoryWithProperties(
        buffer: *const c_char,
        length: c_uint,
        flags: AiPostProcessSteps,
        hint: *const c_char,
        props: *const AiPropertyStore) -> *const AiScene;

    pub fn aiApplyPostProcessing(
        scene: *const AiScene,
        flags: AiPostProcessSteps) -> *const AiScene;

    pub fn aiGetPredefinedLogStream(
        stream: AiDefaultLogStream,
        file: *const c_char) -> AiLogStream;

    pub fn aiAttachLogStream(
        stream: *const AiLogStream);

    pub fn aiEnableVerboseLogging(
        enable: AiBool);

    pub fn aiDetachLogStream(
        stream: *const AiLogStream) -> AiReturn;

    pub fn aiDetachAllLogStreams();

    pub fn aiReleaseImport(
        scene: *const AiScene);

    pub fn aiGetErrorString() -> *const c_char;

    pub fn aiIsExtensionSupported(
        extension: *const c_char) -> AiBool;

    pub fn aiGetExtensionList(
        out: *mut AiString);

    pub fn aiGetMemoryRequirements(
        scene: *const AiScene,
        info: *mut AiMemoryInfo);

    pub fn aiCreatePropertyStore() -> *mut AiPropertyStore;

    pub fn aiReleasePropertyStore(
        store: *mut AiPropertyStore);

    pub fn aiSetImportPropertyInteger(
        store: *mut AiPropertyStore,
        name: *const c_char,
        value: c_int);

    pub fn aiSetImportPropertyFloat(
        store: *mut AiPropertyStore,
        name: *const c_char,
        value: c_float);

    pub fn aiSetImportPropertyString(
        store: *mut AiPropertyStore,
        name: *const c_char,
        value: *const AiString);

    pub fn aiSetImportPropertyMatrix(
        store: *mut AiPropertyStore,
        name: *const c_char,
        value: *const AiMatrix4x4);

    pub fn aiCreateQuaternionFromMatrix(
        quaternion: *mut AiQuaternion,
        matrix: *const AiMatrix3x3);

    pub fn aiDecomposeMatrix(
        matrix: *const AiMatrix4x4,
        scaling: *mut AiVector3D,
        rotation: *mut AiQuaternion,
        position: *mut AiVector3D);

    pub fn aiTransposeMatrix4(
        matrix: *mut AiMatrix4x4);

    pub fn aiTransposeMatrix3(
        matrix: *mut AiMatrix3x3);

    pub fn aiTransformVecByMatrix3(
        vector: *mut AiVector3D,
        matrix: *const AiMatrix3x3);

    pub fn aiTransformVecByMatrix4(
        vector: *mut AiVector3D,
        matrix: *const AiMatrix4x4);

    pub fn aiMultiplyMatrix4(
        dst: *mut AiMatrix4x4,
        src: *const AiMatrix4x4);

    pub fn aiMultiplyMatrix3(
        dst: *mut AiMatrix3x3,
        src: *const AiMatrix3x3);

    pub fn aiIdentityMatrix3(
        matrix: *mut AiMatrix3x3);

    pub fn aiIdentityMatrix4(
        matrix: *mut AiMatrix4x4);

    pub fn aiGetImportFormatCount() -> usize;

    pub fn aiGetImportFormatDescription(
        index: usize) -> *const AiImporterDesc;
}