aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/line.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-xjs/lib/geom/line.js46
1 files changed, 41 insertions, 5 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index 16c40623..6555f6ae 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -446,12 +446,48 @@ exports.Line = Object.create(GeomObj, {
446 indices.push( index ); index++; 446 indices.push( index ); index++;
447 } 447 }
448 448
449 var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, indices.length);
450
451 var strokeMaterial = this.makeStrokeMaterial(); 449 var strokeMaterial = this.makeStrokeMaterial();
452 450// var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, indices.length);
453 this._primArray.push( prim ); 451// this._primArray.push( prim );
454 this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); 452// this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
453
454 // refine the mesh for vertex deformations
455 if (strokeMaterial)
456 {
457 var primArray;
458 if (strokeMaterial.hasVertexDeformation())
459 {
460 var paramRange = strokeMaterial.getVertexDeformationRange();
461 var tolerance = strokeMaterial.getVertexDeformationTolerance();
462 var nVertices = indices.length;
463 nVertices = ShapePrimitive.refineMesh( strokeVertices, strokeNormals, strokeTextures, indices, nVertices, paramRange, tolerance );
464 var subdividedParts = ShapePrimitive.subdivideOversizedMesh( strokeVertices, strokeNormals, strokeTextures, indices );
465
466 primArray = [];
467 if (subdividedParts)
468 {
469 for (var i=0; i<subdividedParts.length; i++)
470 {
471 var obj = subdividedParts[i];
472 primArray.push( ShapePrimitive.create(obj.vertices, obj.normals, obj.uvs, obj.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, obj.vertices.length/3) );
473 }
474 }
475 else
476 primArray = [ ShapePrimitive.create(vrts, nrms, uvs, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices) ];
477 }
478 else
479 {
480 // create the RDGE primitive
481 primArray = [ ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, indices.length) ];
482 }
483
484 var nPrims = primArray.length;
485 for (var i=0; i<nPrims; i++)
486 {
487 this._primArray.push( primArray[i] );
488 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
489 }
490 }
455 491
456 world.updateObject(this); 492 world.updateObject(this);
457 } 493 }