public InterpolatorColor(System.Collections.SortedList colorKeyFrames) { //_colors = a_colorKeyFrames; _interpolators = new List<Interpolator>(); for (int i = 0; i < 4; i++) { Interpolator ip = new Interpolator(); _interpolators.Add(ip); System.Collections.SortedList a = new System.Collections.SortedList(); for (int nClrNum = 0; nClrNum < colorKeyFrames.Count; nClrNum++) { Color clr = (Color)colorKeyFrames.GetByIndex(nClrNum); double dVal = 0; if (i == 0) dVal = clr.A; else if (i == 1) dVal = clr.R; else if (i == 2) dVal = clr.G; else if (i == 3) dVal = clr.B; a.Add(colorKeyFrames.GetKey(nClrNum), dVal); } ip.KeyFramesList = a; } }
/// <summary> /// Renders a set of solid objects. /// </summary> protected virtual void RenderSolidObjects( System.Collections.SortedList list, bool doLightIteration, LightList manualLightList ) { // ----- SOLIDS LOOP ----- for ( int i = 0; i < list.Count; i++ ) { RenderableList renderables = (RenderableList)list.GetByIndex( i ); // bypass if this group is empty if ( renderables.Count == 0 ) { continue; } Pass pass = (Pass)list.GetKey( i ); // Give SM a chance to eliminate this pass if ( !this.ValidatePassForRendering( pass ) ) { continue; } // For solids, we try to do each pass in turn Pass usedPass = this.SetPass( pass ); // render each object associated with this rendering pass for ( int r = 0; r < renderables.Count; r++ ) { IRenderable renderable = (IRenderable)renderables[ r ]; // Give SM a chance to eliminate if ( !this.ValidateRenderableForRendering( usedPass, renderable ) ) { continue; } // Render a single object, this will set up auto params if required this.RenderSingleObject( renderable, usedPass, doLightIteration, manualLightList ); } } }
/// <summary> /// Instantiates a new class. /// </summary> /// <param name="attributes">The attributes from the Xml used to identify the class type.</param> /// <param name="target">The class containing the reference to the member to create.</param> /// <param name="member">Information about the member to create.</param> /// <returns>The instantiated class.</returns> /// <remarks></remarks> private object CreateClass(System.Collections.SortedList attributes, object target, System.Reflection.MemberInfo member) { object _MemberValue; if (member is System.Reflection.FieldInfo) { _MemberValue = ((System.Reflection.FieldInfo)member).GetValue(target); } else if (member is System.Reflection.PropertyInfo) { _MemberValue = ((System.Reflection.PropertyInfo)member).GetValue(target, null); } else { throw new System.NotSupportedException("MemberInfo type, " + member.GetType().Name + ", not supported."); } //Instantiate Object Types if ((_MemberValue == null) & !(IsDataType(member))) { string _MemberType = null; //Create a New Instance of the Object if (attributes != null & attributes.ContainsKey("className")) { _MemberType = System.Convert.ToString(attributes.GetByIndex(attributes.IndexOfKey("className"))); _MemberValue = InstantiateMember(target.GetType().Assembly, _MemberType); } if (_MemberValue == null) { //Attempt to create the class based on the field type. //This won't work if the field is type System.Object. if (member is System.Reflection.FieldInfo) { _MemberType = ((System.Reflection.FieldInfo)member).FieldType.FullName; } else if (member is System.Reflection.PropertyInfo) { _MemberType = ((System.Reflection.PropertyInfo)member).PropertyType.FullName; } _MemberValue = InstantiateMember(target.GetType().Assembly, _MemberType); } //Assign the new class to the target object's field if (member is System.Reflection.FieldInfo) { ((System.Reflection.FieldInfo)member).SetValue(target, _MemberValue); } else if (member is System.Reflection.PropertyInfo) { ((System.Reflection.PropertyInfo)member).SetValue(target, _MemberValue, null); } } return _MemberValue; }