コード例 #1
0
        public override void PostRender(Scene s, Matrix4 VP)
        {
            if (game.GameStats.CastFilling > 0 && game.GameStats.CurrentCast != null && game.GameStats.CastMetal > -1)
            {
                UpdateCastMatrix();
                Matrix4 fillModelspace = Matrix4.CreateScale(1, 1, game.GameStats.CastFilling * game.GameStats.CurrentCast.FillHeight) * fillMatrix * Modelspace;

                ISimpleShader shader;
                if (game.GameStats.CastingTemprature > 25)
                {
                    shader = LiquidShader.Instance;
                    shader.Bind();
                    LiquidShader.Instance.UseTexture();
                    LiquidShader.Instance.AutoPan();
                    LiquidShader.Instance.SetEmission(Util.DefaultEmission);
                }
                else
                {
                    shader = BasicShader.Instance;
                    shader.Bind();
                }

                shader.SetModelspaceMatrix(fillModelspace);
                shader.SetMVP(fillModelspace * VP);
                shader.SetColor(KnownMetal.GetColor(game.GameStats.CastMetal));
                fill.Draw();
            }

            if (game.TooltipHelper.GetOwner() == this)
            {
                game.TooltipHelper.RenderNormalDialog(Input.OrthoMouseX, Input.OrthoMouseY, Util.White60);
            }
        }
コード例 #2
0
ファイル: BladeItem.cs プロジェクト: haved/3DSmithGameCs
        public void RenderBlade(Matrix4 VP, float x, float y, float z, float zRot, float[] heat, Vector3 eyePos)
        {
            Matrix4     modelspace = Type.MeshScaleMatrix * Matrix4.CreateRotationZ(zRot) * Matrix4.CreateTranslation(x, y, z);
            BladeShader Instance   = BladeShader.Instance;

            Instance.Bind();
            Instance.SetModelspaceMatrix(modelspace);
            Instance.SetMVP(modelspace * VP);
            Instance.SetColor(KnownMetal.GetColor(Metal));
            UpdateHeatMap(heat);
            Instance.SetMaps(sharpnessMap, heatMap);
            Instance.SetEyePos(eyePos);
            Type.Mesh.Draw();

            BasicShader Instance0 = BasicShader.Instance;

            Instance0.Bind();
            for (int i = 0; i < Type.Points.Length; i++)
            {
                Matrix4 diamondModelspace = Matrix4.CreateTranslation(Type.Points [i], -0.15f + (float)Math.Sin(Time.CurrentTime() * 4 + Type.Points [i] * Util.PI) * 0.03f, 0) * modelspace;
                Instance0.SetModelspaceMatrix(diamondModelspace);
                Instance0.SetMVP(diamondModelspace * VP);
                Instance0.SetColor(Sharpness[i] < 0.95f?diamondColor * (1 - Sharpness[i]) + sharperDiamondColor * Sharpness[i]:sharpDiamondColor);
                MeshCollection.Diamond.Draw();
            }
        }
コード例 #3
0
ファイル: BladeItem.cs プロジェクト: haved/3DSmithGameCs
        public override void RenderItem(float x, float y, float width, float height)
        {
            BladeShader Instance = BladeShader.Instance;

            Instance.Bind();
            Instance.SetMVP(OrthoRenderEngine.GetMVPForMesh(Type.CenteredScaledMeshMatirx * ItemMatrix, x + 4, y + 4, width - 8, height - 8));
            Instance.SetModelspaceMatrix(OrthoRenderEngine.DefaultModelspace);
            Instance.SetColor(KnownMetal.GetColor(Metal));
            Instance.SetMaps(sharpnessMap);
            Type.Mesh.Draw();
        }
コード例 #4
0
        public override void PostRender(Scene s, Matrix4 VP)
        {
            if (game.GameStats.FoundryAlloy.Amount >= 0.01f)
            {
                Matrix4       m = Matrix4.CreateScale(1, 1, game.GameStats.FoundryAlloy.Amount) * liquidTransform * Modelspace;
                ISimpleShader shader;
                if (game.GameStats.FoundryTemprature > game.GameStats.FoundryAlloy.GetMeltingPoint())
                {
                    shader = LiquidShader.Instance;
                    shader.Bind();
                    LiquidShader.Instance.UseTexture();
                    LiquidShader.Instance.AutoPan();
                    LiquidShader.Instance.SetEmission(Util.DefaultEmission);
                }
                else
                {
                    shader = BasicShader.Instance;
                    shader.Bind();
                }

                shader.SetModelspaceMatrix(m);
                shader.SetMVP(m * VP);
                shader.SetColor(game.GameStats.FoundryAlloy.GetColor());
                molten.Draw();
            }

            if (game.GameStats.CastFilling > 0 & game.GameStats.CastFilling <1 & game.GameStats.CastMetal> -1)
            {
                LiquidShader shader = LiquidShader.Instance;
                shader.Bind();
                shader.SetModelspaceMatrix(Modelspace);
                shader.SetMVP(Modelspace * VP);
                shader.SetColor(KnownMetal.GetColor(game.GameStats.CastMetal));
                shader.UseTexture();
                shader.AutoPan();
                shader.SetEmission(Util.DefaultEmission);
                fall.Draw();
            }

            if (game.TooltipHelper.GetOwner() == this)
            {
                game.TooltipHelper.RenderNormalDialog(Input.OrthoMouseX, Input.OrthoMouseY, Util.White60);
            }
        }
コード例 #5
0
ファイル: BladeItem.cs プロジェクト: haved/3DSmithGameCs
 public Vector4 GetTooltipColor()
 {
     return(KnownMetal.GetColor(Metal));
 }