Skip to content

Commit

Permalink
fix: 🐛 fix bug with depth test when milkyway is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Aug 13, 2024
1 parent 4cd3866 commit fbf9b7a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/singletons/draw-manager/earth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class Earth {
const pos = Sun.position(EpochUTC.fromDateTime(keepTrackApi.getTimeManager().simulationTimeObj));

this.lightDirection = [pos.x, pos.y, pos.z];
vec3.normalize(<vec3>(<unknown> this.lightDirection), <vec3>(<unknown> this.lightDirection));
vec3.normalize(<vec3>(<unknown>this.lightDirection), <vec3>(<unknown>this.lightDirection));

this.modelViewMatrix_ = mat4.copy(mat4.create(), this.mesh.geometry.localMvMatrix);
// this.modelViewMatrix_ = mat4.mul(this.modelViewMatrix_, keepTrackApi.getMainCamera().camMatrix, this.modelViewMatrix_);
Expand Down Expand Up @@ -373,6 +373,10 @@ export class Earth {
this.setUniforms_(gl);
this.setTextures_(gl);

gl.enable(gl.DEPTH_TEST);
gl.disable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);

gl.bindVertexArray(this.mesh.geometry.vao);
gl.drawElements(gl.TRIANGLES, this.mesh.geometry.indexLength, gl.UNSIGNED_SHORT, 0);
gl.bindVertexArray(null);
Expand Down

0 comments on commit fbf9b7a

Please sign in to comment.