Skip to content

Commit

Permalink
Fixup Ellipsoidal Cube Maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Staunton-Lambert committed Jul 23, 2024
1 parent 4e19fa3 commit 1e971cd
Showing 1 changed file with 35 additions and 17 deletions.
52 changes: 35 additions & 17 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,23 +429,41 @@ void main() {

const uvs = this.movieGeometry.getAttribute('uv');

uvs.setXYZ(0, right[2], right[1], right[3]);
uvs.setXYZ(1, right[1], right[0], right[3]);

uvs.setXYZ(2, left[2], left[1], left[3]);
uvs.setXYZ(3, left[1], left[0], left[3]);

uvs.setXYZ(4, top[2], top[1], top[3]);
uvs.setXYZ(5, top[1], top[0], top[3]);

uvs.setXYZ(6, bottom[2], bottom[1], bottom[3]);
uvs.setXYZ(7, bottom[1], bottom[0], bottom[3]);

uvs.setXYZ(8, front[2], front[1], front[3]);
uvs.setXYZ(9, front[1], front[0], front[3]);

uvs.setXYZ(10, back[2], back[1], back[3]);
uvs.setXYZ(11, back[1], back[0], back[3]);
// LEFT
uvs.setXY(0, left[2].x, left[2].y);
uvs.setXY(1, left[1].x, left[1].y);
uvs.setXY(2, left[3].x, left[3].y);
uvs.setXY(3, left[0].x, left[0].y);

// BACK
uvs.setXY(4, back[2].x, back[2].y);
uvs.setXY(5, back[1].x, back[1].y);
uvs.setXY(6, back[3].x, back[3].y);
uvs.setXY(7, back[0].x, back[0].y);

// TOP/UP
uvs.setXY(8, top[2].x, top[2].y);
uvs.setXY(9, top[1].x, top[1].y);
uvs.setXY(10, top[3].x, top[3].y);
uvs.setXY(11, top[0].x, top[0].y);

// BOTTOM/DOWN
uvs.setXY(12, bottom[2].x, bottom[2].y);
uvs.setXY(13, bottom[1].x, bottom[1].y);
uvs.setXY(14, bottom[3].x, bottom[3].y);
uvs.setXY(15, bottom[0].x, bottom[0].y);

// FRONT
uvs.setXY(16, front[2].x, front[2].y);
uvs.setXY(17, front[1].x, front[1].y);
uvs.setXY(18, front[3].x, front[3].y);
uvs.setXY(19, front[0].x, front[0].y);

// RIGHT
uvs.setXY(20, right[2].x, right[2].y);
uvs.setXY(21, right[1].x, right[1].y);
uvs.setXY(22, right[3].x, right[3].y);
uvs.setXY(23, right[0].x, right[0].y);

this.movieScreen = new THREE.Mesh(this.movieGeometry, this.movieMaterial);
this.movieScreen.position.set(position.x, position.y, position.z);
Expand Down

0 comments on commit 1e971cd

Please sign in to comment.