pub struct Execution {
pub globals: Vec<Value>,
pub stack: Vec<Value>,
pub uv: Value,
pub color: Value,
pub roughness: Value,
pub metallic: Value,
pub emissive: Value,
pub opacity: Value,
pub bump: Value,
pub normal: Value,
pub hitpoint: Value,
pub time: Value,
/* private fields */
}Fields§
§globals: Vec<Value>Global variables. The parser keeps count of all global variables and we allocate the array on creation.
stack: Vec<Value>The execution stack.
uv: ValueUV
color: ValueInput/Output color
roughness: ValueRoughness
metallic: ValueMetallic
emissive: ValueEmissive
opacity: ValueOpacity
bump: ValueBump
normal: ValueNormal
hitpoint: ValueHitpoint
time: ValueTime
Implementations§
Source§impl Execution
impl Execution
pub fn new(var_size: usize) -> Self
pub fn new_from_var(execution: &Execution) -> Self
Sourcepub fn reset(&mut self, var_size: usize)
pub fn reset(&mut self, var_size: usize)
When switching between programs we need to resize the count of global variables.
pub fn execute( &mut self, code: &[NodeOp], program: &Program, palette: &ThePalette, )
Sourcepub fn shade(&mut self, index: usize, program: &Program, palette: &ThePalette)
pub fn shade(&mut self, index: usize, program: &Program, palette: &ThePalette)
Execute the shading function
Sourcepub fn execute_function_no_args(
&mut self,
index: usize,
program: &Program,
palette: &ThePalette,
) -> Value
pub fn execute_function_no_args( &mut self, index: usize, program: &Program, palette: &ThePalette, ) -> Value
Call a function with no arguments
Sourcepub fn execute_function(
&mut self,
args: &[Value],
index: usize,
program: &Program,
palette: &ThePalette,
) -> Value
pub fn execute_function( &mut self, args: &[Value], index: usize, program: &Program, palette: &ThePalette, ) -> Value
Call a function with arguments provided as a slice.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Execution
impl RefUnwindSafe for Execution
impl Send for Execution
impl Sync for Execution
impl Unpin for Execution
impl UnsafeUnpin for Execution
impl UnwindSafe for Execution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more