|
@@ -358,7 +358,7 @@ namespace bbiwarg.DataSource
|
|
|
|
|
|
public VertexArray getVertexArray()
|
|
|
{
|
|
|
- Vertex[] vertices = new Vertex[width * height];
|
|
|
+ float[] vertexData = new float[3 * width * height];
|
|
|
Color[] colors = new Color[width * height];
|
|
|
|
|
|
int index = 0;
|
|
@@ -367,19 +367,17 @@ namespace bbiwarg.DataSource
|
|
|
for (int y = 0; y < height; y++)
|
|
|
{
|
|
|
int depth = currentImage.getDepth(x, y);
|
|
|
- vertices[index] = create3DVertexFrom2D(x, y, depth);
|
|
|
+ create3DVertexFrom2D(x, y, depth, vertexData, 3 * index);
|
|
|
colors[index] = currentImage.getColor(x, y);
|
|
|
|
|
|
index++;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
- return new VertexArray(vertices, colors);
|
|
|
+
|
|
|
+ return new VertexArray(vertexData, colors);
|
|
|
}
|
|
|
|
|
|
- private Vertex create3DVertexFrom2D(float pixelX, float pixelY, int depth)
|
|
|
+ private void create3DVertexFrom2D(float pixelX, float pixelY, int depth, float[] vertexData, int index)
|
|
|
{
|
|
|
float convertedDepth = depth / 1000f; // mm into m
|
|
|
|
|
@@ -393,7 +391,9 @@ namespace bbiwarg.DataSource
|
|
|
float x = relX * z;
|
|
|
float y = relY * z;
|
|
|
|
|
|
- return new Vertex(x, y, z);
|
|
|
+ vertexData[index + 0] = x;
|
|
|
+ vertexData[index + 1] = y;
|
|
|
+ vertexData[index + 2] = z;
|
|
|
}
|
|
|
}
|
|
|
}
|