/// <summary>SpriteRenderer constructor.</summary>
        public SpriteRenderer(GraphicsContextAlpha gl, uint max_sprites)
        {
            GL = gl;

            m_imm_quads = new ImmediateModeQuads< Vector4 >( GL, (uint)max_sprites, VertexFormat.Float4 );

            {
                // init the font texture used by DrawTextDebug

                Texture2D font_texture = EmbeddedDebugFontData.CreateTexture();

                m_embedded_font_texture_info = new TextureInfo();

                m_embedded_font_texture_info.Initialize(
                    font_texture,
                    new Vector2i( EmbeddedDebugFontData.NumChars, 1 ),
                    new TRS(
                        new Bounds2(
                            new Vector2(0.0f, 0.0f),
                            new Vector2(
                                (EmbeddedDebugFontData.CharSizei.X * EmbeddedDebugFontData.NumChars ) / (float)font_texture.Width,
                                (EmbeddedDebugFontData.CharSizei.Y / (float)font_texture.Height)
                                )
                            )
                        )
                    );
            }
        }
Beispiel #2
0
 public ParticleSystem(int max_particles)
 {
     this.GL          = Director.Instance.GL;
     this.m_imm_quads = new ImmediateModeQuads <ParticleSystem.Vertex>(this.GL, (uint)max_particles, new VertexFormat[]
     {
         (VertexFormat)259,
         (VertexFormat)259
     });
     this.m_particles = new ParticleSystem.Particle[max_particles];
     for (int i = 0; i < this.m_particles.Length; i++)
     {
         this.m_particles[i] = new ParticleSystem.Particle();
     }
     this.m_random     = new Math.RandGenerator(0);
     this.Shader       = ParticleSystem.DefaultShader;
     this.Emit         = new ParticleSystem.EmitterParams();
     this.Simulation   = new ParticleSystem.SimulationParams();
     this.m_v0.XYUV.Zw = Math._00;
     this.m_v1.XYUV.Zw = Math._10;
     this.m_v2.XYUV.Zw = Math._01;
     this.m_v3.XYUV.Zw = Math._11;
 }
        /// <summary>
        /// ParticleSystem constructor.
        /// </summary>
        /// <param name="max_particles">The maximum number of particles for this particle system.</param>
        public ParticleSystem( int max_particles )
        {
            GL = Director.Instance.GL;
            m_imm_quads = new ImmediateModeQuads< Vertex >( GL, (uint)max_particles, VertexFormat.Float4, VertexFormat.Float4 );
            m_particles = new Particle[ max_particles ];
            for ( int i=0; i < m_particles.Length; ++i )
                m_particles[i] = new Particle();
            m_random = new GameEngine2D.Base.Math.RandGenerator();
            Shader = DefaultShader;
            Emit = new EmitterParams();
            Simulation = new SimulationParams();

            m_v0.XYUV.Zw = GameEngine2D.Base.Math._00;
            m_v1.XYUV.Zw = GameEngine2D.Base.Math._10;
            m_v2.XYUV.Zw = GameEngine2D.Base.Math._01;
            m_v3.XYUV.Zw = GameEngine2D.Base.Math._11;
        }
Beispiel #4
0
            public ParticleEffectsManager()
            {
                Particles = new List<Particle>();
                for (int i = 0; i < max_particles; ++i)
                    Particles.Add(new Particle());

                ShaderProgram = new ShaderProgram("/Application/assets/pfx.cgx");
                ParticleDotTexture = new Texture2D("/Application/assets/particle_dot.png", false);
                Sce.PlayStation.HighLevel.GameEngine2D.Scheduler.Instance.Schedule(this, Tick, 0.0f, false);

                AdHocDraw += this.DrawParticles;

                imm_quads = new ImmediateModeQuads< VertexData >( Director.Instance.GL, (uint)max_particles, VertexFormat.Float2, VertexFormat.Float2, VertexFormat.Float4 );
            }
            public ParticleEffectsManager()
            {
                QualityParticles = new List<Particle>();
                ScoreParticles = new List<Particle>();
                SelectionMarkerParticles = new List<Particle>();
                ActiveQualityParticles = 0;
                ActiveScoreParticles = 0;
                ActiveSelectionMarkerParticles = 0;
                gravity = new Vector2(0.0f, -800.0f);

                for (int i = 0; i < max_qualityParticles; ++i){
                    QualityParticles.Add(new Particle());
                }
                for (int i=0; i < max_scoreParticles; ++i){
                    ScoreParticles.Add (new Particle());
                }
                for (int i=0; i < max_selectionMarkerParticles; ++i){
                    SelectionMarkerParticles.Add(new Particle());
                }

                ShaderProgram = new ShaderProgram("/Application/shaders/pfx.cgx");
                ParticleDotTexture = new Texture2D("/Application/assets/images/particles.png", false);
                ParticleScoreIconTexture = new Texture2D("/Application/assets/images/icons/icons.png", false);
                ParticleSelectionMarkerTexture = new Texture2D("/Application/assets/images/SelectionMarker.png", false);
                Sce.PlayStation.HighLevel.GameEngine2D.Scheduler.Instance.Schedule(this, Tick, 0.0f, false);

                AdHocDraw += this.DrawParticles;

                imm_quads = new ImmediateModeQuads< VertexData >( Director.Instance.GL, (uint)max_particles, VertexFormat.Float2, VertexFormat.Float2, VertexFormat.Float4 );
            }