diff --git a/cocos/core/3d/framework/model-component.ts b/cocos/core/3d/framework/model-component.ts index ffe7a9413f..d9b4cb8b86 100644 --- a/cocos/core/3d/framework/model-component.ts +++ b/cocos/core/3d/framework/model-component.ts @@ -179,6 +179,9 @@ export class ModelComponent extends RenderableComponent { } public onEnable () { + if (!this._model) { + this._updateModels(); + } if (this._model) { this._attachToScene(); } diff --git a/cocos/core/gfx/webgl/webgl-texture.ts b/cocos/core/gfx/webgl/webgl-texture.ts index 424ded5dd9..2481ee5a05 100644 --- a/cocos/core/gfx/webgl/webgl-texture.ts +++ b/cocos/core/gfx/webgl/webgl-texture.ts @@ -5,7 +5,7 @@ import { WebGLCmdFuncCreateTexture, WebGLCmdFuncDestroyTexture, WebGLCmdFuncResi import { WebGLGFXDevice } from './webgl-device'; import { WebGLGPUTexture } from './webgl-gpu-objects'; -function IsPowerOf2 (x: number): boolean{ +function IsPowerOf2 (x: number) { return x > 0 && (x & (x - 1)) === 0; } diff --git a/cocos/core/renderer/models/skeletal-animation-utils.ts b/cocos/core/renderer/models/skeletal-animation-utils.ts index 2dde663e9b..4cbdd3c980 100644 --- a/cocos/core/renderer/models/skeletal-animation-utils.ts +++ b/cocos/core/renderer/models/skeletal-animation-utils.ts @@ -108,7 +108,7 @@ function uploadJointDataDQS (out: Float32Array, base: number, mat: Mat4, firstBo } function roundUpTextureSize (targetLength: number, formatSize: number) { - const minSize = 204; + const minSize = 1020; const formatScale = 4 / Math.sqrt(formatSize); return Math.ceil(Math.max(minSize * formatScale, targetLength) / 12) * 12; } diff --git a/cocos/core/renderer/models/skinning-model.ts b/cocos/core/renderer/models/skinning-model.ts index 8d907bed8b..9366613f01 100644 --- a/cocos/core/renderer/models/skinning-model.ts +++ b/cocos/core/renderer/models/skinning-model.ts @@ -41,6 +41,7 @@ import { samplerLib } from '../core/sampler-lib'; import { Model } from '../scene/model'; import { RenderScene } from '../scene/render-scene'; import { IAnimInfo, IJointsTextureHandle, jointsTextureSamplerHash, selectJointsMediumType } from './skeletal-animation-utils'; +import { DataPoolManager } from '../data-pool-manager'; interface IJointsInfo { buffer: GFXBuffer | null; @@ -85,7 +86,7 @@ export class SkinningModel extends Model { this._mesh = mesh; if (!skeleton || !skinningRoot || !mesh) { return; } this._transform = skinningRoot; - this._jointsMedium.animInfo = cc.director.root.dataPoolManager.jointsAnimationInfo.get(skinningRoot.uuid); + this._jointsMedium.animInfo = (cc.director.root.dataPoolManager as DataPoolManager).jointsAnimationInfo.get(skinningRoot.uuid); if (!this._jointsMedium.buffer) { this._jointsMedium.buffer = this._device.createBuffer({ usage: GFXBufferUsageBit.UNIFORM | GFXBufferUsageBit.TRANSFER_DST, @@ -124,7 +125,7 @@ export class SkinningModel extends Model { public uploadAnimation (anim: AnimationClip | null) { if (!this._skeleton || !this._mesh) { return; } this.uploadedAnim = anim; - const resMgr = cc.director.root.dataPoolManager; + const resMgr = cc.director.root.dataPoolManager as DataPoolManager; const texture = anim ? resMgr.jointsTexturePool.getJointsTextureWithAnimation(this._skeleton, anim) : resMgr.jointsTexturePool.getDefaultJointsTexture(this._skeleton); resMgr.jointsAnimationInfo.switchClip(this._jointsMedium.animInfo!, anim); @@ -136,7 +137,7 @@ export class SkinningModel extends Model { protected _applyJointsTexture (texture: IJointsTextureHandle | null) { if (!texture) { return; } const oldTex = this._jointsMedium.texture; - if (oldTex && oldTex !== texture) { cc.director.root.dataPoolManager.jointsTexturePool.releaseHandle(oldTex); } + if (oldTex && oldTex !== texture) { (cc.director.root.dataPoolManager as DataPoolManager).jointsTexturePool.releaseHandle(oldTex); } this._jointsMedium.texture = texture; const { buffer, jointsTextureInfo } = this._jointsMedium; jointsTextureInfo[0] = texture.handle.texture.width;