void Indicator::CreateMesh(const Vector<IndicatorShape> &Shapes, BaseMesh &MOut) const { Vector<BaseMesh*> AllMeshes(Shapes.Length()); for(UINT ShapeIndex = 0; ShapeIndex < Shapes.Length(); ShapeIndex++) { const IndicatorShape &CurShape = Shapes[ShapeIndex]; Mesh *NewMesh = NULL; switch(CurShape.Type) { case IndicatorShapeSphere: { NewMesh = new Mesh(_Sphere); } break; case IndicatorShapeCylinder: { NewMesh = new Mesh(_Cylinder); } break; default: SignalError("Invalid shape type"); return; } NewMesh->ApplyMatrix(CurShape.TransformMatrix()); NewMesh->SetColor(CurShape.Color); AllMeshes[ShapeIndex] = NewMesh; } MOut.SetGD(_Sphere.GetGD()); MOut.LoadMeshList(AllMeshes); for(UINT ShapeIndex = 0; ShapeIndex < Shapes.Length(); ShapeIndex++) { delete AllMeshes[ShapeIndex]; } }