49        std::vector<float> vertices;
 
   50        std::vector<float> normals;
 
   51        std::vector<float> texCoords;
 
   52        std::vector<int>   indices;
 
   55        float nx, ny, nz, lengthInv = 1.0f / radius;    
 
   58        const float PI = 3.14159265f;
 
   59        float sectorStep = 2 * PI / sectorCount;
 
   60        float stackStep = PI / stackCount;
 
   61        float sectorAngle, stackAngle;
 
   63        for (
int i = 0; i <= stackCount; ++i)
 
   65            stackAngle = PI / 2 - i * stackStep;        
 
   66            xy = radius * cosf(stackAngle);             
 
   67            z = radius * sinf(stackAngle);              
 
   71            for (
int j = 0; j <= sectorCount; ++j)
 
   73                sectorAngle = j * sectorStep;           
 
   76                x = xy * cosf(sectorAngle);             
 
   77                y = xy * sinf(sectorAngle);             
 
   78                vertices.push_back(x);
 
   79                vertices.push_back(y);
 
   80                vertices.push_back(z);
 
   86                normals.push_back(nx);
 
   87                normals.push_back(ny);
 
   88                normals.push_back(nz);
 
   91                s = (float)j / sectorCount;
 
   92                t = (float)i / stackCount;
 
   93                texCoords.push_back(s);
 
   94                texCoords.push_back(t);
 
  100        for (
int i = 0; i < stackCount; ++i)
 
  102            k1 = i * (sectorCount + 1);     
 
  103            k2 = k1 + sectorCount + 1;      
 
  105            for (
int j = 0; j < sectorCount; ++j, ++k1, ++k2)
 
  111                    indices.push_back(k1);
 
  112                    indices.push_back(k2);
 
  113                    indices.push_back(k1 + 1);
 
  117                if (i != (stackCount - 1))
 
  119                    indices.push_back(k1 + 1);
 
  120                    indices.push_back(k2);
 
  121                    indices.push_back(k2 + 1);
 
  128        mesh->
vbo.
load(vertices.data(), vertices.size() * 
sizeof(
float));
 
  129        mesh->
ibo.
load(indices.data(), indices.size() * 
sizeof(
unsigned int));
 
  130        mesh->
count = indices.size();
 
 
  158        std::vector<float> vertices = {
 
  159            -scale, -0.0001f, -scale,
 
  160            -scale, -0.0001f,  scale,
 
  161             scale, -0.0001f, -scale,
 
  162             scale, -0.0001f,  scale,
 
  165        std::vector<unsigned int> indices = {
 
  172        mesh->
vbo.
load(vertices.data(), vertices.size() * 
sizeof(
float));
 
  173        mesh->
ibo.
load(indices.data(), indices.size() * 
sizeof(
unsigned int));
 
  174        mesh->
count = indices.size();