Struct of Array

In der Spieleentwicklung wird häufige ein Struct Of Array benötigt statt eines Arrays von Strukturen.

Statt

struct Color { int r, int g, int b };
struct Color Data[10];

also

struct ColorArray10
{
  int r[10];
  int g[10];
  int b[10];
}
vertex contains
{
  Position, Color, Normal
}

myArray is vertex{10};      // legt EIN Array an: myArray{0}.Position
myArray splits vertex{10};  // legt drei Arraays an: myArray.Position{0}