Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int arr = 36*3;
- // Set the number of vertices in the vertex array.
- m_vertexCount = arr;
- // Set the number of indices in the index array.
- m_indexCount = arr;
- // Create the vertex array.
- vertices = new VertexType[m_vertexCount];
- if (!vertices)
- {
- return false;
- }
- // Create the index array.
- indices = new unsigned long[m_indexCount];
- float r = 2.0f;
- float angle = 0;
- if (!indices)
- {
- return false;
- }
- float step = D3DX_PI * 2.0f / 36;
- float S;
- float C;
- int cont = 0;
- S = sinf(angle *D3DX_PI / 180);
- C = cosf(angle * D3DX_PI / 180);
- for (float i = 0; i <D3DX_PI *2.0f; i+= step) {
- float x1 = r * cosf(i) + (-1.0f);
- float y1 = r * sinf(i);
- float x2 = r * cosf(i+step) + (-1.0f);
- float y2 = r * sinf(i+ step);
- vertices[cont].position = D3DXVECTOR3(x1,y1, -1.0f); // Bottom left.
- vertices[cont].texture = D3DXVECTOR4(0.0f, 1.0f, 1.0f, 1.0f);
- vertices[cont + 1].position = D3DXVECTOR3(x2,y2, -1.0f); // Bottom left.
- vertices[cont + 1].texture = D3DXVECTOR4(0.0f, 1.0f, 1.0f, 1.0f);
- cont += 2;
- }
- for (int i = 0; i < arr; i++)
- indices[i] = i;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement