fix rendering error

This commit is contained in:
jerrywwl
2019-03-14 18:58:01 +08:00
parent c703443e67
commit 1e725d2240
4 changed files with 27 additions and 20 deletions
+16 -18
View File
File diff suppressed because one or more lines are too long
+2
View File
@@ -55,6 +55,7 @@ export class ForwardStage extends RenderStage {
if (camera.clearFlag & GFXClearFlag.COLOR) {
colors[0] = camera.clearColor;
/*
if (this._pipeline.isHDR) {
colors[0] = SRGBToLinear(colors[0]);
const scale = 1.0 / (camera.exposure * this._pipeline.fpScaleInv);
@@ -62,6 +63,7 @@ export class ForwardStage extends RenderStage {
colors[0].g *= scale;
colors[0].b *= scale;
}
*/
colors.length = 1;
}
+1 -1
View File
@@ -526,7 +526,7 @@ export abstract class RenderPipeline {
_vec4Array[0] = camera.exposure;
_vec4Array[1] = _vec4Array[0] * this._fpScaleInv;
_vec4Array[2] = 0.0;
_vec4Array[2] = this._isHDR ? 1.0 : 0.0;
_vec4Array[3] = 1.0 / _vec4Array[1];
this._defaultUboGlobal!.view.set(_vec4Array, UBOGlobal.EXPOSURE_OFFSET);
+8 -1
View File
@@ -1,10 +1,11 @@
import { Root } from '../../core/root';
import { RenderPassStage, UBOGlobal } from '../define';
import { UBOGlobal } from '../define';
import { RenderPipeline, IRenderPipelineInfo } from '../render-pipeline';
import { RenderView } from '../render-view';
import { UIFlow } from './ui-flow';
import { mat4 } from '../../core/vmath';
const _vec4Array = new Float32Array(4);
const _mat4Array = new Float32Array(16);
export class UIPipeline extends RenderPipeline {
@@ -39,6 +40,12 @@ export class UIPipeline extends RenderPipeline {
const camera = view.camera;
mat4.array(_mat4Array, camera.matViewProj);
this._defaultUboGlobal!.view.set(_mat4Array, UBOGlobal.MAT_VIEW_PROJ_OFFSET);
_vec4Array[0] = camera.exposure;
_vec4Array[1] = _vec4Array[0] * this._fpScaleInv;
_vec4Array[2] = 0.0;
_vec4Array[3] = 1.0 / _vec4Array[1];
this._defaultUboGlobal!.view.set(_vec4Array, UBOGlobal.EXPOSURE_OFFSET);
// update ubos
this._globalBindings.get(UBOGlobal.BLOCK.name)!.buffer!.update(this._defaultUboGlobal!.view.buffer);
}