本文整理汇总了C#中ExposedList.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# ExposedList.ToArray方法的具体用法?C# ExposedList.ToArray怎么用?C# ExposedList.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExposedList
的用法示例。
在下文中一共展示了ExposedList.ToArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadVertices
private void ReadVertices (Dictionary<String, Object> map, VertexAttachment attachment, int verticesLength) {
attachment.WorldVerticesLength = verticesLength;
float[] vertices = GetFloatArray(map, "vertices", 1);
float scale = Scale;
if (verticesLength == vertices.Length) {
if (scale != 1) {
for (int i = 0; i < vertices.Length; i++) {
vertices[i] *= scale;
}
}
attachment.vertices = vertices;
return;
}
ExposedList<float> weights = new ExposedList<float>(verticesLength * 3 * 3);
ExposedList<int> bones = new ExposedList<int>(verticesLength * 3);
for (int i = 0, n = vertices.Length; i < n;) {
int boneCount = (int)vertices[i++];
bones.Add(boneCount);
for (int nn = i + boneCount * 4; i < nn; i += 4) {
bones.Add((int)vertices[i]);
weights.Add(vertices[i + 1] * this.Scale);
weights.Add(vertices[i + 2] * this.Scale);
weights.Add(vertices[i + 3]);
}
}
attachment.bones = bones.ToArray();
attachment.vertices = weights.ToArray();
}
示例2: ReadVertices
private Vertices ReadVertices (Stream input, int vertexCount) {
float scale = Scale;
int verticesLength = vertexCount << 1;
Vertices vertices = new Vertices();
if(!ReadBoolean(input)) {
vertices.vertices = ReadFloatArray(input, verticesLength, scale);
return vertices;
}
var weights = new ExposedList<float>(verticesLength * 3 * 3);
var bonesArray = new ExposedList<int>(verticesLength * 3);
for (int i = 0; i < vertexCount; i++) {
int boneCount = ReadVarint(input, true);
bonesArray.Add(boneCount);
for (int ii = 0; ii < boneCount; ii++) {
bonesArray.Add(ReadVarint(input, true));
weights.Add(ReadFloat(input) * scale);
weights.Add(ReadFloat(input) * scale);
weights.Add(ReadFloat(input));
}
}
vertices.vertices = weights.ToArray();
vertices.bones = bonesArray.ToArray();
return vertices;
}