/// <summary> /// Constructor /// </summary> /// <param name="game">Game</param> /// <param name="name">Name</param> /// <param name="description">Particle system description</param> /// <param name="emitter">Particle emitter</param> public ParticleSystemCpu(Game game, string name, ParticleSystemDescription description, ParticleEmitter emitter) { this.Game = game; this.Name = name; this.parameters = new ParticleSystemParams(description) * emitter.Scale; var imgContent = new ImageContent() { Streams = ContentManager.FindContent(description.ContentPath, description.TextureName), }; this.Texture = game.ResourceManager.CreateResource(imgContent); this.TextureCount = (uint)imgContent.Count; this.Emitter = emitter; this.Emitter.UpdateBounds(this.parameters); this.MaxConcurrentParticles = this.Emitter.GetMaximumConcurrentParticles(description.MaxDuration); this.particles = new VertexCpuParticle[this.MaxConcurrentParticles]; this.buffer = new EngineBuffer <VertexCpuParticle>(game.Graphics, description.Name, this.particles, true); buffer.AddInputLayout(game.Graphics.CreateInputLayout(DrawerPool.EffectDefaultCPUParticles.RotationDraw.GetSignature(), VertexCpuParticle.Input(BufferSlot))); buffer.AddInputLayout(game.Graphics.CreateInputLayout(DrawerPool.EffectDefaultCPUParticles.NonRotationDraw.GetSignature(), VertexCpuParticle.Input(BufferSlot))); this.TimeToEnd = this.Emitter.Duration + this.parameters.MaxDuration; }
/// <summary> /// Dispose resources /// </summary> /// <param name="disposing">Free managed resources</param> protected virtual void Dispose(bool disposing) { if (disposing) { buffer?.Dispose(); buffer = null; } }
protected override void WriteSqlServerVariable() { EnginePatternWriter.WriteSqlServerVariable(new TestSqlServerVariable(EngineBuffer.Flush(), ++sql_var_incrementor), EngineCurrentKeyPress); }
protected override void WriteSarbId() { EnginePatternWriter.WriteSarbId(new TestSarbId(EngineBuffer.Flush(), ++sarb_id_incrementor), EngineCurrentKeyPress); }
protected override void WriteNumericConstant() { EnginePatternWriter.WriteNumericConstant(new TestNumericConstant(EngineBuffer.Flush(), ++num_const_incrementor), EngineCurrentKeyPress); }
protected override void WriteOtherKeyword() { EnginePatternWriter.WriteKeyword(new TestOtherKeyword(EngineBuffer.FlushKeyword().Value, ++oth_keyword_incrementor), EngineCurrentKeyPress); }
protected override void WriteControlFlowKeyword() { EnginePatternWriter.WriteKeyword(new TestControlFlowKeyword(EngineBuffer.FlushKeyword().Value, ++cf_keyword_incrementor), EngineCurrentKeyPress); }
protected override void WriteTextConstant() { EnginePatternWriter.WriteTextConstant(new MeasureTextConstantSegment(EngineBuffer.Flush(), 0), EngineCurrentKeyPress); }
protected override void WriteOrganisationId() { EnginePatternWriter.WriteOrganisationId(new MeasureOrganisationIdSegment(EngineBuffer.Flush(), ++org_id_incrementer), EngineCurrentKeyPress); }
protected override void WriteOtherKeyword() { EnginePatternWriter.WriteKeyword(new MeasureKeywordSegment(EngineBuffer.FlushKeyword().Value, 0), EngineCurrentKeyPress); }
protected override void WriteOperatorKeyword() { EnginePatternWriter.WriteKeyword(new MeasureKeywordSegment(EngineBuffer.FlushKeyword().Value, ++operator_incrementor), EngineCurrentKeyPress); }
protected override void WriteFunctionKeyword() { EnginePatternWriter.WriteKeyword(new MeasureFunctionKeywordSegment(EngineBuffer.FlushKeyword().Value, ++func_keyword_incrementor), EngineCurrentKeyPress); }
protected override void WriteField() { EnginePatternWriter.WriteNumericConstant(new FilterVariableSegment(EngineBuffer.Flush(), ++var_incrementor), EngineCurrentKeyPress); }
protected override void WriteFunctionKeyword() { EnginePatternWriter.WriteKeyword(new FilterKeywordSegment(EngineBuffer.FlushKeyword().Value, 0), EngineCurrentKeyPress); }
protected override void WriteTextConstant() { EnginePatternWriter.WriteTextConstant(new TestTextConstant(EngineBuffer.Flush(), ++text_const_incrementor), EngineCurrentKeyPress); }
protected override void WriteField() { EnginePatternWriter.WriteField(new TestField(EngineBuffer.Flush(), ++fld_incrementor), EngineCurrentKeyPress); }
protected override void WriteSqlServerVariable() { EnginePatternWriter.WriteSqlServerVariable(new MeasureSqlServerVariableSegment(EngineBuffer.Flush(), 0), EngineCurrentKeyPress); }