feat: fix bmap-rs test
This commit is contained in:
@@ -213,7 +213,7 @@ macro_rules! libobj_impl_new {
|
|||||||
}
|
}
|
||||||
fn with_sibling<AO>(_: &'o AO, handle: PBMVOID, id: CKID) -> Self
|
fn with_sibling<AO>(_: &'o AO, handle: PBMVOID, id: CKID) -> Self
|
||||||
where
|
where
|
||||||
AO: AbstractObject<'o, P>,
|
AO: AbstractObject<'o, P> + ?Sized,
|
||||||
{
|
{
|
||||||
Self {
|
Self {
|
||||||
handle,
|
handle,
|
||||||
@@ -684,27 +684,28 @@ where
|
|||||||
set_copyable_value(self, bmap::BMMaterial_SetSpecularPower, power)
|
set_copyable_value(self, bmap::BMMaterial_SetSpecularPower, power)
|
||||||
}
|
}
|
||||||
|
|
||||||
// // YYC MARK:
|
// YYC MARK:
|
||||||
// // We use "value getter" to get CKID first then convert it to our instance.
|
// We use "value getter" to get CKID first then convert it to our instance.
|
||||||
// // Same pattern for using "value setter".
|
// Same pattern for using "value setter".
|
||||||
// fn get_texture(&self) -> Result<Option<Box<dyn BMTextureDecl<'o, P> + 'o>>> {
|
fn get_texture(&'o self) -> Result<Option<BMTexture<'o, P>>> {
|
||||||
// let ckid: CKID = get_copyable_value(self, bmap::BMMaterial_GetTexture)?;
|
let ckid: CKID = get_copyable_value(self, bmap::BMMaterial_GetTexture)?;
|
||||||
// Ok(if ckid == INVALID_CKID {
|
Ok(if ckid == INVALID_CKID {
|
||||||
// None
|
None
|
||||||
// } else {
|
} else {
|
||||||
// Some(Box::new(BMTexture::<'o, P>::new(
|
Some(BMTexture::with_sibling(
|
||||||
// unsafe { self.get_pointer() },
|
self,
|
||||||
// ckid,
|
unsafe { self.get_pointer() },
|
||||||
// )))
|
ckid,
|
||||||
// })
|
))
|
||||||
// }
|
})
|
||||||
// fn set_texture(&mut self, texture: Option<&dyn BMTextureDecl<'o, P>>) -> Result<()> {
|
}
|
||||||
// let ckid: CKID = match texture {
|
fn set_texture(&mut self, texture: Option<&BMTexture<'o, P>>) -> Result<()> {
|
||||||
// Some(texture) => unsafe { texture.get_ckid() },
|
let ckid: CKID = match texture {
|
||||||
// None => INVALID_CKID,
|
Some(texture) => unsafe { texture.get_ckid() },
|
||||||
// };
|
None => INVALID_CKID,
|
||||||
// set_copyable_value(self, bmap::BMMaterial_SetTexture, ckid)
|
};
|
||||||
// }
|
set_copyable_value(self, bmap::BMMaterial_SetTexture, ckid)
|
||||||
|
}
|
||||||
|
|
||||||
fn get_texture_border_color(&self) -> Result<bmap::VxColor> {
|
fn get_texture_border_color(&self) -> Result<bmap::VxColor> {
|
||||||
let intermediary = get_copyable_value(self, bmap::BMMaterial_GetTextureBorderColor)?;
|
let intermediary = get_copyable_value(self, bmap::BMMaterial_GetTextureBorderColor)?;
|
||||||
@@ -850,26 +851,27 @@ where
|
|||||||
set_copyable_value(self, bmap::BM3dEntity_SetWorldMatrix, mat)
|
set_copyable_value(self, bmap::BM3dEntity_SetWorldMatrix, mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
// // YYC MARK:
|
// YYC MARK:
|
||||||
// // Same reason for the reuse of "value setter" and "value getter".
|
// Same reason for the reuse of "value setter" and "value getter".
|
||||||
// fn get_current_mesh(&self) -> Result<Option<Box<dyn BMMeshDecl<'o, P> + 'o>>> {
|
fn get_current_mesh(&'o self) -> Result<Option<BMMesh<'o, P>>> {
|
||||||
// let ckid: CKID = get_copyable_value(self, bmap::BM3dEntity_GetCurrentMesh)?;
|
let ckid: CKID = get_copyable_value(self, bmap::BM3dEntity_GetCurrentMesh)?;
|
||||||
// Ok(if ckid == INVALID_CKID {
|
Ok(if ckid == INVALID_CKID {
|
||||||
// None
|
None
|
||||||
// } else {
|
} else {
|
||||||
// Some(Box::new(BMMesh::<'o, P>::new(
|
Some(BMMesh::with_sibling(
|
||||||
// unsafe { self.get_pointer() },
|
self,
|
||||||
// ckid,
|
unsafe { self.get_pointer() },
|
||||||
// )))
|
ckid,
|
||||||
// })
|
))
|
||||||
// }
|
})
|
||||||
// fn set_current_mesh(&mut self, mesh: Option<&dyn BMMeshDecl<'o, P>>) -> Result<()> {
|
}
|
||||||
// let ckid: CKID = match mesh {
|
fn set_current_mesh(&mut self, mesh: Option<BMMesh<'o, P>>) -> Result<()> {
|
||||||
// Some(mesh) => unsafe { mesh.get_ckid() },
|
let ckid: CKID = match mesh {
|
||||||
// None => INVALID_CKID,
|
Some(mesh) => unsafe { mesh.get_ckid() },
|
||||||
// };
|
None => INVALID_CKID,
|
||||||
// set_copyable_value(self, bmap::BM3dEntity_SetCurrentMesh, ckid)
|
};
|
||||||
// }
|
set_copyable_value(self, bmap::BM3dEntity_SetCurrentMesh, ckid)
|
||||||
|
}
|
||||||
|
|
||||||
fn get_visibility(&self) -> Result<bool> {
|
fn get_visibility(&self) -> Result<bool> {
|
||||||
get_copyable_value(self, bmap::BM3dEntity_GetVisibility)
|
get_copyable_value(self, bmap::BM3dEntity_GetVisibility)
|
||||||
@@ -1247,8 +1249,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'p> BMFileReader<'p> {
|
impl<'p> BMFileReader<'p> {
|
||||||
fn get_generic_object_count(&self, fc: FnProtoGetCount) -> Result<usize>
|
fn get_generic_object_count(&self, fc: FnProtoGetCount) -> Result<usize> {
|
||||||
{
|
|
||||||
let mut cnt = MaybeUninit::<CKDWORD>::uninit();
|
let mut cnt = MaybeUninit::<CKDWORD>::uninit();
|
||||||
bmap_exec!(fc(self.get_pointer(), arg_out!(cnt.as_mut_ptr(), CKDWORD)));
|
bmap_exec!(fc(self.get_pointer(), arg_out!(cnt.as_mut_ptr(), CKDWORD)));
|
||||||
|
|
||||||
@@ -1301,13 +1302,19 @@ impl<'p> BMFileReader<'p> {
|
|||||||
self.get_generic_object_count(bmap::BMFile_GetTargetLightCount)
|
self.get_generic_object_count(bmap::BMFile_GetTargetLightCount)
|
||||||
}
|
}
|
||||||
pub fn get_target_lights(&'p self) -> Result<FileObjectIter<'p, BMTargetLight<'p, Self>>> {
|
pub fn get_target_lights(&'p self) -> Result<FileObjectIter<'p, BMTargetLight<'p, Self>>> {
|
||||||
self.get_generic_objects(bmap::BMFile_GetTargetLightCount, bmap::BMFile_GetTargetLight)
|
self.get_generic_objects(
|
||||||
|
bmap::BMFile_GetTargetLightCount,
|
||||||
|
bmap::BMFile_GetTargetLight,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
pub fn get_target_camera_count(&'p self) -> Result<usize> {
|
pub fn get_target_camera_count(&'p self) -> Result<usize> {
|
||||||
self.get_generic_object_count(bmap::BMFile_GetTargetCameraCount)
|
self.get_generic_object_count(bmap::BMFile_GetTargetCameraCount)
|
||||||
}
|
}
|
||||||
pub fn get_target_cameras(&'p self) -> Result<FileObjectIter<'p, BMTargetCamera<'p, Self>>> {
|
pub fn get_target_cameras(&'p self) -> Result<FileObjectIter<'p, BMTargetCamera<'p, Self>>> {
|
||||||
self.get_generic_objects(bmap::BMFile_GetTargetCameraCount, bmap::BMFile_GetTargetCamera)
|
self.get_generic_objects(
|
||||||
|
bmap::BMFile_GetTargetCameraCount,
|
||||||
|
bmap::BMFile_GetTargetCamera,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1378,10 +1385,7 @@ impl<'p> BMFileWriter<'p> {
|
|||||||
type FnProtoCreateObject = unsafe extern "C" fn(PBMVOID, param_out!(CKID)) -> BMBOOL;
|
type FnProtoCreateObject = unsafe extern "C" fn(PBMVOID, param_out!(CKID)) -> BMBOOL;
|
||||||
|
|
||||||
impl<'p> BMFileWriter<'p> {
|
impl<'p> BMFileWriter<'p> {
|
||||||
fn create_generic_objects<O>(
|
fn create_generic_objects<O>(&'p mut self, fc: FnProtoCreateObject) -> Result<O>
|
||||||
&'p mut self,
|
|
||||||
fc: FnProtoCreateObject,
|
|
||||||
) -> Result<O>
|
|
||||||
where
|
where
|
||||||
O: AbstractObject<'p, BMFileWriter<'p>>,
|
O: AbstractObject<'p, BMFileWriter<'p>>,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use bmap_rs::bmap_wrapper as bmap;
|
use bmap_rs::bmap_wrapper as bmap;
|
||||||
|
use std::io::Read;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -22,11 +23,21 @@ fn test_complete() {
|
|||||||
// Start testbench
|
// Start testbench
|
||||||
let file_name = cliopts.file_name.clone();
|
let file_name = cliopts.file_name.clone();
|
||||||
let temp_folder = tempfile::tempdir().unwrap();
|
let temp_folder = tempfile::tempdir().unwrap();
|
||||||
let texture_folder = cliopts.ballance_dir.clone();
|
let mut texture_folder = cliopts.ballance_dir.clone();
|
||||||
texture_folder.push("Textures");
|
texture_folder.push("Textures");
|
||||||
let encodings = cliopts.encodings.clone();
|
let encodings = cliopts.encodings.clone();
|
||||||
bmap::BMap::with_bmap(|b| {
|
bmap::BMap::with_bmap(|b| {
|
||||||
let r = b.create_file_reader("", "", "", std::iter::once(""));
|
let r = b
|
||||||
|
.create_file_reader(
|
||||||
|
file_name.to_str().unwrap(),
|
||||||
|
temp_folder.path().to_str().unwrap(),
|
||||||
|
texture_folder.to_str().unwrap(),
|
||||||
|
encodings.iter().map(|e| e.as_str()),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
testsuits::common::test(&r);
|
||||||
|
testsuits::eq::test(&r);
|
||||||
});
|
});
|
||||||
drop(temp_folder);
|
drop(temp_folder);
|
||||||
}
|
}
|
||||||
@@ -58,7 +69,10 @@ mod cli {
|
|||||||
Self {
|
Self {
|
||||||
file_name: PathBuf::from(file_name),
|
file_name: PathBuf::from(file_name),
|
||||||
ballance_dir: PathBuf::from(ballance_dir),
|
ballance_dir: PathBuf::from(ballance_dir),
|
||||||
encodings: encodings.split(",").collect(),
|
encodings: encodings
|
||||||
|
.split(",")
|
||||||
|
.map(|e| e.to_string())
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,8 +83,12 @@ mod testsuits {
|
|||||||
|
|
||||||
pub mod common {
|
pub mod common {
|
||||||
use super::bmap;
|
use super::bmap;
|
||||||
|
use bmap::{
|
||||||
|
BM3dEntityDecl, BMCameraDecl, BMLightDecl, BMMaterialDecl, BMMeshDecl, BMObjectDecl,
|
||||||
|
BMTextureDecl,
|
||||||
|
};
|
||||||
|
|
||||||
pub fn test(reader: bmap::BMFileReader) {
|
pub fn test(reader: &bmap::BMFileReader) {
|
||||||
println!("===== Groups =====");
|
println!("===== Groups =====");
|
||||||
test_group(reader);
|
test_group(reader);
|
||||||
println!("===== 3dObjects =====");
|
println!("===== 3dObjects =====");
|
||||||
@@ -88,128 +106,139 @@ mod testsuits {
|
|||||||
println!("===== END =====");
|
println!("===== END =====");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_group(reader: bmap::BMFileReader) {
|
#[rustfmt::skip]
|
||||||
for gp in reader.get_groups() {
|
fn test_group(reader: &bmap::BMFileReader) {
|
||||||
println!("{}", gp.get_name());
|
for gp in reader.get_groups().unwrap() {
|
||||||
|
let gp = gp.unwrap();
|
||||||
|
|
||||||
|
println!("{:?}", gp.get_name().unwrap());
|
||||||
for gp_item in gp.get_objects() {
|
for gp_item in gp.get_objects() {
|
||||||
println!("\t{}", gp_item.get_name());
|
println!("\t{}", gp_item.get_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_3dobject(reader: bmap::BMFileReader) {
|
#[rustfmt::skip]
|
||||||
for obj in reader.get_3dobjects() {
|
fn test_3dobject(reader: &bmap::BMFileReader) {
|
||||||
println!("{}", obj.get_name());
|
for obj in reader.get_3dobjects().unwrap() {
|
||||||
|
let obj = obj.unwrap();
|
||||||
|
|
||||||
let current_mesh = obj.get_current_mesh();
|
println!("{:?}", obj.get_name().unwrap());
|
||||||
let mesh_name = if let Some(mesh) = current_mesh {
|
|
||||||
mesh.get_name()
|
let current_mesh = obj.get_current_mesh().unwrap();
|
||||||
} else {
|
let mesh_name = match current_mesh {
|
||||||
"<null>".to_string()
|
Some(mesh) => format!("{:?}", mesh.get_name()),
|
||||||
|
None => "<null>".to_string(),
|
||||||
};
|
};
|
||||||
println!("\tMesh: {}", mesh_name);
|
println!("\tMesh: {}", mesh_name);
|
||||||
println!("\tVisibility: {}", obj.get_visibility());
|
println!("\tVisibility: {}", obj.get_visibility().unwrap());
|
||||||
println!("\tMatrix: {:?}", obj.get_world_matrix().to_const());
|
println!("\tMatrix: {:?}", obj.get_world_matrix().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_mesh(reader: bmap::BMFileReader) {
|
#[rustfmt::skip]
|
||||||
for mesh in reader.get_meshs() {
|
fn test_mesh(reader: &bmap::BMFileReader) {
|
||||||
println!("{}", mesh.get_name());
|
for mesh in reader.get_meshes().unwrap() {
|
||||||
|
let mesh = mesh.unwrap();
|
||||||
|
|
||||||
println!("\tLit Mode: {}", mesh.get_lit_mode());
|
println!("{:?}", mesh.get_name().unwrap());
|
||||||
println!("\tVertex Count: {}", mesh.get_vertex_count());
|
|
||||||
println!("\tFace Count: {}", mesh.get_face_count());
|
println!("\tLit Mode: {:?}", mesh.get_lit_mode().unwrap());
|
||||||
println!("\tMaterial Slot Count: {}", mesh.get_material_slot_count());
|
println!("\tVertex Count: {}", mesh.get_vertex_count().unwrap());
|
||||||
|
println!("\tFace Count: {}", mesh.get_face_count().unwrap());
|
||||||
|
println!("\tMaterial Slot Count: {}", mesh.get_material_slot_count().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_material(reader: bmap::BMFileReader) {
|
#[rustfmt::skip]
|
||||||
for mtl in reader.get_materials() {
|
fn test_material(reader: &bmap::BMFileReader) {
|
||||||
println!("{}", mtl.get_name());
|
for mtl in reader.get_materials().unwrap() {
|
||||||
|
let mtl = mtl.unwrap();
|
||||||
|
|
||||||
println!("\tDiffuse: {:?}", mtl.get_diffuse().to_const_rgba());
|
println!("{:?}", mtl.get_name().unwrap());
|
||||||
println!("\tAmbient: {:?}", mtl.get_ambient().to_const_rgba());
|
|
||||||
println!("\tSpecular: {:?}", mtl.get_specular().to_const_rgba());
|
|
||||||
println!("\tEmissive: {:?}", mtl.get_emissive().to_const_rgba());
|
|
||||||
|
|
||||||
println!("\tSpecular Power: {}", mtl.get_specular_power());
|
println!("\tDiffuse: {:?}", mtl.get_diffuse().unwrap());
|
||||||
|
println!("\tAmbient: {:?}", mtl.get_ambient().unwrap());
|
||||||
|
println!("\tSpecular: {:?}", mtl.get_specular().unwrap());
|
||||||
|
println!("\tEmissive: {:?}", mtl.get_emissive().unwrap());
|
||||||
|
|
||||||
println!(
|
println!("\tSpecular Power: {}", mtl.get_specular_power().unwrap());
|
||||||
"\tTexture Border Color: {:?}",
|
|
||||||
mtl.get_texture_border_color().to_const_rgba()
|
|
||||||
);
|
|
||||||
|
|
||||||
println!("\tTexture Blend Mode: {}", mtl.get_texture_blend_mode());
|
println!("\tTexture Border Color: {:?}", mtl.get_texture_border_color().unwrap());
|
||||||
println!("\tTexture Min Mode: {}", mtl.get_texture_min_mode());
|
|
||||||
println!("\tTexture Mag Mode: {}", mtl.get_texture_mag_mode());
|
|
||||||
println!("\tSource Blend: {}", mtl.get_source_blend());
|
|
||||||
println!("\tDest Blend: {}", mtl.get_dest_blend());
|
|
||||||
println!("\tFill Mode: {}", mtl.get_fill_mode());
|
|
||||||
println!("\tShade Mode: {}", mtl.get_shade_mode());
|
|
||||||
|
|
||||||
println!("\tAlpha Test Enabled: {}", mtl.get_alpha_test_enabled());
|
println!("\tTexture Blend Mode: {:?}", mtl.get_texture_blend_mode().unwrap());
|
||||||
println!("\tAlpha Blend Enabled: {}", mtl.get_alpha_blend_enabled());
|
println!("\tTexture Min Mode: {:?}", mtl.get_texture_min_mode().unwrap());
|
||||||
println!(
|
println!("\tTexture Mag Mode: {:?}", mtl.get_texture_mag_mode().unwrap());
|
||||||
"\tPerspective Correction Enabled: {}",
|
println!("\tSource Blend: {:?}", mtl.get_source_blend().unwrap());
|
||||||
mtl.get_perspective_correction_enabled()
|
println!("\tDest Blend: {:?}", mtl.get_dest_blend().unwrap());
|
||||||
);
|
println!("\tFill Mode: {:?}", mtl.get_fill_mode().unwrap());
|
||||||
println!("\tZ Write Enabled: {}", mtl.get_z_write_enabled());
|
println!("\tShade Mode: {:?}", mtl.get_shade_mode().unwrap());
|
||||||
println!("\tTwo Sided Enabled: {}", mtl.get_two_sided_enabled());
|
|
||||||
|
|
||||||
println!("\tAlpha Ref: {}", mtl.get_alpha_ref());
|
println!("\tAlpha Test Enabled: {}", mtl.get_alpha_test_enabled().unwrap());
|
||||||
|
println!("\tAlpha Blend Enabled: {}", mtl.get_alpha_blend_enabled().unwrap());
|
||||||
|
println!("\tPerspective Correction Enabled: {}", mtl.get_perspective_correction_enabled().unwrap());
|
||||||
|
println!("\tZ Write Enabled: {}", mtl.get_z_write_enabled().unwrap());
|
||||||
|
println!("\tTwo Sided Enabled: {}", mtl.get_two_sided_enabled().unwrap());
|
||||||
|
|
||||||
println!("\tAlpha Func: {}", mtl.get_alpha_func());
|
println!("\tAlpha Ref: {}", mtl.get_alpha_ref().unwrap());
|
||||||
println!("\tZ Func: {}", mtl.get_z_func());
|
|
||||||
|
println!("\tAlpha Func: {:?}", mtl.get_alpha_func().unwrap());
|
||||||
|
println!("\tZ Func: {:?}", mtl.get_z_func().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_texture(reader: bmap::BMFileReader) {
|
#[rustfmt::skip]
|
||||||
for tex in reader.get_textures() {
|
fn test_texture(reader: &bmap::BMFileReader) {
|
||||||
println!("{}", tex.get_name());
|
for tex in reader.get_textures().unwrap() {
|
||||||
|
let tex = tex.unwrap();
|
||||||
|
|
||||||
println!("\tFile Name: {}", tex.get_file_name());
|
println!("{:?}", tex.get_name().unwrap());
|
||||||
println!("\tSave Options: {}", tex.get_save_options());
|
|
||||||
println!("\tVideo Format: {}", tex.get_video_format());
|
println!("\tFile Name: {:?}", tex.get_file_name().unwrap());
|
||||||
|
println!("\tSave Options: {:?}", tex.get_save_options().unwrap());
|
||||||
|
println!("\tVideo Format: {:?}", tex.get_video_format().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_target_light(reader: bmap::BMFileReader) {
|
#[rustfmt::skip]
|
||||||
for lit in reader.get_target_lights() {
|
fn test_target_light(reader: &bmap::BMFileReader) {
|
||||||
println!("{}", lit.get_name());
|
for lit in reader.get_target_lights().unwrap() {
|
||||||
|
let lit = lit.unwrap();
|
||||||
|
|
||||||
println!("\tVisibility: {}", lit.get_visibility());
|
println!("{:?}", lit.get_name().unwrap());
|
||||||
println!("\tMatrix: {:?}", lit.get_world_matrix().to_const());
|
|
||||||
|
|
||||||
println!("\tType: {}", lit.get_type());
|
println!("\tVisibility: {:?}", lit.get_visibility().unwrap());
|
||||||
println!("\tColor: {:?}", lit.get_color().to_const_rgba());
|
println!("\tMatrix: {:?}", lit.get_world_matrix().unwrap());
|
||||||
println!("\tConstant Attenuation: {}", lit.get_constant_attenuation());
|
|
||||||
println!("\tLinear Attenuation: {}", lit.get_linear_attenuation());
|
println!("\tType: {:?}", lit.get_type().unwrap());
|
||||||
println!(
|
println!("\tColor: {:?}", lit.get_color().unwrap());
|
||||||
"\tQuadratic Attenuation: {}",
|
println!("\tConstant Attenuation: {}", lit.get_constant_attenuation().unwrap());
|
||||||
lit.get_quadratic_attenuation()
|
println!("\tLinear Attenuation: {}", lit.get_linear_attenuation().unwrap());
|
||||||
);
|
println!("\tQuadratic Attenuation: {}", lit.get_quadratic_attenuation().unwrap());
|
||||||
println!("\tRange: {}", lit.get_range());
|
println!("\tRange: {}", lit.get_range().unwrap());
|
||||||
println!("\tHot Spot: {}", lit.get_hot_spot());
|
println!("\tHot Spot: {}", lit.get_hot_spot().unwrap());
|
||||||
println!("\tFalloff: {}", lit.get_falloff());
|
println!("\tFalloff: {}", lit.get_falloff().unwrap());
|
||||||
println!("\tFalloff Shape: {}", lit.get_falloff_shape());
|
println!("\tFalloff Shape: {}", lit.get_falloff_shape().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_target_camera(reader: bmap::BMFileReader) {
|
#[rustfmt::skip]
|
||||||
for cam in reader.get_target_cameras() {
|
fn test_target_camera(reader: &bmap::BMFileReader) {
|
||||||
println!("{}", cam.get_name());
|
for cam in reader.get_target_cameras().unwrap() {
|
||||||
|
let cam = cam.unwrap();
|
||||||
|
|
||||||
println!("\tVisibility: {}", cam.get_visibility());
|
println!("{:?}", cam.get_name().unwrap());
|
||||||
println!("\tMatrix: {:?}", cam.get_world_matrix().to_const());
|
|
||||||
|
|
||||||
println!("\tType: {}", cam.get_projection_type());
|
println!("\tVisibility: {:?}", cam.get_visibility().unwrap());
|
||||||
println!("\tOrthographic Zoom: {}", cam.get_orthographic_zoom());
|
println!("\tMatrix: {:?}", cam.get_world_matrix().unwrap());
|
||||||
println!("\tFront Plane: {}", cam.get_front_plane());
|
|
||||||
println!("\tBack Plane: {}", cam.get_back_plane());
|
|
||||||
println!("\tFov: {}", cam.get_fov());
|
|
||||||
|
|
||||||
let (width, height) = cam.get_aspect_ratio();
|
println!("\tType: {:?}", cam.get_projection_type().unwrap());
|
||||||
|
println!("\tOrthographic Zoom: {}", cam.get_orthographic_zoom().unwrap());
|
||||||
|
println!("\tFront Plane: {}", cam.get_front_plane().unwrap());
|
||||||
|
println!("\tBack Plane: {}", cam.get_back_plane().unwrap());
|
||||||
|
println!("\tFov: {}", cam.get_fov().unwrap());
|
||||||
|
|
||||||
|
let (width, height) = cam.get_aspect_ratio().unwrap();
|
||||||
println!("\tAspect Ratio: {}:{}", width, height);
|
println!("\tAspect Ratio: {}:{}", width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +248,7 @@ mod testsuits {
|
|||||||
use super::bmap;
|
use super::bmap;
|
||||||
use std::collections::{BTreeSet, HashSet};
|
use std::collections::{BTreeSet, HashSet};
|
||||||
|
|
||||||
pub fn test(reader: bmap::BMFileReader) {
|
pub fn test(reader: &bmap::BMFileReader) {
|
||||||
// Check requirements
|
// Check requirements
|
||||||
assert!(
|
assert!(
|
||||||
reader.get_3dobject_count().unwrap() >= 2,
|
reader.get_3dobject_count().unwrap() >= 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user