Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 /// 描画(事前にモデルにアニメーションをセット)
 public bool RenderNoAnim(DemoGame.GraphicsDevice graphDev, Matrix4 matrix)
 {
     useModel.WorldMatrix = matrix;
     useModel.Update();
     useModel.Draw(graphDev.Graphics, useShaderCnr, graphDev.GetCurrentCamera().ViewProjection, eyeVec, 1.0f);
     return(true);
 }
Exemplo n.º 3
0
        /// 通常描画(描画時にモデルにアニメーションをセット)
        public bool Render(DemoGame.GraphicsDevice graphDev, Matrix4 matrix, float Brightness)
        {
            useModel.WorldMatrix = matrix;

            if (animPlayId >= 0)
            {
                useModel.SetAnimFrame(animPlayId, animPlayTime);
            }

            useModel.Update();
            useModel.Draw(graphDev.Graphics, useShaderCnr, graphDev.GetCurrentCamera().ViewProjection, eyeVec, Brightness);
            return(true);
        }
Exemplo n.º 4
0
        /// コンストラクタ
        public Application()
        {
            SetUpperLimitFps( 60 );

            graphicsDevice		= new GraphicsDevice();
        }
Exemplo n.º 5
0
        /// 破棄
        private void term()
        {
            DoTerm();

            /// インプット系クラス破棄
            inputTouch.Term();
            inputGPad.Term();

            inputGPad	= null;
            inputTouch	= null;

            stopwatch.Stop();

            graphicsDevice.Term();
            graphicsDevice = null;
        }