- Home /
Question by
B3ukenn00tje · Oct 10, 2017 at 12:22 PM ·
coroutinefor-loopstartupmesh-deformationspeed issues
speeding up reading in a large file
in this project i'm reading in a series of nodes over a couple of frames. this is due to simulate deformations in a mesh. the simulation is around 150 frames long. and consist of almost 67.000 nodes. which isn't that much for a mesh. but the thing is I load everything at the start so I don't have to read anything again during runtime. between pressing play and actually being able to play is almost a minute. I was thinking of speeding it up with coroutines but I can't really figure out how.
the codes is seen below.
line = lines.ReadLine ();
temp = line.Split (new char[] { ',' });
int Nnodes = int.Parse (temp [1]);
deformationData = new Vector3[Nnodes, Nframes]; //initialize the matrix containing the final data
for (int i = 0; i < Nnodes; i++) {
for (int t = 0; t < Nframes; t++)
{
line = lines.ReadLine();
temp = line.Split(new char[] { ',' });
deformationData[i, t] = new Vector3(float.Parse(temp[0]), float.Parse(temp[1]), float.Parse(temp[2]));
}
}
Comment