@glyphcss/vue 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +128 -28
- package/dist/index.d.ts +128 -28
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ee=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var fe=(o,s)=>{for(var i in s)ee(o,i,{get:s[i],enumerable:!0})},Ge=(o,s,i,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of he(s))!me.call(o,a)&&a!==i&&ee(o,a,{get:()=>s[a],enumerable:!(l=de(s,a))||l.enumerable});return o};var ge=o=>Ge(ee({},"__esModule",{value:!0}),o);var ve={};fe(ve,{BASE_TILE:()=>e.BASE_TILE,CAMERA_BACKFACE_CULL_EPS:()=>e.CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE:()=>e.DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION:()=>e.DEFAULT_PROJECTION,GlyphAxesHelper:()=>W,GlyphCamera:()=>H,GlyphCameraContextKey:()=>A,GlyphDirectionalLightHelper:()=>q,GlyphFirstPersonControls:()=>_,GlyphGround:()=>j,GlyphHotspot:()=>D,GlyphMapControls:()=>Y,GlyphMesh:()=>E,GlyphOrbitControls:()=>U,GlyphOrthographicCamera:()=>H,GlyphPerspectiveCamera:()=>X,GlyphScene:()=>N,GlyphSceneContextKey:()=>y,LoopOnce:()=>e.LoopOnce,LoopPingPong:()=>e.LoopPingPong,LoopRepeat:()=>e.LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS:()=>e.VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT:()=>e.VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons:()=>e.antiprismPolygons,arrowPolygons:()=>e.arrowPolygons,axesHelperPolygons:()=>e.axesHelperPolygons,bakeSolidTextureSampledPolygons:()=>e.bakeSolidTextureSampledPolygons,bakeSolidTextureSamples:()=>e.bakeSolidTextureSamples,bipyramidPolygons:()=>e.bipyramidPolygons,buildSceneContext:()=>e.buildSceneContext,cameraCullNormalGroups:()=>e.cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons:()=>e.cameraCullNormalGroupsFromPolygons,cameraCullNormalKey:()=>e.cameraCullNormalKey,cameraCullVisibleSignature:()=>e.cameraCullVisibleSignature,cameraFacingDepth:()=>e.cameraFacingDepth,clampChannel:()=>e.clampChannel,computeSceneBbox:()=>e.computeSceneBbox,computeShapeLighting:()=>e.computeShapeLighting,conePolygons:()=>e.conePolygons,coverPlanarPolygons:()=>e.coverPlanarPolygons,createGlyphAnimationMixer:()=>e.createGlyphAnimationMixer,createIsometricCamera:()=>e.createIsometricCamera,cubePolygons:()=>e.cubePolygons,cuboctahedronPolygons:()=>e.cuboctahedronPolygons,cullInteriorPolygons:()=>e.cullInteriorPolygons,cylinderPolygons:()=>e.cylinderPolygons,deltoidalHexecontahedronPolygons:()=>e.deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons:()=>e.deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons:()=>e.disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons:()=>e.disdyakisTriacontahedronPolygons,dodecahedronPolygons:()=>e.dodecahedronPolygons,findGlyphMeshHandle:()=>P.findGlyphMeshHandle,findMeshUnderPoint:()=>P.findMeshUnderPoint,formatColor:()=>e.formatColor,greatDodecahedronPolygons:()=>e.greatDodecahedronPolygons,greatIcosahedronPolygons:()=>e.greatIcosahedronPolygons,greatStellatedDodecahedronPolygons:()=>e.greatStellatedDodecahedronPolygons,icosahedronPolygons:()=>e.icosahedronPolygons,icosidodecahedronPolygons:()=>e.icosidodecahedronPolygons,injectGlyphBaseStyles:()=>$.injectGlyphBaseStyles,inverseRotateVec3:()=>e.inverseRotateVec3,isAxisAlignedSurfaceNormal:()=>e.isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups:()=>e.isVoxelCameraCullableNormalGroups,loadMesh:()=>e.loadMesh,mergePolygons:()=>e.mergePolygons,normalFacesCamera:()=>e.normalFacesCamera,normalizeInvertMultiplier:()=>e.normalizeInvertMultiplier,normalizePolygons:()=>e.normalizePolygons,octahedronPolygons:()=>e.octahedronPolygons,optimizeMeshPolygons:()=>e.optimizeMeshPolygons,parseColor:()=>e.parseColor,parseGltf:()=>e.parseGltf,parseHexColor:()=>e.parseHexColor,parseMtl:()=>e.parseMtl,parseObj:()=>e.parseObj,parsePureColor:()=>e.parsePureColor,parseRgbColor:()=>e.parseRgbColor,parseVox:()=>e.parseVox,pentagonalHexecontahedronPolygons:()=>e.pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons:()=>e.pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons:()=>e.pentakisDodecahedronPolygons,planePolygons:()=>e.planePolygons,pointInMeshElement:()=>P.pointInMeshElement,polygonCssSurfaceNormal:()=>e.polygonCssSurfaceNormal,polygonFaces:()=>e.polygonFaces,polygonFacesCamera:()=>e.polygonFacesCamera,prismPolygons:()=>e.prismPolygons,pyramidPolygons:()=>e.pyramidPolygons,resolveGeometry:()=>e.resolveGeometry,rhombicDodecahedronPolygons:()=>e.rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons:()=>e.rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons:()=>e.rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons:()=>e.rhombicuboctahedronPolygons,ringPolygons:()=>e.ringPolygons,ringQuadPolygons:()=>e.ringQuadPolygons,rotateVec3:()=>e.rotateVec3,shadeColor:()=>e.shadeColor,smallStellatedDodecahedronPolygons:()=>e.smallStellatedDodecahedronPolygons,snubCubePolygons:()=>e.snubCubePolygons,snubDodecahedronPolygons:()=>e.snubDodecahedronPolygons,spherePolygons:()=>e.spherePolygons,tetrahedronPolygons:()=>e.tetrahedronPolygons,tetrakisHexahedronPolygons:()=>e.tetrakisHexahedronPolygons,torusPolygons:()=>e.torusPolygons,trapezohedronPolygons:()=>e.trapezohedronPolygons,triakisIcosahedronPolygons:()=>e.triakisIcosahedronPolygons,triakisOctahedronPolygons:()=>e.triakisOctahedronPolygons,triakisTetrahedronPolygons:()=>e.triakisTetrahedronPolygons,truncatedCubePolygons:()=>e.truncatedCubePolygons,truncatedCuboctahedronPolygons:()=>e.truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons:()=>e.truncatedDodecahedronPolygons,truncatedIcosahedronPolygons:()=>e.truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons:()=>e.truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons:()=>e.truncatedOctahedronPolygons,truncatedTetrahedronPolygons:()=>e.truncatedTetrahedronPolygons,useGlyphAnimation:()=>J,useGlyphCamera:()=>K,useGlyphSceneContext:()=>I});module.exports=ge(ve);var e=require("@glyphcss/core");var f=require("vue"),F=require("glyphcss");var oe=require("vue"),A=Symbol("glyph-camera");function B(){let o=(0,oe.inject)(A);if(!o)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return o}var y=Symbol("glyph-scene");var N=(0,f.defineComponent)({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(o,{slots:s,attrs:i}){let{cameraRef:l,sceneRerenderRef:a}=B(),n=(0,f.shallowRef)(null),t=(0,f.shallowRef)(null);return(0,f.provide)(y,{sceneRef:t}),(0,f.onMounted)(()=>{let r=n.value;if(!r)return;(0,F.injectGlyphBaseStyles)(r.ownerDocument??void 0);let p={};o.mode!==void 0&&(p.mode=o.mode),o.glyphPalette!==void 0&&(p.glyphPalette=o.glyphPalette),o.useColors!==void 0&&(p.useColors=o.useColors),o.cols!==void 0&&(p.cols=o.cols),o.rows!==void 0&&(p.rows=o.rows),o.cellAspect!==void 0&&(p.cellAspect=o.cellAspect),o.directionalLight!==void 0&&(p.directionalLight=o.directionalLight),o.ambientLight!==void 0&&(p.ambientLight=o.ambientLight),o.autoSize!==void 0&&(p.autoSize=o.autoSize),o.shadow!==void 0&&(p.shadow=o.shadow),l.value!==null&&(p.camera=l.value),t.value=(0,F.createGlyphScene)(r,p),a.value=()=>t.value?.rerender()}),(0,f.onBeforeUnmount)(()=>{t.value?.destroy(),t.value=null,a.value=null}),(0,f.watch)(()=>({mode:o.mode,glyphPalette:o.glyphPalette,useColors:o.useColors,cols:o.cols,rows:o.rows,cellAspect:o.cellAspect,directionalLight:o.directionalLight,ambientLight:o.ambientLight,autoSize:o.autoSize,shadow:o.shadow}),r=>{let p=t.value;if(!p)return;let c={};r.mode!==void 0&&(c.mode=r.mode),r.glyphPalette!==void 0&&(c.glyphPalette=r.glyphPalette),r.useColors!==void 0&&(c.useColors=r.useColors),r.cols!==void 0&&(c.cols=r.cols),r.rows!==void 0&&(c.rows=r.rows),r.cellAspect!==void 0&&(c.cellAspect=r.cellAspect),r.directionalLight!==void 0&&(c.directionalLight=r.directionalLight),r.ambientLight!==void 0&&(c.ambientLight=r.ambientLight),r.autoSize!==void 0&&(c.autoSize=r.autoSize),c.shadow=r.shadow,Object.keys(c).length>0&&p.setOptions(c)},{deep:!1}),()=>{let r=`glyph-host${o.class?` ${o.class}`:""}`;return(0,f.h)("div",{ref:n,class:r,...Object.fromEntries(Object.entries(i).filter(([p])=>p!=="class"))},s.default?.())}}});var d=require("vue"),z=require("@glyphcss/core");var E=(0,d.defineComponent)({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},src:{type:String,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},autoCenter:{type:Boolean,default:!1},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(o,{slots:s}){let i=(0,d.inject)(y);if(!i)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:l}=i,a=(0,d.shallowRef)(null),n=(0,d.shallowRef)(null);(0,d.watch)(()=>o.src,(u,M,Q)=>{if(!u){n.value=null;return}let V=!1;Q(()=>{V=!0}),(0,z.loadMesh)(u).then(Z=>{V||(n.value=Z.polygons)}).catch(()=>{V||(n.value=[])})},{immediate:!0});let t=(0,d.computed)(()=>{let u=o.polygons!==void 0?o.polygons:o.src!==void 0?n.value??[]:o.geometry!==void 0?(0,z.resolveGeometry)(o.geometry,{size:o.size,color:o.color}):[];return o.autoCenter?(0,z.recenterPolygons)(u):u});function r(){let u={};return o.id&&(u.id=o.id),o.position&&(u.position=o.position),o.scale!==void 0&&(u.scale=o.scale),o.rotation&&(u.rotation=o.rotation),u.castShadow=o.castShadow,u.receiveShadow=o.receiveShadow,u}function p(){let u=l.value;if(!u)return;let M=u.add(t.value,r());a.value=M}function c(){a.value?.dispose(),a.value=null}let h=(0,d.watchEffect)(()=>{!l.value||a.value||p()});return(0,d.onBeforeUnmount)(()=>{h(),c()}),(0,d.watch)(t,()=>{c(),p()}),(0,d.watch)(()=>({id:o.id,position:o.position,scale:o.scale,rotation:o.rotation,castShadow:o.castShadow,receiveShadow:o.receiveShadow}),()=>{let u=a.value;u&&(u.setTransform(r()),l.value?.rerender())},{deep:!1}),()=>{let u=`glyph-mesh${o.class?` ${o.class}`:""}`;return(0,d.h)("div",{"data-glyph-mesh-id":o.id,class:u},s.default?.())}}});var k=require("vue"),te=require("@glyphcss/core");var j=(0,k.defineComponent)({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(o,{slots:s}){let i=(0,k.computed)(()=>(0,te.planePolygons)({axis:1,size:o.size,offset:0,color:o.color}));return()=>(0,k.h)(E,{id:o.id,polygons:i.value,position:o.position,rotation:o.rotation??void 0,castShadow:o.castShadow,receiveShadow:o.receiveShadow,class:o.class},s)}});var m=require("vue");var D=(0,m.defineComponent)({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(o,{emit:s,slots:i}){let l=(0,m.inject)(y);if(!l)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:a}=l,n=(0,m.shallowRef)(null),t=(0,m.shallowRef)(null);function r(){let h=a.value;if(!h)return;let u=h.addHotspot({id:o.id,at:o.at,size:o.size},()=>s("click"));n.value=u,t.value=u.el}function p(){n.value?.remove(),n.value=null,t.value=null}let c=(0,m.watchEffect)(()=>{!a.value||n.value||r()});return(0,m.onBeforeUnmount)(()=>{c(),p()}),(0,m.watch)(()=>({id:o.id,at:o.at,size:o.size}),()=>{p(),r()},{deep:!1}),()=>{let h=t.value,u=i.default?.();return h&&u?(0,m.h)(m.Teleport,{to:h},u):null}}});var ne=require("vue");function I(){let o=(0,ne.inject)(y);if(!o)throw new Error("glyphcss: must be used inside a GlyphScene.");return o}var P=require("glyphcss");var R=require("vue"),re=require("glyphcss");var H=(0,R.defineComponent)({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(o,{slots:s}){let i={};o.rotX!==void 0&&(i.rotX=o.rotX),o.rotY!==void 0&&(i.rotY=o.rotY),o.zoom!==void 0&&(i.zoom=o.zoom),o.center!==void 0&&(i.center=o.center);let l=(0,R.shallowRef)((0,re.createGlyphOrthographicCamera)(i)),a=(0,R.shallowRef)(null);function n(){a.value?.()}return(0,R.provide)(A,{cameraRef:l,rerender:n,sceneRerenderRef:a}),(0,R.watch)(()=>({rotX:o.rotX,rotY:o.rotY,zoom:o.zoom}),t=>{let r=l.value;if(!r)return;let p=!1;t.rotX!==void 0&&r.rotX!==t.rotX&&(r.rotX=t.rotX,p=!0),t.rotY!==void 0&&r.rotY!==t.rotY&&(r.rotY=t.rotY,p=!0),t.zoom!==void 0&&r.zoom!==t.zoom&&(r.zoom=t.zoom,p=!0),p&&a.value?.()}),()=>(0,R.h)("div",{class:o.class,style:o.style},s.default?.()??[])}});var O=require("vue"),le=require("glyphcss");var X=(0,O.defineComponent)({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},perspective:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(o,{slots:s}){let i={};o.rotX!==void 0&&(i.rotX=o.rotX),o.rotY!==void 0&&(i.rotY=o.rotY),o.distance!==void 0&&(i.distance=o.distance),o.perspective!==void 0&&(i.perspective=o.perspective),o.zoom!==void 0&&(i.zoom=o.zoom),o.stretch!==void 0&&(i.stretch=o.stretch),o.center!==void 0&&(i.center=o.center);let l=(0,O.shallowRef)((0,le.createGlyphPerspectiveCamera)(i)),a=(0,O.shallowRef)(null);function n(){a.value?.()}return(0,O.provide)(A,{cameraRef:l,rerender:n,sceneRerenderRef:a}),(0,O.watch)(()=>({rotX:o.rotX,rotY:o.rotY,distance:o.distance,perspective:o.perspective,zoom:o.zoom,stretch:o.stretch}),t=>{let r=l.value;if(!r)return;let p=!1;t.rotX!==void 0&&r.rotX!==t.rotX&&(r.rotX=t.rotX,p=!0),t.rotY!==void 0&&r.rotY!==t.rotY&&(r.rotY=t.rotY,p=!0),t.distance!==void 0&&r.distance!==t.distance&&(r.distance=t.distance,p=!0),t.perspective!==void 0&&r.perspective!==t.perspective&&(r.perspective=t.perspective,p=!0),t.zoom!==void 0&&r.zoom!==t.zoom&&(r.zoom=t.zoom,p=!0),t.stretch!==void 0&&r.stretch!==t.stretch&&(r.stretch=t.stretch,p=!0),p&&a.value?.()}),()=>(0,O.h)("div",{class:o.class,style:o.style},s.default?.()??[])}});var ae=require("vue");function K(){let o=(0,ae.inject)(A);if(!o)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return o}var v=require("vue"),ie=require("glyphcss");var U=(0,v.defineComponent)({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(o){let s=(0,v.inject)(y);if(!s)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,v.shallowRef)(null),a=(0,v.watchEffect)(()=>{let n=i.value;if(!n||l.value)return;let t={drag:o.drag,wheel:o.wheel,invert:o.invert,clampPitch:o.clampPitch,animate:o.animate===!1?!1:o.animate};l.value=(0,ie.createGlyphOrbitControls)(n,t)});return(0,v.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,v.watch)(()=>({drag:o.drag,wheel:o.wheel,invert:o.invert,clampPitch:o.clampPitch,animate:o.animate}),n=>{l.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,clampPitch:n.clampPitch,animate:n.animate===!1?!1:n.animate})}),()=>null}});var b=require("vue"),se=require("glyphcss");var Y=(0,b.defineComponent)({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(o){let s=(0,b.inject)(y);if(!s)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,b.shallowRef)(null),a=(0,b.watchEffect)(()=>{let n=i.value;if(!n||l.value)return;let t={drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate===!1?!1:o.animate};l.value=(0,se.createGlyphMapControls)(n,t)});return(0,b.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,b.watch)(()=>({drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate}),n=>{l.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,animate:n.animate===!1?!1:n.animate})}),()=>null}});var S=require("vue"),pe=require("glyphcss");var _=(0,S.defineComponent)({name:"GlyphFirstPersonControls",props:{drag:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},moveSpeed:{type:Number,default:.05},lookSpeed:{type:Number,default:.004},invert:{type:[Boolean,Number],default:!1}},setup(o){let s=(0,S.inject)(y);if(!s)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,S.shallowRef)(null),a=(0,S.watchEffect)(()=>{let n=i.value;if(!n||l.value)return;let t={drag:o.drag,keyboard:o.keyboard,moveSpeed:o.moveSpeed,lookSpeed:o.lookSpeed,invert:o.invert};l.value=(0,pe.createGlyphFirstPersonControls)(n,t)});return(0,S.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,S.watch)(()=>({drag:o.drag,keyboard:o.keyboard,moveSpeed:o.moveSpeed,lookSpeed:o.lookSpeed,invert:o.invert}),n=>{l.value?.update(n)}),()=>null}});var g=require("vue");function Ce(o){let s=o,i=s*.05,l=[];function a(n,t,r){let p=[n[0]-i,n[1]-i,n[2]],c=[t[0]-i,t[1]-i,t[2]],h=[t[0]+i,t[1]+i,t[2]],u=[n[0]+i,n[1]+i,n[2]];l.push({vertices:[p,c,h],color:r}),l.push({vertices:[p,h,u],color:r})}return a([0,0,0],[s,0,0],"#ff0000"),a([0,0,0],[0,s,0],"#00ff00"),a([0,0,0],[0,0,s],"#0000ff"),l}var W=(0,g.defineComponent)({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(o){let s=(0,g.inject)(y);if(!s)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,g.shallowRef)(null),a=(0,g.computed)(()=>Ce(o.size??1));function n(){let t=i.value;t&&(l.value=t.add(a.value))}return(0,g.onMounted)(n),(0,g.onBeforeUnmount)(()=>{l.value?.dispose(),l.value=null}),(0,g.watch)(a,()=>{l.value?.dispose(),l.value=null,n()}),()=>null}});var C=require("vue");function Pe(o,s,i){let[l,a,n]=o,t=i,r=[l,a,n+t],p=[l,a,n-t],c=[l+t,a,n],h=[l-t,a,n],u=[l,a+t,n],M=[l,a-t,n];return[{vertices:[r,c,u],color:s},{vertices:[r,u,h],color:s},{vertices:[r,h,M],color:s},{vertices:[r,M,c],color:s},{vertices:[p,u,c],color:s},{vertices:[p,h,u],color:s},{vertices:[p,M,h],color:s},{vertices:[p,c,M],color:s}]}var q=(0,C.defineComponent)({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(o){let s=(0,C.inject)(y);if(!s)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,C.shallowRef)(null),a=(0,C.computed)(()=>Pe(o.position??[1,1,1],o.color??"#ffff00",o.size??.1));function n(){let t=i.value;t&&(l.value=t.add(a.value))}return(0,C.onMounted)(n),(0,C.onBeforeUnmount)(()=>{l.value?.dispose(),l.value=null}),(0,C.watch)(a,()=>{l.value?.dispose(),l.value=null,n()}),()=>null}});var $=require("glyphcss");var x=require("vue"),ue=require("@glyphcss/core");function L(o){return o&&typeof o=="object"&&"value"in o?o.value:o}function J(o,s,i){let l=(0,x.ref)(null),a=null,n=null,t=null,r=(0,x.ref)(0);function p(){return i==null?l.value:L(i)??l.value}function c(){n!==null&&(cancelAnimationFrame(n),n=null),t=null}function h(){c(),a&&(a.stopAllAction(),a.uncacheRoot(),a=null,r.value++)}function u(){if(n!==null)return;function G(w){if(t===null){t=w,n=requestAnimationFrame(G);return}let T=(w-t)/1e3;t=w,a?.update(T),n=requestAnimationFrame(G)}n=requestAnimationFrame(G)}function M(){h();let G=L(o),w=L(s);if(!G||G.length===0||!w)return;let T=p();T&&(a=(0,ue.createGlyphAnimationMixer)(T,w),r.value++,u())}let Q=(0,x.watch)(()=>{let G=L(o),w=L(s),T=i!=null?L(i):l.value;return{c:G,ctrl:w,r:T}},()=>M(),{immediate:!0,deep:!1});(0,x.onUnmounted)(()=>{Q(),h()});let V=(0,x.computed)(()=>L(o)??[]),Z=(0,x.computed)(()=>V.value.map(G=>G.name)),ce=(0,x.computed)(()=>(r.value,a)),ye=(0,x.computed)(()=>{r.value;let G=V.value,w={};for(let T of G)Object.defineProperty(w,T.name,{enumerable:!0,get(){if(!a)return null;try{return a.clipAction(T.name)}catch{return null}}});return w});return{ref:l,mixer:ce,clips:V,names:Z,actions:ye}}0&&(module.exports={BASE_TILE,CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION,GlyphAxesHelper,GlyphCamera,GlyphCameraContextKey,GlyphDirectionalLightHelper,GlyphFirstPersonControls,GlyphGround,GlyphHotspot,GlyphMapControls,GlyphMesh,GlyphOrbitControls,GlyphOrthographicCamera,GlyphPerspectiveCamera,GlyphScene,GlyphSceneContextKey,LoopOnce,LoopPingPong,LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons,arrowPolygons,axesHelperPolygons,bakeSolidTextureSampledPolygons,bakeSolidTextureSamples,bipyramidPolygons,buildSceneContext,cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons,cameraCullNormalKey,cameraCullVisibleSignature,cameraFacingDepth,clampChannel,computeSceneBbox,computeShapeLighting,conePolygons,coverPlanarPolygons,createGlyphAnimationMixer,createIsometricCamera,cubePolygons,cuboctahedronPolygons,cullInteriorPolygons,cylinderPolygons,deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons,dodecahedronPolygons,findGlyphMeshHandle,findMeshUnderPoint,formatColor,greatDodecahedronPolygons,greatIcosahedronPolygons,greatStellatedDodecahedronPolygons,icosahedronPolygons,icosidodecahedronPolygons,injectGlyphBaseStyles,inverseRotateVec3,isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups,loadMesh,mergePolygons,normalFacesCamera,normalizeInvertMultiplier,normalizePolygons,octahedronPolygons,optimizeMeshPolygons,parseColor,parseGltf,parseHexColor,parseMtl,parseObj,parsePureColor,parseRgbColor,parseVox,pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons,planePolygons,pointInMeshElement,polygonCssSurfaceNormal,polygonFaces,polygonFacesCamera,prismPolygons,pyramidPolygons,resolveGeometry,rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons,ringPolygons,ringQuadPolygons,rotateVec3,shadeColor,smallStellatedDodecahedronPolygons,snubCubePolygons,snubDodecahedronPolygons,spherePolygons,tetrahedronPolygons,tetrakisHexahedronPolygons,torusPolygons,trapezohedronPolygons,triakisIcosahedronPolygons,triakisOctahedronPolygons,triakisTetrahedronPolygons,truncatedCubePolygons,truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons,truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons,truncatedTetrahedronPolygons,useGlyphAnimation,useGlyphCamera,useGlyphSceneContext});
|
|
1
|
+
"use strict";var ee=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var fe=(t,s)=>{for(var i in s)ee(t,i,{get:s[i],enumerable:!0})},Ge=(t,s,i,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of he(s))!me.call(t,a)&&a!==i&&ee(t,a,{get:()=>s[a],enumerable:!(l=de(s,a))||l.enumerable});return t};var ge=t=>Ge(ee({},"__esModule",{value:!0}),t);var ve={};fe(ve,{BASE_TILE:()=>e.BASE_TILE,CAMERA_BACKFACE_CULL_EPS:()=>e.CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE:()=>e.DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION:()=>e.DEFAULT_PROJECTION,GlyphAxesHelper:()=>W,GlyphCamera:()=>H,GlyphCameraContextKey:()=>A,GlyphDirectionalLightHelper:()=>q,GlyphFirstPersonControls:()=>_,GlyphGround:()=>F,GlyphHotspot:()=>D,GlyphMapControls:()=>U,GlyphMesh:()=>z,GlyphOrbitControls:()=>K,GlyphOrthographicCamera:()=>H,GlyphPerspectiveCamera:()=>Y,GlyphScene:()=>B,GlyphSceneContextKey:()=>y,LoopOnce:()=>e.LoopOnce,LoopPingPong:()=>e.LoopPingPong,LoopRepeat:()=>e.LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS:()=>e.VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT:()=>e.VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons:()=>e.antiprismPolygons,arrowPolygons:()=>e.arrowPolygons,axesHelperPolygons:()=>e.axesHelperPolygons,bakeSolidTextureSampledPolygons:()=>e.bakeSolidTextureSampledPolygons,bakeSolidTextureSamples:()=>e.bakeSolidTextureSamples,bipyramidPolygons:()=>e.bipyramidPolygons,buildSceneContext:()=>e.buildSceneContext,cameraCullNormalGroups:()=>e.cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons:()=>e.cameraCullNormalGroupsFromPolygons,cameraCullNormalKey:()=>e.cameraCullNormalKey,cameraCullVisibleSignature:()=>e.cameraCullVisibleSignature,cameraFacingDepth:()=>e.cameraFacingDepth,clampChannel:()=>e.clampChannel,computeSceneBbox:()=>e.computeSceneBbox,computeShapeLighting:()=>e.computeShapeLighting,conePolygons:()=>e.conePolygons,coverPlanarPolygons:()=>e.coverPlanarPolygons,createGlyphAnimationMixer:()=>e.createGlyphAnimationMixer,createIsometricCamera:()=>e.createIsometricCamera,cubePolygons:()=>e.cubePolygons,cuboctahedronPolygons:()=>e.cuboctahedronPolygons,cullInteriorPolygons:()=>e.cullInteriorPolygons,cylinderPolygons:()=>e.cylinderPolygons,deltoidalHexecontahedronPolygons:()=>e.deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons:()=>e.deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons:()=>e.disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons:()=>e.disdyakisTriacontahedronPolygons,dodecahedronPolygons:()=>e.dodecahedronPolygons,findGlyphMeshHandle:()=>P.findGlyphMeshHandle,findMeshUnderPoint:()=>P.findMeshUnderPoint,formatColor:()=>e.formatColor,greatDodecahedronPolygons:()=>e.greatDodecahedronPolygons,greatIcosahedronPolygons:()=>e.greatIcosahedronPolygons,greatStellatedDodecahedronPolygons:()=>e.greatStellatedDodecahedronPolygons,icosahedronPolygons:()=>e.icosahedronPolygons,icosidodecahedronPolygons:()=>e.icosidodecahedronPolygons,injectGlyphBaseStyles:()=>Z.injectGlyphBaseStyles,inverseRotateVec3:()=>e.inverseRotateVec3,isAxisAlignedSurfaceNormal:()=>e.isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups:()=>e.isVoxelCameraCullableNormalGroups,loadMesh:()=>e.loadMesh,mergePolygons:()=>e.mergePolygons,normalFacesCamera:()=>e.normalFacesCamera,normalizeInvertMultiplier:()=>e.normalizeInvertMultiplier,normalizePolygons:()=>e.normalizePolygons,octahedronPolygons:()=>e.octahedronPolygons,optimizeMeshPolygons:()=>e.optimizeMeshPolygons,parseColor:()=>e.parseColor,parseGltf:()=>e.parseGltf,parseHexColor:()=>e.parseHexColor,parseMtl:()=>e.parseMtl,parseObj:()=>e.parseObj,parsePureColor:()=>e.parsePureColor,parseRgbColor:()=>e.parseRgbColor,parseVox:()=>e.parseVox,pentagonalHexecontahedronPolygons:()=>e.pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons:()=>e.pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons:()=>e.pentakisDodecahedronPolygons,planePolygons:()=>e.planePolygons,pointInMeshElement:()=>P.pointInMeshElement,polygonCssSurfaceNormal:()=>e.polygonCssSurfaceNormal,polygonFaces:()=>e.polygonFaces,polygonFacesCamera:()=>e.polygonFacesCamera,prismPolygons:()=>e.prismPolygons,pyramidPolygons:()=>e.pyramidPolygons,resolveGeometry:()=>e.resolveGeometry,rhombicDodecahedronPolygons:()=>e.rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons:()=>e.rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons:()=>e.rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons:()=>e.rhombicuboctahedronPolygons,ringPolygons:()=>e.ringPolygons,ringQuadPolygons:()=>e.ringQuadPolygons,rotateVec3:()=>e.rotateVec3,shadeColor:()=>e.shadeColor,smallStellatedDodecahedronPolygons:()=>e.smallStellatedDodecahedronPolygons,snubCubePolygons:()=>e.snubCubePolygons,snubDodecahedronPolygons:()=>e.snubDodecahedronPolygons,spherePolygons:()=>e.spherePolygons,tetrahedronPolygons:()=>e.tetrahedronPolygons,tetrakisHexahedronPolygons:()=>e.tetrakisHexahedronPolygons,torusPolygons:()=>e.torusPolygons,trapezohedronPolygons:()=>e.trapezohedronPolygons,triakisIcosahedronPolygons:()=>e.triakisIcosahedronPolygons,triakisOctahedronPolygons:()=>e.triakisOctahedronPolygons,triakisTetrahedronPolygons:()=>e.triakisTetrahedronPolygons,truncatedCubePolygons:()=>e.truncatedCubePolygons,truncatedCuboctahedronPolygons:()=>e.truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons:()=>e.truncatedDodecahedronPolygons,truncatedIcosahedronPolygons:()=>e.truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons:()=>e.truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons:()=>e.truncatedOctahedronPolygons,truncatedTetrahedronPolygons:()=>e.truncatedTetrahedronPolygons,useGlyphAnimation:()=>$,useGlyphCamera:()=>X,useGlyphSceneContext:()=>I});module.exports=ge(ve);var e=require("@glyphcss/core");var f=require("vue"),k=require("glyphcss");var te=require("vue"),A=Symbol("glyph-camera");function j(){let t=(0,te.inject)(A);if(!t)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return t}var y=Symbol("glyph-scene");var B=(0,f.defineComponent)({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(t,{slots:s,attrs:i}){let{cameraRef:l,sceneRerenderRef:a}=j(),r=(0,f.shallowRef)(null),o=(0,f.shallowRef)(null);return(0,f.provide)(y,{sceneRef:o}),(0,f.onMounted)(()=>{let n=r.value;if(!n)return;(0,k.injectGlyphBaseStyles)(n.ownerDocument??void 0);let p={};t.mode!==void 0&&(p.mode=t.mode),t.glyphPalette!==void 0&&(p.glyphPalette=t.glyphPalette),t.useColors!==void 0&&(p.useColors=t.useColors),t.cols!==void 0&&(p.cols=t.cols),t.rows!==void 0&&(p.rows=t.rows),t.cellAspect!==void 0&&(p.cellAspect=t.cellAspect),t.directionalLight!==void 0&&(p.directionalLight=t.directionalLight),t.ambientLight!==void 0&&(p.ambientLight=t.ambientLight),t.autoSize!==void 0&&(p.autoSize=t.autoSize),t.shadow!==void 0&&(p.shadow=t.shadow),l.value!==null&&(p.camera=l.value),o.value=(0,k.createGlyphScene)(n,p),a.value=()=>o.value?.rerender()}),(0,f.onBeforeUnmount)(()=>{o.value?.destroy(),o.value=null,a.value=null}),(0,f.watch)(()=>({mode:t.mode,glyphPalette:t.glyphPalette,useColors:t.useColors,cols:t.cols,rows:t.rows,cellAspect:t.cellAspect,directionalLight:t.directionalLight,ambientLight:t.ambientLight,autoSize:t.autoSize,shadow:t.shadow}),n=>{let p=o.value;if(!p)return;let c={};n.mode!==void 0&&(c.mode=n.mode),n.glyphPalette!==void 0&&(c.glyphPalette=n.glyphPalette),n.useColors!==void 0&&(c.useColors=n.useColors),n.cols!==void 0&&(c.cols=n.cols),n.rows!==void 0&&(c.rows=n.rows),n.cellAspect!==void 0&&(c.cellAspect=n.cellAspect),n.directionalLight!==void 0&&(c.directionalLight=n.directionalLight),n.ambientLight!==void 0&&(c.ambientLight=n.ambientLight),n.autoSize!==void 0&&(c.autoSize=n.autoSize),c.shadow=n.shadow,Object.keys(c).length>0&&p.setOptions(c)},{deep:!1}),()=>{let n=`glyph-host${t.class?` ${t.class}`:""}`;return(0,f.h)("div",{ref:r,class:n,...Object.fromEntries(Object.entries(i).filter(([p])=>p!=="class"))},s.default?.())}}});var d=require("vue"),L=require("@glyphcss/core");var z=(0,d.defineComponent)({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},src:{type:String,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},autoCenter:{type:Boolean,default:!1},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(t,{slots:s}){let i=(0,d.inject)(y);if(!i)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:l}=i,a=(0,d.shallowRef)(null),r=(0,d.shallowRef)(null);(0,d.watch)(()=>t.src,(u,M,J)=>{if(!u){r.value=null;return}let T=!1;J(()=>{T=!0}),(0,L.loadMesh)(u).then(Q=>{T||(r.value=Q.polygons)}).catch(()=>{T||(r.value=[])})},{immediate:!0});let o=(0,d.computed)(()=>{let u=t.polygons!==void 0?t.polygons:t.src!==void 0?r.value??[]:t.geometry!==void 0?(0,L.resolveGeometry)(t.geometry,{size:t.size,color:t.color}):[];return t.autoCenter?(0,L.recenterPolygons)(u):u});function n(){let u={};return t.id&&(u.id=t.id),t.position&&(u.position=t.position),t.scale!==void 0&&(u.scale=t.scale),t.rotation&&(u.rotation=t.rotation),u.castShadow=t.castShadow,u.receiveShadow=t.receiveShadow,u}function p(){let u=l.value;if(!u)return;let M=u.add(o.value,n());a.value=M}function c(){a.value?.dispose(),a.value=null}let h=(0,d.watchEffect)(()=>{!l.value||a.value||p()});return(0,d.onBeforeUnmount)(()=>{h(),c()}),(0,d.watch)(o,()=>{c(),p()}),(0,d.watch)(()=>({id:t.id,position:t.position,scale:t.scale,rotation:t.rotation,castShadow:t.castShadow,receiveShadow:t.receiveShadow}),()=>{let u=a.value;u&&(u.setTransform(n()),l.value?.rerender())},{deep:!1}),()=>{let u=`glyph-mesh${t.class?` ${t.class}`:""}`;return(0,d.h)("div",{"data-glyph-mesh-id":t.id,class:u},s.default?.())}}});var N=require("vue"),oe=require("@glyphcss/core");var F=(0,N.defineComponent)({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(t,{slots:s}){let i=(0,N.computed)(()=>(0,oe.planePolygons)({axis:1,size:t.size,offset:0,color:t.color}));return()=>(0,N.h)(z,{id:t.id,polygons:i.value,position:t.position,rotation:t.rotation??void 0,castShadow:t.castShadow,receiveShadow:t.receiveShadow,class:t.class},s)}});var m=require("vue");var D=(0,m.defineComponent)({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(t,{emit:s,slots:i}){let l=(0,m.inject)(y);if(!l)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:a}=l,r=(0,m.shallowRef)(null),o=(0,m.shallowRef)(null);function n(){let h=a.value;if(!h)return;let u=h.addHotspot({id:t.id,at:t.at,size:t.size},()=>s("click"));r.value=u,o.value=u.el}function p(){r.value?.remove(),r.value=null,o.value=null}let c=(0,m.watchEffect)(()=>{!a.value||r.value||n()});return(0,m.onBeforeUnmount)(()=>{c(),p()}),(0,m.watch)(()=>({id:t.id,at:t.at,size:t.size}),()=>{p(),n()},{deep:!1}),()=>{let h=o.value,u=i.default?.();return h&&u?(0,m.h)(m.Teleport,{to:h},u):null}}});var ne=require("vue");function I(){let t=(0,ne.inject)(y);if(!t)throw new Error("glyphcss: must be used inside a GlyphScene.");return t}var P=require("glyphcss");var R=require("vue"),re=require("glyphcss");var H=(0,R.defineComponent)({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(t,{slots:s}){let i={};t.rotX!==void 0&&(i.rotX=t.rotX),t.rotY!==void 0&&(i.rotY=t.rotY),t.zoom!==void 0&&(i.zoom=t.zoom),t.center!==void 0&&(i.center=t.center);let l=(0,R.shallowRef)((0,re.createGlyphOrthographicCamera)(i)),a=(0,R.shallowRef)(null);function r(){a.value?.()}return(0,R.provide)(A,{cameraRef:l,rerender:r,sceneRerenderRef:a}),(0,R.watch)(()=>({rotX:t.rotX,rotY:t.rotY,zoom:t.zoom}),o=>{let n=l.value;if(!n)return;let p=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,p=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,p=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,p=!0),p&&a.value?.()}),()=>(0,R.h)("div",{class:t.class,style:t.style},s.default?.()??[])}});var O=require("vue"),le=require("glyphcss");var Y=(0,O.defineComponent)({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},perspective:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(t,{slots:s}){let i={};t.rotX!==void 0&&(i.rotX=t.rotX),t.rotY!==void 0&&(i.rotY=t.rotY),t.distance!==void 0&&(i.distance=t.distance),t.perspective!==void 0&&(i.perspective=t.perspective),t.zoom!==void 0&&(i.zoom=t.zoom),t.stretch!==void 0&&(i.stretch=t.stretch),t.center!==void 0&&(i.center=t.center);let l=(0,O.shallowRef)((0,le.createGlyphPerspectiveCamera)(i)),a=(0,O.shallowRef)(null);function r(){a.value?.()}return(0,O.provide)(A,{cameraRef:l,rerender:r,sceneRerenderRef:a}),(0,O.watch)(()=>({rotX:t.rotX,rotY:t.rotY,distance:t.distance,perspective:t.perspective,zoom:t.zoom,stretch:t.stretch}),o=>{let n=l.value;if(!n)return;let p=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,p=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,p=!0),o.distance!==void 0&&n.distance!==o.distance&&(n.distance=o.distance,p=!0),o.perspective!==void 0&&n.perspective!==o.perspective&&(n.perspective=o.perspective,p=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,p=!0),o.stretch!==void 0&&n.stretch!==o.stretch&&(n.stretch=o.stretch,p=!0),p&&a.value?.()}),()=>(0,O.h)("div",{class:t.class,style:t.style},s.default?.()??[])}});var ae=require("vue");function X(){let t=(0,ae.inject)(A);if(!t)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return t}var v=require("vue"),ie=require("glyphcss");var K=(0,v.defineComponent)({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(t){let s=(0,v.inject)(y);if(!s)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,v.shallowRef)(null),a=(0,v.watchEffect)(()=>{let r=i.value;if(!r||l.value)return;let o={drag:t.drag,wheel:t.wheel,invert:t.invert,clampPitch:t.clampPitch,animate:t.animate===!1?!1:t.animate};l.value=(0,ie.createGlyphOrbitControls)(r,o)});return(0,v.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,v.watch)(()=>({drag:t.drag,wheel:t.wheel,invert:t.invert,clampPitch:t.clampPitch,animate:t.animate}),r=>{l.value?.update({drag:r.drag,wheel:r.wheel,invert:r.invert,clampPitch:r.clampPitch,animate:r.animate===!1?!1:r.animate})}),()=>null}});var b=require("vue"),se=require("glyphcss");var U=(0,b.defineComponent)({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(t){let s=(0,b.inject)(y);if(!s)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,b.shallowRef)(null),a=(0,b.watchEffect)(()=>{let r=i.value;if(!r||l.value)return;let o={drag:t.drag,wheel:t.wheel,invert:t.invert,animate:t.animate===!1?!1:t.animate};l.value=(0,se.createGlyphMapControls)(r,o)});return(0,b.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,b.watch)(()=>({drag:t.drag,wheel:t.wheel,invert:t.invert,animate:t.animate}),r=>{l.value?.update({drag:r.drag,wheel:r.wheel,invert:r.invert,animate:r.animate===!1?!1:r.animate})}),()=>null}});var S=require("vue"),pe=require("glyphcss");var _=(0,S.defineComponent)({name:"GlyphFirstPersonControls",props:{enabled:{type:Boolean,default:void 0},lookEnabled:{type:Boolean,default:void 0},moveEnabled:{type:Boolean,default:void 0},jumpEnabled:{type:Boolean,default:void 0},crouchEnabled:{type:Boolean,default:void 0},lookSensitivity:{type:Number,default:void 0},invertY:{type:Boolean,default:void 0},moveSpeed:{type:Number,default:void 0},jumpVelocity:{type:Number,default:void 0},gravity:{type:Number,default:void 0},eyeHeight:{type:Number,default:void 0},crouchHeight:{type:Number,default:void 0},groundZ:{type:Number,default:void 0},minPitch:{type:Number,default:void 0},maxPitch:{type:Number,default:void 0}},setup(t){let s=(0,S.inject)(y);if(!s)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,S.shallowRef)(null),a=()=>({enabled:t.enabled,lookEnabled:t.lookEnabled,moveEnabled:t.moveEnabled,jumpEnabled:t.jumpEnabled,crouchEnabled:t.crouchEnabled,lookSensitivity:t.lookSensitivity,invertY:t.invertY,moveSpeed:t.moveSpeed,jumpVelocity:t.jumpVelocity,gravity:t.gravity,eyeHeight:t.eyeHeight,crouchHeight:t.crouchHeight,groundZ:t.groundZ,minPitch:t.minPitch,maxPitch:t.maxPitch}),r=(0,S.watchEffect)(()=>{let o=i.value;!o||l.value||(l.value=(0,pe.createGlyphFirstPersonControls)(o,a()))});return(0,S.onBeforeUnmount)(()=>{r(),l.value?.destroy(),l.value=null}),(0,S.watch)(a,o=>{l.value?.update(o)}),()=>null}});var g=require("vue");function Ce(t){let s=t,i=s*.05,l=[];function a(r,o,n){let p=[r[0]-i,r[1]-i,r[2]],c=[o[0]-i,o[1]-i,o[2]],h=[o[0]+i,o[1]+i,o[2]],u=[r[0]+i,r[1]+i,r[2]];l.push({vertices:[p,c,h],color:n}),l.push({vertices:[p,h,u],color:n})}return a([0,0,0],[s,0,0],"#ff0000"),a([0,0,0],[0,s,0],"#00ff00"),a([0,0,0],[0,0,s],"#0000ff"),l}var W=(0,g.defineComponent)({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(t){let s=(0,g.inject)(y);if(!s)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,g.shallowRef)(null),a=(0,g.computed)(()=>Ce(t.size??1));function r(){let o=i.value;o&&(l.value=o.add(a.value))}return(0,g.onMounted)(r),(0,g.onBeforeUnmount)(()=>{l.value?.dispose(),l.value=null}),(0,g.watch)(a,()=>{l.value?.dispose(),l.value=null,r()}),()=>null}});var C=require("vue");function Pe(t,s,i){let[l,a,r]=t,o=i,n=[l,a,r+o],p=[l,a,r-o],c=[l+o,a,r],h=[l-o,a,r],u=[l,a+o,r],M=[l,a-o,r];return[{vertices:[n,c,u],color:s},{vertices:[n,u,h],color:s},{vertices:[n,h,M],color:s},{vertices:[n,M,c],color:s},{vertices:[p,u,c],color:s},{vertices:[p,h,u],color:s},{vertices:[p,M,h],color:s},{vertices:[p,c,M],color:s}]}var q=(0,C.defineComponent)({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(t){let s=(0,C.inject)(y);if(!s)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,C.shallowRef)(null),a=(0,C.computed)(()=>Pe(t.position??[1,1,1],t.color??"#ffff00",t.size??.1));function r(){let o=i.value;o&&(l.value=o.add(a.value))}return(0,C.onMounted)(r),(0,C.onBeforeUnmount)(()=>{l.value?.dispose(),l.value=null}),(0,C.watch)(a,()=>{l.value?.dispose(),l.value=null,r()}),()=>null}});var Z=require("glyphcss");var x=require("vue"),ue=require("@glyphcss/core");function V(t){return t&&typeof t=="object"&&"value"in t?t.value:t}function $(t,s,i){let l=(0,x.ref)(null),a=null,r=null,o=null,n=(0,x.ref)(0);function p(){return i==null?l.value:V(i)??l.value}function c(){r!==null&&(cancelAnimationFrame(r),r=null),o=null}function h(){c(),a&&(a.stopAllAction(),a.uncacheRoot(),a=null,n.value++)}function u(){if(r!==null)return;function G(w){if(o===null){o=w,r=requestAnimationFrame(G);return}let E=(w-o)/1e3;o=w,a?.update(E),r=requestAnimationFrame(G)}r=requestAnimationFrame(G)}function M(){h();let G=V(t),w=V(s);if(!G||G.length===0||!w)return;let E=p();E&&(a=(0,ue.createGlyphAnimationMixer)(E,w),n.value++,u())}let J=(0,x.watch)(()=>{let G=V(t),w=V(s),E=i!=null?V(i):l.value;return{c:G,ctrl:w,r:E}},()=>M(),{immediate:!0,deep:!1});(0,x.onUnmounted)(()=>{J(),h()});let T=(0,x.computed)(()=>V(t)??[]),Q=(0,x.computed)(()=>T.value.map(G=>G.name)),ce=(0,x.computed)(()=>(n.value,a)),ye=(0,x.computed)(()=>{n.value;let G=T.value,w={};for(let E of G)Object.defineProperty(w,E.name,{enumerable:!0,get(){if(!a)return null;try{return a.clipAction(E.name)}catch{return null}}});return w});return{ref:l,mixer:ce,clips:T,names:Q,actions:ye}}0&&(module.exports={BASE_TILE,CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION,GlyphAxesHelper,GlyphCamera,GlyphCameraContextKey,GlyphDirectionalLightHelper,GlyphFirstPersonControls,GlyphGround,GlyphHotspot,GlyphMapControls,GlyphMesh,GlyphOrbitControls,GlyphOrthographicCamera,GlyphPerspectiveCamera,GlyphScene,GlyphSceneContextKey,LoopOnce,LoopPingPong,LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons,arrowPolygons,axesHelperPolygons,bakeSolidTextureSampledPolygons,bakeSolidTextureSamples,bipyramidPolygons,buildSceneContext,cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons,cameraCullNormalKey,cameraCullVisibleSignature,cameraFacingDepth,clampChannel,computeSceneBbox,computeShapeLighting,conePolygons,coverPlanarPolygons,createGlyphAnimationMixer,createIsometricCamera,cubePolygons,cuboctahedronPolygons,cullInteriorPolygons,cylinderPolygons,deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons,dodecahedronPolygons,findGlyphMeshHandle,findMeshUnderPoint,formatColor,greatDodecahedronPolygons,greatIcosahedronPolygons,greatStellatedDodecahedronPolygons,icosahedronPolygons,icosidodecahedronPolygons,injectGlyphBaseStyles,inverseRotateVec3,isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups,loadMesh,mergePolygons,normalFacesCamera,normalizeInvertMultiplier,normalizePolygons,octahedronPolygons,optimizeMeshPolygons,parseColor,parseGltf,parseHexColor,parseMtl,parseObj,parsePureColor,parseRgbColor,parseVox,pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons,planePolygons,pointInMeshElement,polygonCssSurfaceNormal,polygonFaces,polygonFacesCamera,prismPolygons,pyramidPolygons,resolveGeometry,rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons,ringPolygons,ringQuadPolygons,rotateVec3,shadeColor,smallStellatedDodecahedronPolygons,snubCubePolygons,snubDodecahedronPolygons,spherePolygons,tetrahedronPolygons,tetrakisHexahedronPolygons,torusPolygons,trapezohedronPolygons,triakisIcosahedronPolygons,triakisOctahedronPolygons,triakisTetrahedronPolygons,truncatedCubePolygons,truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons,truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons,truncatedTetrahedronPolygons,useGlyphAnimation,useGlyphCamera,useGlyphSceneContext});
|
package/dist/index.d.cts
CHANGED
|
@@ -832,60 +832,160 @@ declare const GlyphMapControls: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
832
832
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
833
833
|
|
|
834
834
|
interface GlyphFirstPersonControlsProps {
|
|
835
|
-
|
|
836
|
-
|
|
835
|
+
enabled?: boolean;
|
|
836
|
+
lookEnabled?: boolean;
|
|
837
|
+
moveEnabled?: boolean;
|
|
838
|
+
jumpEnabled?: boolean;
|
|
839
|
+
crouchEnabled?: boolean;
|
|
840
|
+
lookSensitivity?: number;
|
|
841
|
+
invertY?: boolean;
|
|
837
842
|
moveSpeed?: number;
|
|
838
|
-
|
|
839
|
-
|
|
843
|
+
jumpVelocity?: number;
|
|
844
|
+
gravity?: number;
|
|
845
|
+
eyeHeight?: number;
|
|
846
|
+
crouchHeight?: number;
|
|
847
|
+
groundZ?: number;
|
|
848
|
+
minPitch?: number;
|
|
849
|
+
maxPitch?: number;
|
|
840
850
|
}
|
|
841
851
|
declare const GlyphFirstPersonControls: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
842
|
-
|
|
852
|
+
enabled: {
|
|
843
853
|
type: BooleanConstructor;
|
|
844
|
-
default:
|
|
854
|
+
default: undefined;
|
|
845
855
|
};
|
|
846
|
-
|
|
856
|
+
lookEnabled: {
|
|
847
857
|
type: BooleanConstructor;
|
|
848
|
-
default:
|
|
858
|
+
default: undefined;
|
|
859
|
+
};
|
|
860
|
+
moveEnabled: {
|
|
861
|
+
type: BooleanConstructor;
|
|
862
|
+
default: undefined;
|
|
863
|
+
};
|
|
864
|
+
jumpEnabled: {
|
|
865
|
+
type: BooleanConstructor;
|
|
866
|
+
default: undefined;
|
|
867
|
+
};
|
|
868
|
+
crouchEnabled: {
|
|
869
|
+
type: BooleanConstructor;
|
|
870
|
+
default: undefined;
|
|
871
|
+
};
|
|
872
|
+
lookSensitivity: {
|
|
873
|
+
type: NumberConstructor;
|
|
874
|
+
default: undefined;
|
|
875
|
+
};
|
|
876
|
+
invertY: {
|
|
877
|
+
type: BooleanConstructor;
|
|
878
|
+
default: undefined;
|
|
849
879
|
};
|
|
850
880
|
moveSpeed: {
|
|
851
881
|
type: NumberConstructor;
|
|
852
|
-
default:
|
|
882
|
+
default: undefined;
|
|
853
883
|
};
|
|
854
|
-
|
|
884
|
+
jumpVelocity: {
|
|
855
885
|
type: NumberConstructor;
|
|
856
|
-
default:
|
|
886
|
+
default: undefined;
|
|
857
887
|
};
|
|
858
|
-
|
|
859
|
-
type:
|
|
860
|
-
default:
|
|
888
|
+
gravity: {
|
|
889
|
+
type: NumberConstructor;
|
|
890
|
+
default: undefined;
|
|
891
|
+
};
|
|
892
|
+
eyeHeight: {
|
|
893
|
+
type: NumberConstructor;
|
|
894
|
+
default: undefined;
|
|
895
|
+
};
|
|
896
|
+
crouchHeight: {
|
|
897
|
+
type: NumberConstructor;
|
|
898
|
+
default: undefined;
|
|
899
|
+
};
|
|
900
|
+
groundZ: {
|
|
901
|
+
type: NumberConstructor;
|
|
902
|
+
default: undefined;
|
|
903
|
+
};
|
|
904
|
+
minPitch: {
|
|
905
|
+
type: NumberConstructor;
|
|
906
|
+
default: undefined;
|
|
907
|
+
};
|
|
908
|
+
maxPitch: {
|
|
909
|
+
type: NumberConstructor;
|
|
910
|
+
default: undefined;
|
|
861
911
|
};
|
|
862
912
|
}>, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
863
|
-
|
|
913
|
+
enabled: {
|
|
864
914
|
type: BooleanConstructor;
|
|
865
|
-
default:
|
|
915
|
+
default: undefined;
|
|
866
916
|
};
|
|
867
|
-
|
|
917
|
+
lookEnabled: {
|
|
868
918
|
type: BooleanConstructor;
|
|
869
|
-
default:
|
|
919
|
+
default: undefined;
|
|
920
|
+
};
|
|
921
|
+
moveEnabled: {
|
|
922
|
+
type: BooleanConstructor;
|
|
923
|
+
default: undefined;
|
|
924
|
+
};
|
|
925
|
+
jumpEnabled: {
|
|
926
|
+
type: BooleanConstructor;
|
|
927
|
+
default: undefined;
|
|
928
|
+
};
|
|
929
|
+
crouchEnabled: {
|
|
930
|
+
type: BooleanConstructor;
|
|
931
|
+
default: undefined;
|
|
932
|
+
};
|
|
933
|
+
lookSensitivity: {
|
|
934
|
+
type: NumberConstructor;
|
|
935
|
+
default: undefined;
|
|
936
|
+
};
|
|
937
|
+
invertY: {
|
|
938
|
+
type: BooleanConstructor;
|
|
939
|
+
default: undefined;
|
|
870
940
|
};
|
|
871
941
|
moveSpeed: {
|
|
872
942
|
type: NumberConstructor;
|
|
873
|
-
default:
|
|
943
|
+
default: undefined;
|
|
874
944
|
};
|
|
875
|
-
|
|
945
|
+
jumpVelocity: {
|
|
876
946
|
type: NumberConstructor;
|
|
877
|
-
default:
|
|
947
|
+
default: undefined;
|
|
878
948
|
};
|
|
879
|
-
|
|
880
|
-
type:
|
|
881
|
-
default:
|
|
949
|
+
gravity: {
|
|
950
|
+
type: NumberConstructor;
|
|
951
|
+
default: undefined;
|
|
952
|
+
};
|
|
953
|
+
eyeHeight: {
|
|
954
|
+
type: NumberConstructor;
|
|
955
|
+
default: undefined;
|
|
956
|
+
};
|
|
957
|
+
crouchHeight: {
|
|
958
|
+
type: NumberConstructor;
|
|
959
|
+
default: undefined;
|
|
960
|
+
};
|
|
961
|
+
groundZ: {
|
|
962
|
+
type: NumberConstructor;
|
|
963
|
+
default: undefined;
|
|
964
|
+
};
|
|
965
|
+
minPitch: {
|
|
966
|
+
type: NumberConstructor;
|
|
967
|
+
default: undefined;
|
|
968
|
+
};
|
|
969
|
+
maxPitch: {
|
|
970
|
+
type: NumberConstructor;
|
|
971
|
+
default: undefined;
|
|
882
972
|
};
|
|
883
973
|
}>> & Readonly<{}>, {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
974
|
+
enabled: boolean;
|
|
975
|
+
lookEnabled: boolean;
|
|
976
|
+
moveEnabled: boolean;
|
|
977
|
+
jumpEnabled: boolean;
|
|
978
|
+
crouchEnabled: boolean;
|
|
979
|
+
lookSensitivity: number;
|
|
980
|
+
invertY: boolean;
|
|
887
981
|
moveSpeed: number;
|
|
888
|
-
|
|
982
|
+
jumpVelocity: number;
|
|
983
|
+
gravity: number;
|
|
984
|
+
eyeHeight: number;
|
|
985
|
+
crouchHeight: number;
|
|
986
|
+
groundZ: number;
|
|
987
|
+
minPitch: number;
|
|
988
|
+
maxPitch: number;
|
|
889
989
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
890
990
|
|
|
891
991
|
interface GlyphAxesHelperProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -832,60 +832,160 @@ declare const GlyphMapControls: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
832
832
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
833
833
|
|
|
834
834
|
interface GlyphFirstPersonControlsProps {
|
|
835
|
-
|
|
836
|
-
|
|
835
|
+
enabled?: boolean;
|
|
836
|
+
lookEnabled?: boolean;
|
|
837
|
+
moveEnabled?: boolean;
|
|
838
|
+
jumpEnabled?: boolean;
|
|
839
|
+
crouchEnabled?: boolean;
|
|
840
|
+
lookSensitivity?: number;
|
|
841
|
+
invertY?: boolean;
|
|
837
842
|
moveSpeed?: number;
|
|
838
|
-
|
|
839
|
-
|
|
843
|
+
jumpVelocity?: number;
|
|
844
|
+
gravity?: number;
|
|
845
|
+
eyeHeight?: number;
|
|
846
|
+
crouchHeight?: number;
|
|
847
|
+
groundZ?: number;
|
|
848
|
+
minPitch?: number;
|
|
849
|
+
maxPitch?: number;
|
|
840
850
|
}
|
|
841
851
|
declare const GlyphFirstPersonControls: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
842
|
-
|
|
852
|
+
enabled: {
|
|
843
853
|
type: BooleanConstructor;
|
|
844
|
-
default:
|
|
854
|
+
default: undefined;
|
|
845
855
|
};
|
|
846
|
-
|
|
856
|
+
lookEnabled: {
|
|
847
857
|
type: BooleanConstructor;
|
|
848
|
-
default:
|
|
858
|
+
default: undefined;
|
|
859
|
+
};
|
|
860
|
+
moveEnabled: {
|
|
861
|
+
type: BooleanConstructor;
|
|
862
|
+
default: undefined;
|
|
863
|
+
};
|
|
864
|
+
jumpEnabled: {
|
|
865
|
+
type: BooleanConstructor;
|
|
866
|
+
default: undefined;
|
|
867
|
+
};
|
|
868
|
+
crouchEnabled: {
|
|
869
|
+
type: BooleanConstructor;
|
|
870
|
+
default: undefined;
|
|
871
|
+
};
|
|
872
|
+
lookSensitivity: {
|
|
873
|
+
type: NumberConstructor;
|
|
874
|
+
default: undefined;
|
|
875
|
+
};
|
|
876
|
+
invertY: {
|
|
877
|
+
type: BooleanConstructor;
|
|
878
|
+
default: undefined;
|
|
849
879
|
};
|
|
850
880
|
moveSpeed: {
|
|
851
881
|
type: NumberConstructor;
|
|
852
|
-
default:
|
|
882
|
+
default: undefined;
|
|
853
883
|
};
|
|
854
|
-
|
|
884
|
+
jumpVelocity: {
|
|
855
885
|
type: NumberConstructor;
|
|
856
|
-
default:
|
|
886
|
+
default: undefined;
|
|
857
887
|
};
|
|
858
|
-
|
|
859
|
-
type:
|
|
860
|
-
default:
|
|
888
|
+
gravity: {
|
|
889
|
+
type: NumberConstructor;
|
|
890
|
+
default: undefined;
|
|
891
|
+
};
|
|
892
|
+
eyeHeight: {
|
|
893
|
+
type: NumberConstructor;
|
|
894
|
+
default: undefined;
|
|
895
|
+
};
|
|
896
|
+
crouchHeight: {
|
|
897
|
+
type: NumberConstructor;
|
|
898
|
+
default: undefined;
|
|
899
|
+
};
|
|
900
|
+
groundZ: {
|
|
901
|
+
type: NumberConstructor;
|
|
902
|
+
default: undefined;
|
|
903
|
+
};
|
|
904
|
+
minPitch: {
|
|
905
|
+
type: NumberConstructor;
|
|
906
|
+
default: undefined;
|
|
907
|
+
};
|
|
908
|
+
maxPitch: {
|
|
909
|
+
type: NumberConstructor;
|
|
910
|
+
default: undefined;
|
|
861
911
|
};
|
|
862
912
|
}>, () => null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
863
|
-
|
|
913
|
+
enabled: {
|
|
864
914
|
type: BooleanConstructor;
|
|
865
|
-
default:
|
|
915
|
+
default: undefined;
|
|
866
916
|
};
|
|
867
|
-
|
|
917
|
+
lookEnabled: {
|
|
868
918
|
type: BooleanConstructor;
|
|
869
|
-
default:
|
|
919
|
+
default: undefined;
|
|
920
|
+
};
|
|
921
|
+
moveEnabled: {
|
|
922
|
+
type: BooleanConstructor;
|
|
923
|
+
default: undefined;
|
|
924
|
+
};
|
|
925
|
+
jumpEnabled: {
|
|
926
|
+
type: BooleanConstructor;
|
|
927
|
+
default: undefined;
|
|
928
|
+
};
|
|
929
|
+
crouchEnabled: {
|
|
930
|
+
type: BooleanConstructor;
|
|
931
|
+
default: undefined;
|
|
932
|
+
};
|
|
933
|
+
lookSensitivity: {
|
|
934
|
+
type: NumberConstructor;
|
|
935
|
+
default: undefined;
|
|
936
|
+
};
|
|
937
|
+
invertY: {
|
|
938
|
+
type: BooleanConstructor;
|
|
939
|
+
default: undefined;
|
|
870
940
|
};
|
|
871
941
|
moveSpeed: {
|
|
872
942
|
type: NumberConstructor;
|
|
873
|
-
default:
|
|
943
|
+
default: undefined;
|
|
874
944
|
};
|
|
875
|
-
|
|
945
|
+
jumpVelocity: {
|
|
876
946
|
type: NumberConstructor;
|
|
877
|
-
default:
|
|
947
|
+
default: undefined;
|
|
878
948
|
};
|
|
879
|
-
|
|
880
|
-
type:
|
|
881
|
-
default:
|
|
949
|
+
gravity: {
|
|
950
|
+
type: NumberConstructor;
|
|
951
|
+
default: undefined;
|
|
952
|
+
};
|
|
953
|
+
eyeHeight: {
|
|
954
|
+
type: NumberConstructor;
|
|
955
|
+
default: undefined;
|
|
956
|
+
};
|
|
957
|
+
crouchHeight: {
|
|
958
|
+
type: NumberConstructor;
|
|
959
|
+
default: undefined;
|
|
960
|
+
};
|
|
961
|
+
groundZ: {
|
|
962
|
+
type: NumberConstructor;
|
|
963
|
+
default: undefined;
|
|
964
|
+
};
|
|
965
|
+
minPitch: {
|
|
966
|
+
type: NumberConstructor;
|
|
967
|
+
default: undefined;
|
|
968
|
+
};
|
|
969
|
+
maxPitch: {
|
|
970
|
+
type: NumberConstructor;
|
|
971
|
+
default: undefined;
|
|
882
972
|
};
|
|
883
973
|
}>> & Readonly<{}>, {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
974
|
+
enabled: boolean;
|
|
975
|
+
lookEnabled: boolean;
|
|
976
|
+
moveEnabled: boolean;
|
|
977
|
+
jumpEnabled: boolean;
|
|
978
|
+
crouchEnabled: boolean;
|
|
979
|
+
lookSensitivity: number;
|
|
980
|
+
invertY: boolean;
|
|
887
981
|
moveSpeed: number;
|
|
888
|
-
|
|
982
|
+
jumpVelocity: number;
|
|
983
|
+
gravity: number;
|
|
984
|
+
eyeHeight: number;
|
|
985
|
+
crouchHeight: number;
|
|
986
|
+
groundZ: number;
|
|
987
|
+
minPitch: number;
|
|
988
|
+
maxPitch: number;
|
|
889
989
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
890
990
|
|
|
891
991
|
interface GlyphAxesHelperProps {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CAMERA_BACKFACE_CULL_EPS as pn,VOXEL_CAMERA_CULL_AXIS_EPS as un,VOXEL_CAMERA_CULL_NORMAL_LIMIT as cn,normalizePolygons as yn,mergePolygons as dn,coverPlanarPolygons as hn,optimizeMeshPolygons as mn,cullInteriorPolygons as fn,cameraCullNormalGroups as Gn,cameraCullNormalGroupsFromPolygons as gn,cameraCullNormalKey as Cn,cameraCullVisibleSignature as Pn,cameraFacingDepth as vn,isAxisAlignedSurfaceNormal as bn,isVoxelCameraCullableNormalGroups as Sn,normalFacesCamera as xn,polygonCssSurfaceNormal as wn,polygonFacesCamera as An,parseObj as Rn,parseMtl as On,parseGltf as Mn,bakeSolidTextureSamples as Tn,bakeSolidTextureSampledPolygons as Hn,loadMesh as Vn,createIsometricCamera as Ln,parseVox as zn,polygonFaces as En,computeShapeLighting as kn,parseColor as Bn,parsePureColor as Fn,parseHexColor as Nn,parseRgbColor as jn,formatColor as Dn,clampChannel as In,shadeColor as Xn,rotateVec3 as Kn,inverseRotateVec3 as Un,resolveGeometry as Yn,tetrahedronPolygons as _n,cubePolygons as Wn,octahedronPolygons as qn,dodecahedronPolygons as $n,icosahedronPolygons as Jn,smallStellatedDodecahedronPolygons as Qn,greatDodecahedronPolygons as Zn,greatStellatedDodecahedronPolygons as er,greatIcosahedronPolygons as or,cuboctahedronPolygons as tr,icosidodecahedronPolygons as nr,truncatedTetrahedronPolygons as rr,truncatedCubePolygons as lr,truncatedOctahedronPolygons as ar,truncatedDodecahedronPolygons as ir,truncatedIcosahedronPolygons as sr,truncatedCuboctahedronPolygons as pr,truncatedIcosidodecahedronPolygons as ur,rhombicuboctahedronPolygons as cr,rhombicosidodecahedronPolygons as yr,snubCubePolygons as dr,snubDodecahedronPolygons as hr,rhombicDodecahedronPolygons as mr,rhombicTriacontahedronPolygons as fr,triakisTetrahedronPolygons as Gr,triakisOctahedronPolygons as gr,triakisIcosahedronPolygons as Cr,tetrakisHexahedronPolygons as Pr,pentakisDodecahedronPolygons as vr,disdyakisDodecahedronPolygons as br,disdyakisTriacontahedronPolygons as Sr,deltoidalIcositetrahedronPolygons as xr,deltoidalHexecontahedronPolygons as wr,pentagonalIcositetrahedronPolygons as Ar,pentagonalHexecontahedronPolygons as Rr,prismPolygons as Or,antiprismPolygons as Mr,bipyramidPolygons as Tr,trapezohedronPolygons as Hr,spherePolygons as Vr,cylinderPolygons as Lr,conePolygons as zr,torusPolygons as Er,pyramidPolygons as kr,planePolygons as Br,ringPolygons as Fr,ringQuadPolygons as Nr,arrowPolygons as jr,axesHelperPolygons as Dr,buildSceneContext as Ir,computeSceneBbox as Xr,BASE_TILE as Kr,DEFAULT_CAMERA_STATE as Ur,DEFAULT_PROJECTION as Yr,normalizeInvertMultiplier as _r,createGlyphAnimationMixer as Wr,LoopOnce as qr,LoopRepeat as $r,LoopPingPong as Jr}from"@glyphcss/core";import{defineComponent as Q,h as Z,provide as ee,shallowRef as N,onMounted as oe,onBeforeUnmount as te,watch as ne}from"vue";import{createGlyphScene as re,injectGlyphBaseStyles as le}from"glyphcss";import{inject as J}from"vue";var m=Symbol("glyph-camera");function b(){let e=J(m);if(!e)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return e}var c=Symbol("glyph-scene");var A=Q({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(e,{slots:s,attrs:a}){let{cameraRef:r,sceneRerenderRef:l}=b(),t=N(null),o=N(null);return ee(c,{sceneRef:o}),oe(()=>{let n=t.value;if(!n)return;le(n.ownerDocument??void 0);let i={};e.mode!==void 0&&(i.mode=e.mode),e.glyphPalette!==void 0&&(i.glyphPalette=e.glyphPalette),e.useColors!==void 0&&(i.useColors=e.useColors),e.cols!==void 0&&(i.cols=e.cols),e.rows!==void 0&&(i.rows=e.rows),e.cellAspect!==void 0&&(i.cellAspect=e.cellAspect),e.directionalLight!==void 0&&(i.directionalLight=e.directionalLight),e.ambientLight!==void 0&&(i.ambientLight=e.ambientLight),e.autoSize!==void 0&&(i.autoSize=e.autoSize),e.shadow!==void 0&&(i.shadow=e.shadow),r.value!==null&&(i.camera=r.value),o.value=re(n,i),l.value=()=>o.value?.rerender()}),te(()=>{o.value?.destroy(),o.value=null,l.value=null}),ne(()=>({mode:e.mode,glyphPalette:e.glyphPalette,useColors:e.useColors,cols:e.cols,rows:e.rows,cellAspect:e.cellAspect,directionalLight:e.directionalLight,ambientLight:e.ambientLight,autoSize:e.autoSize,shadow:e.shadow}),n=>{let i=o.value;if(!i)return;let u={};n.mode!==void 0&&(u.mode=n.mode),n.glyphPalette!==void 0&&(u.glyphPalette=n.glyphPalette),n.useColors!==void 0&&(u.useColors=n.useColors),n.cols!==void 0&&(u.cols=n.cols),n.rows!==void 0&&(u.rows=n.rows),n.cellAspect!==void 0&&(u.cellAspect=n.cellAspect),n.directionalLight!==void 0&&(u.directionalLight=n.directionalLight),n.ambientLight!==void 0&&(u.ambientLight=n.ambientLight),n.autoSize!==void 0&&(u.autoSize=n.autoSize),u.shadow=n.shadow,Object.keys(u).length>0&&i.setOptions(u)},{deep:!1}),()=>{let n=`glyph-host${e.class?` ${e.class}`:""}`;return Z("div",{ref:t,class:n,...Object.fromEntries(Object.entries(a).filter(([i])=>i!=="class"))},s.default?.())}}});import{defineComponent as ae,h as ie,inject as se,onBeforeUnmount as pe,watch as R,shallowRef as j,computed as ue,watchEffect as ce}from"vue";import{resolveGeometry as ye,recenterPolygons as de,loadMesh as he}from"@glyphcss/core";var v=ae({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},src:{type:String,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},autoCenter:{type:Boolean,default:!1},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(e,{slots:s}){let a=se(c);if(!a)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:r}=a,l=j(null),t=j(null);R(()=>e.src,(p,f,x)=>{if(!p){t.value=null;return}let g=!1;x(()=>{g=!0}),he(p).then(w=>{g||(t.value=w.polygons)}).catch(()=>{g||(t.value=[])})},{immediate:!0});let o=ue(()=>{let p=e.polygons!==void 0?e.polygons:e.src!==void 0?t.value??[]:e.geometry!==void 0?ye(e.geometry,{size:e.size,color:e.color}):[];return e.autoCenter?de(p):p});function n(){let p={};return e.id&&(p.id=e.id),e.position&&(p.position=e.position),e.scale!==void 0&&(p.scale=e.scale),e.rotation&&(p.rotation=e.rotation),p.castShadow=e.castShadow,p.receiveShadow=e.receiveShadow,p}function i(){let p=r.value;if(!p)return;let f=p.add(o.value,n());l.value=f}function u(){l.value?.dispose(),l.value=null}let y=ce(()=>{!r.value||l.value||i()});return pe(()=>{y(),u()}),R(o,()=>{u(),i()}),R(()=>({id:e.id,position:e.position,scale:e.scale,rotation:e.rotation,castShadow:e.castShadow,receiveShadow:e.receiveShadow}),()=>{let p=l.value;p&&(p.setTransform(n()),r.value?.rerender())},{deep:!1}),()=>{let p=`glyph-mesh${e.class?` ${e.class}`:""}`;return ie("div",{"data-glyph-mesh-id":e.id,class:p},s.default?.())}}});import{defineComponent as me,h as fe,computed as Ge}from"vue";import{planePolygons as ge}from"@glyphcss/core";var O=me({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(e,{slots:s}){let a=Ge(()=>ge({axis:1,size:e.size,offset:0,color:e.color}));return()=>fe(v,{id:e.id,polygons:a.value,position:e.position,rotation:e.rotation??void 0,castShadow:e.castShadow,receiveShadow:e.receiveShadow,class:e.class},s)}});import{defineComponent as Ce,inject as Pe,onBeforeUnmount as ve,watch as be,shallowRef as D,watchEffect as Se,h as xe,Teleport as we}from"vue";var M=Ce({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(e,{emit:s,slots:a}){let r=Pe(c);if(!r)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:l}=r,t=D(null),o=D(null);function n(){let y=l.value;if(!y)return;let p=y.addHotspot({id:e.id,at:e.at,size:e.size},()=>s("click"));t.value=p,o.value=p.el}function i(){t.value?.remove(),t.value=null,o.value=null}let u=Se(()=>{!l.value||t.value||n()});return ve(()=>{u(),i()}),be(()=>({id:e.id,at:e.at,size:e.size}),()=>{i(),n()},{deep:!1}),()=>{let y=o.value,p=a.default?.();return y&&p?xe(we,{to:y},p):null}}});import{inject as Ae}from"vue";function T(){let e=Ae(c);if(!e)throw new Error("glyphcss: must be used inside a GlyphScene.");return e}import{findGlyphMeshHandle as I,pointInMeshElement as X,findMeshUnderPoint as K}from"glyphcss";import{defineComponent as Re,h as Oe,provide as Me,shallowRef as U,watch as Te}from"vue";import{createGlyphOrthographicCamera as He}from"glyphcss";var C=Re({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.zoom!==void 0&&(a.zoom=e.zoom),e.center!==void 0&&(a.center=e.center);let r=U(He(a)),l=U(null);function t(){l.value?.()}return Me(m,{cameraRef:r,rerender:t,sceneRerenderRef:l}),Te(()=>({rotX:e.rotX,rotY:e.rotY,zoom:e.zoom}),o=>{let n=r.value;if(!n)return;let i=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,i=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,i=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,i=!0),i&&l.value?.()}),()=>Oe("div",{class:e.class,style:e.style},s.default?.()??[])}});import{defineComponent as Ve,h as Le,provide as ze,shallowRef as Y,watch as Ee}from"vue";import{createGlyphPerspectiveCamera as ke}from"glyphcss";var H=Ve({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},perspective:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.distance!==void 0&&(a.distance=e.distance),e.perspective!==void 0&&(a.perspective=e.perspective),e.zoom!==void 0&&(a.zoom=e.zoom),e.stretch!==void 0&&(a.stretch=e.stretch),e.center!==void 0&&(a.center=e.center);let r=Y(ke(a)),l=Y(null);function t(){l.value?.()}return ze(m,{cameraRef:r,rerender:t,sceneRerenderRef:l}),Ee(()=>({rotX:e.rotX,rotY:e.rotY,distance:e.distance,perspective:e.perspective,zoom:e.zoom,stretch:e.stretch}),o=>{let n=r.value;if(!n)return;let i=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,i=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,i=!0),o.distance!==void 0&&n.distance!==o.distance&&(n.distance=o.distance,i=!0),o.perspective!==void 0&&n.perspective!==o.perspective&&(n.perspective=o.perspective,i=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,i=!0),o.stretch!==void 0&&n.stretch!==o.stretch&&(n.stretch=o.stretch,i=!0),i&&l.value?.()}),()=>Le("div",{class:e.class,style:e.style},s.default?.()??[])}});import{inject as Be}from"vue";function V(){let e=Be(m);if(!e)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return e}import{defineComponent as Fe,inject as Ne,onBeforeUnmount as je,watch as De,shallowRef as Ie,watchEffect as Xe}from"vue";import{createGlyphOrbitControls as Ke}from"glyphcss";var L=Fe({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Ne(c);if(!s)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=Ie(null),l=Xe(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate===!1?!1:e.animate};r.value=Ke(t,o)});return je(()=>{l(),r.value?.destroy(),r.value=null}),De(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate}),t=>{r.value?.update({drag:t.drag,wheel:t.wheel,invert:t.invert,clampPitch:t.clampPitch,animate:t.animate===!1?!1:t.animate})}),()=>null}});import{defineComponent as Ue,inject as Ye,onBeforeUnmount as _e,watch as We,shallowRef as qe,watchEffect as $e}from"vue";import{createGlyphMapControls as Je}from"glyphcss";var z=Ue({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Ye(c);if(!s)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=qe(null),l=$e(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate===!1?!1:e.animate};r.value=Je(t,o)});return _e(()=>{l(),r.value?.destroy(),r.value=null}),We(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate}),t=>{r.value?.update({drag:t.drag,wheel:t.wheel,invert:t.invert,animate:t.animate===!1?!1:t.animate})}),()=>null}});import{defineComponent as Qe,inject as Ze,onBeforeUnmount as eo,watch as oo,shallowRef as to,watchEffect as no}from"vue";import{createGlyphFirstPersonControls as ro}from"glyphcss";var E=Qe({name:"GlyphFirstPersonControls",props:{drag:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},moveSpeed:{type:Number,default:.05},lookSpeed:{type:Number,default:.004},invert:{type:[Boolean,Number],default:!1}},setup(e){let s=Ze(c);if(!s)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=to(null),l=no(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert};r.value=ro(t,o)});return eo(()=>{l(),r.value?.destroy(),r.value=null}),oo(()=>({drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert}),t=>{r.value?.update(t)}),()=>null}});import{defineComponent as lo,inject as ao,onMounted as io,onBeforeUnmount as so,watch as po,computed as uo,shallowRef as co}from"vue";function yo(e){let s=e,a=s*.05,r=[];function l(t,o,n){let i=[t[0]-a,t[1]-a,t[2]],u=[o[0]-a,o[1]-a,o[2]],y=[o[0]+a,o[1]+a,o[2]],p=[t[0]+a,t[1]+a,t[2]];r.push({vertices:[i,u,y],color:n}),r.push({vertices:[i,y,p],color:n})}return l([0,0,0],[s,0,0],"#ff0000"),l([0,0,0],[0,s,0],"#00ff00"),l([0,0,0],[0,0,s],"#0000ff"),r}var k=lo({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(e){let s=ao(c);if(!s)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=co(null),l=uo(()=>yo(e.size??1));function t(){let o=a.value;o&&(r.value=o.add(l.value))}return io(t),so(()=>{r.value?.dispose(),r.value=null}),po(l,()=>{r.value?.dispose(),r.value=null,t()}),()=>null}});import{defineComponent as ho,inject as mo,onMounted as fo,onBeforeUnmount as Go,watch as go,computed as Co,shallowRef as Po}from"vue";function vo(e,s,a){let[r,l,t]=e,o=a,n=[r,l,t+o],i=[r,l,t-o],u=[r+o,l,t],y=[r-o,l,t],p=[r,l+o,t],f=[r,l-o,t];return[{vertices:[n,u,p],color:s},{vertices:[n,p,y],color:s},{vertices:[n,y,f],color:s},{vertices:[n,f,u],color:s},{vertices:[i,p,u],color:s},{vertices:[i,y,p],color:s},{vertices:[i,f,y],color:s},{vertices:[i,u,f],color:s}]}var B=ho({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(e){let s=mo(c);if(!s)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=Po(null),l=Co(()=>vo(e.position??[1,1,1],e.color??"#ffff00",e.size??.1));function t(){let o=a.value;o&&(r.value=o.add(l.value))}return fo(t),Go(()=>{r.value?.dispose(),r.value=null}),go(l,()=>{r.value?.dispose(),r.value=null,t()}),()=>null}});import{injectGlyphBaseStyles as _}from"glyphcss";import{ref as W,watch as bo,onUnmounted as So,computed as S}from"vue";import{createGlyphAnimationMixer as xo}from"@glyphcss/core";function P(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function F(e,s,a){let r=W(null),l=null,t=null,o=null,n=W(0);function i(){return a==null?r.value:P(a)??r.value}function u(){t!==null&&(cancelAnimationFrame(t),t=null),o=null}function y(){u(),l&&(l.stopAllAction(),l.uncacheRoot(),l=null,n.value++)}function p(){if(t!==null)return;function d(h){if(o===null){o=h,t=requestAnimationFrame(d);return}let G=(h-o)/1e3;o=h,l?.update(G),t=requestAnimationFrame(d)}t=requestAnimationFrame(d)}function f(){y();let d=P(e),h=P(s);if(!d||d.length===0||!h)return;let G=i();G&&(l=xo(G,h),n.value++,p())}let x=bo(()=>{let d=P(e),h=P(s),G=a!=null?P(a):r.value;return{c:d,ctrl:h,r:G}},()=>f(),{immediate:!0,deep:!1});So(()=>{x(),y()});let g=S(()=>P(e)??[]),w=S(()=>g.value.map(d=>d.name)),q=S(()=>(n.value,l)),$=S(()=>{n.value;let d=g.value,h={};for(let G of d)Object.defineProperty(h,G.name,{enumerable:!0,get(){if(!l)return null;try{return l.clipAction(G.name)}catch{return null}}});return h});return{ref:r,mixer:q,clips:g,names:w,actions:$}}export{Kr as BASE_TILE,pn as CAMERA_BACKFACE_CULL_EPS,Ur as DEFAULT_CAMERA_STATE,Yr as DEFAULT_PROJECTION,k as GlyphAxesHelper,C as GlyphCamera,m as GlyphCameraContextKey,B as GlyphDirectionalLightHelper,E as GlyphFirstPersonControls,O as GlyphGround,M as GlyphHotspot,z as GlyphMapControls,v as GlyphMesh,L as GlyphOrbitControls,C as GlyphOrthographicCamera,H as GlyphPerspectiveCamera,A as GlyphScene,c as GlyphSceneContextKey,qr as LoopOnce,Jr as LoopPingPong,$r as LoopRepeat,un as VOXEL_CAMERA_CULL_AXIS_EPS,cn as VOXEL_CAMERA_CULL_NORMAL_LIMIT,Mr as antiprismPolygons,jr as arrowPolygons,Dr as axesHelperPolygons,Hn as bakeSolidTextureSampledPolygons,Tn as bakeSolidTextureSamples,Tr as bipyramidPolygons,Ir as buildSceneContext,Gn as cameraCullNormalGroups,gn as cameraCullNormalGroupsFromPolygons,Cn as cameraCullNormalKey,Pn as cameraCullVisibleSignature,vn as cameraFacingDepth,In as clampChannel,Xr as computeSceneBbox,kn as computeShapeLighting,zr as conePolygons,hn as coverPlanarPolygons,Wr as createGlyphAnimationMixer,Ln as createIsometricCamera,Wn as cubePolygons,tr as cuboctahedronPolygons,fn as cullInteriorPolygons,Lr as cylinderPolygons,wr as deltoidalHexecontahedronPolygons,xr as deltoidalIcositetrahedronPolygons,br as disdyakisDodecahedronPolygons,Sr as disdyakisTriacontahedronPolygons,$n as dodecahedronPolygons,I as findGlyphMeshHandle,K as findMeshUnderPoint,Dn as formatColor,Zn as greatDodecahedronPolygons,or as greatIcosahedronPolygons,er as greatStellatedDodecahedronPolygons,Jn as icosahedronPolygons,nr as icosidodecahedronPolygons,_ as injectGlyphBaseStyles,Un as inverseRotateVec3,bn as isAxisAlignedSurfaceNormal,Sn as isVoxelCameraCullableNormalGroups,Vn as loadMesh,dn as mergePolygons,xn as normalFacesCamera,_r as normalizeInvertMultiplier,yn as normalizePolygons,qn as octahedronPolygons,mn as optimizeMeshPolygons,Bn as parseColor,Mn as parseGltf,Nn as parseHexColor,On as parseMtl,Rn as parseObj,Fn as parsePureColor,jn as parseRgbColor,zn as parseVox,Rr as pentagonalHexecontahedronPolygons,Ar as pentagonalIcositetrahedronPolygons,vr as pentakisDodecahedronPolygons,Br as planePolygons,X as pointInMeshElement,wn as polygonCssSurfaceNormal,En as polygonFaces,An as polygonFacesCamera,Or as prismPolygons,kr as pyramidPolygons,Yn as resolveGeometry,mr as rhombicDodecahedronPolygons,fr as rhombicTriacontahedronPolygons,yr as rhombicosidodecahedronPolygons,cr as rhombicuboctahedronPolygons,Fr as ringPolygons,Nr as ringQuadPolygons,Kn as rotateVec3,Xn as shadeColor,Qn as smallStellatedDodecahedronPolygons,dr as snubCubePolygons,hr as snubDodecahedronPolygons,Vr as spherePolygons,_n as tetrahedronPolygons,Pr as tetrakisHexahedronPolygons,Er as torusPolygons,Hr as trapezohedronPolygons,Cr as triakisIcosahedronPolygons,gr as triakisOctahedronPolygons,Gr as triakisTetrahedronPolygons,lr as truncatedCubePolygons,pr as truncatedCuboctahedronPolygons,ir as truncatedDodecahedronPolygons,sr as truncatedIcosahedronPolygons,ur as truncatedIcosidodecahedronPolygons,ar as truncatedOctahedronPolygons,rr as truncatedTetrahedronPolygons,F as useGlyphAnimation,V as useGlyphCamera,T as useGlyphSceneContext};
|
|
1
|
+
import{CAMERA_BACKFACE_CULL_EPS as pn,VOXEL_CAMERA_CULL_AXIS_EPS as un,VOXEL_CAMERA_CULL_NORMAL_LIMIT as cn,normalizePolygons as yn,mergePolygons as dn,coverPlanarPolygons as hn,optimizeMeshPolygons as mn,cullInteriorPolygons as fn,cameraCullNormalGroups as Gn,cameraCullNormalGroupsFromPolygons as gn,cameraCullNormalKey as Cn,cameraCullVisibleSignature as Pn,cameraFacingDepth as vn,isAxisAlignedSurfaceNormal as bn,isVoxelCameraCullableNormalGroups as Sn,normalFacesCamera as xn,polygonCssSurfaceNormal as wn,polygonFacesCamera as An,parseObj as Rn,parseMtl as On,parseGltf as Mn,bakeSolidTextureSamples as En,bakeSolidTextureSampledPolygons as Hn,loadMesh as Tn,createIsometricCamera as Vn,parseVox as Ln,polygonFaces as zn,computeShapeLighting as Nn,parseColor as jn,parsePureColor as kn,parseHexColor as Bn,parseRgbColor as Fn,formatColor as Dn,clampChannel as In,shadeColor as Yn,rotateVec3 as Xn,inverseRotateVec3 as Kn,resolveGeometry as Un,tetrahedronPolygons as _n,cubePolygons as Wn,octahedronPolygons as qn,dodecahedronPolygons as Zn,icosahedronPolygons as $n,smallStellatedDodecahedronPolygons as Jn,greatDodecahedronPolygons as Qn,greatStellatedDodecahedronPolygons as er,greatIcosahedronPolygons as tr,cuboctahedronPolygons as or,icosidodecahedronPolygons as nr,truncatedTetrahedronPolygons as rr,truncatedCubePolygons as lr,truncatedOctahedronPolygons as ar,truncatedDodecahedronPolygons as ir,truncatedIcosahedronPolygons as sr,truncatedCuboctahedronPolygons as pr,truncatedIcosidodecahedronPolygons as ur,rhombicuboctahedronPolygons as cr,rhombicosidodecahedronPolygons as yr,snubCubePolygons as dr,snubDodecahedronPolygons as hr,rhombicDodecahedronPolygons as mr,rhombicTriacontahedronPolygons as fr,triakisTetrahedronPolygons as Gr,triakisOctahedronPolygons as gr,triakisIcosahedronPolygons as Cr,tetrakisHexahedronPolygons as Pr,pentakisDodecahedronPolygons as vr,disdyakisDodecahedronPolygons as br,disdyakisTriacontahedronPolygons as Sr,deltoidalIcositetrahedronPolygons as xr,deltoidalHexecontahedronPolygons as wr,pentagonalIcositetrahedronPolygons as Ar,pentagonalHexecontahedronPolygons as Rr,prismPolygons as Or,antiprismPolygons as Mr,bipyramidPolygons as Er,trapezohedronPolygons as Hr,spherePolygons as Tr,cylinderPolygons as Vr,conePolygons as Lr,torusPolygons as zr,pyramidPolygons as Nr,planePolygons as jr,ringPolygons as kr,ringQuadPolygons as Br,arrowPolygons as Fr,axesHelperPolygons as Dr,buildSceneContext as Ir,computeSceneBbox as Yr,BASE_TILE as Xr,DEFAULT_CAMERA_STATE as Kr,DEFAULT_PROJECTION as Ur,normalizeInvertMultiplier as _r,createGlyphAnimationMixer as Wr,LoopOnce as qr,LoopRepeat as Zr,LoopPingPong as $r}from"@glyphcss/core";import{defineComponent as J,h as Q,provide as ee,shallowRef as B,onMounted as te,onBeforeUnmount as oe,watch as ne}from"vue";import{createGlyphScene as re,injectGlyphBaseStyles as le}from"glyphcss";import{inject as $}from"vue";var m=Symbol("glyph-camera");function b(){let e=$(m);if(!e)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return e}var c=Symbol("glyph-scene");var A=J({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(e,{slots:s,attrs:a}){let{cameraRef:r,sceneRerenderRef:l}=b(),n=B(null),t=B(null);return ee(c,{sceneRef:t}),te(()=>{let o=n.value;if(!o)return;le(o.ownerDocument??void 0);let i={};e.mode!==void 0&&(i.mode=e.mode),e.glyphPalette!==void 0&&(i.glyphPalette=e.glyphPalette),e.useColors!==void 0&&(i.useColors=e.useColors),e.cols!==void 0&&(i.cols=e.cols),e.rows!==void 0&&(i.rows=e.rows),e.cellAspect!==void 0&&(i.cellAspect=e.cellAspect),e.directionalLight!==void 0&&(i.directionalLight=e.directionalLight),e.ambientLight!==void 0&&(i.ambientLight=e.ambientLight),e.autoSize!==void 0&&(i.autoSize=e.autoSize),e.shadow!==void 0&&(i.shadow=e.shadow),r.value!==null&&(i.camera=r.value),t.value=re(o,i),l.value=()=>t.value?.rerender()}),oe(()=>{t.value?.destroy(),t.value=null,l.value=null}),ne(()=>({mode:e.mode,glyphPalette:e.glyphPalette,useColors:e.useColors,cols:e.cols,rows:e.rows,cellAspect:e.cellAspect,directionalLight:e.directionalLight,ambientLight:e.ambientLight,autoSize:e.autoSize,shadow:e.shadow}),o=>{let i=t.value;if(!i)return;let u={};o.mode!==void 0&&(u.mode=o.mode),o.glyphPalette!==void 0&&(u.glyphPalette=o.glyphPalette),o.useColors!==void 0&&(u.useColors=o.useColors),o.cols!==void 0&&(u.cols=o.cols),o.rows!==void 0&&(u.rows=o.rows),o.cellAspect!==void 0&&(u.cellAspect=o.cellAspect),o.directionalLight!==void 0&&(u.directionalLight=o.directionalLight),o.ambientLight!==void 0&&(u.ambientLight=o.ambientLight),o.autoSize!==void 0&&(u.autoSize=o.autoSize),u.shadow=o.shadow,Object.keys(u).length>0&&i.setOptions(u)},{deep:!1}),()=>{let o=`glyph-host${e.class?` ${e.class}`:""}`;return Q("div",{ref:n,class:o,...Object.fromEntries(Object.entries(a).filter(([i])=>i!=="class"))},s.default?.())}}});import{defineComponent as ae,h as ie,inject as se,onBeforeUnmount as pe,watch as R,shallowRef as F,computed as ue,watchEffect as ce}from"vue";import{resolveGeometry as ye,recenterPolygons as de,loadMesh as he}from"@glyphcss/core";var v=ae({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},src:{type:String,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},autoCenter:{type:Boolean,default:!1},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(e,{slots:s}){let a=se(c);if(!a)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:r}=a,l=F(null),n=F(null);R(()=>e.src,(p,f,x)=>{if(!p){n.value=null;return}let g=!1;x(()=>{g=!0}),he(p).then(w=>{g||(n.value=w.polygons)}).catch(()=>{g||(n.value=[])})},{immediate:!0});let t=ue(()=>{let p=e.polygons!==void 0?e.polygons:e.src!==void 0?n.value??[]:e.geometry!==void 0?ye(e.geometry,{size:e.size,color:e.color}):[];return e.autoCenter?de(p):p});function o(){let p={};return e.id&&(p.id=e.id),e.position&&(p.position=e.position),e.scale!==void 0&&(p.scale=e.scale),e.rotation&&(p.rotation=e.rotation),p.castShadow=e.castShadow,p.receiveShadow=e.receiveShadow,p}function i(){let p=r.value;if(!p)return;let f=p.add(t.value,o());l.value=f}function u(){l.value?.dispose(),l.value=null}let y=ce(()=>{!r.value||l.value||i()});return pe(()=>{y(),u()}),R(t,()=>{u(),i()}),R(()=>({id:e.id,position:e.position,scale:e.scale,rotation:e.rotation,castShadow:e.castShadow,receiveShadow:e.receiveShadow}),()=>{let p=l.value;p&&(p.setTransform(o()),r.value?.rerender())},{deep:!1}),()=>{let p=`glyph-mesh${e.class?` ${e.class}`:""}`;return ie("div",{"data-glyph-mesh-id":e.id,class:p},s.default?.())}}});import{defineComponent as me,h as fe,computed as Ge}from"vue";import{planePolygons as ge}from"@glyphcss/core";var O=me({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(e,{slots:s}){let a=Ge(()=>ge({axis:1,size:e.size,offset:0,color:e.color}));return()=>fe(v,{id:e.id,polygons:a.value,position:e.position,rotation:e.rotation??void 0,castShadow:e.castShadow,receiveShadow:e.receiveShadow,class:e.class},s)}});import{defineComponent as Ce,inject as Pe,onBeforeUnmount as ve,watch as be,shallowRef as D,watchEffect as Se,h as xe,Teleport as we}from"vue";var M=Ce({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(e,{emit:s,slots:a}){let r=Pe(c);if(!r)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:l}=r,n=D(null),t=D(null);function o(){let y=l.value;if(!y)return;let p=y.addHotspot({id:e.id,at:e.at,size:e.size},()=>s("click"));n.value=p,t.value=p.el}function i(){n.value?.remove(),n.value=null,t.value=null}let u=Se(()=>{!l.value||n.value||o()});return ve(()=>{u(),i()}),be(()=>({id:e.id,at:e.at,size:e.size}),()=>{i(),o()},{deep:!1}),()=>{let y=t.value,p=a.default?.();return y&&p?xe(we,{to:y},p):null}}});import{inject as Ae}from"vue";function E(){let e=Ae(c);if(!e)throw new Error("glyphcss: must be used inside a GlyphScene.");return e}import{findGlyphMeshHandle as I,pointInMeshElement as Y,findMeshUnderPoint as X}from"glyphcss";import{defineComponent as Re,h as Oe,provide as Me,shallowRef as K,watch as Ee}from"vue";import{createGlyphOrthographicCamera as He}from"glyphcss";var C=Re({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.zoom!==void 0&&(a.zoom=e.zoom),e.center!==void 0&&(a.center=e.center);let r=K(He(a)),l=K(null);function n(){l.value?.()}return Me(m,{cameraRef:r,rerender:n,sceneRerenderRef:l}),Ee(()=>({rotX:e.rotX,rotY:e.rotY,zoom:e.zoom}),t=>{let o=r.value;if(!o)return;let i=!1;t.rotX!==void 0&&o.rotX!==t.rotX&&(o.rotX=t.rotX,i=!0),t.rotY!==void 0&&o.rotY!==t.rotY&&(o.rotY=t.rotY,i=!0),t.zoom!==void 0&&o.zoom!==t.zoom&&(o.zoom=t.zoom,i=!0),i&&l.value?.()}),()=>Oe("div",{class:e.class,style:e.style},s.default?.()??[])}});import{defineComponent as Te,h as Ve,provide as Le,shallowRef as U,watch as ze}from"vue";import{createGlyphPerspectiveCamera as Ne}from"glyphcss";var H=Te({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},perspective:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.distance!==void 0&&(a.distance=e.distance),e.perspective!==void 0&&(a.perspective=e.perspective),e.zoom!==void 0&&(a.zoom=e.zoom),e.stretch!==void 0&&(a.stretch=e.stretch),e.center!==void 0&&(a.center=e.center);let r=U(Ne(a)),l=U(null);function n(){l.value?.()}return Le(m,{cameraRef:r,rerender:n,sceneRerenderRef:l}),ze(()=>({rotX:e.rotX,rotY:e.rotY,distance:e.distance,perspective:e.perspective,zoom:e.zoom,stretch:e.stretch}),t=>{let o=r.value;if(!o)return;let i=!1;t.rotX!==void 0&&o.rotX!==t.rotX&&(o.rotX=t.rotX,i=!0),t.rotY!==void 0&&o.rotY!==t.rotY&&(o.rotY=t.rotY,i=!0),t.distance!==void 0&&o.distance!==t.distance&&(o.distance=t.distance,i=!0),t.perspective!==void 0&&o.perspective!==t.perspective&&(o.perspective=t.perspective,i=!0),t.zoom!==void 0&&o.zoom!==t.zoom&&(o.zoom=t.zoom,i=!0),t.stretch!==void 0&&o.stretch!==t.stretch&&(o.stretch=t.stretch,i=!0),i&&l.value?.()}),()=>Ve("div",{class:e.class,style:e.style},s.default?.()??[])}});import{inject as je}from"vue";function T(){let e=je(m);if(!e)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return e}import{defineComponent as ke,inject as Be,onBeforeUnmount as Fe,watch as De,shallowRef as Ie,watchEffect as Ye}from"vue";import{createGlyphOrbitControls as Xe}from"glyphcss";var V=ke({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Be(c);if(!s)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=Ie(null),l=Ye(()=>{let n=a.value;if(!n||r.value)return;let t={drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate===!1?!1:e.animate};r.value=Xe(n,t)});return Fe(()=>{l(),r.value?.destroy(),r.value=null}),De(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate}),n=>{r.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,clampPitch:n.clampPitch,animate:n.animate===!1?!1:n.animate})}),()=>null}});import{defineComponent as Ke,inject as Ue,onBeforeUnmount as _e,watch as We,shallowRef as qe,watchEffect as Ze}from"vue";import{createGlyphMapControls as $e}from"glyphcss";var L=Ke({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Ue(c);if(!s)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=qe(null),l=Ze(()=>{let n=a.value;if(!n||r.value)return;let t={drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate===!1?!1:e.animate};r.value=$e(n,t)});return _e(()=>{l(),r.value?.destroy(),r.value=null}),We(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate}),n=>{r.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,animate:n.animate===!1?!1:n.animate})}),()=>null}});import{defineComponent as Je,inject as Qe,onBeforeUnmount as et,watch as tt,shallowRef as ot,watchEffect as nt}from"vue";import{createGlyphFirstPersonControls as rt}from"glyphcss";var z=Je({name:"GlyphFirstPersonControls",props:{enabled:{type:Boolean,default:void 0},lookEnabled:{type:Boolean,default:void 0},moveEnabled:{type:Boolean,default:void 0},jumpEnabled:{type:Boolean,default:void 0},crouchEnabled:{type:Boolean,default:void 0},lookSensitivity:{type:Number,default:void 0},invertY:{type:Boolean,default:void 0},moveSpeed:{type:Number,default:void 0},jumpVelocity:{type:Number,default:void 0},gravity:{type:Number,default:void 0},eyeHeight:{type:Number,default:void 0},crouchHeight:{type:Number,default:void 0},groundZ:{type:Number,default:void 0},minPitch:{type:Number,default:void 0},maxPitch:{type:Number,default:void 0}},setup(e){let s=Qe(c);if(!s)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=ot(null),l=()=>({enabled:e.enabled,lookEnabled:e.lookEnabled,moveEnabled:e.moveEnabled,jumpEnabled:e.jumpEnabled,crouchEnabled:e.crouchEnabled,lookSensitivity:e.lookSensitivity,invertY:e.invertY,moveSpeed:e.moveSpeed,jumpVelocity:e.jumpVelocity,gravity:e.gravity,eyeHeight:e.eyeHeight,crouchHeight:e.crouchHeight,groundZ:e.groundZ,minPitch:e.minPitch,maxPitch:e.maxPitch}),n=nt(()=>{let t=a.value;!t||r.value||(r.value=rt(t,l()))});return et(()=>{n(),r.value?.destroy(),r.value=null}),tt(l,t=>{r.value?.update(t)}),()=>null}});import{defineComponent as lt,inject as at,onMounted as it,onBeforeUnmount as st,watch as pt,computed as ut,shallowRef as ct}from"vue";function yt(e){let s=e,a=s*.05,r=[];function l(n,t,o){let i=[n[0]-a,n[1]-a,n[2]],u=[t[0]-a,t[1]-a,t[2]],y=[t[0]+a,t[1]+a,t[2]],p=[n[0]+a,n[1]+a,n[2]];r.push({vertices:[i,u,y],color:o}),r.push({vertices:[i,y,p],color:o})}return l([0,0,0],[s,0,0],"#ff0000"),l([0,0,0],[0,s,0],"#00ff00"),l([0,0,0],[0,0,s],"#0000ff"),r}var N=lt({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(e){let s=at(c);if(!s)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=ct(null),l=ut(()=>yt(e.size??1));function n(){let t=a.value;t&&(r.value=t.add(l.value))}return it(n),st(()=>{r.value?.dispose(),r.value=null}),pt(l,()=>{r.value?.dispose(),r.value=null,n()}),()=>null}});import{defineComponent as dt,inject as ht,onMounted as mt,onBeforeUnmount as ft,watch as Gt,computed as gt,shallowRef as Ct}from"vue";function Pt(e,s,a){let[r,l,n]=e,t=a,o=[r,l,n+t],i=[r,l,n-t],u=[r+t,l,n],y=[r-t,l,n],p=[r,l+t,n],f=[r,l-t,n];return[{vertices:[o,u,p],color:s},{vertices:[o,p,y],color:s},{vertices:[o,y,f],color:s},{vertices:[o,f,u],color:s},{vertices:[i,p,u],color:s},{vertices:[i,y,p],color:s},{vertices:[i,f,y],color:s},{vertices:[i,u,f],color:s}]}var j=dt({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(e){let s=ht(c);if(!s)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=Ct(null),l=gt(()=>Pt(e.position??[1,1,1],e.color??"#ffff00",e.size??.1));function n(){let t=a.value;t&&(r.value=t.add(l.value))}return mt(n),ft(()=>{r.value?.dispose(),r.value=null}),Gt(l,()=>{r.value?.dispose(),r.value=null,n()}),()=>null}});import{injectGlyphBaseStyles as _}from"glyphcss";import{ref as W,watch as vt,onUnmounted as bt,computed as S}from"vue";import{createGlyphAnimationMixer as St}from"@glyphcss/core";function P(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function k(e,s,a){let r=W(null),l=null,n=null,t=null,o=W(0);function i(){return a==null?r.value:P(a)??r.value}function u(){n!==null&&(cancelAnimationFrame(n),n=null),t=null}function y(){u(),l&&(l.stopAllAction(),l.uncacheRoot(),l=null,o.value++)}function p(){if(n!==null)return;function d(h){if(t===null){t=h,n=requestAnimationFrame(d);return}let G=(h-t)/1e3;t=h,l?.update(G),n=requestAnimationFrame(d)}n=requestAnimationFrame(d)}function f(){y();let d=P(e),h=P(s);if(!d||d.length===0||!h)return;let G=i();G&&(l=St(G,h),o.value++,p())}let x=vt(()=>{let d=P(e),h=P(s),G=a!=null?P(a):r.value;return{c:d,ctrl:h,r:G}},()=>f(),{immediate:!0,deep:!1});bt(()=>{x(),y()});let g=S(()=>P(e)??[]),w=S(()=>g.value.map(d=>d.name)),q=S(()=>(o.value,l)),Z=S(()=>{o.value;let d=g.value,h={};for(let G of d)Object.defineProperty(h,G.name,{enumerable:!0,get(){if(!l)return null;try{return l.clipAction(G.name)}catch{return null}}});return h});return{ref:r,mixer:q,clips:g,names:w,actions:Z}}export{Xr as BASE_TILE,pn as CAMERA_BACKFACE_CULL_EPS,Kr as DEFAULT_CAMERA_STATE,Ur as DEFAULT_PROJECTION,N as GlyphAxesHelper,C as GlyphCamera,m as GlyphCameraContextKey,j as GlyphDirectionalLightHelper,z as GlyphFirstPersonControls,O as GlyphGround,M as GlyphHotspot,L as GlyphMapControls,v as GlyphMesh,V as GlyphOrbitControls,C as GlyphOrthographicCamera,H as GlyphPerspectiveCamera,A as GlyphScene,c as GlyphSceneContextKey,qr as LoopOnce,$r as LoopPingPong,Zr as LoopRepeat,un as VOXEL_CAMERA_CULL_AXIS_EPS,cn as VOXEL_CAMERA_CULL_NORMAL_LIMIT,Mr as antiprismPolygons,Fr as arrowPolygons,Dr as axesHelperPolygons,Hn as bakeSolidTextureSampledPolygons,En as bakeSolidTextureSamples,Er as bipyramidPolygons,Ir as buildSceneContext,Gn as cameraCullNormalGroups,gn as cameraCullNormalGroupsFromPolygons,Cn as cameraCullNormalKey,Pn as cameraCullVisibleSignature,vn as cameraFacingDepth,In as clampChannel,Yr as computeSceneBbox,Nn as computeShapeLighting,Lr as conePolygons,hn as coverPlanarPolygons,Wr as createGlyphAnimationMixer,Vn as createIsometricCamera,Wn as cubePolygons,or as cuboctahedronPolygons,fn as cullInteriorPolygons,Vr as cylinderPolygons,wr as deltoidalHexecontahedronPolygons,xr as deltoidalIcositetrahedronPolygons,br as disdyakisDodecahedronPolygons,Sr as disdyakisTriacontahedronPolygons,Zn as dodecahedronPolygons,I as findGlyphMeshHandle,X as findMeshUnderPoint,Dn as formatColor,Qn as greatDodecahedronPolygons,tr as greatIcosahedronPolygons,er as greatStellatedDodecahedronPolygons,$n as icosahedronPolygons,nr as icosidodecahedronPolygons,_ as injectGlyphBaseStyles,Kn as inverseRotateVec3,bn as isAxisAlignedSurfaceNormal,Sn as isVoxelCameraCullableNormalGroups,Tn as loadMesh,dn as mergePolygons,xn as normalFacesCamera,_r as normalizeInvertMultiplier,yn as normalizePolygons,qn as octahedronPolygons,mn as optimizeMeshPolygons,jn as parseColor,Mn as parseGltf,Bn as parseHexColor,On as parseMtl,Rn as parseObj,kn as parsePureColor,Fn as parseRgbColor,Ln as parseVox,Rr as pentagonalHexecontahedronPolygons,Ar as pentagonalIcositetrahedronPolygons,vr as pentakisDodecahedronPolygons,jr as planePolygons,Y as pointInMeshElement,wn as polygonCssSurfaceNormal,zn as polygonFaces,An as polygonFacesCamera,Or as prismPolygons,Nr as pyramidPolygons,Un as resolveGeometry,mr as rhombicDodecahedronPolygons,fr as rhombicTriacontahedronPolygons,yr as rhombicosidodecahedronPolygons,cr as rhombicuboctahedronPolygons,kr as ringPolygons,Br as ringQuadPolygons,Xn as rotateVec3,Yn as shadeColor,Jn as smallStellatedDodecahedronPolygons,dr as snubCubePolygons,hr as snubDodecahedronPolygons,Tr as spherePolygons,_n as tetrahedronPolygons,Pr as tetrakisHexahedronPolygons,zr as torusPolygons,Hr as trapezohedronPolygons,Cr as triakisIcosahedronPolygons,gr as triakisOctahedronPolygons,Gr as triakisTetrahedronPolygons,lr as truncatedCubePolygons,pr as truncatedCuboctahedronPolygons,ir as truncatedDodecahedronPolygons,sr as truncatedIcosahedronPolygons,ur as truncatedIcosidodecahedronPolygons,ar as truncatedOctahedronPolygons,rr as truncatedTetrahedronPolygons,k as useGlyphAnimation,T as useGlyphCamera,E as useGlyphSceneContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glyphcss/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Native Vue 3 components for the glyphcss ASCII polygon mesh rendering engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"glyphcss": "^0.0.
|
|
45
|
-
"
|
|
44
|
+
"@glyphcss/core": "^0.0.7",
|
|
45
|
+
"glyphcss": "^0.0.7"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"vue": "^3.0.0"
|