Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/WolfireGames/overgrowth.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorStephan Vedder <vedder@mbits.info>2022-04-29 11:07:50 +0300
committerStephan Vedder <vedder@mbits.info>2022-04-29 11:07:50 +0300
commit93ad205c3df9de871f0555229eaadb7a5a96eb59 (patch)
tree1a89c6727caeee23949c0aab703a824b56c13be1 /Source
parent985d8585224e949d3e02838541bc1cfb0f1fdac3 (diff)
Remove unused geometry helpers
Diffstat (limited to 'Source')
-rw-r--r--Source/Graphics/geometry.cpp330
-rw-r--r--Source/Graphics/geometry.h12
2 files changed, 2 insertions, 340 deletions
diff --git a/Source/Graphics/geometry.cpp b/Source/Graphics/geometry.cpp
index fa699d7c..cbccc682 100644
--- a/Source/Graphics/geometry.cpp
+++ b/Source/Graphics/geometry.cpp
@@ -311,91 +311,6 @@ void GetWireBoxVertArray( std::vector<vec3> &data )
}
}
-/*
- * Draws a solid sphere
- */
-void renderSolidSphere(GLdouble radius, GLint slices, GLint stacks)
-{
- int i,j;
-
- /* Adjust z and radius as stacks are drawn. */
-
- double z0,z1;
- double r0,r1;
-
- /* Pre-computed circle */
-
- double *sint1,*cost1;
- double *sint2,*cost2;
- circleTable(&sint1,&cost1,-slices);
- circleTable(&sint2,&cost2,stacks*2);
-
- /* The top stack is covered with a triangle fan */
-
- z0 = 1.0f;
- z1 = cost2[1];
- r0 = 0.0f;
- r1 = sint2[1];
-
- glBegin(GL_TRIANGLE_FAN);
-
- glNormal3d(0,0,1);
- glVertex3d(0,0,radius);
-
- for (j=slices; j>=0; j--)
- {
- glNormal3d(cost1[j]*r1, sint1[j]*r1, z1 );
- glVertex3d(cost1[j]*r1*radius, sint1[j]*r1*radius, z1*radius);
- }
-
- glEnd();
-
- /* Cover each stack with a quad strip, except the top and bottom stacks */
-
- for( i=1; i<stacks-1; i++ )
- {
- z0 = z1; z1 = cost2[i+1];
- r0 = r1; r1 = sint2[i+1];
-
- glBegin(GL_QUAD_STRIP);
-
- for(j=0; j<=slices; j++)
- {
- glNormal3d(cost1[j]*r1, sint1[j]*r1, z1 );
- glVertex3d(cost1[j]*r1*radius, sint1[j]*r1*radius, z1*radius);
- glNormal3d(cost1[j]*r0, sint1[j]*r0, z0 );
- glVertex3d(cost1[j]*r0*radius, sint1[j]*r0*radius, z0*radius);
- }
-
- glEnd();
- }
-
- /* The bottom stack is covered with a triangle fan */
-
- z0 = z1;
- r0 = r1;
-
- glBegin(GL_TRIANGLE_FAN);
-
- glNormal3d(0,0,-1);
- glVertex3d(0,0,-radius);
-
- for (j=0; j<=slices; j++)
- {
- glNormal3d(cost1[j]*r0, sint1[j]*r0, z0 );
- glVertex3d(cost1[j]*r0*radius, sint1[j]*r0*radius, z0*radius);
- }
-
- glEnd();
-
- /* Release sin and cos tables */
-
- OG_FREE(sint1);
- OG_FREE(cost1);
- OG_FREE(sint2);
- OG_FREE(cost2);
-}
-
// Get interleaved vert array (3 verts) for GL_LINES
void GetWireSphereVertArray(GLdouble radius, GLint slices, GLint stacks, std::vector<float> &data) {
double r,x,y,z;
@@ -563,247 +478,4 @@ void GetUnitBoxVertArray(std::vector<float> &verts, std::vector<unsigned> &faces
faces.push_back(1-1);
faces.push_back(4-1);
faces.push_back(8-1);
-}
-
-/*
- * Draws a solid cylinder
- */
-void renderSolidCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
-{
- int i,j;
-
- /* Step in z and radius as stacks are drawn. */
-
-
- double z0,z1;
- const double zStep = height/stacks;
-
- /* Pre-computed circle */
-
- double *sint,*cost;
- circleTable(&sint,&cost,-slices);
-
- /* Cover the base and top */
-
- glBegin(GL_TRIANGLE_FAN);
- glNormal3d(0.0f, 0.0f, -1.0f );
- glVertex3d(0.0f, 0.0f, -height/2 );
- for (j=0; j<=slices; j++)
- glVertex3d(cost[j]*radius, sint[j]*radius, -height/2);
- glEnd();
-
- glBegin(GL_TRIANGLE_FAN);
- glNormal3d(0.0f, 0.0f, 1.0f );
- glVertex3d(0.0f, 0.0f, height/2);
- for (j=slices; j>=0; j--)
- glVertex3d(cost[j]*radius, sint[j]*radius, height/2);
- glEnd();
-
- /* Do the stacks */
-
- z0 = -height/2;
- z1 = zStep-height/2;
-
- for (i=1; i<=stacks; i++)
- {
- if (i==stacks)
- z1 = height/2;
-
- glBegin(GL_QUAD_STRIP);
- for (j=0; j<=slices; j++ )
- {
- glNormal3d(cost[j], sint[j], 0.0f );
- glVertex3d(cost[j]*radius, sint[j]*radius, z0 );
- glVertex3d(cost[j]*radius, sint[j]*radius, z1 );
- }
- glEnd();
-
- z0 = z1; z1 += zStep;
- }
-
- /* Release sin and cos tables */
-
- OG_FREE(sint);
- OG_FREE(cost);
-}
-
-/*
- * Draws a wire cylinder
- */
-void renderWireCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks)
-{
- int i,j;
-
- /* Step in z and radius as stacks are drawn. */
-
- double z = 0.0f;
- const double zStep = height/stacks;
-
- /* Pre-computed circle */
-
- double *sint,*cost;
- circleTable(&sint,&cost,-slices);
-
- /* Draw the stacks... */
-
- for (i=0; i<=stacks; i++)
- {
- if (i==stacks)
- z = height;
-
- glBegin(GL_LINE_LOOP);
- for( j=0; j<slices; j++ ) {
- glNormal3d(cost[j], sint[j], 0.0f);
- glVertex3d(cost[j]*radius, sint[j]*radius, z );
- }
- glEnd();
-
- z += zStep;
- }
-
- /* Draw the slices */
-
- glBegin(GL_LINES);
-
- for (j=0; j<slices; j++)
- {
- glNormal3d(cost[j], sint[j], 0.0f );
- glVertex3d(cost[j]*radius, sint[j]*radius, 0.0f );
- glVertex3d(cost[j]*radius, sint[j]*radius, height);
- }
-
- glEnd();
-
- /* Release sin and cos tables */
-
- OG_FREE(sint);
- OG_FREE(cost);
-}
-
-
-#undef num_faces
-
-
-#ifdef _WIN32
-#define NOMINMAX
-#include <windows.h>
-#endif
-
-#include "opengl.h"
-
-GLuint GetBoxDisplayList( const vec3 &sides )
-{
- GLuint display_list = glGenLists(1);
- glNewList(display_list,GL_COMPILE);
- glBegin(GL_QUADS);
- glNormal3f(0,-1,0);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
-
- glNormal3f(0,1,0);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
-
- glNormal3f(1,0,0);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
-
- glNormal3f(-1,0,0);
- glVertex3f( -sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( -sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( -sides[0]*0.5f, sides[1]*0.5f,-sides[2]*0.5f);
- glVertex3f( -sides[0]*0.5f,-sides[1]*0.5f,-sides[2]*0.5f);
-
- glNormal3f(0,0,-1);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f, -sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f, -sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, -sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, -sides[2]*0.5f);
-
- glNormal3f(0,0,1);
- glVertex3f( sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f( sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f, sides[1]*0.5f, sides[2]*0.5f);
- glVertex3f(-sides[0]*0.5f,-sides[1]*0.5f, sides[2]*0.5f);
- glEnd();
- glEndList();
-
- return display_list;
-}
-
-
-
-GLuint GetMultiSphereDisplayList( const vec3 *positions, const float *radii, int num_spheres )
-{
- CHECK_GL_ERROR();
- GLuint display_list = glGenLists(1);
- CHECK_GL_ERROR();
- glNewList(display_list,GL_COMPILE);
- CHECK_GL_ERROR();
-
- for(int i=0; i<num_spheres; i++){
- glPushMatrix();
- glTranslatef(positions[i][0], positions[i][1], positions[i][2]);
- renderSolidSphere(radii[i],12,12);
- glPopMatrix();
- }
- CHECK_GL_ERROR();
- for(int i=0; i<num_spheres; i++){
- for(int j=i+1; j<num_spheres; j++){
- vec3 connection = normalize(positions[j]-positions[i]);
- vec3 right;// = normalize(vec3(1.0f,1.0f,1.0f));
- vec3 up;// = normalize(cross(right,connection));
- //right = normalize(cross(up,connection));
-
- PlaneSpace(connection, right, up);
-
- vec3 avg_pos = (positions[j]+positions[i])*0.5f;
-
- mat4 transform;
- transform.SetColumn(0,right);
- transform.SetColumn(1,up);
- transform.SetColumn(2,connection);
- transform.SetColumn(3,avg_pos);
-
- glPushMatrix();
- glMultMatrixf(transform);
- renderSolidCylinder(radii[i],
- distance(positions[i], positions[j]),
- 12,12);
- glPopMatrix();
- }
- }
- CHECK_GL_ERROR();
- glEndList();
- return display_list;
-}
-
-GLuint GetWireCylinderDisplayList( float radius, float height, GLint slices, GLint stacks )
-{
- GLuint display_list = glGenLists(1);
- glNewList(display_list,GL_COMPILE);
- glPushMatrix();
- glTranslatef(0.0f,height*0.5f,0.0f);
- glRotatef(90,1,0,0);
- renderWireCylinder(radius,height,slices,stacks);
- glPopMatrix();
- glEndList();
- return display_list;
-}
-
-GLuint GetSphereDisplayList( float radius )
-{
- GLuint display_list = glGenLists(1);
- glNewList(display_list,GL_COMPILE);
- glPushMatrix();
- renderSolidSphere(radius,12,12);
- glPopMatrix();
- glEndList();
- return display_list;
-}
+} \ No newline at end of file
diff --git a/Source/Graphics/geometry.h b/Source/Graphics/geometry.h
index a5f67670..cc89540b 100644
--- a/Source/Graphics/geometry.h
+++ b/Source/Graphics/geometry.h
@@ -171,17 +171,7 @@
#include <vector>
/* -- INTERFACE FUNCTION PROTOTYPES -------------------------------------------------- */
-
-GLuint GetBoxDisplayList(const vec3 &sides);
-GLuint GetSphereDisplayList(float radius);
-GLuint GetMultiSphereDisplayList(const vec3 *positions, const float *radii, int num_spheres);
-
-void renderSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-
-void renderWireCylinder(GLdouble radius, GLdouble height, GLint slices, GLint stacks);
-
-GLuint GetWireCylinderDisplayList( float radius, float height, GLint slices, GLint stacks );
-
+
void GetWireCylinderVertArray(GLint slices, std::vector<vec3> &data);
void GetWireSphereVertArray(GLdouble radius, GLint slices, GLint stacks, std::vector<float> &data);
void GetWireBoxVertArray( std::vector<vec3> &data );