update method
void
update()
Implementation
void update() {
count = 0;
// Triangulate. Yeah, this is slow.
final smin2 = size - 2;
for(int z = 1; z < smin2; z ++){
final zOffset = size2.toInt() * z;
final fz = ( z - halfsize ) / halfsize; //+ 1
for (int y = 1; y < smin2; y ++ ) {
final yOffset = zOffset + size.toInt() * y;
final fy = ( y - halfsize ) / halfsize; //+ 1
for (int x = 1; x < smin2; x ++ ) {
final fx = ( x - halfsize ) / halfsize; //+ 1
final q = yOffset + x;
polygonize( fx, fy, fz, q, isolation );
}
}
}
// set the draw range to only the processed triangles
geometry?.setDrawRange( 0, count! );
// update geometry data
geometry?.getAttributeFromString('position').needsUpdate = true;
geometry?.getAttributeFromString('normal').needsUpdate = true;
if (enableUvs ) geometry?.getAttributeFromString( 'uv' ).needsUpdate = true;
if (enableColors ) geometry?.getAttributeFromString( 'color' ).needsUpdate = true;
// safety check
if (count! / 3 > maxPolyCount ){
throw( 'THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.' );
}
}