Files
EzVibe/assets/live2d/CubismSdkForWeb-5-r.5/live2dcubismpixi.js
e2hang 798e5c2f7d checkpoint: segfault root cause analysis + Live2D stability fixes
- _refresh_messages: widget pool reuse to avoid layout cascade → QWebEngineView crash
- viewer.html: QWebChannel bridge, texture resize, burst render, gl.finish
- live2d_view.py: debug checkpoints, playMotion/setExpression render-on-demand
- main.py: Chromium flags --no-sandbox --in-process-gpu --disable-gpu-rasterization --ignore-gpu-blocklist
- scheduler.py: test_reminder re-enabled
- docs: complete root cause analysis
2026-05-23 13:33:58 +08:00

2 lines
10 KiB
JavaScript

var LIVE2DCUBISMPIXI,__extends=this&&this.__extends||function(){var e=function(r,t){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(r,t)};return function(r,t){function s(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}}();!function(e){var r=function(e){function r(r,s,o,a,n,l){var u=e.call(this)||this;if(u._coreModel=r,u._textures=s,u._animator=o,u._physicsRig=a,u._userData=n,u._groups=l,u._animator.groups=u._groups,null==u._coreModel)return u;u._meshes=new Array(u._coreModel.drawables.ids.length);for(var d=0;d<u._meshes.length;++d){for(var c=u._coreModel.drawables.vertexUvs[d].slice(0,u._coreModel.drawables.vertexUvs[d].length),h=1;h<c.length;h+=2)c[h]=1-c[h];if(u._meshes[d]=new i(s[u._coreModel.drawables.textureIndices[d]],u._coreModel.drawables.vertexPositions[d],c,u._coreModel.drawables.indices[d],PIXI.DRAW_MODES.TRIANGLES),u._meshes[d].name=u._coreModel.drawables.ids[d],u._meshes[d].scale.y*=-1,u._meshes[d].isCulling=!Live2DCubismCore.Utils.hasIsDoubleSidedBit(u._coreModel.drawables.constantFlags[d]),Live2DCubismCore.Utils.hasBlendAdditiveBit(u._coreModel.drawables.constantFlags[d]))if(u._coreModel.drawables.maskCounts[d]>0){var _=new PIXI.Filter;_.blendMode=PIXI.BLEND_MODES.ADD,u._meshes[d].filters=[_]}else u._meshes[d].blendMode=PIXI.BLEND_MODES.ADD;else if(Live2DCubismCore.Utils.hasBlendMultiplicativeBit(u._coreModel.drawables.constantFlags[d]))if(u._coreModel.drawables.maskCounts[d]>0){var m=new PIXI.Filter;m.blendMode=PIXI.BLEND_MODES.MULTIPLY,u._meshes[d].filters=[m]}else u._meshes[d].blendMode=PIXI.BLEND_MODES.MULTIPLY;u.addChild(u._meshes[d])}return u._maskSpriteContainer=new t(r,u),u}return __extends(r,e),Object.defineProperty(r.prototype,"parameters",{get:function(){return this._coreModel.parameters},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"parts",{get:function(){return this._coreModel.parts},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"drawables",{get:function(){return this._coreModel.drawables},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"canvasinfo",{get:function(){return this._coreModel.canvasinfo},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"textures",{get:function(){return this._textures},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"animator",{get:function(){return this._animator},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"userData",{get:function(){return this._userData},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"meshes",{get:function(){return this._meshes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"masks",{get:function(){return this._maskSpriteContainer},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"groups",{get:function(){return this._groups},enumerable:!0,configurable:!0}),r.prototype.update=function(e){var r=this,t=.016*e;this._animator.updateAndEvaluate(t),this._physicsRig&&this._physicsRig.updateAndEvaluate(t),this._coreModel.update();for(var s=!1,i=0;i<this._meshes.length;++i)this._meshes[i].alpha=this._coreModel.drawables.opacities[i],this._meshes[i].visible=Live2DCubismCore.Utils.hasIsVisibleBit(this._coreModel.drawables.dynamicFlags[i]),Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(this._coreModel.drawables.dynamicFlags[i])&&(this._meshes[i].vertices=this._coreModel.drawables.vertexPositions[i],this._meshes[i].dirtyVertex=!0),Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(this._coreModel.drawables.dynamicFlags[i])&&(s=!0);s&&this.children.sort(function(e,t){var s=r._meshes.indexOf(e),i=r._meshes.indexOf(t);return r._coreModel.drawables.renderOrders[s]-r._coreModel.drawables.renderOrders[i]}),this._coreModel.drawables.resetDynamicFlags()},r.prototype.destroy=function(r){null!=this._coreModel&&this._coreModel.release(),e.prototype.destroy.call(this,r),this.masks.destroy(),this._meshes.forEach(function(e){e.destroy()}),(1==r||r.texture)&&this._textures.forEach(function(e){e.destroy()})},r.prototype.getModelMeshById=function(e){if(null==this._meshes)return null;for(var r=0,t=this._meshes;r<t.length;r++){var s=t[r];if(s.name===e)return s}return null},r.prototype.addParameterValueById=function(e,r){var t=this._coreModel.parameters.ids.indexOf(e);-1!=t&&(this._coreModel.parameters.values[t]=this._coreModel.parameters.values[t]+r)},r._create=function(e,t,s,i,o,a){void 0===i&&(i=null),void 0===o&&(o=null),void 0===a&&(a=null);var n=new r(e,t,s,i,o,a);return n.isValid?n:(n.destroy(),null)},Object.defineProperty(r.prototype,"isValid",{get:function(){return null!=this._coreModel},enumerable:!0,configurable:!0}),r}(PIXI.Container);e.Model=r;var t=function(e){function r(r,t){var s=e.call(this)||this;s._maskShaderVertSrc=new String("\n attribute vec2 aVertexPosition;\n attribute vec2 aTextureCoord;\n uniform mat3 projectionMatrix;\n varying vec2 vTextureCoord;\n void main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n }\n "),s._maskShaderFragSrc=new String("\n varying vec2 vTextureCoord;\n uniform sampler2D uSampler;\n void main(void){\n vec4 c = texture2D(uSampler, vTextureCoord);\n c.r = c.a;\n c.g = 0.0;\n c.b = 0.0;\n gl_FragColor = c;\n }\n "),s._maskShader=new PIXI.Filter(s._maskShaderVertSrc.toString(),s._maskShaderFragSrc.toString());var o=r.drawables.maskCounts,a=r.drawables.masks;s._maskMeshContainers=new Array,s._maskTextures=new Array,s._maskSprites=new Array;for(var n=0;n<t.meshes.length;++n)if(o[n]>0){for(var l=new PIXI.Container,u=0;u<a[n].length;++u){var d=r.drawables.masks[n][u],c=new i(t.meshes[d].texture,t.meshes[d].vertices,t.meshes[d].uvs,t.meshes[d].indices,PIXI.DRAW_MODES.TRIANGLES);c.name=t.meshes[d].name,c.transform=t.meshes[d].transform,c.worldTransform=t.meshes[d].worldTransform,c.localTransform=t.meshes[d].localTransform,c.isCulling=t.meshes[d].isCulling,c.isMaskMesh=!0,c.filters=[s._maskShader],l.addChild(c)}l.transform=t.transform,l.worldTransform=t.worldTransform,l.localTransform=t.localTransform,s._maskMeshContainers.push(l);var h=PIXI.RenderTexture.create(0,0);s._maskTextures.push(h);var _=new PIXI.Sprite(h);s._maskSprites.push(_),s.addChild(_),t.meshes[n].mask=_}return s}return __extends(r,e),Object.defineProperty(r.prototype,"maskSprites",{get:function(){return this._maskSprites},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"maskMeshes",{get:function(){return this._maskMeshContainers},enumerable:!0,configurable:!0}),r.prototype.destroy=function(e){this._maskSprites.forEach(function(e){e.destroy()}),this._maskTextures.forEach(function(e){e.destroy()}),this._maskMeshContainers.forEach(function(e){e.destroy()}),this._maskShader=null},r.prototype.update=function(e){for(var r=0;r<this._maskSprites.length;++r)e.render(this._maskMeshContainers[r],this._maskTextures[r],!0,null,!1)},r.prototype.resize=function(e,r){for(var t=0;t<this._maskTextures.length;++t)this._maskTextures[t].resize(e,r,!1)},r}(PIXI.Container);e.MaskSpriteContainer=t;var s=function(){function e(){this._textures=new Array,this._timeScale=1,this._animatorBuilder=new LIVE2DCUBISMFRAMEWORK.AnimatorBuilder}return e.prototype.setMoc=function(e){return this._moc=e,this},e.prototype.setTimeScale=function(e){return this._timeScale=e,this},e.prototype.setPhysics3Json=function(e){return this._physicsRigBuilder||(this._physicsRigBuilder=new LIVE2DCUBISMFRAMEWORK.PhysicsRigBuilder),this._physicsRigBuilder.setPhysics3Json(e),this},e.prototype.setUserData3Json=function(e){return this._userDataBuilder||(this._userDataBuilder=new LIVE2DCUBISMFRAMEWORK.UserDataBuilder),this._userDataBuilder.setUserData3Json(e),this},e.prototype.addTexture=function(e,r){return this._textures.splice(e,0,r),this},e.prototype.addAnimatorLayer=function(e,r,t){return void 0===r&&(r=LIVE2DCUBISMFRAMEWORK.BuiltinAnimationBlenders.OVERRIDE),void 0===t&&(t=1),this._animatorBuilder.addLayer(e,r,t),this},e.prototype.addGroups=function(e){return this._groups=e,this},e.prototype.buildFromModel3Json=function(e,r,t){var s=this,i=r.url,o=i.substring(0,i.lastIndexOf("/")+1),a=0;void 0!==r.data.FileReferences.Moc&&e.add("moc",o+r.data.FileReferences.Moc,{xhrType:PIXI.loaders.Resource.XHR_RESPONSE_TYPE.BUFFER}),void 0!==r.data.FileReferences.Textures&&r.data.FileReferences.Textures.forEach(function(r){e.add("texture"+a,o+r),a++}),void 0!==r.data.FileReferences.Physics&&e.add("physics",o+r.data.FileReferences.Physics,{xhrType:PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON}),void 0!==r.data.FileReferences.UserData&&e.add("userdata",o+r.data.FileReferences.UserData,{xhrType:PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON}),r.data.Groups,this._groups=LIVE2DCUBISMFRAMEWORK.Groups.fromModel3Json(r.data),e.load(function(e,r){if(void 0!==r.moc&&s.setMoc(Live2DCubismCore.Moc.fromArrayBuffer(r.moc.data)),void 0!==r.texture0)for(var i=0;i<a;i++)s.addTexture(i,r["texture"+i].texture);void 0!==r.physics&&s.setPhysics3Json(r.physics.data),void 0!==r.userdata&&s.setUserData3Json(r.userdata.data);var o=s.build();t(o)})},e.prototype.build=function(){var e=Live2DCubismCore.Model.fromMoc(this._moc);if(null==e)return null;var t=this._animatorBuilder.setTarget(e).setTimeScale(this._timeScale).build(),s=null;this._physicsRigBuilder&&(s=this._physicsRigBuilder.setTarget(e).setTimeScale(this._timeScale).build());var i=null;return this._userDataBuilder&&(i=this._userDataBuilder.setTarget(e).build()),r._create(e,this._textures,t,s,i,this._groups)},e}();e.ModelBuilder=s;var i=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.isCulling=!1,r.isMaskMesh=!1,r}return __extends(r,e),r.prototype._renderWebGL=function(r){!0===this.isMaskMesh?r.state.setFrontFace(1):r.state.setFrontFace(0),!0===this.isCulling?r.state.setCullFace(1):r.state.setCullFace(0),e.prototype._renderWebGL.call(this,r),r.state.setFrontFace(0)},r}(PIXI.mesh.Mesh);e.CubismMesh=i}(LIVE2DCUBISMPIXI||(LIVE2DCUBISMPIXI={}));