예제 #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (DemoGame game = new DemoGame())
     {
         game.Run();
     }
 }
예제 #2
0
        /// 描画処理
        public override bool DoDraw2( DemoGame.GraphicsDevice graphDev ,Vector3 BasePos )
        {
            if(!sprite.Visible){
            return false;
            }
            //			sprite.SetDrawRect(0,0,10,10);
            var currentMatrix = CalcSpriteMatrix(graphDev.GetCurrentCamera().Pos ,BasePos);
            var modelMatrix = sprite.CreateModelMatrix(0,0);
            var worldViewProj = graphDev.GetCurrentCamera().Projection * graphDev.GetCurrentCamera().View * currentMatrix * modelMatrix;

            textureShaderProgram.SetUniformValue(0, ref worldViewProj);

            float alphaRate = 1.0f;
            int alphaRateId = textureShaderProgram.FindUniform("AlphaRate");
            if (alphaRateId >= 0) {
            textureShaderProgram.SetUniformValue(alphaRateId, alphaRate);
            }

            graphDev.Graphics.SetShaderProgram(textureShaderProgram);
            graphDev.Graphics.SetVertexBuffer(0, sprite.Vertices);
            graphDev.Graphics.SetTexture(0, sprite.Texture);

            graphDev.Graphics.Enable(EnableMode.Blend);
            graphDev.Graphics.Disable(EnableMode.DepthTest);
            graphDev.Graphics.Disable(EnableMode.CullFace);
            graphDev.Graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);

            graphDev.Graphics.DrawArrays(DrawMode.TriangleFan, 0, 4);
            return true;
        }
예제 #3
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (DemoGame demo = new DemoGame())
     {
         demo.Run();
     }
 }