Skip to content

Instantly share code, notes, and snippets.

@majorpakhom
Last active August 29, 2015 14:05
Show Gist options
  • Save majorpakhom/a448bf14754a81bcc856 to your computer and use it in GitHub Desktop.
Save majorpakhom/a448bf14754a81bcc856 to your computer and use it in GitHub Desktop.
size_t i;
for(i = 0; i < facesCount; ++i) {
memcpy(&verticiesPrepared[i*9 + 0], &verticies[(faces[i*9 + 0] - 1)*3 + 0], 3*sizeof(double));
memcpy(&verticiesPrepared[i*9 + 3], &verticies[(faces[i*9 + 3] - 1)*3 + 0], 3*sizeof(double));
memcpy(&verticiesPrepared[i*9 + 6], &verticies[(faces[i*9 + 6] - 1)*3 + 0], 3*sizeof(double));
memcpy(&textureCoordinatesPrepared[i*6 + 0], &textureCoordinates[(faces[i*9 + 1] - 1)*2 + 0], 2*sizeof(double));
memcpy(&textureCoordinatesPrepared[i*6 + 2], &textureCoordinates[(faces[i*9 + 4] - 1)*2 + 0], 2*sizeof(double));
memcpy(&textureCoordinatesPrepared[i*6 + 4], &textureCoordinates[(faces[i*9 + 7] - 1)*2 + 0], 2*sizeof(double));
memcpy(&normalsPrepared[i*9 + 0], &normals[(faces[i*9 + 2] - 1)*3 + 0], 3*sizeof(double));
memcpy(&normalsPrepared[i*9 + 3], &normals[(faces[i*9 + 5] - 1)*3 + 0], 3*sizeof(double));
memcpy(&normalsPrepared[i*9 + 6], &normals[(faces[i*9 + 8] - 1)*3 + 0], 3*sizeof(double));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment