fix camera size scaling

This commit is contained in:
jerrywwl
2019-03-04 19:11:32 +08:00
parent 4beeb0095b
commit 7dc7d280d8
6 changed files with 389 additions and 19 deletions
+380 -11
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -103,7 +103,7 @@ export class WebGL2GFXDevice extends GFXDevice {
const webGLCtxAttribs: WebGLContextAttributes = {
alpha: true,
// antialias: this._isAntialias,
antialias: false,
antialias: true,
depth: true,
stencil: true,
premultipliedAlpha: this._isPremultipliedAlpha,
+1 -1
View File
@@ -12,7 +12,7 @@ export enum ForwardFlowPriority {
FORWARD = 0,
}
const _idVec4Array = Float32Array.from([0, 0, 0, 1]);
const _idVec4Array = Float32Array.from([1, 1, 1, 0]);
export class ForwardPipeline extends RenderPipeline {
+5 -3
View File
@@ -46,9 +46,11 @@ export class ForwardStage extends RenderStage {
const queue = this._pipeline.queue;
const camera = view.camera!;
this._renderArea.width = camera.width;
this._renderArea.height = camera.height;
const vp = camera.viewport;
this._renderArea.x = vp.x * camera.width;
this._renderArea.y = vp.y * camera.height;
this._renderArea.width = vp.width * camera.width;
this._renderArea.height = vp.height * camera.height;
colors[0] = camera.clearColor;
cmdBuff.begin();
+2 -2
View File
@@ -162,11 +162,11 @@ export class Camera {
return this._proj;
}
set viewport (v) {
set viewport (v: Rect) {
this._viewport = v;
}
get viewport () {
get viewport (): Rect {
return this._viewport;
}
-1
View File
@@ -1,6 +1,5 @@
import { Node } from '../../scene-graph/node';
import { RenderScene } from './render-scene';
import { vec4 } from '../../core/vmath';
export enum LightType {
DIRECTIONAL,