Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-07-13 00:36:09 +0000
committerStijn Buys <ingar@osirion.org>2008-07-13 00:36:09 +0000
commit2e789cb9894ac5a9565013b134f1c1e51174f430 (patch)
tree3ea0c4d644eeeb38f11c26bf623b9be55602dbe1 /src/model/vertexarray.cc
parent0121804ec5f9ac21f892d013806de01a5eddb109 (diff)
skyglobe
Diffstat (limited to 'src/model/vertexarray.cc')
-rw-r--r--src/model/vertexarray.cc42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/model/vertexarray.cc b/src/model/vertexarray.cc
index da9c3d2..b0da6ab 100644
--- a/src/model/vertexarray.cc
+++ b/src/model/vertexarray.cc
@@ -75,34 +75,18 @@ void VertexArray::add_sphere()
math::Vector3f v;
math::Vector3f n;
math::Vector3f tex;
-
int count;
- //float h = (float) (SPHERESEGMENTS-1) / 2 -1;
+ // add sphere
for (int j=0; j < (SPHERESEGMENTS-1) / 2; j++) {
float r = sintable[j];
float r1 = sintable[j+1];
-/* v.assign(r, 0, costable[j]);
- n = v;
- n.normalize();
- tex.assign(1, (float)(SPHERESEGMENTS-1-j) / (float)(SPHERESEGMENTS-1), 0);
- add_vertex(v, n, white, tex);
-
- v = math::Vector3f(r1, 0, costable[j+1]);
- n = v;
- n.normalize();
- tex.assign(1, (float) (SPHERESEGMENTS-2-j) / (float)(SPHERESEGMENTS-1), 0 );
- add_vertex(v, n, white, tex);
-
- count =2;
-*/
for (int i = 0; i < SPHERESEGMENTS; i++) {
v = math::Vector3f(r*costable[i], r*sintable[i], costable[j]);
n = v;
n.normalize();
- //tex.assign((float)i/(float)(SPHERESEGMENTS), (float) (j) / h, 0);
tex.assign((float)i/(float)(SPHERESEGMENTS-1), -costable[j]/2 + 0.5f , 0);
add_vertex(v, n, white, tex);
@@ -116,6 +100,30 @@ void VertexArray::add_sphere()
}
+ // add inside-out sphere
+ for (int j=0; j < (SPHERESEGMENTS-1) / 2; j++) {
+
+ float r = sintable[j];
+ float r1 = sintable[j+1];
+
+
+ for (int i = SPHERESEGMENTS -1 ; i >= 0; i--) {
+ v = math::Vector3f(r*costable[i], r*sintable[i], costable[j]);
+ n = v;
+ n.normalize();
+ tex.assign(1-(float)i/(float)(SPHERESEGMENTS-1), -costable[j]/2 + 0.5f , 0);
+ add_vertex(v, n, white, tex);
+
+ v = math::Vector3f(r1*costable[i], r1*sintable[i], costable[j+1]);
+ n = v;
+ n.normalize();
+ tex.assign(1-(float)i/(float)(SPHERESEGMENTS-1), -costable[j+1]/2 + 0.5f, 0);
+ add_vertex(v, n, white, tex);
+ count +=2;
+ }
+
+ }
+
delete[] sintable;
delete[] costable;
}