Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/three/plugins/images/GeneratedSurfacePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export class GeneratedSurfacePlugin {
const geometry = new PlaneGeometry( 1, 1, lonVerts + 2, latVerts + 2 );

const [ minU, minV, maxU, maxV ] = tiling.getTileBounds( x, y, level, true, true );
const uvRange = tiling.getTileContentUVBounds( x, y, level );

// adjust the geometry to position it at the region
const { position, normal, uv } = geometry.attributes;
Expand Down Expand Up @@ -389,8 +390,8 @@ export class GeneratedSurfacePlugin {
}

// derive UV from the final (potentially adjusted) lat/lon so the overlay samples correctly
const u = MathUtils.mapLinear( projection.convertLongitudeToNormalized( lon ), minU, maxU, 0, 1 );
const v = MathUtils.mapLinear( projection.convertLatitudeToNormalized( lat ), minV, maxV, 0, 1 );
const u = MathUtils.mapLinear( projection.convertLongitudeToNormalized( lon ), minU, maxU, uvRange[ 0 ], uvRange[ 2 ] );
const v = MathUtils.mapLinear( projection.convertLatitudeToNormalized( lat ), minV, maxV, uvRange[ 1 ], uvRange[ 3 ] );

// update the geometry
position.setXYZ( i, _pos.x, _pos.y, _pos.z );
Expand Down
Loading