Permalink
Browse files

Fixed MarchingCubes bug introduced by previous commit. Added flat sha…

…ded material to marching cubes example.
  • Loading branch information...
1 parent 5dd0968 commit 5d5f92d6411f3d39725ea704594d7a09ecb92cca @alteredq committed Apr 30, 2012
Showing with 16 additions and 0 deletions.
  1. +10 −0 examples/js/MarchingCubes.js
  2. +6 −0 examples/webgl_marching_cubes.html
View
10 examples/js/MarchingCubes.js
@@ -52,6 +52,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs ) {
this.maxCount = 4096; // TODO: find the fastest size for this buffer
this.count = 0;
+
this.hasPos = false;
this.hasNormal = false;
this.hasUv = false;
@@ -394,6 +395,15 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs ) {
for ( var i = this.count * 3; i < this.positionArray.length; i ++ )
this.positionArray[ i ] = 0.0;
+ this.hasPos = true;
+ this.hasNormal = true;
+
+ if ( this.enableUvs ) {
+
+ this.hasUv = true;
+
+ }
+
renderCallback( this );
};
View
6 examples/webgl_marching_cubes.html
@@ -316,6 +316,12 @@
h: 0, s: 0, v: 1
},
+ "flat" :
+ {
+ m: new THREE.MeshPhongMaterial( { color: 0x000000, specular: 0x111111, shininess: 1, shading: THREE.FlatShading, perPixel: true } ),
+ h: 0, s: 0, v: 1
+ },
+
"textured" :
{
m: new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 1, map: texture, perPixel: true } ),

2 comments on commit 5d5f92d

@mrdoob

hasPositions, hasNormals, hasUvs?

@alteredq
Owner

Good call ;)

Changed:

763fcf7

Please sign in to comment.