diff --git a/dist/Accessor.d.ts b/dist/Accessor.d.ts new file mode 100644 index 0000000..cf5518c --- /dev/null +++ b/dist/Accessor.d.ts @@ -0,0 +1,24 @@ +import { TTypeArray } from "./types"; +type TBufferView = { + byteOffset?: number; +}; +type TAccessor = { + componentType: number; + type: number; + count: number; + byteOffset?: number; + min?: Array; + max?: Array; +}; +declare class Accessor { + componentLen: number; + elementCnt: number; + byteOffset: number; + byteSize: number; + boundMin: Array | null; + boundMax: Array | null; + type: string | null; + data: TTypeArray | null; + fromBin(accessor: TAccessor, bufView: TBufferView, bin: ArrayBuffer): this; +} +export default Accessor; diff --git a/dist/Animation.d.ts b/dist/Animation.d.ts new file mode 100644 index 0000000..41bd5cb --- /dev/null +++ b/dist/Animation.d.ts @@ -0,0 +1,38 @@ +import type Accessor from './Accessor'; +type Transform = typeof ETransform[keyof typeof ETransform]; +export declare const ETransform: { + readonly Rot: 0; + readonly Pos: 1; + readonly Scl: 2; +}; +type Lerp = typeof ELerp[keyof typeof ELerp]; +export declare const ELerp: { + readonly Step: 0; + readonly Linear: 1; + readonly Cubic: 2; +}; +export declare class Track { + static Transform: { + readonly Rot: 0; + readonly Pos: 1; + readonly Scl: 2; + }; + static Lerp: { + readonly Step: 0; + readonly Linear: 1; + readonly Cubic: 2; + }; + transform: Transform; + interpolation: Lerp; + jointIndex: number; + timeStampIndex: number; + keyframes: Accessor; + static fromGltf(jointIdx: number, target: string, inter: string): Track; +} +export declare class Animation { + name: string; + timestamps: Array; + tracks: Array; + constructor(name?: string); +} +export {}; diff --git a/dist/Draco.d.ts b/dist/Draco.d.ts new file mode 100644 index 0000000..e556d31 --- /dev/null +++ b/dist/Draco.d.ts @@ -0,0 +1,15 @@ +import type { Primitive } from './Mesh'; +import Accessor from './Accessor'; +export default class Draco { + mod: any; + decoder: any; + mesh: any; + faceCnt: number; + vertCnt: number; + constructor(mod: any); + dispose(): void; + loadMesh(bin: ArrayBuffer, offset: number, len: number): this; + loadPrimitive(prim: Primitive, dAttr: any, gAttr: any, json: any): void; + parseAttribute(dIdx: number, gIdx: number, json: any): Accessor; + decodeAttributeData(id: any, type: string, len: number): any; +} diff --git a/dist/Glb.d.ts b/dist/Glb.d.ts new file mode 100644 index 0000000..9efba31 --- /dev/null +++ b/dist/Glb.d.ts @@ -0,0 +1,2 @@ +declare function parseGLB(res: Response): Promise<[JSON, ArrayBuffer] | null>; +export default parseGLB; diff --git a/dist/InterleavedBuffer.d.ts b/dist/InterleavedBuffer.d.ts new file mode 100644 index 0000000..7eee91c --- /dev/null +++ b/dist/InterleavedBuffer.d.ts @@ -0,0 +1,24 @@ +declare class Attrib { + byteOffset: number; + componentLen: number; + boundMin: Array | null; + boundMax: Array | null; + constructor(accID: number, json: any); +} +export default class InterleavedBuffer { + data: Float32Array | null; + elementCnt: number; + componentLen: number; + byteStride: number; + byteSize: number; + position: Attrib | null; + normal: Attrib | null; + tangent: Attrib | null; + texcoord_0: Attrib | null; + texcoord_1: Attrib | null; + color_0: Attrib | null; + joints_0: Attrib | null; + weights_0: Attrib | null; + constructor(attr: any, json: any, bin: ArrayBuffer); +} +export {}; diff --git a/dist/Material.d.ts b/dist/Material.d.ts new file mode 100644 index 0000000..e8ebfb3 --- /dev/null +++ b/dist/Material.d.ts @@ -0,0 +1,13 @@ +import { TVec4 } from './types'; +export declare class Material { + index: number; + name: string; + baseColor: TVec4; + metallic: number; + roughness: number; + constructor(mat: any); + get baseColorHex(): number; + get baseColorGammaHex(): number; + get baseColorString(): string; + get baseColorGammaString(): string; +} diff --git a/dist/Mesh.d.ts b/dist/Mesh.d.ts new file mode 100644 index 0000000..3134c8b --- /dev/null +++ b/dist/Mesh.d.ts @@ -0,0 +1,24 @@ +import Accessor from './Accessor'; +import InterleavedBuffer from './InterleavedBuffer'; +export declare class Mesh { + index: number | null; + name: string | null; + primitives: Array; + position: number[] | null; + rotation: number[] | null; + scale: number[] | null; +} +export declare class Primitive { + materialName: string | null; + materialIdx: number | null; + indices: Accessor | null; + position: Accessor | null; + normal: Accessor | null; + tangent: Accessor | null; + texcoord_0: Accessor | null; + texcoord_1: Accessor | null; + color_0: Accessor | null; + joints_0: Accessor | null; + weights_0: Accessor | null; + interleaved: InterleavedBuffer | null; +} diff --git a/dist/Pose.d.ts b/dist/Pose.d.ts new file mode 100644 index 0000000..601b0f3 --- /dev/null +++ b/dist/Pose.d.ts @@ -0,0 +1,14 @@ +declare class PoseJoint { + index: number; + rot?: number[]; + pos?: number[]; + scl?: number[]; + constructor(idx: number, rot?: number[], pos?: number[], scl?: number[]); +} +declare class Pose { + name: string; + joints: Array; + constructor(name?: string); + add(idx: number, rot?: number[], pos?: number[], scl?: number[]): void; +} +export { Pose, PoseJoint }; diff --git a/dist/Skin.d.ts b/dist/Skin.d.ts new file mode 100644 index 0000000..15d270c --- /dev/null +++ b/dist/Skin.d.ts @@ -0,0 +1,17 @@ +export declare class Skin { + index: number | null; + name: string | null; + joints: Array; + position: number[] | null; + rotation: number[] | null; + scale: number[] | null; +} +export declare class SkinJoint { + name: string | null; + index: number | null; + parentIndex: number | null; + bindMatrix: number[] | null; + position: number[] | null; + rotation: number[] | null; + scale: number[] | null; +} diff --git a/dist/Texture.d.ts b/dist/Texture.d.ts new file mode 100644 index 0000000..fefc3b7 --- /dev/null +++ b/dist/Texture.d.ts @@ -0,0 +1,6 @@ +export declare class Texture { + index: number | null; + name: string | null; + mime: string | null; + blob: Blob | null; +} diff --git a/dist/gltf2parser.cjs.js b/dist/gltf2parser.cjs.js index 4ebf81f..76c6d42 100644 --- a/dist/gltf2parser.cjs.js +++ b/dist/gltf2parser.cjs.js @@ -65,14 +65,16 @@ const ComponentVarMap = { }; class Accessor { - componentLen = 0; - elementCnt = 0; - byteOffset = 0; - byteSize = 0; - boundMin = null; - boundMax = null; - type = null; - data = null; + constructor() { + this.componentLen = 0; + this.elementCnt = 0; + this.byteOffset = 0; + this.byteSize = 0; + this.boundMin = null; + this.boundMax = null; + this.type = null; + this.data = null; + } fromBin(accessor, bufView, bin) { const [ compByte, @@ -99,11 +101,11 @@ class Accessor { } class Attrib { - byteOffset = 0; - componentLen = 0; - boundMin = null; - boundMax = null; constructor(accID, json) { + this.byteOffset = 0; + this.componentLen = 0; + this.boundMin = null; + this.boundMax = null; const accessor = json.accessors[accID]; this.componentLen = ComponentVarMap[accessor.type]; this.byteOffset = accessor.byteOffset; @@ -112,20 +114,20 @@ class Attrib { } } class InterleavedBuffer { - data = null; - elementCnt = 0; - componentLen = 0; - byteStride = 0; - byteSize = 0; - position = null; - normal = null; - tangent = null; - texcoord_0 = null; - texcoord_1 = null; - color_0 = null; - joints_0 = null; - weights_0 = null; constructor(attr, json, bin) { + this.data = null; + this.elementCnt = 0; + this.componentLen = 0; + this.byteStride = 0; + this.byteSize = 0; + this.position = null; + this.normal = null; + this.tangent = null; + this.texcoord_0 = null; + this.texcoord_1 = null; + this.color_0 = null; + this.joints_0 = null; + this.weights_0 = null; const accessor = json.accessors[attr.POSITION]; const bView = json.bufferViews[accessor.bufferView]; this.elementCnt = accessor.count; @@ -154,12 +156,9 @@ class InterleavedBuffer { } class Draco { - mod; - decoder; - mesh; - faceCnt = 0; - vertCnt = 0; constructor(mod) { + this.faceCnt = 0; + this.vertCnt = 0; this.mod = mod; this.decoder = new this.mod.Decoder(); } @@ -267,44 +266,52 @@ class Draco { } class Mesh { - index = null; - name = null; - primitives = []; - position = null; - rotation = null; - scale = null; + constructor() { + this.index = null; + this.name = null; + this.primitives = []; + this.position = null; + this.rotation = null; + this.scale = null; + } } class Primitive { - materialName = null; - materialIdx = null; - indices = null; - position = null; - normal = null; - tangent = null; - texcoord_0 = null; - texcoord_1 = null; - color_0 = null; - joints_0 = null; - weights_0 = null; - interleaved = null; + constructor() { + this.materialName = null; + this.materialIdx = null; + this.indices = null; + this.position = null; + this.normal = null; + this.tangent = null; + this.texcoord_0 = null; + this.texcoord_1 = null; + this.color_0 = null; + this.joints_0 = null; + this.weights_0 = null; + this.interleaved = null; + } } class Skin { - index = null; - name = null; - joints = []; - position = null; - rotation = null; - scale = null; + constructor() { + this.index = null; + this.name = null; + this.joints = []; + this.position = null; + this.rotation = null; + this.scale = null; + } } class SkinJoint { - name = null; - index = null; - parentIndex = null; - bindMatrix = null; - position = null; - rotation = null; - scale = null; + constructor() { + this.name = null; + this.index = null; + this.parentIndex = null; + this.bindMatrix = null; + this.position = null; + this.rotation = null; + this.scale = null; + } } const ETransform = { @@ -317,16 +324,15 @@ const ELerp = { Linear: 1, Cubic: 2 }; -class Track { - static Transform = ETransform; - static Lerp = ELerp; - transform = ETransform.Pos; - interpolation = ELerp.Step; - jointIndex = 0; - timeStampIndex = 0; - keyframes; +const _Track = class { + constructor() { + this.transform = ETransform.Pos; + this.interpolation = ELerp.Step; + this.jointIndex = 0; + this.timeStampIndex = 0; + } static fromGltf(jointIdx, target, inter) { - const t = new Track(); + const t = new _Track(); t.jointIndex = jointIdx; switch (target) { case "translation": @@ -352,29 +358,30 @@ class Track { } return t; } -} +}; +let Track = _Track; +Track.Transform = ETransform; +Track.Lerp = ELerp; class Animation { - name = ""; - timestamps = []; - tracks = []; constructor(name) { + this.name = ""; + this.timestamps = []; + this.tracks = []; if (name) this.name = name; } } class Texture { - index = null; - name = null; - mime = null; - blob = null; + constructor() { + this.index = null; + this.name = null; + this.mime = null; + this.blob = null; + } } class PoseJoint { - index; - rot; - pos; - scl; constructor(idx, rot, pos, scl) { this.index = idx; this.rot = rot; @@ -383,9 +390,9 @@ class PoseJoint { } } class Pose { - name = ""; - joints = []; constructor(name) { + this.name = ""; + this.joints = []; if (name) this.name = name; } @@ -407,12 +414,12 @@ function hexString(r, g, b) { return ("#" + rr.slice(-2) + gg.slice(-2) + bb.slice(-2)).toUpperCase(); } class Material { - index = -1; - name = ""; - baseColor = [0, 0, 0, 1]; - metallic = 0; - roughness = 0; constructor(mat) { + this.index = -1; + this.name = ""; + this.baseColor = [0, 0, 0, 1]; + this.metallic = 0; + this.roughness = 0; this.name = mat.name || window.crypto.randomUUID(); if (mat.pbrMetallicRoughness) { if (mat.pbrMetallicRoughness.baseColorFactor) { @@ -440,11 +447,9 @@ class Material { } class Gltf2Parser { - json; - bin; - _needsDraco = false; - _extDraco = void 0; constructor(json, bin) { + this._needsDraco = false; + this._extDraco = void 0; this.json = json; this.bin = bin || new ArrayBuffer(0); if (json.extensionsRequired) { @@ -932,6 +937,7 @@ exports.Accessor = Accessor; exports.Animation = Animation; exports.ELerp = ELerp; exports.ETransform = ETransform; +exports.Gltf2Parser = Gltf2Parser; exports.Mesh = Mesh; exports.Pose = Pose; exports.Primitive = Primitive; @@ -939,5 +945,4 @@ exports.Skin = Skin; exports.SkinJoint = SkinJoint; exports.Texture = Texture; exports.Track = Track; -exports["default"] = Gltf2Parser; exports.parseGLB = parseGLB; diff --git a/dist/gltf2parser.es.js b/dist/gltf2parser.es.js index d16ecaa..6f6da13 100644 --- a/dist/gltf2parser.es.js +++ b/dist/gltf2parser.es.js @@ -61,14 +61,16 @@ const ComponentVarMap = { }; class Accessor { - componentLen = 0; - elementCnt = 0; - byteOffset = 0; - byteSize = 0; - boundMin = null; - boundMax = null; - type = null; - data = null; + constructor() { + this.componentLen = 0; + this.elementCnt = 0; + this.byteOffset = 0; + this.byteSize = 0; + this.boundMin = null; + this.boundMax = null; + this.type = null; + this.data = null; + } fromBin(accessor, bufView, bin) { const [ compByte, @@ -95,11 +97,11 @@ class Accessor { } class Attrib { - byteOffset = 0; - componentLen = 0; - boundMin = null; - boundMax = null; constructor(accID, json) { + this.byteOffset = 0; + this.componentLen = 0; + this.boundMin = null; + this.boundMax = null; const accessor = json.accessors[accID]; this.componentLen = ComponentVarMap[accessor.type]; this.byteOffset = accessor.byteOffset; @@ -108,20 +110,20 @@ class Attrib { } } class InterleavedBuffer { - data = null; - elementCnt = 0; - componentLen = 0; - byteStride = 0; - byteSize = 0; - position = null; - normal = null; - tangent = null; - texcoord_0 = null; - texcoord_1 = null; - color_0 = null; - joints_0 = null; - weights_0 = null; constructor(attr, json, bin) { + this.data = null; + this.elementCnt = 0; + this.componentLen = 0; + this.byteStride = 0; + this.byteSize = 0; + this.position = null; + this.normal = null; + this.tangent = null; + this.texcoord_0 = null; + this.texcoord_1 = null; + this.color_0 = null; + this.joints_0 = null; + this.weights_0 = null; const accessor = json.accessors[attr.POSITION]; const bView = json.bufferViews[accessor.bufferView]; this.elementCnt = accessor.count; @@ -150,12 +152,9 @@ class InterleavedBuffer { } class Draco { - mod; - decoder; - mesh; - faceCnt = 0; - vertCnt = 0; constructor(mod) { + this.faceCnt = 0; + this.vertCnt = 0; this.mod = mod; this.decoder = new this.mod.Decoder(); } @@ -263,44 +262,52 @@ class Draco { } class Mesh { - index = null; - name = null; - primitives = []; - position = null; - rotation = null; - scale = null; + constructor() { + this.index = null; + this.name = null; + this.primitives = []; + this.position = null; + this.rotation = null; + this.scale = null; + } } class Primitive { - materialName = null; - materialIdx = null; - indices = null; - position = null; - normal = null; - tangent = null; - texcoord_0 = null; - texcoord_1 = null; - color_0 = null; - joints_0 = null; - weights_0 = null; - interleaved = null; + constructor() { + this.materialName = null; + this.materialIdx = null; + this.indices = null; + this.position = null; + this.normal = null; + this.tangent = null; + this.texcoord_0 = null; + this.texcoord_1 = null; + this.color_0 = null; + this.joints_0 = null; + this.weights_0 = null; + this.interleaved = null; + } } class Skin { - index = null; - name = null; - joints = []; - position = null; - rotation = null; - scale = null; + constructor() { + this.index = null; + this.name = null; + this.joints = []; + this.position = null; + this.rotation = null; + this.scale = null; + } } class SkinJoint { - name = null; - index = null; - parentIndex = null; - bindMatrix = null; - position = null; - rotation = null; - scale = null; + constructor() { + this.name = null; + this.index = null; + this.parentIndex = null; + this.bindMatrix = null; + this.position = null; + this.rotation = null; + this.scale = null; + } } const ETransform = { @@ -313,16 +320,15 @@ const ELerp = { Linear: 1, Cubic: 2 }; -class Track { - static Transform = ETransform; - static Lerp = ELerp; - transform = ETransform.Pos; - interpolation = ELerp.Step; - jointIndex = 0; - timeStampIndex = 0; - keyframes; +const _Track = class { + constructor() { + this.transform = ETransform.Pos; + this.interpolation = ELerp.Step; + this.jointIndex = 0; + this.timeStampIndex = 0; + } static fromGltf(jointIdx, target, inter) { - const t = new Track(); + const t = new _Track(); t.jointIndex = jointIdx; switch (target) { case "translation": @@ -348,29 +354,30 @@ class Track { } return t; } -} +}; +let Track = _Track; +Track.Transform = ETransform; +Track.Lerp = ELerp; class Animation { - name = ""; - timestamps = []; - tracks = []; constructor(name) { + this.name = ""; + this.timestamps = []; + this.tracks = []; if (name) this.name = name; } } class Texture { - index = null; - name = null; - mime = null; - blob = null; + constructor() { + this.index = null; + this.name = null; + this.mime = null; + this.blob = null; + } } class PoseJoint { - index; - rot; - pos; - scl; constructor(idx, rot, pos, scl) { this.index = idx; this.rot = rot; @@ -379,9 +386,9 @@ class PoseJoint { } } class Pose { - name = ""; - joints = []; constructor(name) { + this.name = ""; + this.joints = []; if (name) this.name = name; } @@ -403,12 +410,12 @@ function hexString(r, g, b) { return ("#" + rr.slice(-2) + gg.slice(-2) + bb.slice(-2)).toUpperCase(); } class Material { - index = -1; - name = ""; - baseColor = [0, 0, 0, 1]; - metallic = 0; - roughness = 0; constructor(mat) { + this.index = -1; + this.name = ""; + this.baseColor = [0, 0, 0, 1]; + this.metallic = 0; + this.roughness = 0; this.name = mat.name || window.crypto.randomUUID(); if (mat.pbrMetallicRoughness) { if (mat.pbrMetallicRoughness.baseColorFactor) { @@ -436,11 +443,9 @@ class Material { } class Gltf2Parser { - json; - bin; - _needsDraco = false; - _extDraco = void 0; constructor(json, bin) { + this._needsDraco = false; + this._extDraco = void 0; this.json = json; this.bin = bin || new ArrayBuffer(0); if (json.extensionsRequired) { @@ -924,4 +929,4 @@ class Gltf2Parser { } } -export { Accessor, Animation, ELerp, ETransform, Mesh, Pose, Primitive, Skin, SkinJoint, Texture, Track, Gltf2Parser as default, parseGLB }; +export { Accessor, Animation, ELerp, ETransform, Gltf2Parser, Mesh, Pose, Primitive, Skin, SkinJoint, Texture, Track, parseGLB }; diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..a36e647 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,39 @@ +import parseGLB from './Glb'; +import Accessor from './Accessor'; +import Draco from './Draco'; +import { Mesh, Primitive } from './Mesh'; +import { Skin, SkinJoint } from './Skin'; +import { Animation, Track, ETransform, ELerp } from './Animation'; +import { Texture } from './Texture'; +import { Pose } from './Pose'; +import { Material } from './Material'; +declare class Gltf2Parser { + json: any; + bin: ArrayBuffer; + _needsDraco: boolean; + _extDraco?: Draco; + constructor(json: any, bin?: ArrayBuffer | null); + get needsDraco(): boolean; + useDraco(mod: any): this; + dispose(): void; + getNodeByName(n: string): [any, number] | null; + getMeshNames(): Array; + getMeshByName(n: string): [any, number] | null; + getMeshNodes(idx: number): Array; + getMesh(id: string | number | undefined): Mesh | null; + getSkinNames(): Array; + getSkinByName(n: string): [any, number] | null; + getSkin(id: string | number | undefined): Skin | null; + getMaterial(id: string | number | undefined): Material | null; + getAllMaterials(): Record; + getTexture(id: number): Texture | null; + getAnimationNames(): Array; + getAnimationByName(n: string): [any, number] | null; + getAnimation(id: string | number | undefined): any; + getPoseByName(n: string): [any, number] | null; + getPose(id?: string): Pose | null; + parseAccessor(accID: number): Accessor | null; + isAccessorInterleaved(accID: number): boolean; + static fetch(url: string): Promise; +} +export { parseGLB, Accessor, Texture, Pose, Mesh, Primitive, Skin, SkinJoint, Animation, Track, ETransform, ELerp, Gltf2Parser }; diff --git a/dist/structs.d.ts b/dist/structs.d.ts new file mode 100644 index 0000000..e1f3f00 --- /dev/null +++ b/dist/structs.d.ts @@ -0,0 +1,3 @@ +import { TTypeArrayCon } from './types'; +export declare const ComponentTypeMap: Record; +export declare const ComponentVarMap: Record; diff --git a/dist/types.d.ts b/dist/types.d.ts new file mode 100644 index 0000000..520df76 --- /dev/null +++ b/dist/types.d.ts @@ -0,0 +1,4 @@ +export type TTypeArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array; +export type TTypeArrayCon = Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor; +export type TVec3 = Array | [number, number, number]; +export type TVec4 = Array | [number, number, number, number]; diff --git a/package.json b/package.json index be1a985..606b3e1 100644 --- a/package.json +++ b/package.json @@ -1,46 +1,48 @@ { - "name" : "gltf2parser", - "version" : "0.0.2", - "author" : "Pedro Sousa ( Vor @ SketchPunk Labs )", - "description" : "Parse GLTF2 Files", - "keywords" : ["gltf", "webgl", "mesh"], - "license" : "MIT", - - "homepage" : "https://github.com/sketchpunklabs/gltf2parser#readme", - "repository" : { "type": "git", "url": "git+https://github.com/sketchpunklabs/gltf2parser.git" }, - "bugs" : { "url": "https://github.com/sketchpunklabs/gltf2parser/issues" }, - - "files" : [ "dist" ], - "main" : "./dist/gltf2parser.cjs.js", - "module" : "./dist/gltf2parser.es.js", - "types" : "./dist/index.d.ts", + "name": "gltf2parser", + "version": "0.0.2", + "author": "Pedro Sousa ( Vor @ SketchPunk Labs )", + "description": "Parse GLTF2 Files", + "keywords": [ + "gltf", + "webgl", + "mesh" + ], + "license": "MIT", + "homepage": "https://github.com/sketchpunklabs/gltf2parser#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/sketchpunklabs/gltf2parser.git" + }, + "bugs": { + "url": "https://github.com/sketchpunklabs/gltf2parser/issues" + }, + "files": [ + "dist" + ], + "module": "./dist/gltf2parser.es.js", + "types": "./dist/index.d.ts", "exports": { ".": { - "import" : "./dist/gltf2parser.es.js", - "require" : "./dist/gltf2parser.cjs.js" + "import": "./dist/gltf2parser.es.js", + "require": "./dist/gltf2parser.cjs.js" } }, - - "scripts" : { - "dev" : "vite", - "build" : "vite build", - "build:types" : "tsc --declaration --noEmit false --emitDeclarationOnly --strict false --outDir ./dist", - "build:site" : "vite build --mode site", - "pack" : "npm pack", - "preview-site" : "vite preview", - "lint" : "eslint . --ext .ts" - }, - - "dependencies": { + "scripts": { + "dev": "vite", + "build": "vite build", + "build:types": "tsc --declaration --noEmit false --emitDeclarationOnly --strict false --outDir ./dist", + "build:site": "vite build --mode site", + "pack": "npm pack", + "preview-site": "vite preview", + "lint": "eslint . --ext .ts" }, - "devDependencies": { - "typescript" : "^4.6.2", - "vite" : "^2.8.6", - "three" : "^0.138.2", - - "eslint" : "^8.10.0", - "@typescript-eslint/eslint-plugin" : "^5.13.0", - "@typescript-eslint/parser" : "^5.13.0" + "@typescript-eslint/eslint-plugin": "^5.62.0", + "@typescript-eslint/parser": "^5.13.0", + "eslint": "^8.10.0", + "three": "^0.138.2", + "typescript": "^4.6.2", + "vite": "^2.8.6" } -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index 049eca7..5179ec0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -629,11 +629,10 @@ class Gltf2Parser{ // #endregion } -export default Gltf2Parser; -export { +export { parseGLB, Accessor, Texture, Pose, Mesh, Primitive, Skin, SkinJoint, - Animation, Track, ETransform, ELerp, + Animation, Track, ETransform, ELerp, Gltf2Parser }; \ No newline at end of file