|
|
|
@ -16,7 +16,8 @@ export enum DrawMode
|
|
|
|
|
|
|
|
|
|
export class PreViewer
|
|
|
|
|
{
|
|
|
|
|
private _bNeedUpdate: boolean;
|
|
|
|
|
//现在我们移动一次鼠标,为后面的3帧都进行渲染,避免某些情况下丢帧
|
|
|
|
|
private _NeedRenderCount = 3;
|
|
|
|
|
//渲染器
|
|
|
|
|
private _Render: WebGLRenderer;
|
|
|
|
|
//场景
|
|
|
|
@ -73,15 +74,15 @@ export class PreViewer
|
|
|
|
|
get Camera() { return this._Camera.Camera; }
|
|
|
|
|
UpdateScreen()
|
|
|
|
|
{
|
|
|
|
|
this._bNeedUpdate = true;
|
|
|
|
|
this._NeedRenderCount = 3;
|
|
|
|
|
}
|
|
|
|
|
StartRender = () =>
|
|
|
|
|
{
|
|
|
|
|
requestAnimationFrame(this.StartRender);
|
|
|
|
|
if (this._Scene != null && this._bNeedUpdate)
|
|
|
|
|
if (this._Scene != null && this._NeedRenderCount > 0)
|
|
|
|
|
{
|
|
|
|
|
this.Render();
|
|
|
|
|
this._bNeedUpdate = false;
|
|
|
|
|
this._NeedRenderCount--;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
Render()
|
|
|
|
|