|
@@ -446,6 +446,7 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
case 'Mesh':
|
|
|
case 'Extrusion':
|
|
|
+ case 'SubD':
|
|
|
|
|
|
var geometry = loader.parse( obj.geometry );
|
|
|
|
|
@@ -455,6 +456,13 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if ( mat === null ) {
|
|
|
+
|
|
|
+ mat = this._createMaterial();
|
|
|
+ mat = this._compareMaterials( mat );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
var mesh = new Mesh( geometry, mat );
|
|
|
mesh.castShadow = attributes.castsShadows;
|
|
|
mesh.receiveShadow = attributes.receivesShadows;
|
|
@@ -509,8 +517,21 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
var width = ctx.measureText( geometry.text ).width + 10;
|
|
|
var height = geometry.fontHeight + 10;
|
|
|
|
|
|
- ctx.canvas.width = width;
|
|
|
- ctx.canvas.height = height;
|
|
|
+ // ref https://bl.ocks.org/duhaime/60c7083009bbd49ce50a58c371d8c818
|
|
|
+ var dpr = window.devicePixelRatio || 1;
|
|
|
+ var bsr = ctx.webkitBackingStorePixelRatio ||
|
|
|
+ ctx.mozBackingStorePixelRatio ||
|
|
|
+ ctx.msBackingStorePixelRatio ||
|
|
|
+ ctx.oBackingStorePixelRatio ||
|
|
|
+ ctx.backingStorePixelRatio || 1;
|
|
|
+
|
|
|
+ var r = dpr / bsr;
|
|
|
+
|
|
|
+ ctx.canvas.width = width * r;
|
|
|
+ ctx.canvas.height = height * r;
|
|
|
+ ctx.canvas.style.width = width + 'px';
|
|
|
+ ctx.canvas.style.height = height + 'px';
|
|
|
+ ctx.setTransform( r, 0, 0, r, 0, 0 );
|
|
|
|
|
|
ctx.font = font;
|
|
|
ctx.textBaseline = 'middle';
|
|
@@ -1166,6 +1187,20 @@ Rhino3dmLoader.Rhino3dmWorker = function () {
|
|
|
|
|
|
break;
|
|
|
|
|
|
+ case rhino.ObjectType.SubD:
|
|
|
+
|
|
|
+ // TODO: precalculate resulting vertices and faces and warn on excessive results
|
|
|
+ _geometry.subdivide( 3 );
|
|
|
+ var mesh = rhino.Mesh.createFromSubDControlNet( _geometry );
|
|
|
+ if ( mesh ) {
|
|
|
+
|
|
|
+ geometry = mesh.toThreejsJSON();
|
|
|
+ mesh.delete();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
/*
|
|
|
case rhino.ObjectType.Annotation:
|
|
|
case rhino.ObjectType.Hatch:
|