Upgrade to Pro — share decks privately, control downloads, hide ads and more …

XNA Particle System

Kartones
December 07, 2011

XNA Particle System

@ Universidad Politécnica de Salamanca (May 2007)

Kartones

December 07, 2011
Tweet

More Decks by Kartones

Other Decks in Programming

Transcript

  1. Agenda • Agenda • Evolution of videogames • A simple

    particle system • Content pipeline for our system • Demos • End 
  2. Evolution of videogames Unicelular entity First videogame Primitive shapes Arcades

    Pigmentation Videoconsoles arrive 2,5 Dimensions First FPS Jump to 3D OpenGL/DirectX The invasion XNA: 3D for anyone
  3. A simple particle system Basic Concepts 2D Sprite Two triangles

    Or just one more speed, less versatility • Particles are always oriented (looking at) the camera (like sprites in Doom 2 :) • PointSprites: Manage just the center of the sprite (a point), when drawn transforms to a 3D polygon
  4. A simple particle system The particle engine • Particle Entity:

    Simple, contains information about position, mass, speed, acceleration, age… • Particle system: Contains a group of particles and rules of how they will behave. • Emitter: Way of creating the particles • Integrator: Particles “Update()” • Particle Engine: Group of N particle systems Particle Engine Particle System Particle System Particle Particle Particle Particle
  5. Content pipeline Basic Concepts • Content is imported • ParticleSystemImporter

    • Content is processed • ParticleSystemProcessor • Content is written • ParticleSystemWriter • Content is readed • ParticleSystemReader
  6. Content pipeline In detail • Importing [ContentImporter(".pfx", DisplayName = "Custom

    - Particle System Importer", DefaultProcessor = "ParticleSystemProcessor")] public class ParticleSystemImporter : ContentImporter<ParticleSystemImported> { public override ParticleSystemImported Import(string filename, ContentImporterContext context) {} } • Processing [ContentProcessor(DisplayName = "Custom - Particle System Processor")] public class ParticleSystemProcessor : ContentProcessor<ParticleSystemImported, ParticleSystemProcessed> { public override ParticleSystemProcessed Process(ParticleSystemImported input, ContentProcessorContext context) {} }
  7. Content pipeline In detail • Writing [ContentTypeWriter] public class ParticleSystemWriter

    : ContentTypeWriter<ParticleSystemProcessed> { protected override void Write(ContentWriter output, ParticleSystemProcessed value) {} public override string GetRuntimeType(Microsoft.Xna.Framework.TargetPlatform targetPlatform) {} public override string GetRuntimeReader(Microsoft.Xna.Framework.TargetPlatform targetPlatform) } • Reading public class ParticleSystemReader : ContentTypeReader<ParticleSystem> { protected override ParticleSystem Read(ContentReader input, ParticleSystem existingInstance) {} }