コード例 #1
0
        /// <summary>
        /// Generates a DistributionVector
        /// </summary>
        /// <param name="sp"></param>
        /// <returns></returns>
        public static DistributionVector FromStruct(StructProperty sp)
        {
            var lookupTable = sp.GetProp <ArrayProperty <FloatProperty> >("LookupTable");

            if (lookupTable != null && lookupTable.Count > 1)
            {
                float min = lookupTable[0];
                float max = lookupTable[1];

                int            index   = 2;
                List <Vector3> vectors = new List <Vector3>();
                while (index < lookupTable.Count)
                {
                    Vector3 v = new Vector3(lookupTable[index], lookupTable[index + 1], lookupTable[index + 2]);
                    vectors.Add(v);
                    index += 3;
                }

                DistributionVector dv = new DistributionVector
                {
                    HasLookupTable = true,
                    MinValue       = min,
                    MaxValue       = max,
                    Property       = sp,
                    PropertyName   = sp.Name.Name,
                    Vectors        = new ObservableCollectionExtended <Vector3>(vectors)
                };
                return(dv);
            }

            // ERROR
            return(null);
        }
コード例 #2
0
        public static BioParticleModuleColorOverLife Parse(ExportEntry export)
        {
            var props  = export.GetProperties();
            var bpmcol = new BioParticleModuleColorOverLife();

            bpmcol.Export        = export;
            bpmcol.ColorOverLife = DistributionVector.FromStruct(props.GetProp <StructProperty>("ColorOverLife"));
            bpmcol.AlphaOverLife = DistributionFloat.FromStruct(props.GetProp <StructProperty>("AlphaOverLife"));
            return(bpmcol);
        }