Skip to content
This repository was archived by the owner on Jan 24, 2020. It is now read-only.

In-world UX #48

Merged
merged 54 commits into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9aff891
Add grid animation
Jun 23, 2019
c58632f
Add room grid
Jun 24, 2019
fdcf200
Add target mesh
Jun 24, 2019
27e7682
Adjust target location derivation
Jun 24, 2019
a79b72a
Major grid alignment work
Jun 24, 2019
ebcb1d2
Add room dimensions set support
Jun 24, 2019
29d2d87
Add room highlight support
Jun 24, 2019
68e45f0
Add tray mesh
Jun 24, 2019
b233925
Add room links meshes
Jun 24, 2019
49f6bb4
Add initial menu ui
Jun 24, 2019
e282285
Clean up iframe initialization
Jun 24, 2019
a9671d4
Tray mesh positioning cleanup
Jun 24, 2019
572b934
Clean up room link mesh pointing
Jun 24, 2019
d5ea165
Add room diagram mesh support
Jun 24, 2019
561868b
Add tray reset key
Jun 24, 2019
14d8f3c
Add room classification support
Jun 24, 2019
fac359c
Hook in room classification to tray diagrams
Jun 24, 2019
b2b1b78
Bugfix room link mesh destination alignment
Jun 24, 2019
f8fcaa4
Add initial grid volume adding
Jun 24, 2019
0f715d7
Add initial menu page source
Jun 25, 2019
8e43bd6
Add volume/portal meshes support
Jun 25, 2019
e964a31
More reality tabs volume management work
Jun 25, 2019
0f2a086
Re-add menu support in index.html
Jun 25, 2019
72fca90
Add missing x.png image
Jun 25, 2019
a7803bb
Menu ui cleanup
Jun 25, 2019
41850da
Bugfix plane draw alignment
Jun 25, 2019
3146d31
Add menu mesh controller mesh raycasting
Jun 25, 2019
67b77b6
Dead code cleanup
Jun 26, 2019
a330e42
Add portal mesh world alignment
Jun 26, 2019
3bc60a9
More portal alignment bugfixing
Jun 26, 2019
cc8f9ac
Dead code cleanup
Jun 26, 2019
a458ab6
Disable depthWrite for roomMesh
Jun 26, 2019
e045bd0
Dead code removal
Jun 26, 2019
09c7ba3
Add menu click tracking
Jun 26, 2019
85d37a8
Tabs management menu cleanup
Jun 26, 2019
61b2e45
Clean up URL entry
Jun 26, 2019
a2c27c7
More menu cleanup
Jun 26, 2019
d0fb69d
Add send mouse move flow to menu hovering
Jun 26, 2019
e2b468a
More menu refactoring
Jun 27, 2019
e34cd49
Add tabs management
Jun 27, 2019
decce09
Major tab management HTML integration work
Jun 27, 2019
6c9cb4e
Clean up mouse move event buttons
Jun 27, 2019
4726ca3
Commenting cleanup
Jun 27, 2019
63ab17f
Bugfix room removal
Jun 27, 2019
2f75538
Bugfix open tab
Jun 27, 2019
414d824
Add cubic bezier source file
Jun 27, 2019
04118a2
Include cubic bezier source
Jun 27, 2019
69f40dd
Animate menu
Jun 27, 2019
e9763b3
Make only right controller pointable
Jun 27, 2019
284b059
Remove root studio UI
Jun 27, 2019
b2295a8
Add rain.html example
Jun 29, 2019
6867f5b
Minimize menu package.json
Jun 29, 2019
f6426f0
Update local package.json to exoland
Jun 29, 2019
6115439
Add initial css
Jun 29, 2019
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
647 changes: 647 additions & 0 deletions BufferGeometryUtils.js

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions cubicBezier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* https://github.com/gre/bezier-easing
* BezierEasing - use bezier curve for transition easing function
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
*/

const cubicBezier = (() => {

// These values are established by empiricism with tests (tradeoff: performance VS precision)
var NEWTON_ITERATIONS = 4;
var NEWTON_MIN_SLOPE = 0.001;
var SUBDIVISION_PRECISION = 0.0000001;
var SUBDIVISION_MAX_ITERATIONS = 10;

var kSplineTableSize = 11;
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);

var float32ArraySupported = typeof Float32Array === 'function';

function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }
function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }
function C (aA1) { return 3.0 * aA1; }

// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; }

// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); }

function binarySubdivide (aX, aA, aB, mX1, mX2) {
var currentX, currentT, i = 0;
do {
currentT = aA + (aB - aA) / 2.0;
currentX = calcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0.0) {
aB = currentT;
} else {
aA = currentT;
}
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
return currentT;
}

function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
var currentSlope = getSlope(aGuessT, mX1, mX2);
if (currentSlope === 0.0) {
return aGuessT;
}
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
aGuessT -= currentX / currentSlope;
}
return aGuessT;
}

function LinearEasing (x) {
return x;
}

return function bezier (mX1, mY1, mX2, mY2) {
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) {
throw new Error('bezier x values must be in [0, 1] range');
}

if (mX1 === mY1 && mX2 === mY2) {
return LinearEasing;
}

// Precompute samples table
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
for (var i = 0; i < kSplineTableSize; ++i) {
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
}

function getTForX (aX) {
var intervalStart = 0.0;
var currentSample = 1;
var lastSample = kSplineTableSize - 1;

for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
intervalStart += kSampleStepSize;
}
--currentSample;

// Interpolate to provide an initial guess for t
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
var guessForT = intervalStart + dist * kSampleStepSize;

var initialSlope = getSlope(guessForT, mX1, mX2);
if (initialSlope >= NEWTON_MIN_SLOPE) {
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
} else if (initialSlope === 0.0) {
return guessForT;
} else {
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
}
}

return function BezierEasing (x) {
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
if (x === 0) {
return 0;
}
if (x === 1) {
return 1;
}
return calcBezier(getTForX(x), mY1, mY2);
};
};

})();
Loading