mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-19 14:03:20 +02:00
commit
9f681c0709
1 changed files with 7 additions and 11 deletions
|
@ -25,18 +25,14 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
|
|||
GLfloat* vertexData = new GLfloat[vertices * 3];
|
||||
GLfloat* vertex = vertexData;
|
||||
for (int i = 0; i < stacks - 1; i++) {
|
||||
float phi = PIf * 0.5f * i / (stacks - 1), z, radius;
|
||||
sincosf(phi, &z, &radius);
|
||||
float phi = PIf * 0.5f * i / (stacks - 1);
|
||||
float z = sinf(phi), radius = cosf(phi);
|
||||
|
||||
for (int j = 0; j < slices; j++) {
|
||||
float theta = PIf * 2.0f * j / slices;
|
||||
float x, y;
|
||||
sincosf(theta, &x, &y);
|
||||
x *= radius;
|
||||
y *= radius;
|
||||
|
||||
*(vertex++) = x;
|
||||
*(vertex++) = y;
|
||||
|
||||
*(vertex++) = sinf(theta) * radius;
|
||||
*(vertex++) = cosf(theta) * radius;
|
||||
*(vertex++) = z;
|
||||
}
|
||||
}
|
||||
|
@ -76,9 +72,9 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
|
|||
}
|
||||
|
||||
glGenBuffers(1, &vbo.second);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo.second);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo.second);
|
||||
const int BYTES_PER_INDEX = sizeof(GLushort);
|
||||
glBufferData(GL_ARRAY_BUFFER, indices * BYTES_PER_INDEX, indexData, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices * BYTES_PER_INDEX, indexData, GL_STATIC_DRAW);
|
||||
delete[] indexData;
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue