Add files for assimp rust wrapper
This commit is contained in:
222
port/assimp_rs/Cargo.lock
generated
222
port/assimp_rs/Cargo.lock
generated
@@ -1,6 +1,228 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "assimp_rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.71.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"itertools",
|
||||
"log",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"libc",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.180"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
@@ -6,4 +6,5 @@ edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
[build-dependencies]
|
||||
bindgen = "*"
|
||||
33
port/assimp_rs/build.rs
Normal file
33
port/assimp_rs/build.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
extern crate bindgen;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// Tell cargo to look for shared libraries in the specified directory
|
||||
println!("cargo:rustc-link-search=/../../../lib/");
|
||||
|
||||
// Tell cargo to tell rustc to link the system bzip2
|
||||
// shared library.
|
||||
println!("cargo:rustc-link-lib=assimp");
|
||||
|
||||
// The bindgen::Builder is the main entry point
|
||||
// to bindgen, and lets you build up options for
|
||||
// the resulting bindings.
|
||||
let bindings = bindgen::Builder::default()
|
||||
// The input header we would like to generate
|
||||
// bindings for.
|
||||
.header("assimp_wrapper.h")
|
||||
// Tell cargo to invalidate the built crate whenever any of the
|
||||
// included header files changed.
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
// Finish the builder and generate the bindings.
|
||||
.generate()
|
||||
// Unwrap the Result and panic on failure.
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
// Write the bindings to the $OUT_DIR/bindings.rs file.
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
18
port/assimp_rs/src/assimp_wrapper.h
Normal file
18
port/assimp_rs/src/assimp_wrapper.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <assimp/camera.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/vector3.h>
|
||||
#include <assimp/matrix4x4.h>
|
||||
#include <assimp/quaternion.h>
|
||||
#include <assimp/color4.h>
|
||||
#include <assimp/mesh.h>
|
||||
#include <assimp/anim.h>
|
||||
#include <assimp/metadata.h>
|
||||
#include <assimp/light.h>
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/texture.h>
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/version.h>
|
||||
#include <assimp/importerdesc.h>
|
||||
@@ -1 +0,0 @@
|
||||
pub use self::structs::{Camera};
|
||||
@@ -1,17 +1,5 @@
|
||||
pub mod camera;
|
||||
pub mod core;
|
||||
pub mod errors;
|
||||
pub mod formats;
|
||||
pub mod material;
|
||||
pub mod postprocess;
|
||||
pub mod shims;
|
||||
pub mod socket;
|
||||
pub mod structs;
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(true, true);
|
||||
}
|
||||
}
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
pub struct Animation<'mA, 'mMA, 'nA> {
|
||||
/* The name of the animation. If the modeling package this data was
|
||||
* exported from does support only a single animation channel, this
|
||||
* name is usually empty (length is zero).
|
||||
*/
|
||||
m_name: Option<String>,
|
||||
// Duration of the animation in ticks
|
||||
m_duration: f64,
|
||||
// Ticks per second. Zero (0.000... ticks/second) if not
|
||||
// specified in the imported file
|
||||
m_ticks_per_second: Option<f64>,
|
||||
/* Number of bone animation channels.
|
||||
Each channel affects a single node.
|
||||
*/
|
||||
m_num_channels: u64,
|
||||
/* Node animation channels. Each channel
|
||||
affects a single node.
|
||||
?? -> The array is m_num_channels in size.
|
||||
(maybe refine to a derivative type of usize?)
|
||||
*/
|
||||
m_channels: &'nA NodeAnim,
|
||||
/* Number of mesh animation channels. Each
|
||||
channel affects a single mesh and defines
|
||||
vertex-based animation.
|
||||
*/
|
||||
m_num_mesh_channels: u64,
|
||||
/* The mesh animation channels. Each channel
|
||||
affects a single mesh.
|
||||
The array is m_num_mesh_channels in size
|
||||
(maybe refine to a derivative of usize?)
|
||||
*/
|
||||
m_mesh_channels: &'mA MeshAnim,
|
||||
/* The number of mesh animation channels. Each channel
|
||||
affects a single mesh and defines some morphing animation.
|
||||
*/
|
||||
m_num_morph_mesh_channels: u64,
|
||||
/* The morph mesh animation channels. Each channel affects a single mesh.
|
||||
The array is mNumMorphMeshChannels in size.
|
||||
*/
|
||||
m_morph_mesh_channels: &'mMA MeshMorphAnim
|
||||
}
|
||||
pub struct NodeAnim {}
|
||||
pub struct MeshAnim {}
|
||||
pub struct MeshMorphAnim {}
|
||||
@@ -1,6 +0,0 @@
|
||||
mod anim;
|
||||
pub use self::anim::{
|
||||
Animation,
|
||||
NodeAnim,
|
||||
MeshAnim,
|
||||
MeshMorphAnim};
|
||||
@@ -1,2 +0,0 @@
|
||||
mod blob;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod bone;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod camera;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
struct Color3D {
|
||||
r: f32,
|
||||
g: f32,
|
||||
b: f32
|
||||
}
|
||||
|
||||
impl Color3D {
|
||||
pub fn new(r_f32: f32, g_f32: f32, b_f32: f32) -> Color3D {
|
||||
Color3D {r: r_f32, g: g_f32, b: b_f32 }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
struct Color4D {
|
||||
r: f32,
|
||||
g: f32,
|
||||
b: f32,
|
||||
a: f32
|
||||
}
|
||||
|
||||
impl Color4D {
|
||||
pub fn new(r_f32: f32, g_f32: f32, b_f32: f32, a_f32: f32) -> Color4D {
|
||||
Color4D {r: r_f32, g: g_f32, b: b_f32, a: a_f32 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
mod color;
|
||||
pub use self::color::{
|
||||
Color3D,
|
||||
Color4D
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
mod face;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod key;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod light;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod material;
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
struct Matrix3x3 {
|
||||
a1: f32,
|
||||
a2: f32,
|
||||
a3: f32,
|
||||
b1: f32,
|
||||
b2: f32,
|
||||
b3: f32,
|
||||
c1: f32,
|
||||
c2: f32,
|
||||
c3: f32
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
struct Matrix4x4 {
|
||||
a1: f32,
|
||||
a2: f32,
|
||||
a3: f32,
|
||||
a4: f32,
|
||||
b1: f32,
|
||||
b2: f32,
|
||||
b3: f32,
|
||||
b4: f32,
|
||||
c1: f32,
|
||||
c2: f32,
|
||||
c3: f32,
|
||||
c4: f32,
|
||||
d1: f32,
|
||||
d2: f32,
|
||||
d3: f32,
|
||||
d4: f32
|
||||
}
|
||||
|
||||
impl Matrix3x3 {
|
||||
pub fn new(
|
||||
a1_f32: f32, a2_f32: f32, a3_f32: f32,
|
||||
b1_f32: f32, b2_f32: f32, b3_f32: f32,
|
||||
c1_f32: f32, c2_f32: f32, c3_f32: f32
|
||||
) -> Matrix3x3 {
|
||||
Matrix3x3 {
|
||||
a1: a1_f32, a2: a2_f32, a3: a3_f32,
|
||||
b1: b1_f32, b2: b2_f32, b3: b3_f32,
|
||||
c1: c1_f32, c2: c2_f32, c3: c3_f32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Matrix4x4 {
|
||||
pub fn new(
|
||||
a1_f32: f32, a2_f32: f32, a3_f32: f32, a4_f32: f32,
|
||||
b1_f32: f32, b2_f32: f32, b3_f32: f32, b4_f32: f32,
|
||||
c1_f32: f32, c2_f32: f32, c3_f32: f32, c4_f32: f32,
|
||||
d1_f32: f32, d2_f32: f32, d3_f32: f32, d4_f32: f32
|
||||
) -> Matrix4x4 {
|
||||
Matrix4x4 {
|
||||
a1: a1_f32, a2: a2_f32, a3: a3_f32, a4: a4_f32,
|
||||
b1: b1_f32, b2: b2_f32, b3: b3_f32, b4: b4_f32,
|
||||
c1: c1_f32, c2: c2_f32, c3: c3_f32, c4: c4_f32,
|
||||
d1: d1_f32, d2: d2_f32, d3: d3_f32, d4: d4_f32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
mod matrix;
|
||||
pub use self::matrix::{
|
||||
Matrix3x3,
|
||||
Matrix4x4};
|
||||
@@ -1,35 +0,0 @@
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
struct MemoryInfo {
|
||||
textures: u32,
|
||||
materials: u32,
|
||||
meshes: u32,
|
||||
nodes: u32,
|
||||
animations: u32,
|
||||
cameras: u32,
|
||||
lights: u32,
|
||||
total: u32
|
||||
}
|
||||
|
||||
impl MemoryInfo {
|
||||
pub fn new(
|
||||
textures_uint: u32,
|
||||
materials_uint: u32,
|
||||
meshes_uint: u32,
|
||||
nodes_uint: u32,
|
||||
animations_uint: u32,
|
||||
cameras_uint: u32,
|
||||
lights_uint: u32,
|
||||
total_uint: u32) -> MemoryInfo {
|
||||
|
||||
MemoryInfo {
|
||||
textures: textures_uint,
|
||||
materials: materials_uint,
|
||||
meshes: meshes_uint,
|
||||
nodes: nodes_uint,
|
||||
animations: animations_uint,
|
||||
cameras: cameras_uint,
|
||||
lights: lights_uint,
|
||||
total: total_uint
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
mod memory;
|
||||
pub use self::memory::MemoryInfo;
|
||||
@@ -1,3 +0,0 @@
|
||||
mod mesh;
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod meta;
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
mod anim;
|
||||
/* Animation
|
||||
* NodeAnim
|
||||
* MeshAnim
|
||||
* MeshMorphAnim
|
||||
*/
|
||||
mod blob;
|
||||
/* ExportDataBlob
|
||||
*/
|
||||
mod vec;
|
||||
/* Vector2d
|
||||
* Vector3d
|
||||
* */
|
||||
mod matrix;
|
||||
/* Matrix3by3
|
||||
* Matrix4by4
|
||||
*/
|
||||
mod camera;
|
||||
/* Camera */
|
||||
mod color;
|
||||
/* Color3d
|
||||
* Color4d
|
||||
*/
|
||||
mod key;
|
||||
/* MeshKey
|
||||
* MeshMorphKey
|
||||
* QuatKey
|
||||
* VectorKey
|
||||
*/
|
||||
mod texel;
|
||||
mod plane;
|
||||
mod string;
|
||||
/* String
|
||||
*/
|
||||
mod material;
|
||||
/* Material
|
||||
* MaterialPropery
|
||||
* MaterialPropertyString
|
||||
*/
|
||||
mod mem;
|
||||
mod quaternion;
|
||||
mod face;
|
||||
mod vertex_weight;
|
||||
mod mesh;
|
||||
/* Mesh
|
||||
*/
|
||||
mod meta;
|
||||
/* Metadata
|
||||
* MetadataEntry
|
||||
*/
|
||||
mod node;
|
||||
/* Node
|
||||
* */
|
||||
mod light;
|
||||
mod texture;
|
||||
mod ray;
|
||||
mod transform;
|
||||
/* UVTransform */
|
||||
mod bone;
|
||||
mod scene;
|
||||
/* Scene */
|
||||
@@ -1,2 +0,0 @@
|
||||
mod node;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod plane;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
struct Plane {
|
||||
a: f32,
|
||||
b: f32,
|
||||
c: f32,
|
||||
d: f32
|
||||
}
|
||||
|
||||
impl Plane {
|
||||
pub fn new(
|
||||
a_f32: f32,
|
||||
b_f32: f32,
|
||||
c_f32: f32,
|
||||
d_f32: f32
|
||||
) -> Plane {
|
||||
Plane {
|
||||
a: a_f32,
|
||||
b: b_f32,
|
||||
c: b_f32,
|
||||
d: d_f32
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
mod quaternion;
|
||||
|
||||
pub use self::quaternion::Quaternion;
|
||||
@@ -1,7 +0,0 @@
|
||||
use crate::vec;
|
||||
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
pub struct Quaternion {
|
||||
_coordinates: vec::Vector4d
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
mod ray;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod scene;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
mod string;
|
||||
pub use self::string::MAXLEN;
|
||||
pub use self::string::Str;
|
||||
@@ -1,41 +0,0 @@
|
||||
pub const MAXLEN: usize = 1024;
|
||||
|
||||
/// Want to consider replacing `Vec<char>`
|
||||
/// with a comparable definition at
|
||||
/// https://doc.rust-lang.org/src/alloc/string.rs.html#415-417
|
||||
#[derive(Clone, Debug)]
|
||||
struct Str {
|
||||
length: usize,
|
||||
data: Vec<char>
|
||||
}
|
||||
|
||||
impl Str {
|
||||
pub fn new(len_u32: usize, data_string: String) -> Str {
|
||||
Str {
|
||||
length: len_u32,
|
||||
data: data_string.chars().collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// MaterialPropertyStr
|
||||
/// The size of length is truncated to 4 bytes on a 64-bit platform when used as a
|
||||
/// material property (see MaterialSystem.cpp, as aiMaterial::AddProperty() ).
|
||||
#[derive(Clone, Debug)]
|
||||
struct MaterialPropertyStr {
|
||||
length: usize,
|
||||
data: Vec<char>
|
||||
}
|
||||
|
||||
|
||||
impl MaterialPropertyStr {
|
||||
pub fn new(len_u32: usize, data_string: String) -> MaterialPropertyStr {
|
||||
MaterialPropertyStr {
|
||||
length: len_u32,
|
||||
data: data_string.chars().collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
mod texture;
|
||||
pub use self::texture::Texel;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
struct Texel {
|
||||
b: u32,
|
||||
g: u32,
|
||||
r: u32,
|
||||
a: u32
|
||||
}
|
||||
|
||||
impl Texel {
|
||||
pub fn new(b_u32: u32, g_u32: u32,
|
||||
r_u32: u32, a_u32: u32) -> Texel {
|
||||
Texel {
|
||||
b: b_u32,
|
||||
g: g_u32,
|
||||
r: r_u32,
|
||||
a: a_u32
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
mod transform;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod vec;
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
struct Vector2d {
|
||||
x: f32,
|
||||
y: f32
|
||||
}
|
||||
|
||||
struct Vector3d {
|
||||
x: f32,
|
||||
y: f32,
|
||||
z: f32
|
||||
}
|
||||
|
||||
struct Vector4d {
|
||||
x: f32,
|
||||
y: f32,
|
||||
z: f32,
|
||||
w: f32
|
||||
}
|
||||
|
||||
impl Vector2d {
|
||||
pub fn new(x_f32: f32, y_f32: f32) -> Vector2d {
|
||||
Vector2d {
|
||||
x: x_f32,
|
||||
y: y_f32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Vector3d {
|
||||
pub fn new(x_f32: f32, y_f32: f32, z_f32: f32) -> Vector3d {
|
||||
Vector3d {
|
||||
x: x_f32,
|
||||
y: y_f32,
|
||||
z: z_f32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Vector4d {
|
||||
pub fn new(x_f32: f32, y_f32: f32, z_f32: f32, w_f32: f32) -> Vector4d {
|
||||
Vector4d {
|
||||
x: x_f32,
|
||||
y: y_f32,
|
||||
z: z_f32,
|
||||
w: w_f32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
mod vertex;
|
||||
// pub use self::vertex::
|
||||
Reference in New Issue
Block a user