struct{
Vector3* centers;
float* radii;
float* colors;
unsigned int size;
}Spheres;
対
struct Sphere{
Vector3 center;
float radius;
float color;
};
struct{
struct Sphere* spheres;
unsigned int size;
}Spheres;
使用例
void spheres_process(){
int i;
for(i = 0; i < Spheres.size; ++i){
// do something with this sphere
}
}
2番目のケースは、すべてのデータがインターリーブされており、同時にキャッシュにロードする必要があるため、空間的な局所性が優れていると思います。どちらの場合も、すべての球を同時に処理します。何か入力はありますか?