mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
fixed setOrthographicProjection
This commit is contained in:
parent
0212461717
commit
a6452745a3
@ -792,3 +792,5 @@ class MyScene extends RenderNode {
|
||||
}
|
||||
|
||||
renderer.addNodes([new scene.Axes(), new MyScene()]);
|
||||
|
||||
window.renderer = renderer;
|
||||
|
||||
@ -1250,9 +1250,8 @@ class Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
protected _readDepthBuffer() {
|
||||
this.depthFramebuffer!.readPixelBuffersAsync();
|
||||
//console.log("read depth");
|
||||
protected _readDepthBuffer(callback?: () => void) {
|
||||
this.depthFramebuffer!.readPixelBuffersAsync(callback);
|
||||
}
|
||||
|
||||
protected _readPickingBuffer_webgl1() {
|
||||
@ -1390,12 +1389,14 @@ class Renderer {
|
||||
|
||||
public setOrthographicProjection(isOrtho: boolean) {
|
||||
if (isOrtho !== this.activeCamera.isOrthographic) {
|
||||
let dist = this.getDepthMinDistance();
|
||||
if (dist && isOrtho) {
|
||||
this.activeCamera.focusDistance = dist;
|
||||
}
|
||||
this.activeCamera.isOrthographic = isOrtho;
|
||||
this.events.dispatch(this.events.projchanged, this.activeCamera);
|
||||
this._readDepthBuffer(() => {
|
||||
let dist = this.getDepthMinDistance();
|
||||
if (dist && isOrtho) {
|
||||
this.activeCamera.focusDistance = dist;
|
||||
}
|
||||
this.activeCamera.isOrthographic = isOrtho;
|
||||
this.events.dispatch(this.events.projchanged, this.activeCamera);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -264,17 +264,15 @@ export class Framebuffer extends BaseFramebuffer {
|
||||
clientWaitAsync(gl, sync, 0).then(() => {
|
||||
this._skipFrame = false;
|
||||
gl.deleteSync(sync);
|
||||
|
||||
for (let i = 0; i < pb.length; i++) {
|
||||
let pbi = pb[i];
|
||||
if (pbi.data) {
|
||||
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, pbi.buffer);
|
||||
gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, pbi.data!);
|
||||
callback && callback(this);
|
||||
}
|
||||
}
|
||||
|
||||
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
|
||||
callback && callback(this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user