UNPKG

awv3

Version:
88 lines (54 loc) 3.81 kB
AWV client CAD framework [![Live demo](intro.png)](http://awv3-next.github.io/example-levelofdetail/) # Install npm install awv3 --save # ES6 or CommonJS HTML ``` html <div id="main" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;"></div> ``` JS ``` javascript import THREE from 'three'; import { Canvas, View, Object3 } from 'awv3'; // Create new canvas const canvas = new Canvas({ dom: '#main' }); // Create a view, defaults into the same dom-node as the canvas const view = new View(canvas); let mesh = {command: "Blob", data: "GQaÉPB3*Ì¥Jj5£D)3.cF¼´NE0©«p|S·D©t¨0;07BpÎÌFC·63.©S¢WkÍÀÄ^gg6ÁP£9Ä$xÃmÊ·¢|cÆ!º%~ÆWa[¼MsLÅmxÊv}oN¡qL.ÆÆ¤Z!Iu¤6Z2UµPxVx,°¤¢«O²¤¹H=¡l´.¼o~Ãh]À3·]q·lc6:{}TÁuC¡¢1^·QP¥AG¸ÎËJ¸R¨Á¨M(®MÌBK1B|t³ËZ@²l§9Âv®M7%Ev¡@vB¨ÂP¸¦ZL¿MSr66[§Ã¯F%=q¨KNCf$N½9_xQ*§goÃb7dµ4¼²W~7h}2duNJW*U¤À4±È=¨XF2Ì¢FfInP¡H¼JºUÈ._¡²L7¼]GD±Ç¿¼;«dVAM[F«]VÎË#g%´¾Ä¸¸a3ËavÄ$¼Fzz®Q¡¸®_Â}¸»k¢Pc¹:@Ì6¢D1G©$cz:1S~O6ËqI³S¥@XM©Olw%f@w·GÃLÆ¥³qzQIGA5¨@r¶FDUL¢¥T¥3¼^aHzoºÍW][OH³gdÇ)!", length: 1093}; // Parse meshes, group objects, collect materials const model = new Object3((await canvas.parser.parse(mesh)).models).updateMaterials(); // Add to scene view.scene.add(model); ``` # ES5 global namespace include HTML ``` html <div id="main" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;"></div> <script src="node_modules/three/three.min.js"></script> <script src="node_modules/awv3/browser.js"></script> ``` JS ``` javascript // Create new canvas var canvas = new AWV.Canvas({ dom: '#main' }); // Create a view, defaults into the same dom-node as the canvas var view = new AWV.View(canvas); var mesh = {command: "Blob", data: "GQaÉPB3*Ì¥Jj5£D)3.cF¼´NE0©«p|S·D©t¨0;07BpÎÌFC·63.©S¢WkÍÀÄ^gg6ÁP£9Ä$xÃmÊ·¢|cÆ!º%~ÆWa[¼MsLÅmxÊv}oN¡qL.ÆÆ¤Z!Iu¤6Z2UµPxVx,°¤¢«O²¤¹H=¡l´.¼o~Ãh]À3·]q·lc6:{}TÁuC¡¢1^·QP¥AG¸ÎËJ¸R¨Á¨M(®MÌBK1B|t³ËZ@²l§9Âv®M7%Ev¡@vB¨ÂP¸¦ZL¿MSr66[§Ã¯F%=q¨KNCf$N½9_xQ*§goÃb7dµ4¼²W~7h}2duNJW*U¤À4±È=¨XF2Ì¢FfInP¡H¼JºUÈ._¡²L7¼]GD±Ç¿¼;«dVAM[F«]VÎË#g%´¾Ä¸¸a3ËavÄ$¼Fzz®Q¡¸®_Â}¸»k¢Pc¹:@Ì6¢D1G©$cz:1S~O6ËqI³S¥@XM©Olw%f@w·GÃLÆ¥³qzQIGA5¨@r¶FDUL¢¥T¥3¼^aHzoºÍW][OH³gdÇ)!", length: 1093}; // Parse meshes canvas.parser.parse(mesh).then(function(context) { // Group objects, collect materials var model = new AWV.Object3(context.models).updateMaterials(); // Add to scene view.scene.add(model); ``` # Documentation [Documentation](http://awv3-next.github.io/awv3/documentation/) # Demos [Live demo: webpack, es6, simple example](http://awv3-next.github.io/example-simple/), ([source](https://github.com/awv3-next/example-simple)) [Live demo: webpack, es6, async lifecycles](http://awv3-next.github.io/example-await/), ([source](https://github.com/awv3-next/example-await)) [Live demo: webpack, es6, interaction](http://awv3-next.github.io/example-interaction/), ([source](https://github.com/awv3-next/example-interaction)) [Live demo: webpack, es6, snapping](http://awv3-next.github.io/example-snap/), ([source](https://github.com/awv3-next/example-snap)) [Live demo: webpack, es6, level of detail](http://awv3-next.github.io/example-levelofdetail/), ([source](https://github.com/awv3-next/example-levelofdetail)) [Live demo: webpack, es6, signalr-server communication](http://awv3-next.github.io/example-signalr/), ([source](https://github.com/awv3-next/example-signalr)) [Live demo: es5, global namespace include](http://awv3-next.github.io/example-global/), ([source](https://github.com/awv3-next/example-global))