Пример #1
0
        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();
            }
        }
Пример #2
0
        public void RenderView(Matrix4 VP, Scene s)
        {
            blade.RenderBlade(VP, Pos.X, Pos.Y - (diamond < 0?-0.6f:blade.Type.Points[diamond] * blade.Type.MeshScale), height, Util.PI / 2, heat, GetEyePos());

            BasicShader shader = BasicShader.Instance;

            shader.Bind();
            Matrix4 modelspace = Matrix4.CreateTranslation(0, 1, 0) * Matrix4.CreateRotationX(-hammerMove) * Matrix4.CreateTranslation(0, 2.5f + hammerY * hammerMove / 4, 0) * Matrix4.CreateRotationX(0.9f - hammerMove) *
                                 Matrix4.CreateRotationZ(0.7f + hammerX * hammerMove / 4) * Matrix4.CreateTranslation(1.9f, -2.4f, height + 1) * Modelspace;

            shader.SetMVP(modelspace * VP);
            shader.SetModelspaceMatrix(modelspace);
            shader.ResetColor();
            hammer.Draw();

            OrthoRenderEngine.DrawExtendedColoredTexturedBox(TextureCollection.DialogBG, Util.White, 50, 50, 250, 250);
            OrthoRenderEngine.DrawColoredMesh(table.Mesh, projection, Util.White, 50, 50, 250, 250);
            OrthoRenderEngine.DrawColoredMesh(table.Coal, projection, Util.White, 50, 50, 250, 250);
        }