Exemplo n.º 1
0
//	void OnRenderObject()
//	{
//		//meshRenderer.sharedMaterial.color = backgroundColor;
//		lineMaterial.SetPass(0);
//
//		GL.PushMatrix();
//		GL.MultMatrix(transform.localToWorldMatrix);
//		GL.Begin(GL.LINES);
//
//		for (int i = 0; i < lines.Length / 3; i++)
//		{
//			GL.Color(lineColor);
//			GL.Vertex(lines[i * 3]);
//			GL.Vertex(lines[i * 3 + 1]);
//
//			GL.Color(lineColor * 2);
//			GL.Vertex(lines[i * 3 + 1]);
//			GL.Vertex(lines[i * 3 + 2]);
//
//			GL.Color(backgroundColor);
//			GL.Vertex(lines[i * 3 + 2]);
//			GL.Vertex(lines[i * 3]);
//		}
//
//		GL.End();
//		GL.PopMatrix();
//	}

    void OnRenderObject()
    {
        lineMaterial.SetPass(0);

        GLHelper.BeginRendering(transform.localToWorldMatrix);

        GL.Begin(GL.LINES);
        for (int i = 0; i < lines.Length / 3; i++)
        {
            GLHelper.DrawLine(lines[i * 3], lines[i * 3 + 1], lineColor);
            GLHelper.DrawLine(lines[i * 3 + 1], lines[i * 3 + 2], lineColor);
            GLHelper.DrawLine(lines[i * 3 + 2], lines[i * 3], backgroundColor);
        }
        GL.End();
//
        GL.Begin(GL.QUADS);
//		foreach (Vector3 p in randomPoints) {
//			GLHelper.DrawCube (p, 0.1f, Color.green);
//		}
        GLHelper.DrawCuboid(transform.position, transform.localScale, Color.green);
        GL.End();
        GLHelper.EndRendering();
    }