Skip to content

Commit 7740858

Browse files
committed
Always use vec4
1 parent 604a60e commit 7740858

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/shader-chunks/shaders/gbuffer-default-output.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818

1919
#ifdef out_Normal
2020

21-
out_Normal = vec2(0.0);
21+
out_Normal = vec4(0.0);
2222

2323
#endif

src/utils/Background.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ export class Background extends Group implements Disposable {
9797

9898
for(const entry of values.gBuffer) {
9999

100-
const t = (typeof entry[1] === "number") ? "float" : `vec${[...entry[1]].length}`;
101-
102100
uniforms.set(`pp_${entry[0]}`, new Uniform(entry[1]));
103-
uniformDeclarations.push(`uniform ${t} pp_${entry[0]};`);
101+
uniformDeclarations.push(`uniform vec4 pp_${entry[0]};`);
104102
mrtWrites.push(`\t#ifdef out_${entry[0]}\n\t\tout_${entry[0]} = pp_${entry[0]};\n#endif`);
105103

106104
}

src/utils/ClearValues.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ClearValues extends EventDispatcher<BaseEventMap> {
2929
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/clearBuffer
3030
*/
3131

32-
readonly gBuffer: Map<string, GLfloat | GLfloat[]>;
32+
readonly gBuffer: Map<string, [GLfloat, GLfloat, GLfloat, GLfloat]>;
3333

3434
/**
3535
* Constructs new clear values.
@@ -42,8 +42,8 @@ export class ClearValues extends EventDispatcher<BaseEventMap> {
4242
this._color = null;
4343
this._alpha = null;
4444

45-
const gBuffer = new ObservableMap<string, GLfloat | GLfloat[]>([
46-
[GBuffer.NORMAL, [0.0, 0.0]],
45+
const gBuffer = new ObservableMap<string, [GLfloat, GLfloat, GLfloat, GLfloat]>([
46+
[GBuffer.NORMAL, [0.0, 0.0, 0.0, 1.0]],
4747
[GBuffer.ORM, [1.0, 0.0, 0.0, 0.0]],
4848
[GBuffer.EMISSION, [0.0, 0.0, 0.0, 1.0]]
4949
]);

0 commit comments

Comments
 (0)