예제 #1
0
        static VisualComponent()
        {
            //create Quad mesh
            Vertex3D[] verts = new Vertex3D[]
            {
                new Vertex3D(new Vector2(0, 1), new Vector2(0, 0)),
                new Vertex3D(new Vector2(0, 0), new Vector2(0, 1)),
                new Vertex3D(new Vector2(1, 0), new Vector2(1, 1)),
                new Vertex3D(new Vector2(0, 1), new Vector2(0, 0)),
                new Vertex3D(new Vector2(1, 0), new Vector2(1, 1)),
                new Vertex3D(new Vector2(1, 1), new Vector2(1, 0)),
            };
            defaultMesh = new Mesh(verts, new int[] { 0, 1, 2, 3, 4, 5 });

            //load default material
            ShaderSettings   ss   = new ShaderSettings();
            RenderDirectives rd   = new RenderDirectives();
            string           path = "Toys.Resourses.shaders.";
            string           vs   = ShaderManager.ReadFromAssetStream(path + "UIElement.vsh");
            string           fs   = ShaderManager.ReadFromAssetStream(path + "UIElement.fsh");

            ss.TextureDiffuse    = true;
            defaultMaterial      = new MaterialCustom(ss, rd, vs, fs);
            defaultMaterial.Name = "Texture";

            defaultTexture = Texture2D.LoadEmpty();
        }
예제 #2
0
        private void CreateShader()
        {
            string path = "Toys.Resourses.shaders.";
            string vs   = ShaderManager.ReadFromAssetStream(path + "PM.vsh");
            string fs   = ShaderManager.ReadFromAssetStream(path + "PM.fsh");

            shaderProgram = ShaderConstructor.CreateShader(vs, fs);
            CreateShader(shaderProgram);
        }