コード例 #1
0
        public void Bind()
        {
            GLProg.Bind();
            GL.BindVertexArray(ID);

            if (Tex != null)
            {
                if (GLProg.SetUniform("TEX", Tex))
                {
                    Tex.Bind();
                }
            }
            if (Tex2 != null)
            {
                if (GLProg.SetUniform("TEX2", Tex2))
                {
                    Tex2.Bind();
                }
            }

            GLProg.SetUniform("u_modelview", ref ModelMatrix);
            GLProg.SetUniform("u_projection", ref Camera.Projection);
            GLProg.SetUniform("u_view", ref Camera.View);
            GLProg.SetUniform("u_viewrot", ref Camera.Rotation);
            GLProg.SetUniform("Time", (float)Program.SWatch.ElapsedMilliseconds / 1000);
            GLProg.SetUniform("Resolution", Camera.ScreenRes);
            GLProg.SetUniform("Settings", new Vector4(Settings.FXAA ? 1 : 0, Settings.Wireframe ? 1 : 0, 0, 0));

            Indices.Bind();
            Verts.Bind();
            Colors.BindOnAttrib(GLProg.Attrib("Color"));
            UVs.BindOnAttrib(GLProg.Attrib("UV"));
            BlockData.BindOnAttrib(GLProg.Attrib("Data"));
        }
コード例 #2
0
    } // end TellMouseFinishPos

    // change fur color to next fur color on mouse down
    public void OnMouseDown()
    {
        // cycle selected color
        if (selectedColor < NUM_OF_FURS)
        {
            selectedColor++;
        }
        else
        {
            selectedColor = 0;
        }

        // set the main texture to the selected color
        switch (selectedColor)
        {
        case 0:
            Tex1.GetComponent <Renderer>().material.mainTexture = mouse1;
            Tex2.GetComponent <Renderer>().material.mainTexture = mouse1;
            break;

        case 1:
            Tex1.GetComponent <Renderer>().material.mainTexture = mouse2;
            Tex2.GetComponent <Renderer>().material.mainTexture = mouse2;
            break;

        case 2:
            Tex1.GetComponent <Renderer>().material.mainTexture = mouse3;
            Tex2.GetComponent <Renderer>().material.mainTexture = mouse3;
            break;

        case 3:
            Tex1.GetComponent <Renderer>().material.mainTexture = mouse4;
            Tex2.GetComponent <Renderer>().material.mainTexture = mouse4;
            break;

        default:
            Tex1.GetComponent <Renderer>().material.mainTexture = mouse1;
            Tex2.GetComponent <Renderer>().material.mainTexture = mouse1;
            break;
        }
    } // end OnMouseDown