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 a016d7a3..f9d0625d 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -413,12 +413,48 @@ exports.Line = Object.create(GeomObj, {
413 indices.push( index ); index++; 413 indices.push( index ); index++;
414 } 414 }
415 415
416 var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, indices.length);
417
418 var strokeMaterial = this.makeStrokeMaterial(); 416 var strokeMaterial = this.makeStrokeMaterial();
419 417// var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, indices.length);
420 this._primArray.push( prim ); 418// this._primArray.push( prim );
421 this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); 419// this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
420
421 // refine the mesh for vertex deformations
422 if (strokeMaterial)
423 {
424 var primArray;
425 if (strokeMaterial.hasVertexDeformation())
426 {
427 var paramRange = strokeMaterial.getVertexDeformationRange();
428 var tolerance = strokeMaterial.getVertexDeformationTolerance();
429 var nVertices = indices.length;
430 nVertices = ShapePrimitive.refineMesh( strokeVertices, strokeNormals, strokeTextures, indices, nVertices, paramRange, tolerance );
431 var subdividedParts = ShapePrimitive.subdivideOversizedMesh( strokeVertices, strokeNormals, strokeTextures, indices );
432
433 primArray = [];
434 if (subdividedParts)
435 {
436 for (var i=0; i<subdividedParts.length; i++)
437 {
438 var obj = subdividedParts[i];
439 primArray.push( ShapePrimitive.create(obj.vertices, obj.normals, obj.uvs, obj.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, obj.vertices.length/3) );
440 }
441 }
442 else
443 primArray = [ ShapePrimitive.create(vrts, nrms, uvs, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices) ];
444 }
445 else
446 {
447 // create the RDGE primitive
448 primArray = [ ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, indices.length) ];
449 }
450
451 var nPrims = primArray.length;
452 for (var i=0; i<nPrims; i++)
453 {
454 this._primArray.push( primArray[i] );
455 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
456 }
457 }
422 458
423 world.updateObject(this); 459 world.updateObject(this);
424 } 460 }