Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.1.0 (compilable, browser-ready, server-ready) #5

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/index.bundle.js
1 change: 1 addition & 0 deletions .gitigore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/index.bundle.js
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@ A websperience by Vi Hart, Andrea Hawksley, and Henry Segerman, using the hyperb

Try it at: https://hawksley.github.io/hypVR/


## Installing Locally

The version 1.1.0 requires node.js version > 6 and should work with every os.

### Steps:
- git clone this project
- run "npm install" where you cloned this project
- run "npm start"

you should see the application run on http://localhost:8080
Enjoy.

### Release Notes:
1.1.0:
- The application can be compiled with webpack to reduce dramatically the file size of the imported code
- Less pollution of the global scope
- using webVR polyfill, the application runs on browsers
- the package host it own dev server to compile the code as each file save
- the dev server can be run from an npm command

### Further Enhancements:
- finishing polishing the code to make it more granular and easy to modify
- introducing performance testing for big functions like gramShmidt
- introducing unit tests

## Links
- http://vihart.com
- http://andreahawksley.com
Expand All @@ -15,3 +41,4 @@ Try it at: https://hawksley.github.io/hypVR/
- http://www.geometrygames.org/CurvedSpaces/
- http://www.marctenbosch.com
- https://github.com/MozVR/vr-web-examples/tree/master/threejs-vr-boilerplate
- https://github.com/AbdoulSy
File renamed without changes.
51 changes: 21 additions & 30 deletions index.html → dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@

<body></body>

<!-- This entire block in only to facilitate dynamically enabling and
disabling the WebVR polyfill, and is not necessary for most WebVR apps.
If you want to use the polyfill in your app, just include the js file and
everything will work the way you want it to by default. -->
<script>
var WebVRConfig = {
// Prevents the polyfill from initializing automatically.
DEFER_INITIALIZATION: true,
FORCE_ENABLE_VR: true
}
</script>
<script src="js/third-party/wglu/wglu-url.js"></script>

<script type="x-shader/x-vertex" id="vertexShader">
// This shader moves vertices around

Expand All @@ -45,8 +58,8 @@
uniform mat4 translation; // dodecahedral
uniform mat4 boost;
// uniform vec3 cellColor;
uniform vec4 cellColorQuat;
uniform vec4 userCellColorQuat;
uniform vec4 cellColorQuat;
uniform vec4 userCellColorQuat;

vec3 ChooseColor( in vec3 nBase )
{
Expand Down Expand Up @@ -138,7 +151,7 @@
float norm = sqrt(r*r+g*g+b*b);
r /= norm;
g /= norm;
b /= norm;
b /= norm;
return vec3(r*0.5 + 0.5,g*0.5 + 0.5,b*0.5 + 0.5);
}

Expand Down Expand Up @@ -222,32 +235,10 @@
}
</script>

<!--
three.js 3d library
-->
<script src="js/lib/three.min.js"></script>

<script src="js/hypMath.js"></script>
<!--
VRControlsHyperbolic.js acquires positional information from connected VR devices and applies the transformations to a three.js camera object. Also deals with hyperbolic and parabolic motions.
-->
<script src="js/vr/PhoneVR.js"></script>
<script src="js/vr/VRControlsHyperbolic.js"></script>

<!--
VREffect.js handles stereo camera setup and rendering.
-->
<script src="js/vr/VREffect.js"></script>

<script src="js/loaders/OBJLoader.js"></script>
<!--
dodec_no_id.js stores hyperbolic translation matrices to make copies of the dodecahedron.
-->
<script src="js/436.js"></script>
<!--
<script src="js/534Reflect.js"></script>
-->

<script src="js/hypTiling.js" type="text/javascript" id="mainCode"></script>

<!--
Bundled App (Concatenated and Minified)
Libraries, dependencies and Main code
-->
<script src="./index.bundle.js" id="mainCode"></script>
</html>
99 changes: 99 additions & 0 deletions dist/js/third-party/wglu/wglu-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
Copyright (c) 2015, Brandon Jones.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

/*
Provides a simple way to get values from the query string if they're present
and use a default value if not. Not strictly a "WebGL" utility, but I use it
frequently enough for debugging that I wanted to include it here.

Example:
For the URL http://example.com/index.html?particleCount=1000

WGLUUrl.getInt("particleCount", 100); // URL overrides, returns 1000
WGLUUrl.getInt("particleSize", 10); // Not in URL, returns default of 10
*/
var WGLUUrl = (function() {

"use strict";

var urlArgs = null;

window.onhashchange = function() {
// Force re-parsing on next access
urlArgs = null;
};

function ensureArgsCached() {
if (!urlArgs) {
urlArgs = {};
var query = window.location.search.substring(1) || window.location.hash.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
urlArgs[pair[0].toLowerCase()] = unescape(pair[1]);
}
}
}

function getString(name, defaultValue) {
ensureArgsCached();
var lcaseName = name.toLowerCase();
if (lcaseName in urlArgs) {
return urlArgs[lcaseName];
}
return defaultValue;
}

function getInt(name, defaultValue) {
ensureArgsCached();
var lcaseName = name.toLowerCase();
if (lcaseName in urlArgs) {
return parseInt(urlArgs[lcaseName], 10);
}
return defaultValue;
}

function getFloat(name, defaultValue) {
ensureArgsCached();
var lcaseName = name.toLowerCase();
if (lcaseName in urlArgs) {
return parseFloat(urlArgs[lcaseName]);
}
return defaultValue;
}

function getBool(name, defaultValue) {
ensureArgsCached();
var lcaseName = name.toLowerCase();
if (lcaseName in urlArgs) {
return parseInt(urlArgs[lcaseName], 10) != 0;
}
return defaultValue;
}

return {
getString: getString,
getInt: getInt,
getFloat: getFloat,
getBool: getBool
};
})();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
87 changes: 0 additions & 87 deletions js/436.js

This file was deleted.

Loading