Scenes with lights now get parsed correctly.
This commit is contained in:
parent
c2d36e0d14
commit
f7e57f2aee
|
@ -43,13 +43,13 @@ Scene $Scene_fr1 {
|
|||
SurfaceShaderBind [$Material]
|
||||
Transform [1.000000 -0.000000 0.000000 -0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 -0.000000 1.000000 -0.000000 -0.000000 0.000000 -1.000000 1.000000]
|
||||
}
|
||||
#SphereLight $__Lamp {
|
||||
# Color [50.000000 50.000000 50.000000]
|
||||
# Radius [0.100000]
|
||||
#}
|
||||
#Instance {
|
||||
# Data [$__Lamp]
|
||||
# Transform [0.019856 -0.060763 0.000000 -0.000000 0.015191 0.079422 -0.000000 0.000000 0.000000 -0.000000 1.000000 -0.000000 -0.026851 -0.125233 -4.432303 1.000000]
|
||||
#}
|
||||
SphereLight $__Lamp {
|
||||
Color [50.000000 50.000000 50.000000]
|
||||
Radius [0.100000]
|
||||
}
|
||||
Instance {
|
||||
Data [$__Lamp]
|
||||
Transform [0.019856 -0.060763 0.000000 -0.000000 0.015191 0.079422 -0.000000 0.000000 0.000000 -0.000000 1.000000 -0.000000 -0.026851 -0.125233 -4.432303 1.000000]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ impl AssemblyBuilder {
|
|||
let obj = &self.objects[inst.data_index];
|
||||
match obj {
|
||||
&Object::Surface(ref s) => bbs.extend(s.bounds()),
|
||||
&Object::Light(_) => unimplemented!(),
|
||||
&Object::Light(ref l) => bbs.extend(l.bounds()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,19 @@ pub struct SphereLight {
|
|||
|
||||
impl SphereLight {
|
||||
pub fn new(radii: Vec<f32>, colors: Vec<XYZ>) -> SphereLight {
|
||||
unimplemented!()
|
||||
let bbs = radii.iter()
|
||||
.map(|r| {
|
||||
BBox {
|
||||
min: Point::new(-*r, -*r, -*r),
|
||||
max: Point::new(*r, *r, *r),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
SphereLight {
|
||||
radii: radii,
|
||||
colors: colors,
|
||||
bounds_: bbs,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::result::Result;
|
|||
use super::DataTree;
|
||||
use super::psy::{parse_matrix, PsyParseError};
|
||||
use super::psy_mesh_surface::parse_mesh_surface;
|
||||
use super::psy_light::parse_sphere_light;
|
||||
|
||||
use assembly::{Assembly, AssemblyBuilder, Object};
|
||||
|
||||
|
@ -70,6 +71,17 @@ pub fn parse_assembly(tree: &DataTree) -> Result<Assembly, PsyParseError> {
|
|||
}
|
||||
}
|
||||
|
||||
// Sphere Light
|
||||
"SphereLight" => {
|
||||
if let &DataTree::Internal { ident: Some(ident), .. } = child {
|
||||
builder.add_object(ident,
|
||||
Object::Light(Box::new(try!(parse_sphere_light(&child)))));
|
||||
} else {
|
||||
// TODO: error condition of some kind, because no ident
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
|
||||
_ => {
|
||||
// TODO: some kind of error, because not a known type name
|
||||
}
|
||||
|
@ -99,10 +111,6 @@ pub fn parse_assembly(tree: &DataTree) -> Result<Assembly, PsyParseError> {
|
|||
// assembly->add_surface_shader(child.name, parse_surface_shader(child));
|
||||
// }
|
||||
//
|
||||
// // Sphere Light
|
||||
// else if (child.type == "SphereLight") {
|
||||
// assembly->add_object(child.name, parse_sphere_light(child));
|
||||
// }
|
||||
//
|
||||
// // Rectangle Light
|
||||
// else if (child.type == "RectangleLight") {
|
||||
|
|
Loading…
Reference in New Issue
Block a user