Skip to content

Commit

Permalink
Fixed MarchingCubes bug introduced by previous commit. Added flat sha…
Browse files Browse the repository at this point in the history
…ded material to marching cubes example.
  • Loading branch information
alteredq committed Apr 30, 2012
1 parent 5dd0968 commit 5d5f92d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/js/MarchingCubes.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );

};
Expand Down
6 changes: 6 additions & 0 deletions examples/webgl_marching_cubes.html
Expand Up @@ -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 } ),
Expand Down

2 comments on commit 5d5f92d

@mrdoob
Copy link

@mrdoob mrdoob commented on 5d5f92d May 1, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasPositions, hasNormals, hasUvs?

@alteredq
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call ;)

Changed:

763fcf7

Please sign in to comment.