Add #flight=N|NE|E|SE|S|SW|W|NW URL parameter for corridor direction
Adds 8 compass directions for the tile-build axis. Camera position, corridor rotation, and refetch math all read from window.__flightDir. Test URLs: #flight=N north (default, +Z, current behaviour) #flight=E east (+X) #flight=S south (-Z) #flight=W west (-X) #flight=NE northeast (diagonal) #flight=SE southeast #flight=SW southwest #flight=NW northwest Renders with no hash unchanged. Each direction rotates the corridor so its long axis follows the chosen compass bearing, and the camera drifts along that bearing.
This commit is contained in:
1 parent
c2d6fd38ba
commit
9027099d89
2 files changed
+33
-8
No files matched your search
@@ -516,6 +516,21 @@ var noiseDataUri = 'data:image/png;base64,PLACEHOLDER';
|
||||
// URL override for easy A/B testing: #renderer=clouds2d / #renderer=clouds3d
|
||||
var _urlRenderer = (location.hash.match(/renderer=(\w+)/) || [])[1];
|
||||
var renderer = _urlRenderer || (window.CONFIG && window.CONFIG.renderer) || 'vanta';
|
||||
|
||||
// Flight direction for ground-tile corridor (N, NE, E, SE, S, SW, W, NW).
|
||||
// Default 'N' (= +Z world) so behaviour is unchanged when hash is absent.
|
||||
var _urlFlight = (location.hash.match(/flight=(\w+)/) || [])[1];
|
||||
var FLIGHT_DIRS = {
|
||||
N: { cos: 0.0, sin: 1.0, dx: 0, dz: 1 },
|
||||
NE: { cos: 0.7071068, sin: 0.7071068, dx: 0.7071068, dz: 0.7071068 },
|
||||
E: { cos: 1.0, sin: 0.0, dx: 1, dz: 0 },
|
||||
SE: { cos: 0.7071068, sin:-0.7071068, dx: 0.7071068, dz:-0.7071068 },
|
||||
S: { cos: 0.0, sin:-1.0, dx: 0, dz:-1 },
|
||||
SW: { cos:-0.7071068, sin:-0.7071068, dx:-0.7071068, dz:-0.7071068 },
|
||||
W: { cos:-1.0, sin: 0.0, dx:-1, dz: 0 },
|
||||
NW: { cos:-0.7071068, sin: 0.7071068, dx:-0.7071068, dz: 0.7071068 }
|
||||
};
|
||||
window.__flightDir = FLIGHT_DIRS[_urlFlight && FLIGHT_DIRS[_urlFlight.toUpperCase()] ? _urlFlight.toUpperCase() : 'N'];
|
||||
var useVanta = (renderer !== 'clouds2d' && renderer !== 'clouds3d');
|
||||
var effect;
|
||||
if (useVanta && typeof VANTA !== 'undefined') {
|
||||
|
||||
Reference in new issue
Block a user