Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

lodspheremesh.cpp File Reference

#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <celmath/mathlib.h>
#include <celmath/vecmath.h>
#include "gl.h"
#include "glext.h"
#include "vecgl.h"
#include "lodspheremesh.h"

Include dependency graph for lodspheremesh.cpp:

Go to the source code of this file.

Functions

static float getSphereLOD (float discSizeInPixels)
static void InitTrigArrays ()
static Point3f spherePoint (int theta, int phi)

Variables

static float * cosPhi = NULL
static float * cosTheta = NULL
static int maxDivisions = 4096
static int MaxVertexSize = 3 + 3 + 3 + MAX_SPHERE_MESH_TEXTURES * 2
static int minStep = 128
static int phiDivisions = maxDivisions / 2
static float * sinPhi = NULL
static float * sinTheta = NULL
static int thetaDivisions = maxDivisions
static bool trigArraysInitialized = false


Function Documentation

static float getSphereLOD float  discSizeInPixels  )  [static]
 

Definition at line 75 of file lodspheremesh.cpp.

Referenced by LODSphereMesh::render().

00076 {
00077     if (discSizeInPixels < 10)
00078         return -3.0f;
00079     else if (discSizeInPixels < 20)
00080         return -2.0f;
00081     else if (discSizeInPixels < 50)
00082         return -1.0f;
00083     else if (discSizeInPixels < 200)
00084         return 0.0f;
00085     else if (discSizeInPixels < 1200)
00086         return 1.0f;
00087     else if (discSizeInPixels < 7200)
00088         return 2.0f;
00089     else if (discSizeInPixels < 53200)
00090         return 3.0f;
00091     else
00092         return 4.0f;
00093 }

static void InitTrigArrays  )  [static]
 

Definition at line 49 of file lodspheremesh.cpp.

References cos(), cosPhi, cosTheta, phiDivisions, PI, sin(), sinPhi, sinTheta, thetaDivisions, and trigArraysInitialized.

Referenced by LODSphereMesh::LODSphereMesh().

00050 {
00051     sinTheta = new float[thetaDivisions + 1];
00052     cosTheta = new float[thetaDivisions + 1];
00053     sinPhi = new float[phiDivisions + 1];
00054     cosPhi = new float[phiDivisions + 1];
00055 
00056     int i;
00057     for (i = 0; i <= thetaDivisions; i++)
00058     {
00059         double theta = (double) i / (double) thetaDivisions * 2.0 * PI;
00060         sinTheta[i] = (float) sin(theta);
00061         cosTheta[i] = (float) cos(theta);
00062     }
00063 
00064     for (i = 0; i <= phiDivisions; i++)
00065     {
00066         double phi = ((double) i / (double) phiDivisions - 0.5) * PI;
00067         sinPhi[i] = (float) sin(phi);
00068         cosPhi[i] = (float) cos(phi);
00069     }
00070 
00071     trigArraysInitialized = true;
00072 }

static Point3f spherePoint int  theta,
int  phi
[static]
 

Definition at line 121 of file lodspheremesh.cpp.

References cosPhi, cosTheta, sinPhi, and sinTheta.

Referenced by LODSphereMesh::renderPatches().

00122 {
00123     return Point3f(cosPhi[phi] * cosTheta[theta],
00124                    sinPhi[phi],
00125                    cosPhi[phi] * sinTheta[theta]);
00126 }


Variable Documentation

float* cosPhi = NULL [static]
 

Definition at line 32 of file lodspheremesh.cpp.

Referenced by InitTrigArrays(), LODSphereMesh::renderSection(), and spherePoint().

float* cosTheta = NULL [static]
 

Definition at line 34 of file lodspheremesh.cpp.

Referenced by InitTrigArrays(), LODSphereMesh::renderSection(), and spherePoint().

int maxDivisions = 4096 [static]
 

Definition at line 27 of file lodspheremesh.cpp.

Referenced by LODSphereMesh::render(), and LODSphereMesh::renderSection().

int MaxVertexSize = 3 + 3 + 3 + MAX_SPHERE_MESH_TEXTURES * 2 [static]
 

Definition at line 41 of file lodspheremesh.cpp.

Referenced by LODSphereMesh::LODSphereMesh(), and LODSphereMesh::render().

int minStep = 128 [static]
 

Definition at line 30 of file lodspheremesh.cpp.

Referenced by LODSphereMesh::LODSphereMesh(), and LODSphereMesh::render().

int phiDivisions = maxDivisions / 2 [static]
 

Definition at line 29 of file lodspheremesh.cpp.

Referenced by InitTrigArrays(), LODSphereMesh::LODSphereMesh(), and LODSphereMesh::renderSection().

float* sinPhi = NULL [static]
 

Definition at line 31 of file lodspheremesh.cpp.

Referenced by InitTrigArrays(), LODSphereMesh::renderSection(), and spherePoint().

float* sinTheta = NULL [static]
 

Definition at line 33 of file lodspheremesh.cpp.

Referenced by InitTrigArrays(), LODSphereMesh::renderSection(), and spherePoint().

int thetaDivisions = maxDivisions [static]
 

Definition at line 28 of file lodspheremesh.cpp.

Referenced by InitTrigArrays(), LODSphereMesh::LODSphereMesh(), and LODSphereMesh::renderSection().

bool trigArraysInitialized = false [static]
 

Definition at line 26 of file lodspheremesh.cpp.

Referenced by InitTrigArrays(), and LODSphereMesh::LODSphereMesh().


Generated on Sat Jan 14 22:30:55 2006 for Celestia by  doxygen 1.4.1