Permalink
Browse files

testing

  • Loading branch information...
1 parent 6c3ce32 commit 048a4a9331f75889ad960df78f9efaedbaeacc41 unknown committed Jan 12, 2011
View
BIN c3dl-dev/tests/shapes/testing.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN c3dl-dev/tests/shapes/testing2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
26 c3dl/shapes/sphere.js
@@ -23,18 +23,13 @@ c3dl.Sphere = c3dl.inherit(c3dl.Shape, function () {
sphereArray.push(this.sphereX[i]);
sphereArray.push(this.sphereY[i]);
sphereArray.push(this.sphereZ[i]);
- texCoords.push(0);
- texCoords.push(i/this.sphereDetailU);
}
sphereArray.push(0);
sphereArray.push(-1);
sphereArray.push(0);
sphereArray.push(this.sphereX[0]);
sphereArray.push(this.sphereY[0]);
sphereArray.push(this.sphereZ[0]);
- texCoords.push(0);
- texCoords.push(1);
-
var v1, v11, v2;
// middle rings
@@ -50,10 +45,7 @@ c3dl.Sphere = c3dl.inherit(c3dl.Shape, function () {
sphereArray.push(parseFloat(this.sphereX[v2]));
sphereArray.push(parseFloat(this.sphereY[v2]));
sphereArray.push(parseFloat(this.sphereZ[v2++]));
- texCoords.push(i/this.sphereDetailV);
- texCoords.push(j/this.sphereDetailU);
}
-
// close each ring
v1 = v11;
v2 = voff;
@@ -64,8 +56,14 @@ c3dl.Sphere = c3dl.inherit(c3dl.Shape, function () {
sphereArray.push(parseFloat(this.sphereX[v2]));
sphereArray.push(parseFloat(this.sphereY[v2]));
sphereArray.push(parseFloat(this.sphereZ[v2]));
- texCoords.push(i/this.sphereDetailV);
- texCoords.push(1);
+ }
+ for (i = 0; i < this.sphereDetailV*2; i++) {
+ for (var j = 0; j < this.sphereDetailU; j++) {
+ texCoords.push(j/this.sphereDetailU);
+ texCoords.push(i/(this.sphereDetailV*2));
+ }
+ texCoords.push(j/this.sphereDetailU);
+ texCoords.push(i/(this.sphereDetailV*2));
}
// add the northern cap
for (i = 0; i < this.sphereDetailU; i++) {
@@ -77,8 +75,6 @@ c3dl.Sphere = c3dl.inherit(c3dl.Shape, function () {
sphereArray.push(0);
sphereArray.push(1);
sphereArray.push(0);
- texCoords.push(i/this.sphereDetailU);
- texCoords.push(0);
}
sphereArray.push(parseFloat(this.sphereX[voff]));
@@ -87,12 +83,6 @@ c3dl.Sphere = c3dl.inherit(c3dl.Shape, function () {
sphereArray.push(0);
sphereArray.push(1);
sphereArray.push(0);
- texCoords.push(1);
- texCoords.push(1);
- for (i = texCoords.length; i > 0; i--) {
- texCoords.push(texCoords[i]);
- }
-
var vertices = new C3DL_FLOAT_ARRAY(sphereArray);
var normals = new C3DL_FLOAT_ARRAY(sphereArray);
texCoords = new C3DL_FLOAT_ARRAY(texCoords);

0 comments on commit 048a4a9

Please sign in to comment.