public static void AddQuad( VertexHelper vertexHelper, Rect bounds, Vector2 posMin, Vector2 posMax, ColorMode mode, Color colorA, Color colorB, Vector2 uvMin, Vector2 uvMax, VertexMaterialData materialProperties) { int cnt = vertexHelper.currentVertCount; Color32[] colors = new Color32[4]; colors[0] = GetColor(mode, colorA, colorB, bounds, posMin.x, posMin.y); colors[1] = GetColor(mode, colorA, colorB, bounds, posMin.x, posMax.y); colors[2] = GetColor(mode, colorA, colorB, bounds, posMax.x, posMax.y); colors[3] = GetColor(mode, colorA, colorB, bounds, posMax.x, posMin.y); float uvX = 0, uvY = 0, tangentW = 0; materialProperties.Apply(ref uvX, ref uvY, ref tangentW); Vector2 uv1 = new Vector2(uvX, uvY); Vector3 normal = Vector3.back; Vector4 tangent = new Vector4(1, 0, 0, tangentW); vertexHelper.AddVert(new Vector3(posMin.x, posMin.y, 0f), colors[0], new Vector2(uvMin.x, uvMin.y), uv1, normal, tangent); vertexHelper.AddVert(new Vector3(posMin.x, posMax.y, 0f), colors[1], new Vector2(uvMin.x, uvMax.y), uv1, normal, tangent); vertexHelper.AddVert(new Vector3(posMax.x, posMax.y, 0f), colors[2], new Vector2(uvMax.x, uvMax.y), uv1, normal, tangent); vertexHelper.AddVert(new Vector3(posMax.x, posMin.y, 0f), colors[3], new Vector2(uvMax.x, uvMin.y), uv1, normal, tangent); vertexHelper.AddTriangle(cnt, cnt + 1, cnt + 2); vertexHelper.AddTriangle(cnt + 2, cnt + 3, cnt); }
//public Vector2Property[] Vector2Properties; //public Vector3Property[] Vector3Properties; //public Vector4Property[] Vector4Properties; //public ColorProperty[] ColorProperties; public void Apply(ref float uvX, ref float uvY, ref float tangentW) { VertexMaterialData.Apply(FloatProperties, ref uvX, ref uvY, ref tangentW); //VertexMaterialData.Apply(Vector2Properties, ref texCoord, ref normal, ref tangent); //VertexMaterialData.Apply(Vector3Properties, ref texCoord, ref normal, ref tangent); //VertexMaterialData.Apply(Vector4Properties, ref texCoord, ref normal, ref tangent); //VertexMaterialData.Apply(ColorProperties, ref uvX, ref uvY, ref tangentW); }