本文整理汇总了C#中VectorLine.SetupVertexColors方法的典型用法代码示例。如果您正苦于以下问题:C# VectorLine.SetupVertexColors方法的具体用法?C# VectorLine.SetupVertexColors怎么用?C# VectorLine.SetupVertexColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorLine
的用法示例。
在下文中一共展示了VectorLine.SetupVertexColors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetColor
public static void SetColor(VectorLine line, Color color)
{
if (line.lineColors == null) {
line.SetupVertexColors();
}
int end = line.lineColors.Length;
for (int i = 0; i < end; i++) {
line.lineColors[i] = color;
}
line.mesh.colors = line.lineColors;
}
示例2: SetColors
public static void SetColors(VectorLine line, Color[] lineColors)
{
if (line.lineColors == null) {
line.SetupVertexColors();
}
if (!line.isPoints) {
if (WrongArrayLength (line, lineColors.Length, FunctionName.SetColors)) {
return;
}
}
else if (lineColors.Length != GetPointsLength(line)) {
LogError("Vector: SetColors: Length of lineColors array in " + line.vectorObject.name + " must be same length as points array");
return;
}
int start = 0;
int end = lineColors.Length;
SetStartAndEnd (line, ref start, ref end);
int idx = start*4;
for (int i = start; i < end; i++) {
line.lineColors[idx] = lineColors[i];
line.lineColors[idx+1] = lineColors[i];
line.lineColors[idx+2] = lineColors[i];
line.lineColors[idx+3] = lineColors[i];
idx += 4;
}
line.mesh.colors = line.lineColors;
}
示例3: SetColorsSmooth
public static void SetColorsSmooth(VectorLine line, Color[] lineColors)
{
if (line.isPoints) {
LogError ("Vector: SetColorsSmooth must be used with a line rather than points");
return;
}
if (line.lineColors == null) {
line.SetupVertexColors();
}
if (WrongArrayLength (line, lineColors.Length, FunctionName.SetColorsSmooth)) {
return;
}
int start = 0;
int end = lineColors.Length;
SetStartAndEnd (line, ref start, ref end);
int idx = start*4;
line.lineColors[idx ] = lineColors[start];
line.lineColors[idx+1] = lineColors[start];
line.lineColors[idx+2] = lineColors[start];
line.lineColors[idx+3] = lineColors[start];
idx += 4;
for (int i = start+1; i < end; i++) {
line.lineColors[idx ] = lineColors[i-1];
line.lineColors[idx+1] = lineColors[i-1];
line.lineColors[idx+2] = lineColors[i];
line.lineColors[idx+3] = lineColors[i];
idx += 4;
}
line.mesh.colors = line.lineColors;
}