/// 描画処理 public override bool DoDraw2( DemoGame.GraphicsDevice graphDev ,Vector3 BasePos ) { // useMdlHdl.Render( graphDev, baseMtx * Matrix4.Scale(new Vector3(0.15f, 0.15f, 0.15f)) ); // Matrix4 mtx = GetBoneMatrix( 2 ); // Common.VectorUtil.Set( ref BodyPos, mtx.M41, mtx.M42, mtx.M43 ); // boundingShape.SetMult( mtx ); var currentMatrix = CalcSpriteMatrix(graphDev.GetCurrentCamera().Pos ,BasePos); var worldViewProj = graphDev.GetCurrentCamera().Projection * graphDev.GetCurrentCamera().View * currentMatrix; spriteShader.SetUniformValue(0, ref worldViewProj); graphDev.Graphics.SetShaderProgram(spriteShader); graphDev.Graphics.SetVertexBuffer(0, vertices); graphDev.Graphics.SetTexture(0, StaticDataList.textureUnified); // graphDev.Graphics.Enable(EnableMode.Blend); // graphDev.Graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha); graphDev.Graphics.Disable(EnableMode.DepthTest); graphDev.Graphics.Enable(EnableMode.CullFace); graphDev.Graphics.SetCullFace(CullFaceMode.Back, CullFaceDirection.Ccw); graphDev.Graphics.DrawArrays(DrawMode.TriangleFan, 0, 4); return true; }
/// 描画 public override bool Draw( DemoGame.GraphicsDevice graphDev ) { if( objMark.TypeId == 0 ){ SetBillboardMatrix( graphDev.GetCurrentCamera() ); } else{ SetBillboardMatrixY( graphDev.GetCurrentCamera() ); } objMark.Draw( graphDev ); return true; }
/// 描画処理 public override bool DoDraw( DemoGame.GraphicsDevice graphDev ) { if( billFlg == true ){ SetBillboardMatrix( graphDev.GetCurrentCamera() ); } else if( billYFlg == true ){ SetBillboardMatrixY( graphDev.GetCurrentCamera() ); } objEff.Draw( graphDev ); return true; }
/// 描画処理 public override bool DoDraw2( DemoGame.GraphicsDevice graphDev ,Vector3 BasePos ) { CalcSpriteMatrix(graphDev.GetCurrentCamera().Pos ,BasePos); ctrlResMgr.SetSpriteData(BasePos,rotation,uvPos,uvSize,texSize); return true; }
/// 描画処理 public override bool DoDraw2( DemoGame.GraphicsDevice graphDev ,Vector3 BasePos ) { var currentMatrix = CalcSpriteMatrix(graphDev.GetCurrentCamera().Pos ,BasePos); var worldViewProj = graphDev.GetCurrentCamera().Projection * graphDev.GetCurrentCamera().View * currentMatrix; spriteShader.SetUniformValue(0, ref worldViewProj); graphDev.Graphics.SetShaderProgram(spriteShader); graphDev.Graphics.SetVertexBuffer(0, vertices); graphDev.Graphics.SetTexture(0, StaticDataList.textureUnified); graphDev.Graphics.Enable(EnableMode.CullFace); graphDev.Graphics.SetCullFace(CullFaceMode.None, CullFaceDirection.Ccw); graphDev.Graphics.Disable(EnableMode.DepthTest); graphDev.Graphics.DrawArrays(DrawMode.TriangleFan, 0, 4); return true; }
/// デバック用 ///--------------------------------------------------------------------------- /// デバック用:描画 public void Draw( DemoGame.GraphicsDevice graphDev, Rgba color ) { DemoGame.RenderGeometry drawTri = new DemoGame.RenderGeometry(); drawTri.MakeTriangle(); DemoGame.Camera camera = graphDev.GetCurrentCamera(); for( int i=0; i<EntryNum; i++ ){ drawTri.DrawTriangle( graphDev.Graphics, Triangle[i], camera, color ); } drawTri = null; }
/// 描画処理 public override bool DoDraw2( DemoGame.GraphicsDevice graphDev ,Vector3 BasePos ) { var currentMatrix = CalcSpriteMatrix(graphDev.GetCurrentCamera().Pos ,BasePos); var worldViewProj = graphDev.GetCurrentCamera().Projection * graphDev.GetCurrentCamera().View * currentMatrix; spriteShader.SetUniformValue(0, ref worldViewProj); graphDev.Graphics.SetShaderProgram(spriteShader); graphDev.Graphics.SetVertexBuffer(0, vertices); graphDev.Graphics.SetTexture(0, StaticDataList.textureUnified); graphDev.Graphics.Enable(EnableMode.CullFace); graphDev.Graphics.SetCullFace(CullFaceMode.Front, CullFaceDirection.Ccw); graphDev.Graphics.Disable(EnableMode.DepthTest); graphDev.Graphics.DrawArrays(DrawMode.TriangleFan, 0, 4); if(TexIdForText < 3){ if(appearCount == (int)Data.SetupValue.AppearAndLeaveTime && deadflag2 == false){ ObjTex.changeText(); } ObjTex.Draw2(graphDev, BasePos); } return true; }
/// private メソッド ///--------------------------------------------------------------------------- /// デバック用 ///--------------------------------------------------------------------------- /// デバック用:描画 public void Draw( DemoGame.GraphicsDevice graphDev, int hitIdx, Rgba color1, Rgba color2 ) { DemoGame.RenderGeometry drawSph = new DemoGame.RenderGeometry(); drawSph.MakeCapsule(); DemoGame.Camera camera = graphDev.GetCurrentCamera(); if( hitIdx < 0 ){ drawSph.DrawCapsule( graphDev.Graphics, this.Capsule, camera, color1 ); } else{ drawSph.DrawCapsule( graphDev.Graphics, this.Capsule, camera, color2 ); } drawSph = null; }
/// 描画(事前にモデルにアニメーションをセット) 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; }
/// 通常描画(描画時にモデルにアニメーションをセット) 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; }
internal void DrawSprites(DemoGame.GraphicsDevice graphDev) { FrameBuffer fbuffer = graphicsContext.GetFrameBuffer() ; // Matrix4 projection = Matrix4.Ortho( 0, fbuffer.Width, fbuffer.Height, 0, -100.0f, 100.0f ) ; float aspect = graphicsContext.Screen.AspectRatio; float fov = FMath.Radians(45.0f); Matrix4 projection = graphDev.GetCurrentCamera().ViewProjection; // graphicsContext.Enable( EnableMode.Blend ) ; graphDev.Graphics.Enable(EnableMode.CullFace); graphDev.Graphics.SetCullFace(CullFaceMode.None, CullFaceDirection.Ccw); graphDev.Graphics.Disable(EnableMode.DepthTest); graphicsContext.SetVertexBuffer( 0, vertexBuffer ) ; for ( var sprite = drawList ; sprite != null ; sprite = sprite.drawNext ) { var material = sprite.Material ; graphicsContext.SetShaderProgram( material.ShaderProgram ) ; material.ShaderProgram.SetUniformValue( 0, ref projection ) ; graphicsContext.SetBlendFunc( material.BlendFunc ) ; graphicsContext.SetTexture( 0, material.Texture ) ; int next = ( sprite.drawNext == null ) ? indexCount : sprite.drawNext.indexID ; graphicsContext.DrawArrays( DrawMode.Triangles, sprite.indexID, next - sprite.indexID ) ; } }