mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 12:33:27 +02:00
add wire cube implementation to GeometryCache and DeferredLightingEffect
This commit is contained in:
parent
1617d79f2e
commit
ef42203481
3 changed files with 8 additions and 4 deletions
|
@ -68,7 +68,7 @@ void DeferredLightingEffect::renderSolidSphere(float radius, int slices, int sta
|
|||
|
||||
void DeferredLightingEffect::renderWireSphere(float radius, int slices, int stacks) {
|
||||
bindSimpleProgram();
|
||||
glutWireSphere(radius, slices, stacks);
|
||||
DependencyManager::get<GeometryCache>()->renderSphere(radius, slices, stacks, false);
|
||||
releaseSimpleProgram();
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ const int NUM_COORDS_PER_VERTEX = 3;
|
|||
const int NUM_BYTES_PER_VERTEX = NUM_COORDS_PER_VERTEX * sizeof(GLfloat);
|
||||
const int NUM_BYTES_PER_INDEX = sizeof(GLushort);
|
||||
|
||||
void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
||||
void GeometryCache::renderSphere(float radius, int slices, int stacks, bool solid) {
|
||||
VerticesIndices& vbo = _sphereVBOs[IntPair(slices, stacks)];
|
||||
int vertices = slices * (stacks - 1) + 2;
|
||||
int indices = slices * stacks * NUM_VERTICES_PER_TRIANGULATED_QUAD;
|
||||
|
@ -211,7 +211,11 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
|||
|
||||
glPushMatrix();
|
||||
glScalef(radius, radius, radius);
|
||||
if (solid) {
|
||||
glDrawRangeElementsEXT(GL_TRIANGLES, 0, vertices - 1, indices, GL_UNSIGNED_SHORT, 0);
|
||||
} else {
|
||||
glDrawRangeElementsEXT(GL_LINES, 0, vertices - 1, indices, GL_UNSIGNED_SHORT, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
|
|
@ -38,7 +38,7 @@ class GeometryCache : public ResourceCache {
|
|||
|
||||
public:
|
||||
void renderHemisphere(int slices, int stacks);
|
||||
void renderSphere(float radius, int slices, int stacks);
|
||||
void renderSphere(float radius, int slices, int stacks, bool solid = true);
|
||||
void renderSquare(int xDivisions, int yDivisions);
|
||||
void renderHalfCylinder(int slices, int stacks);
|
||||
void renderCone(float base, float height, int slices, int stacks);
|
||||
|
|
Loading…
Reference in a new issue