public void Execute(ref WooState state) { if (state._Recursions > 0 || !state.GetRule(_RulePrototype._Name).CanRecurse()) { state._Recursions--; for (int i = 0; i < _ArgValue.Count(); i++) { if (_RulePrototype._Args[i]._Type == VarType.varVector) { state.AddVector(_RulePrototype._Args[i]._Name, _ArgValue[i].EvaluateVector(ref state)); } else if (_RulePrototype._Args[i]._Type == VarType.varFloat) { state.AddFloat(_RulePrototype._Args[i]._Name, _ArgValue[i].EvaluateFloat(ref state)); } } state.GetRule(_RulePrototype._Name).Execute(ref state); for (int i = 0; i < _ArgValue.Count(); i++) { if (_RulePrototype._Args[i]._Type == VarType.varVector) { state.RemoveVector(_RulePrototype._Args[i]._Name); } else if (_RulePrototype._Args[i]._Type == VarType.varFloat) { state.RemoveFloat(_RulePrototype._Args[i]._Name); } } state._Recursions++; } }
public void Execute(ref WooState state) { if (state._Recursions > 0 || !state.GetRule(_RulePrototype._Name).CanRecurse()) { state._Recursions--; for (int i=0; i<_ArgValue.Count(); i++) { if (_RulePrototype._Args[i]._Type == VarType.varVector) state.AddVector(_RulePrototype._Args[i]._Name, _ArgValue[i].EvaluateVector(ref state)); else if (_RulePrototype._Args[i]._Type == VarType.varFloat) state.AddFloat(_RulePrototype._Args[i]._Name, _ArgValue[i].EvaluateFloat(ref state)); } state.GetRule(_RulePrototype._Name).Execute(ref state); for (int i = 0; i < _ArgValue.Count(); i++) { if (_RulePrototype._Args[i]._Type == VarType.varVector) state.RemoveVector(_RulePrototype._Args[i]._Name); else if (_RulePrototype._Args[i]._Type == VarType.varFloat) state.RemoveFloat(_RulePrototype._Args[i]._Name); } state._Recursions++; } }
public WooState Clone() { WooState clone = new WooState(); clone._Position = this._Position.Clone(); clone._rX = this._rX; clone._rY = this._rY; clone._rZ = this._rZ; clone._Diff = this._Diff.Clone(); clone._Refl = this._Refl.Clone(); clone._Emi = this._Emi.Clone(); clone._Spec = this._Spec.Clone(); clone._Abs = this._Abs.Clone(); clone._v0 = this._v0.Clone(); clone._v1 = this._v1.Clone(); clone._v2 = this._v2.Clone(); clone._v3 = this._v3.Clone(); clone._Power = this._Power; clone._Gloss = this._Gloss; clone._Opacity = this._Opacity; clone._Density = this._Density; clone._TintDensity = this._TintDensity; clone._RefractiveIndex = this._RefractiveIndex; clone._Rules = this._Rules; clone._Shaders = this._Shaders; clone._Random = this._Random; clone._Parent = this._Parent; clone._Rotation = this._Rotation.Clone(); clone._Scale = new Vector3(this._Scale); clone._Recursions = this._Recursions; clone._Objects = this._Objects; clone._PreviousState = this._PreviousState; clone._Preview = this._Preview; clone._MengerIterations = this._MengerIterations; for (int i = 0; i < 27; i++) clone._MengerPattern[i] = this._MengerPattern[i]; clone._DistanceFunction = this._DistanceFunction; clone._DistanceMinimum = this._DistanceMinimum; clone._DistanceScale = this._DistanceScale; clone._DistanceOffset = this._DistanceOffset.Clone(); clone._DistanceIterations = this._DistanceIterations; clone._DistanceExtents = this._DistanceExtents; clone._StepSize = this._StepSize; clone._MaterialFunction = this._MaterialFunction; clone._Depth = this._Depth; foreach (VectorVariable vecvar in _VectorVariable) { clone.AddVector(vecvar._Name, vecvar._Value); } foreach (FloatVariable floatvar in _FloatVariable) { clone.AddFloat(floatvar._Name, floatvar._Value); } clone._FractalIterations = this._FractalIterations; clone._FractalIterationCount = this._FractalIterationCount; clone._ColourIterationCount = this._ColourIterationCount; clone._DEMode = this._DEMode; return clone; }
public WooState Clone() { WooState clone = new WooState(); clone._Position = this._Position.Clone(); clone._rX = this._rX; clone._rY = this._rY; clone._rZ = this._rZ; clone._Diff = this._Diff.Clone(); clone._Refl = this._Refl.Clone(); clone._Emi = this._Emi.Clone(); clone._Spec = this._Spec.Clone(); clone._Abs = this._Abs.Clone(); clone._v0 = this._v0.Clone(); clone._v1 = this._v1.Clone(); clone._v2 = this._v2.Clone(); clone._v3 = this._v3.Clone(); clone._Power = this._Power; clone._Gloss = this._Gloss; clone._Opacity = this._Opacity; clone._Density = this._Density; clone._TintDensity = this._TintDensity; clone._RefractiveIndex = this._RefractiveIndex; clone._Rules = this._Rules; clone._Shaders = this._Shaders; clone._Random = this._Random; clone._Parent = this._Parent; clone._Rotation = this._Rotation.Clone(); clone._Scale = new Vector3(this._Scale); clone._Recursions = this._Recursions; clone._Objects = this._Objects; clone._PreviousState = this._PreviousState; clone._Preview = this._Preview; clone._MengerIterations = this._MengerIterations; for (int i = 0; i < 27; i++) { clone._MengerPattern[i] = this._MengerPattern[i]; } clone._DistanceFunction = this._DistanceFunction; clone._DistanceMinimum = this._DistanceMinimum; clone._DistanceScale = this._DistanceScale; clone._DistanceOffset = this._DistanceOffset.Clone(); clone._DistanceIterations = this._DistanceIterations; clone._DistanceExtents = this._DistanceExtents; clone._StepSize = this._StepSize; clone._MaterialFunction = this._MaterialFunction; clone._Depth = this._Depth; foreach (VectorVariable vecvar in _VectorVariable) { clone.AddVector(vecvar._Name, vecvar._Value); } foreach (FloatVariable floatvar in _FloatVariable) { clone.AddFloat(floatvar._Name, floatvar._Value); } clone._FractalIterations = this._FractalIterations; clone._FractalIterationCount = this._FractalIterationCount; clone._ColourIterationCount = this._ColourIterationCount; clone._DEMode = this._DEMode; return(clone); }