/// <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)
                                )
                            )
                        )
                    );
            }
        }
Exemple #2
0
        int m_push_depth; // check push/pop errors

        #endregion Fields

        #region Constructors

        /// <summary>
        /// </summary>
        /// <param name="gl">Needed for its matrix stack.</param>
        /// <param name="draw_helpers">Needed only for debug draw (DebugDraw).</param>
        public Camera3D( GraphicsContextAlpha gl, DrawHelpers draw_helpers )
        {
            GL = gl;
            m_draw_helpers = draw_helpers;

            m_push_depth = 0;

            Frustum = new Frustum();
        }
Exemple #3
0
        /// <summary>Director constructor.</summary>
        Director( uint sprites_capacity, uint draw_helpers_capacity, Sce.PlayStation.Core.Graphics.GraphicsContext context )
        {
            m_paused = false;
            m_frame_timer = new Timer();
            m_run_with_scene_called = false;
            m_elapsed = 0.0;

            GL = new GraphicsContextAlpha( context );
            DrawHelpers = new DrawHelpers( GL, draw_helpers_capacity );
            SpriteRenderer = new SpriteRenderer( GL, 6 * sprites_capacity );
            //DebugFlags |= GameEngine2D.DebugFlags.Log;

            m_canceled_replace_scene = new HashSet< Scene >();
        }
Exemple #4
0
        uint m_view_matrix_tag; // check for ViewMatrix update

        #endregion Fields

        #region Constructors

        /// <summary>
        /// </summary>
        /// <param name="gl">The core graphics context.</param>
        /// <param name="max_vertices">The maximum number of vertices you will be able to
        /// write in one frame with this DrawHelpers object.</param>
        public DrawHelpers( GraphicsContextAlpha gl, uint max_vertices )
        {
            GL = gl;

            {
                m_shader_program = Common.CreateShaderProgram("default.cgx");

                m_shader_program.SetUniformBinding( 0, "MVP" ) ;
                m_shader_program.SetAttributeBinding( 0, "p" ) ;
                m_shader_program.SetAttributeBinding( 1, "vin_color" ) ;
            }

            m_current_color = Colors.Magenta;
            m_shader_depth = 0;
            m_view_matrix_tag = unchecked((uint)-1);
            m_model_matrix_tag = unchecked((uint)-1);
            m_projection_matrix_tag = unchecked((uint)-1);

            m_imm = new ImmediateMode<Vertex>( gl, max_vertices, null, 0, 0, VertexFormat.Float4, VertexFormat.Float4 );
        }
Exemple #5
0
        /// <summary>
        /// </summary>
        /// <param name="gl">Needed for the matrix stack</param>
        /// <param name="draw_helpers">Needed only for debug draw</param>
        public Camera2D( GraphicsContextAlpha gl, DrawHelpers draw_helpers )
        {
            GL = gl;
            m_draw_helpers = draw_helpers;

            m_data.m_support_scale = 1.0f;
            m_data.m_support_unit_vec = Math._01;
            m_data.m_support_is_y = true;
            m_data.m_center = GameEngine2D.Base.Math._00;
            m_data.m_aspect = 1.0f;
            m_data.m_znear = -1.0f;
            m_data.m_zfar = 1.0f;

            m_push_depth = 0;

            m_prev_touch_state = false;
            m_touch_state = false;
            m_drag_mode = 0;
            m_drag_start_pos = GameEngine2D.Base.Math._00;
        }
        /// <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;
        }