1 line
76 KiB
Plaintext
1 line
76 KiB
Plaintext
|
|
{"version":3,"file":"XLoader.cjs","sources":["../../src/loaders/XLoader.js"],"sourcesContent":["import {\n AnimationClip,\n AnimationMixer,\n Bone,\n BufferGeometry,\n FileLoader,\n Float32BufferAttribute,\n FrontSide,\n Loader,\n LoaderUtils,\n Matrix4,\n Mesh,\n MeshPhongMaterial,\n Quaternion,\n Skeleton,\n SkinnedMesh,\n TextureLoader,\n Uint16BufferAttribute,\n Vector2,\n Vector3,\n} from 'three'\nimport { decodeText } from '../_polyfill/LoaderUtils'\n\nvar XLoader = /* @__PURE__ */ (function () {\n var classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError('Cannot call a class as a function')\n }\n }\n\n var createClass = (function () {\n function defineProperties(target, props) {\n for (let i = 0; i < props.length; i++) {\n var descriptor = props[i]\n descriptor.enumerable = descriptor.enumerable || false\n descriptor.configurable = true\n if ('value' in descriptor) descriptor.writable = true\n Object.defineProperty(target, descriptor.key, descriptor)\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps)\n if (staticProps) defineProperties(Constructor, staticProps)\n return Constructor\n }\n })()\n\n var XboneInf = function XboneInf() {\n classCallCheck(this, XboneInf)\n\n this.boneName = ''\n this.BoneIndex = 0\n this.Indeces = []\n this.Weights = []\n this.initMatrix = null\n this.OffsetMatrix = null\n }\n\n var XAnimationInfo = function XAnimationInfo() {\n classCallCheck(this, XAnimationInfo)\n\n this.animeName = ''\n this.boneName = ''\n this.targetBone = null\n this.keyType = 4\n this.frameStartLv = 0\n this.keyFrames = []\n this.InverseMx = null\n }\n\n var XAnimationObj = (function () {\n function XAnimationObj(_flags) {\n classCallCheck(this, XAnimationObj)\n\n this.fps = 30\n this.name = 'xanimation'\n this.length = 0\n this.hierarchy = []\n this.putFlags = _flags\n if (this.putFlags.putPos === undefined) {\n this.putFlags.putPos = true\n }\n\n if (this.putFlags.putRot === undefined) {\n this.putFlags.putRot = true\n }\n\n if (this.putFlags.putScl === undefined) {\n this.putFlags.putScl = true\n }\n }\n\n createClass(XAnimationObj, [\n {\n key: 'make',\n value: function make(XAnimationInfoArray) {\n for (let i = 0; i < XAnimationInfoArray.length; i++) {\n this.hierarchy.push(this.makeBonekeys(XAnimationInfoArray[i]))\n }\n\n this.length = this.hierarchy[0].keys[this.hierarchy[0].keys.length - 1].time\n },\n },\n {\n key: 'clone',\n value: function clone() {\n return Object.assign({}, this)\n },\n },\n {\n key: 'makeBonekeys',\n value: function makeBonekeys(XAnimationInfo) {\n var refObj = {}\n refObj.name = XAnimationInfo.boneName\n refObj.parent = ''\n refObj.keys = this.keyFrameRefactor(XAnimationInfo)\n refObj.copy = function () {\n return Object.assign({}, this)\n }\n\n return refObj\n },\n },\n {\n key: 'keyFrameRefactor',\n value: function keyFrameRefactor(XAnimationInfo) {\n var keys = []\n for (let i = 0; i < XAnimationInfo.keyFrames.length; i++) {\n var keyframe = {}\n keyframe.time = XAnimationInfo.keyFrames[i].time * this.fps\n if (XAnimationInfo.keyFrames[i].pos && this.putFlags.putPos) {\n keyframe.pos = XAnimationInfo.keyFrames[i].pos\n }\n\n if (XAnimationInfo.keyFrames[i].rot && this.putFlags.putRot) {\n keyframe.rot = XAnimationInfo.keyFrames[i].rot\n }\n\n if (XAnimationInfo.keyFrames[i].scl && this.putFlags.putScl) {\n keyframe.scl = XAni
|