mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
update assimp to 6.0.5
This commit is contained in:
parent
2d2eb57e2e
commit
f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# Open Asset Import Library (ASSIMP)
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006-2020, ASSIMP Development Team
|
||||
# Copyright (c) 2006-2026, ASSIMP Development Team
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# Open Asset Import Library (ASSIMP)
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006-2020, ASSIMP Development Team
|
||||
# Copyright (c) 2006-2026, ASSIMP Development Team
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -36,23 +36,21 @@ aiProcess_JoinIdenticalVertices = 0x2
|
|||
#
|
||||
aiProcess_MakeLeftHanded = 0x4
|
||||
|
||||
## <hr>Triangulates all faces of all meshes.
|
||||
## <hr>Triangulates all faces of all meshes.
|
||||
#
|
||||
# By default the imported mesh data might contain faces with more than 3
|
||||
# indices. For rendering you'll usually want all faces to be triangles.
|
||||
# This post processing step splits up faces with more than 3 indices into
|
||||
# triangles. Line and point primitives are #not# modified! If you want
|
||||
# indices. For rendering you'll usually want all faces to be triangles.
|
||||
# This post processing step splits up faces with more than 3 indices into
|
||||
# triangles. Line and point primitives are *not* modified! If you want
|
||||
# 'triangles only' with no other kinds of primitives, try the following
|
||||
# solution:
|
||||
# <ul>
|
||||
# <li>Specify both #aiProcess_Triangulate and #aiProcess_SortByPType <li>
|
||||
# <li>Ignore all point and line meshes when you process assimp's output<li>
|
||||
# <ul>
|
||||
# - Specify both #aiProcess_Triangulate and #aiProcess_SortByPType
|
||||
# - Ignore all point and line meshes when you process assimp's output
|
||||
#
|
||||
aiProcess_Triangulate = 0x8
|
||||
|
||||
## <hr>Removes some parts of the data structure (animations, materials,
|
||||
# light sources, cameras, textures, vertex components).
|
||||
# <hr>Removes some parts of the data structure (animations, materials,
|
||||
# light sources, cameras, textures, vertex components).
|
||||
#
|
||||
# The components to be removed are specified in a separate
|
||||
# configuration option, <tt>#AI_CONFIG_PP_RVC_FLAGS<tt>. This is quite useful
|
||||
|
|
@ -232,6 +230,15 @@ aiProcess_RemoveRedundantMaterials = 0x1000
|
|||
#
|
||||
aiProcess_FixInfacingNormals = 0x2000
|
||||
|
||||
## This step generically populates aiBone->mArmature and aiBone->mNode generically
|
||||
# The point of these is it saves you later having to calculate these elements
|
||||
# This is useful when handling rest information or skin information
|
||||
# If you have multiple armatures on your models we strongly recommend enabling this
|
||||
# Instead of writing your own multi-root, multi-armature lookups we have done the
|
||||
# hard work for you :)
|
||||
|
||||
aiProcess_PopulateArmatureData = 0x4000
|
||||
|
||||
## <hr>This step splits meshes with more than one primitive type in
|
||||
# homogeneous sub-meshes.
|
||||
#
|
||||
|
|
@ -385,7 +392,7 @@ aiProcess_OptimizeGraph = 0x400000
|
|||
#
|
||||
# <b>Output UV coordinate system:<b>
|
||||
# @code
|
||||
# 0y|0y ---------- 1x|0y
|
||||
# 0x|0y ---------- 1x|0y
|
||||
# | |
|
||||
# | |
|
||||
# | |
|
||||
|
|
@ -432,6 +439,46 @@ aiProcess_SplitByBoneCount = 0x2000000
|
|||
#
|
||||
aiProcess_Debone = 0x4000000
|
||||
|
||||
## <hr>This step will perform a global scale of the model.
|
||||
#
|
||||
# Some importers are providing a mechanism to define a scaling unit for the
|
||||
# model. This post processing step can be used to do so. You need to get the
|
||||
# global scaling from your importer settings like in FBX. Use the flag
|
||||
# AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY from the global property table to configure this.
|
||||
#
|
||||
# Use <tt>#AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY</tt> to setup the global scaling factor.
|
||||
#
|
||||
aiProcess_GlobalScale = 0x8000000
|
||||
|
||||
## <hr>A postprocessing step to embed of textures.
|
||||
#
|
||||
# This will remove external data dependencies for textures.
|
||||
# If a texture's file does not exist at the specified path
|
||||
# (due, for instance, to an absolute path generated on another system),
|
||||
# it will check if a file with the same name exists at the root folder
|
||||
# of the imported model. And if so, it uses that.
|
||||
#
|
||||
aiProcess_EmbedTextures = 0x10000000
|
||||
|
||||
##
|
||||
#
|
||||
aiProcess_ForceGenNormals = 0x20000000
|
||||
|
||||
## <hr>Drops normals for all faces of all meshes.
|
||||
#
|
||||
# This is ignored if no normals are present.
|
||||
# Face normals are shared between all points of a single face,
|
||||
# so a single point can have multiple normals, which
|
||||
# forces the library to duplicate vertices in some cases.
|
||||
# #aiProcess_JoinIdenticalVertices is *senseless* then.
|
||||
# This process gives sense back to aiProcess_JoinIdenticalVertices
|
||||
#
|
||||
aiProcess_DropNormals = 0x40000000,
|
||||
|
||||
##
|
||||
#
|
||||
aiProcess_GenBoundingBoxes = 0x80000000
|
||||
|
||||
aiProcess_GenEntityMeshes = 0x100000
|
||||
aiProcess_OptimizeAnimations = 0x200000
|
||||
aiProcess_FixTexturePaths = 0x200000
|
||||
|
|
|
|||
|
|
@ -555,6 +555,14 @@ class Bone(Structure):
|
|||
# The maximum value for this member is
|
||||
#AI_MAX_BONE_WEIGHTS.
|
||||
("mNumWeights", c_uint),
|
||||
|
||||
# The bone armature node - used for skeleton conversion
|
||||
# you must enable aiProcess_PopulateArmatureData to populate this
|
||||
("mArmature", POINTER(Node)),
|
||||
|
||||
# The bone node in the scene - used for skeleton conversion
|
||||
# you must enable aiProcess_PopulateArmatureData to populate this
|
||||
("mNode", POINTER(Node)),
|
||||
|
||||
# The vertices affected by this bone
|
||||
("mWeights", POINTER(VertexWeight)),
|
||||
|
|
@ -857,6 +865,9 @@ class QuatKey(Structure):
|
|||
|
||||
# The value of this key
|
||||
("mValue", Quaternion),
|
||||
|
||||
# The interpolation setting of this key
|
||||
("mInterpolation", c_uint32)
|
||||
]
|
||||
|
||||
class MeshMorphKey(Structure):
|
||||
|
|
|
|||
16
Engine/lib/assimp/port/PyAssimp/pyproject.toml
Normal file
16
Engine/lib/assimp/port/PyAssimp/pyproject.toml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "pyassimp"
|
||||
version = "6.0.2"
|
||||
license = "ISC"
|
||||
authors = [
|
||||
{ name = "ASSIMP Developers", email = "kim.kulling@assimp.org" },
|
||||
]
|
||||
maintainers = [{ name = "Séverin Lemaignan", email = "severin@guakamole.org" }]
|
||||
description = "Python bindings for the Open Asset Import Library (ASSIMP)"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = ["numpy"]
|
||||
6
Engine/lib/assimp/port/assimp_rs/Cargo.lock
generated
6
Engine/lib/assimp/port/assimp_rs/Cargo.lock
generated
|
|
@ -1,6 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "assimp_rs"
|
||||
version = "0.1.0"
|
||||
|
||||
|
|
@ -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 = "*"
|
||||
|
|
|
|||
40
Engine/lib/assimp/port/assimp_rs/build.rs
Normal file
40
Engine/lib/assimp/port/assimp_rs/build.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
extern crate bindgen;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// Rerun if wrapper header changes
|
||||
println!("cargo:rerun-if-changed=./src/assimp_wrapper.h");
|
||||
|
||||
// Tell cargo to look for shared libraries in the specified directory
|
||||
println!("cargo:rustc-link-search=../../bin/");
|
||||
|
||||
// Tell cargo to tell rustc to link the assimp 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("./src/assimp_wrapper.h").clang_arg("-I../../include/")
|
||||
// Tell cargo to invalidate the built crate whenever any of the
|
||||
// included header files changed.
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
.blocklist_item("FP_ZERO")
|
||||
.blocklist_item("FP_SUBNORMAL")
|
||||
.blocklist_item("FP_NORMAL")
|
||||
.blocklist_item("FP_INFINITE")
|
||||
.blocklist_item("FP_NAN")
|
||||
// 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!");
|
||||
}
|
||||
48
Engine/lib/assimp/port/assimp_rs/src/assimp_wrapper.h
Normal file
48
Engine/lib/assimp/port/assimp_rs/src/assimp_wrapper.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef ASSIMP_WRAPPER_H_INC
|
||||
#define ASSIMP_WRAPPER_H_INC
|
||||
|
||||
#include <assimp/defs.h>
|
||||
#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>
|
||||
#include <assimp/aabb.h>
|
||||
#include <assimp/anim.h>
|
||||
#include <assimp/camera.h>
|
||||
#include <assimp/cexport.h>
|
||||
#include <assimp/cfileio.h>
|
||||
#include <assimp/cimport.h>
|
||||
#include <assimp/color4.h>
|
||||
#include <assimp/commonMetaData.h>
|
||||
#include <assimp/defs.h>
|
||||
#include <assimp/importerdesc.h>
|
||||
#include <assimp/light.h>
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/matrix3x3.h>
|
||||
#include <assimp/matrix4x4.h>
|
||||
#include <assimp/mesh.h>
|
||||
#include <assimp/metadata.h>
|
||||
#include <assimp/pbrmaterial.h>
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/quaternion.h>
|
||||
#include <assimp/revision.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/texture.h>
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/vector2.h>
|
||||
#include <assimp/vector3.h>
|
||||
#include <assimp/version.h>
|
||||
|
||||
#endif // ASSIMP_WRAPPER_H_INC
|
||||
|
|
@ -1 +0,0 @@
|
|||
pub use self::structs::{Camera};
|
||||
|
|
@ -1,17 +1,21 @@
|
|||
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)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(true, true);
|
||||
fn import_test() {
|
||||
unsafe {
|
||||
use crate::aiImportFile;
|
||||
let mut file: *mut dyn const i8 = std::ptr::null_mut();
|
||||
//let file = String::from("test.obj");
|
||||
//let (ptr, len, cap) = file.into_raw_parts();
|
||||
//let raw_file = unsafe{String::from_raw_parts}
|
||||
let asset = aiImportFile(file, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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::
|
||||
|
|
@ -470,7 +470,7 @@ extern ( C ) {
|
|||
* material settings and bitangents accordingly.
|
||||
*
|
||||
* Output UV coordinate system:
|
||||
* <pre> 0y|0y ---------- 1x|0y
|
||||
* <pre> 0x|0y ---------- 1x|0y
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||
SET (CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||
SET (IOS TRUE)
|
||||
|
||||
SET (IOS_SDK_DEVICE iPhoneSimulator)
|
||||
|
||||
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||
|
||||
|
||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
|
@ -31,9 +31,8 @@ TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain
|
|||
CMAKE_C_COMPILER=$(xcrun -find cc)
|
||||
CMAKE_CXX_COMPILER=$(xcrun -find c++)
|
||||
|
||||
BUILD_ARCHS_DEVICE="arm64e arm64 armv7s armv7"
|
||||
BUILD_ARCHS_SIMULATOR="x86_64 i386"
|
||||
BUILD_ARCHS_ALL=($BUILD_ARCHS_DEVICE $BUILD_ARCHS_SIMULATOR)
|
||||
BUILD_ARCHS_DEVICE="arm64e arm64"
|
||||
BUILD_ARCHS_SIMULATOR="arm64-simulator x86_64-simulator"
|
||||
|
||||
CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min)
|
||||
CPP_DEV_TARGET=
|
||||
|
|
@ -46,61 +45,83 @@ function join { local IFS="$1"; shift; echo "$*"; }
|
|||
|
||||
build_arch()
|
||||
{
|
||||
IOS_SDK_DEVICE=iPhoneOS
|
||||
CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[0]}
|
||||
|
||||
if [[ "$BUILD_ARCHS_SIMULATOR" =~ "$1" ]]
|
||||
then
|
||||
ARCH=$1
|
||||
if [[ "$ARCH" == *"-simulator" ]]; then
|
||||
echo '[!] Target SDK set to SIMULATOR.'
|
||||
IOS_SDK_DEVICE=iPhoneSimulator
|
||||
CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[1]}
|
||||
IOS_SDK_DEVICE="iphonesimulator" # Use lowercase matching xcrun naming
|
||||
BUILD_ARCH="${ARCH%-simulator}" # Remove "-simulator" from architecture name
|
||||
OUTPUT_FOLDER="$BUILD_DIR/ios-$ARCH"
|
||||
MIN_VERSION_FLAG="-mios-simulator-version-min=$IOS_SDK_TARGET"
|
||||
else
|
||||
echo '[!] Target SDK set to DEVICE.'
|
||||
IOS_SDK_DEVICE="iphoneos" # For device builds
|
||||
BUILD_ARCH="$ARCH"
|
||||
OUTPUT_FOLDER="$BUILD_DIR/ios-$ARCH"
|
||||
MIN_VERSION_FLAG="-miphoneos-version-min=$IOS_SDK_TARGET"
|
||||
fi
|
||||
|
||||
unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS CMAKE_CLI_INPUT
|
||||
|
||||
export CC="$(xcrun -sdk iphoneos -find clang)"
|
||||
|
||||
# Use xcrun with the correct SDK to find clang
|
||||
export CC="$(xcrun -sdk $IOS_SDK_DEVICE -find clang)"
|
||||
export CPP="$CC -E"
|
||||
export DEVROOT=$XCODE_ROOT_DIR/Platforms/$IOS_SDK_DEVICE.platform/Developer
|
||||
export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk
|
||||
export CFLAGS="-arch $1 -pipe -no-cpp-precomp -isysroot $SDKROOT -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET"
|
||||
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
|
||||
export CFLAGS="$CFLAGS -Og"
|
||||
|
||||
# Derive correct platform directory names
|
||||
# Note: iPhoneOS.platform and iPhoneSimulator.platform are used by Xcode internally.
|
||||
if [[ "$IOS_SDK_DEVICE" == "iphonesimulator" ]]; then
|
||||
PLATFORM_NAME="iPhoneSimulator"
|
||||
else
|
||||
export CFLAGS="$CFLAGS -O3"
|
||||
PLATFORM_NAME="iPhoneOS"
|
||||
fi
|
||||
export LDFLAGS="-arch $1 -isysroot $SDKROOT -L$SDKROOT/usr/lib/"
|
||||
|
||||
export DEVROOT="$XCODE_ROOT_DIR/Platforms/$PLATFORM_NAME.platform/Developer"
|
||||
export SDKROOT="$DEVROOT/SDKs/$PLATFORM_NAME$IOS_SDK_VERSION.sdk"
|
||||
|
||||
# Set flags. For simulator builds, we use -mios-simulator-version-min; for device, -miphoneos-version-min.
|
||||
export CFLAGS="-arch $BUILD_ARCH -pipe -no-cpp-precomp -isysroot $SDKROOT -I$SDKROOT/usr/include/ $MIN_VERSION_FLAG"
|
||||
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
|
||||
export CFLAGS="$CFLAGS -Og"
|
||||
else
|
||||
export CFLAGS="$CFLAGS -O3"
|
||||
fi
|
||||
export LDFLAGS="-arch $BUILD_ARCH -isysroot $SDKROOT -L$SDKROOT/usr/lib/"
|
||||
export CPPFLAGS="$CFLAGS"
|
||||
export CXXFLAGS="$CFLAGS -std=$CPP_STD"
|
||||
|
||||
rm CMakeCache.txt
|
||||
|
||||
CMAKE_CLI_INPUT="-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DASSIMP_BUILD_ZLIB=ON"
|
||||
|
||||
rm -f CMakeCache.txt
|
||||
|
||||
# Construct the CMake toolchain file path
|
||||
# Make sure these toolchain files differentiate between device and simulator builds properly.
|
||||
TOOLCHAIN_FILE="./port/iOS/${PLATFORM_NAME}_$(echo "$BUILD_ARCH" | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake"
|
||||
|
||||
CMAKE_CLI_INPUT="-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
|
||||
-DASSIMP_BUILD_ZLIB=ON"
|
||||
|
||||
echo "[!] Running CMake with -G 'Unix Makefiles' $CMAKE_CLI_INPUT"
|
||||
|
||||
cmake -G 'Unix Makefiles' ${CMAKE_CLI_INPUT}
|
||||
|
||||
echo "[!] Building $1 library"
|
||||
|
||||
echo "[!] Building $ARCH library"
|
||||
xcrun -run make clean
|
||||
xcrun -run make assimp -j 8 -l
|
||||
|
||||
xcrun -run make assimp -j 8 -l
|
||||
|
||||
mkdir -p $OUTPUT_FOLDER
|
||||
|
||||
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||
echo "[!] Moving built dynamic libraries into: $BUILD_DIR/$1/"
|
||||
mv ./lib/*.dylib $BUILD_DIR/$1/
|
||||
echo "[!] Moving built dynamic libraries into: $OUTPUT_FOLDER"
|
||||
mv ./lib/*.dylib $OUTPUT_FOLDER/
|
||||
fi
|
||||
|
||||
echo "[!] Moving built static libraries into: $BUILD_DIR/$1/"
|
||||
mv ./lib/*.a $BUILD_DIR/$1/
|
||||
|
||||
echo "[!] Moving built static libraries into: $OUTPUT_FOLDER"
|
||||
mv ./lib/*.a $OUTPUT_FOLDER/
|
||||
}
|
||||
|
||||
echo "[!] $0 - assimp iOS build script"
|
||||
|
||||
CPP_STD_LIB=${CPP_STD_LIB_LIST[0]}
|
||||
CPP_STD=${CPP_STD_LIST[0]}
|
||||
DEPLOY_ARCHS=${BUILD_ARCHS_ALL[*]}
|
||||
DEPLOY_FAT=1
|
||||
DEPLOY_XCFramework=1
|
||||
|
||||
|
|
@ -158,14 +179,15 @@ done
|
|||
cd ../../
|
||||
rm -rf $BUILD_DIR
|
||||
|
||||
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||
echo "Creating folder: $BUILD_DIR/$ARCH_TARGET"
|
||||
mkdir -p $BUILD_DIR/$ARCH_TARGET
|
||||
echo "Building for arc: $ARCH_TARGET"
|
||||
build_arch $ARCH_TARGET
|
||||
#rm ./lib/libassimp.a
|
||||
for ARCH in $BUILD_ARCHS_DEVICE; do
|
||||
echo "Building for DEVICE arch: $ARCH"
|
||||
build_arch $ARCH
|
||||
done
|
||||
|
||||
for ARCH in $BUILD_ARCHS_SIMULATOR; do
|
||||
echo "Building for SIMULATOR arch: $ARCH"
|
||||
build_arch $ARCH
|
||||
done
|
||||
|
||||
make_fat_static_or_shared_binary()
|
||||
{
|
||||
|
|
@ -209,21 +231,63 @@ if [[ "$DEPLOY_FAT" -eq 1 ]]; then
|
|||
echo "[!] Done! The fat binaries can be found at $BUILD_DIR"
|
||||
fi
|
||||
|
||||
make_xcframework()
|
||||
{
|
||||
make_xcframework() {
|
||||
LIB_NAME=$1
|
||||
FRAMEWORK_PATH=$BUILD_DIR/$LIB_NAME.xcframework
|
||||
FRAMEWORK_PATH="$BUILD_DIR/$LIB_NAME.xcframework"
|
||||
|
||||
ARGS = ""
|
||||
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||
ARGS="$ARGS -library $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.dylib -headers ./include "
|
||||
else
|
||||
ARGS="$ARGS -library $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a -headers ./include "
|
||||
fi
|
||||
done
|
||||
# Paths to device and simulator libraries
|
||||
DEVICE_LIB_PATH="$BUILD_DIR/ios-arm64/libassimp.a"
|
||||
ARM64_SIM_LIB_PATH="$BUILD_DIR/ios-arm64-simulator/libassimp.a"
|
||||
X86_64_SIM_LIB_PATH="$BUILD_DIR/ios-x86_64-simulator/libassimp.a"
|
||||
UNIVERSAL_SIM_LIB_PATH="$BUILD_DIR/ios-simulator/libassimp.a"
|
||||
|
||||
# Ensure we have a clean location for the universal simulator lib
|
||||
mkdir -p "$BUILD_DIR/ios-simulator"
|
||||
|
||||
# Combine simulator libraries if both arm64 and x86_64 simulator slices are present
|
||||
if [[ -f "$ARM64_SIM_LIB_PATH" && -f "$X86_64_SIM_LIB_PATH" ]]; then
|
||||
echo "[+] Combining arm64 and x86_64 simulator libs into a universal simulator library..."
|
||||
lipo -create "$ARM64_SIM_LIB_PATH" "$X86_64_SIM_LIB_PATH" -output "$UNIVERSAL_SIM_LIB_PATH" || {
|
||||
echo "[ERROR] lipo failed to combine simulator libraries."
|
||||
exit 1
|
||||
}
|
||||
SIM_LIB_PATH="$UNIVERSAL_SIM_LIB_PATH"
|
||||
elif [[ -f "$ARM64_SIM_LIB_PATH" ]]; then
|
||||
echo "[!] Only arm64 simulator library found. Using it as is."
|
||||
SIM_LIB_PATH="$ARM64_SIM_LIB_PATH"
|
||||
elif [[ -f "$X86_64_SIM_LIB_PATH" ]]; then
|
||||
echo "[!] Only x86_64 simulator library found. Using it as is."
|
||||
SIM_LIB_PATH="$X86_64_SIM_LIB_PATH"
|
||||
else
|
||||
SIM_LIB_PATH=""
|
||||
fi
|
||||
|
||||
ARGS=""
|
||||
|
||||
# Device library
|
||||
if [[ -f "$DEVICE_LIB_PATH" ]]; then
|
||||
echo "[DEBUG] Adding library $DEVICE_LIB_PATH for device arm64"
|
||||
ARGS="$ARGS -library $DEVICE_LIB_PATH -headers ./include"
|
||||
else
|
||||
echo "[WARNING] Device library not found: $DEVICE_LIB_PATH"
|
||||
fi
|
||||
|
||||
# Simulator library (could be universal or a single-arch one)
|
||||
if [[ -n "$SIM_LIB_PATH" && -f "$SIM_LIB_PATH" ]]; then
|
||||
echo "[DEBUG] Adding library $SIM_LIB_PATH for simulator"
|
||||
ARGS="$ARGS -library $SIM_LIB_PATH -headers ./include"
|
||||
fi
|
||||
|
||||
if [[ -z "$ARGS" ]]; then
|
||||
echo "[ERROR] No valid libraries found to create XCFramework."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create XCFramework
|
||||
echo "[+] Creating XCFramework ..."
|
||||
xcodebuild -create-xcframework $ARGS -output $FRAMEWORK_PATH
|
||||
|
||||
echo "[!] Done! The XCFramework can be found at $FRAMEWORK_PATH"
|
||||
}
|
||||
|
||||
if [[ "$DEPLOY_XCFramework" -eq 1 ]]; then
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ public final class AiMesh {
|
|||
* @return true if tangents and bitangents are available
|
||||
*/
|
||||
public boolean hasTangentsAndBitangents() {
|
||||
return m_tangents != null && m_tangents != null;
|
||||
return m_tangents != null && m_bitangents != null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ public enum AiPostProcessSteps {
|
|||
*
|
||||
* <b>Output UV coordinate system:</b><br>
|
||||
* <code><pre>
|
||||
* 0y|0y ---------- 1x|0y
|
||||
* 0x|0y ---------- 1x|0y
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue