Beispiel #1
0
        void UpdateString()
        {
            if (!m_texture.Initialized)
            {
                return;
            }

            int width  = m_texture.Width;
            int height = m_texture.Height;

            Rectangle rect = new Rectangle(0, 0, width, height);

            Bitmap bitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
            graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
            graphics.Clip = new Region(rect);

            graphics.DrawString(m_text, m_font, m_brush, 0.0f, 0.0f);
            graphics.Flush();

            BitmapData data = bitmap.LockBits(rect,
                                              ImageLockMode.ReadOnly,
                                              System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            GraphicsCommand.UpdateTextureRGBA(m_texture, data.Scan0);

            bitmap.UnlockBits(data);

            m_updateString = false;

            bitmap.Dispose();
            graphics.Dispose();
        }
Beispiel #2
0
        public override void DrawShadow(Light a_light)
        {
            if (m_model != null)
            {
                lock (this)
                {
                    GraphicsCommand.BindModel(m_model);

                    GraphicsCommand.DrawElementsUInt(m_model.Indices);
                }
            }
        }
Beispiel #3
0
        public override void Draw(Camera a_camera)
        {
            if (m_model != null)
            {
                lock (this)
                {
                    GraphicsCommand.BindModel(m_model);

                    GraphicsCommand.DrawElementsUInt(m_model.Indices);
                }
            }
        }
Beispiel #4
0
        internal override Vector2 Draw(Vector2 a_resolution, Vector2 a_trueResolution)
        {
            CalculateTrueTransform();

            int widthDiff  = m_internalWidth - m_width;
            int heightDiff = m_internalHeight - m_height;

            TrueDrawingPosition = new Vector2(m_scrollPos.X * widthDiff, m_scrollPos.Y * heightDiff);
            TruePosition        = new Vector2(TruePosition.X - m_scrollPos.X * widthDiff, TruePosition.Y + m_scrollPos.Y * heightDiff);

            GraphicsCommand.SetViewport(GetActiveRect(a_resolution));

            return(TrueSize);
        }
Beispiel #5
0
        public override void DrawShadow(Light a_light)
        {
            if (m_model != null)
            {
                lock (this)
                {
                    if (m_matrices != null)
                    {
                        GraphicsCommand.BindMatrix4(Material.Program, 128, m_matrices);
                    }

                    GraphicsCommand.BindModel(m_model);

                    GraphicsCommand.DrawElementsUInt(m_model.Indices);
                }
            }
        }
Beispiel #6
0
        public override void Draw(Camera a_camera)
        {
            if (m_model != null)
            {
                lock (this)
                {
                    // Dirty but works
                    if (m_matrices != null)
                    {
                        GraphicsCommand.BindMatrix4(Material.Program, 128, m_matrices);
                    }

                    GraphicsCommand.BindModel(m_model);

                    GraphicsCommand.DrawElementsUInt(m_model.Indices);
                }
            }
        }
Beispiel #7
0
        internal override Vector2 Draw(Vector2 a_resolution, Vector2 a_trueResolution)
        {
            if (m_texture != null && m_texture.Initialized)
            {
                CalculateTrueTransform();
                Matrix4 transform = ToMatrix(a_resolution, a_trueResolution);

                Program program = Shaders.TRANSFORM_IMAGE_SHADER_INVERTED;

                GraphicsCommand.BindProgram(program);

                GraphicsCommand.BindMatrix4(program, 0, transform);
                GraphicsCommand.BindTexture(program, 1, m_texture, 0);

                GraphicsCommand.Draw();
            }

            return(a_resolution);
        }
        public override void DrawShadow(Light a_light)
        {
            switch (m_drawingMode)
            {
            case e_MaterialDrawingMode.Triangles:
            {
                GraphicsCommand.DrawTriangles(m_indices);

                break;
            }

            default:
            {
                GraphicsCommand.Draw(m_indices);

                break;
            }
            }
        }
        public override void Draw(Camera a_camera)
        {
            switch (m_drawingMode)
            {
            case e_MaterialDrawingMode.Triangles:
            {
                GraphicsCommand.DrawTriangles(m_indices);

                break;
            }

            default:
            {
                GraphicsCommand.Draw(m_indices);

                break;
            }
            }
        }
Beispiel #10
0
 internal override void PostDraw(Vector2 a_resolution, Vector2 a_trueResolution)
 {
     GraphicsCommand.SetViewport(new Rectangle(0, 0, (int)a_resolution.X, (int)a_resolution.Y));
 }