コード例 #1
0
ファイル: Program.cs プロジェクト: WeirdBeardDev/arcengine
        /// <summary>
        /// Called when it is time to draw a frame.
        /// </summary>
        public override void Draw()
        {
            // Clears the background
            Display.ClearBuffers();

            // Aplly a rotation
            Matrix4 mvp = Matrix4.CreateRotationY(Yaw) * ModelViewMatrix * ProjectionMatrix;

            Display.Shader = Shader;

            // Uniforms
            Shader.SetUniform("modelview", mvp);
            Shader.SetUniform("DiffuseMaterial", new float[] { 0.0f, 0.75f, 0.75f });
            Shader.SetUniform("LightPosition", new float[] { 0.25f, 0.25f, -1.0f });
            Shader.SetUniform("AmbientMaterial", new float[] { 0.04f, 0.04f, 0.04f });
            Shader.SetUniform("SpecularMaterial", new float[] { 0.5f, 0.5f, 0.5f });
            Shader.SetUniform("Shininess", 50.0f);

            if (swap)
            {
                Torus.Draw();
            }
            else
            {
                Trefoil.Draw();
            }

            // Some dummy text
            Sprite.Begin();
            Sprite.DrawString(Font, new Vector2(50, 25), Color.White, "Here's an example of draw buffers.");
            Sprite.DrawString(Font, new Vector2(50, 50), Color.White, "Press space key to  swap mesh.");
            Sprite.End();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: WeirdBeardDev/arcengine
        /// <summary>
        /// Unload contents
        /// </summary>
        public override void UnloadContent()
        {
            if (Font != null)
            {
                Font.Dispose();
            }
            Font = null;

            if (Shader != null)
            {
                Shader.Dispose();
            }
            Shader = null;

            if (Sprite != null)
            {
                Sprite.Dispose();
            }
            Sprite = null;

            if (Trefoil != null)
            {
                Trefoil.Dispose();
            }
            Trefoil = null;

            if (Torus != null)
            {
                Torus.Dispose();
            }
            Torus = null;
        }