[−][src]Struct pbrt::core::paramset::ParamSet
ParamSet
provides a generic way to pass data between the scene files and the factory
functions that create various pieces of the rendering pipeline. It enables the renderer to be
extensible, many of the constructor methods on Pbrt take a name and a ParamSet
. This
allows new types of Texture
s, Camera
s, Shape
s, etc. to be added without haven't to change
and method signatures.
Methods
impl ParamSet
[src]
pub fn find_one_bool(&self, name: &str, default: bool) -> bool
[src]
find_one_bool will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type bool
then default
will be returned.
Examples
use pbrt::core::paramset::testutils::make_bool_param_set; let ps = make_bool_param_set("value", vec![true]); assert_eq!(ps.find_one_bool("value", false), true); assert_eq!(ps.find_one_bool("non-existent", false), false);
pub fn find_one_float(&self, name: &str, default: Float) -> Float
[src]
find_one_float will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type Float
then default
will be returned.
Examples
use pbrt::core::paramset::testutils::make_float_param_set; let ps = make_float_param_set("value", vec![1.]); assert_eq!(ps.find_one_float("value", 2.), 1.); assert_eq!(ps.find_one_float("non-existent", 2.), 2.);
pub fn find_one_int(&self, name: &str, default: isize) -> isize
[src]
find_one_int will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type isize
then default
will be returned.
Examples
use pbrt::core::paramset::testutils::make_int_param_set; let ps = make_int_param_set("value", vec![1]); assert_eq!(ps.find_one_int("value", 2), 1); assert_eq!(ps.find_one_int("non-existent", 2), 2);
pub fn find_one_point2f(&self, name: &str, default: Point2f) -> Point2f
[src]
find_one_point2f will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type Point2f
then default
will be returned.
Examples
use pbrt::core::geometry::Point2f; use pbrt::core::paramset::testutils::make_point2f_param_set; let ps = make_point2f_param_set("value", vec![Point2f::from([1., 1.])]); assert_eq!( ps.find_one_point2f("value", Point2f::from([2., 2.])), Point2f::from([1., 1.]) ); assert_eq!( ps.find_one_point2f("non-existent", Point2f::from([2., 2.])), Point2f::from([2., 2.]) );
pub fn find_one_vector2f(&self, name: &str, default: Vector2f) -> Vector2f
[src]
find_one_vector2f will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type Vector2f
then default
will be returned.
Examples
use pbrt::core::geometry::Vector2f; use pbrt::core::paramset::testutils::make_vector2f_param_set; let ps = make_vector2f_param_set("value", vec![Vector2f::from([1., 1.])]); assert_eq!( ps.find_one_vector2f("value", Vector2f::from([2., 2.])), Vector2f::from([1., 1.]) ); assert_eq!( ps.find_one_vector2f("non-existent", Vector2f::from([2., 2.])), Vector2f::from([2., 2.]) );
pub fn find_one_point3f(&self, name: &str, default: Point3f) -> Point3f
[src]
find_one_point3f will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type Point3f
then default
will be returned.
Examples
use pbrt::core::geometry::Point3f; use pbrt::core::paramset::testutils::make_point3f_param_set; let ps = make_point3f_param_set("value", vec![Point3f::from([1., 1., 1.])]); assert_eq!( ps.find_one_point3f("value", Point3f::from([2., 2., 2.])), Point3f::from([1., 1., 1.]) ); assert_eq!( ps.find_one_point3f("non-existent", Point3f::from([2., 2., 2.])), Point3f::from([2., 2., 2.]) );
pub fn find_one_vector3f(&self, name: &str, default: Vector3f) -> Vector3f
[src]
find_one_vector3f will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type Vector3f
then default
will be returned.
Examples
use pbrt::core::geometry::Vector3f; use pbrt::core::paramset::testutils::make_vector3f_param_set; let ps = make_vector3f_param_set("value", vec![Vector3f::from([1., 1., 1.])]); assert_eq!( ps.find_one_vector3f("value", Vector3f::from([2., 2., 2.])), Vector3f::from([1., 1., 1.]) ); assert_eq!( ps.find_one_vector3f("non-existent", Vector3f::from([2., 2., 2.])), Vector3f::from([2., 2., 2.]) );
pub fn find_one_normal3f(&self, name: &str, default: Normal3f) -> Normal3f
[src]
find_one_normal3f will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type Normal3f
then default
will be returned.
Examples
use pbrt::core::geometry::Normal3f; use pbrt::core::paramset::testutils::make_normal3f_param_set; let ps = make_normal3f_param_set("value", vec![Normal3f::from([1., 1., 1.])]); assert_eq!( ps.find_one_normal3f("value", Normal3f::from([2., 2., 2.])), Normal3f::from([1., 1., 1.]) ); assert_eq!( ps.find_one_normal3f("non-existent", Normal3f::from([2., 2., 2.])), Normal3f::from([2., 2., 2.]) );
pub fn find_one_spectrum(&self, name: &str, default: Spectrum) -> Spectrum
[src]
find_one_spectrum will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type Spectrum
then default
will be returned.
Examples
use pbrt::core::paramset::testutils::make_spectrum_param_set; use pbrt::core::spectrum::Spectrum; let ps = make_spectrum_param_set("value", vec![Spectrum::from_rgb([1., 1., 1.])]); assert_eq!( ps.find_one_spectrum("value", Spectrum::from_rgb([2., 2., 2.])), Spectrum::from_rgb([1., 1., 1.]) ); assert_eq!( ps.find_one_spectrum("non-existent", Spectrum::from_rgb([2., 2., 2.])), Spectrum::from_rgb([2., 2., 2.]) );
pub fn find_one_string(&self, name: &str, default: String) -> String
[src]
find_one_string will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type String
then default
will be returned.
Examples
use pbrt::core::paramset::testutils::make_string_param_set; let ps = make_string_param_set("value", vec!["found".to_string()]); assert_eq!( ps.find_one_string("value", "default".to_string()), "found".to_string() ); assert_eq!( ps.find_one_string("non-existent", "default".to_string()), "default".to_string() );
pub fn find_one_texture(&self, name: &str, default: String) -> String
[src]
find_one_texture will return the first parameter in the set for the given
name
. If no values are found default
is returned. If the value by that
name is found but isn't of type String
then default
will be returned.
Examples
use pbrt::core::paramset::testutils::make_texture_param_set; let ps = make_texture_param_set("value", vec!["found".to_string()]); assert_eq!( ps.find_one_texture("value", "default".to_string()), "found".to_string() ); assert_eq!( ps.find_one_texture("non-existent", "default".to_string()), "default".to_string() );
pub fn report_unused(&self) -> bool
[src]
report_unused
will print out all values in this ParamSet
that have not been accessed,
will return true if any unused values are found.
Useful after parsing a scene to see what configuration data was superfluous, or for
detecting incomplete implementations of scene factory fuctions.
Trait Implementations
impl Clone for ParamSet
[src]
impl Debug for ParamSet
[src]
impl Default for ParamSet
[src]
impl From<Vec<ParamSetItem>> for ParamSet
[src]
fn from(psis: Vec<ParamSetItem>) -> Self
[src]
impl PartialEq<ParamSet> for ParamSet
[src]
impl StructuralPartialEq for ParamSet
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ParamSet
impl Send for ParamSet
impl !Sync for ParamSet
impl Unpin for ParamSet
impl UnwindSafe for ParamSet
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,