void IParticleProcessor.Initalise(ParticleSystemTypeData typeData, IParticleProcessor[] allProcessors, bool useColourValues, uint maxLifeTimeSteps, uint timeStepHz, uint maxExpectedCount) { CpuParticleProcessorData processor = typeData.RuntimeLogicData.CpuParticleProcessorData; this.particleTypeData = typeData; this.timeStepHz = timeStepHz; this.processors = allProcessors; this.addIndices = new uint[8]; //max expected count is always a power of 2 this.maxCount = maxExpectedCount; this.countMask = maxExpectedCount - 1; bool usesUserValues = typeData.RuntimeLogicData.SystemUsesUserValues; bool usesLifeOrAge = typeData.RuntimeLogicData.SystemUsesLifeOrAgeValues; positions = new Vector4[maxExpectedCount]; velocity = new Vector4[maxExpectedCount]; if (useColourValues) { colours = new Vector4[maxExpectedCount]; } if (usesUserValues) { userdata = new Vector4[maxExpectedCount]; } if (usesLifeOrAge) { lifeData = new Vector2[maxExpectedCount]; } System.Reflection.Assembly asm = processor.Assembly; Type type = asm.GetType(processor.RuntimeClassName); System.Reflection.MethodInfo frameMethod = type.GetMethod(typeData.Name + "_frame", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); System.Reflection.MethodInfo onceMethod = type.GetMethod(typeData.Name + "_once", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); this.frameMethod = (UpdateParticleDelegate)Delegate.CreateDelegate(typeof(UpdateParticleDelegate), frameMethod); this.onceMethod = (AddParticleDelegate)Delegate.CreateDelegate(typeof(AddParticleDelegate), onceMethod); }
void IParticleProcessor.Initalise(ParticleSystemTypeData typeData, IParticleProcessor[] allProcessors, bool useColourValues, uint maxLifeTimeSteps, uint timeStepHz, uint maxExpectedCount) { CpuParticleProcessorData processor = typeData.RuntimeLogicData.CpuParticleProcessorData; this.particleTypeData = typeData; this.timeStepHz = timeStepHz; this.processors = allProcessors; this.addIndices = new uint[8]; //max expected count is always a power of 2 this.maxCount = maxExpectedCount; this.countMask = maxExpectedCount - 1; bool usesUserValues = typeData.RuntimeLogicData.SystemUsesUserValues; bool usesLifeOrAge = typeData.RuntimeLogicData.SystemUsesLifeOrAgeValues; positions = new Vector4[maxExpectedCount]; velocity = new Vector4[maxExpectedCount]; if (useColourValues) colours = new Vector4[maxExpectedCount]; if (usesUserValues) userdata = new Vector4[maxExpectedCount]; if (usesLifeOrAge) lifeData = new Vector2[maxExpectedCount]; System.Reflection.Assembly asm = processor.Assembly; Type type = asm.GetType(processor.RuntimeClassName); System.Reflection.MethodInfo frameMethod = type.GetMethod(typeData.Name + "_frame", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); System.Reflection.MethodInfo onceMethod = type.GetMethod(typeData.Name + "_once", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); this.frameMethod = (UpdateParticleDelegate)Delegate.CreateDelegate(typeof(UpdateParticleDelegate), frameMethod); this.onceMethod = (AddParticleDelegate)Delegate.CreateDelegate(typeof(AddParticleDelegate), onceMethod); }