threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
93 lines • 4.07 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { onChange } from 'ts-browser-helpers';
import { Importer, Rhino3dmLoader2 } from '../../assetmanager';
import { BaseImporterPlugin } from '../base/BaseImporterPlugin';
import { uiFolderContainer, uiToggle } from 'uiconfig.js';
/**
* Adds support for loading Rhino `.3dm`, `model/vnd.3dm`, `model/3dm` files and data uris.
* @category Plugins
*/
let Rhino3dmLoadPlugin = class Rhino3dmLoadPlugin extends BaseImporterPlugin {
constructor() {
super(...arguments);
this._importer = new Importer(Rhino3dmLoader2, ['3dm'], ['model/vnd.3dm', 'model/3dm'], true);
/**
* Import materials from the file based on material source and color source. If false, a default material will be used
* Same as {@link Rhino3dmLoader2.ImportMaterials}
*/
this.importMaterials = true;
/**
* Force layer materials even if material/color source is not from layer. Only works if {@link importMaterials} is true
* Same as {@link Rhino3dmLoader2.ForceLayerMaterials}
*/
this.forceLayerMaterials = false;
/**
* Replace meshes with instanced meshes if they have the same parent, geometry and material
* Same as {@link Rhino3dmLoader2.ReplaceWithInstancedMesh}
*/
this.replaceWithInstancedMesh = false;
/**
* Hide all lines, line segments and points in the file
* Same as {@link Rhino3dmLoader2.HideLineMesh}
*/
this.hideLineMesh = false;
/**
* Hide all points in the file
*/
this.hidePointMesh = true;
/**
* Remove strings from userData
*/
this.loadUserDataStrings = true;
}
_refresh() {
Rhino3dmLoader2.ImportMaterials = this.importMaterials;
Rhino3dmLoader2.ForceLayerMaterials = this.forceLayerMaterials;
Rhino3dmLoader2.ReplaceWithInstancedMesh = this.replaceWithInstancedMesh;
Rhino3dmLoader2.HideLineMesh = this.hideLineMesh;
Rhino3dmLoader2.HidePointMesh = this.hidePointMesh;
Rhino3dmLoader2.LoadUserDataStrings = this.loadUserDataStrings;
Rhino3dmLoader2.LoadUserDataWarnings = false;
}
onAdded(viewer) {
if (!window.WebAssembly)
throw new Error('Rhino3dmLoadPlugin requires WebAssembly support');
super.onAdded(viewer);
this._refresh();
}
};
Rhino3dmLoadPlugin.PluginType = 'Rhino3dmLoadPlugin';
__decorate([
onChange(Rhino3dmLoadPlugin.prototype._refresh),
uiToggle()
], Rhino3dmLoadPlugin.prototype, "importMaterials", void 0);
__decorate([
onChange(Rhino3dmLoadPlugin.prototype._refresh),
uiToggle()
], Rhino3dmLoadPlugin.prototype, "forceLayerMaterials", void 0);
__decorate([
onChange(Rhino3dmLoadPlugin.prototype._refresh),
uiToggle()
], Rhino3dmLoadPlugin.prototype, "replaceWithInstancedMesh", void 0);
__decorate([
onChange(Rhino3dmLoadPlugin.prototype._refresh),
uiToggle()
], Rhino3dmLoadPlugin.prototype, "hideLineMesh", void 0);
__decorate([
onChange(Rhino3dmLoadPlugin.prototype._refresh),
uiToggle()
], Rhino3dmLoadPlugin.prototype, "hidePointMesh", void 0);
__decorate([
onChange(Rhino3dmLoadPlugin.prototype._refresh),
uiToggle()
], Rhino3dmLoadPlugin.prototype, "loadUserDataStrings", void 0);
Rhino3dmLoadPlugin = __decorate([
uiFolderContainer('Rhino 3dm Loader')
], Rhino3dmLoadPlugin);
export { Rhino3dmLoadPlugin };
//# sourceMappingURL=Rhino3dmLoadPlugin.js.map