Skip to content

Commit

Permalink
vive settings
Browse files Browse the repository at this point in the history
  • Loading branch information
amandaghassaei committed May 11, 2017
1 parent 47e12a5 commit 87df520
Show file tree
Hide file tree
Showing 76 changed files with 693 additions and 63 deletions.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified assets/Curved/creaseMesh.txt
100644 → 100755
Empty file.
Empty file modified assets/Curved/curvedcrease2.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Origami/hypar.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Origami/randlettflappingbird.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Origami/singlesquaretwist.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Origami/squaretwistManyAngles.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/PolygonUnfolding/cubeunwrapping.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/honeycomb_333_cp.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/hyperbolic_limit_cp.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/miura-ori.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/oval_tessellation_cp.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/rattanweaveLang.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/reschbarbell.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/reschtritessellation.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/waterbomb.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/waterbombTwist.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tessellations/wedged_double_faced.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tests/SimpleVertex.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tests/SimpleVertex2.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/Tests/TwoTri.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/attrib.txt
100644 → 100755
Empty file.
Empty file modified assets/examplepattern.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified assets/patternwithtriangulations.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified css/main.css
100644 → 100755
Empty file.
Empty file modified css/nav.css
100644 → 100755
Empty file.
Empty file modified dependencies/CopyShader.js
100644 → 100755
Empty file.
Empty file modified dependencies/Detector.js
100644 → 100755
Empty file.
Empty file modified dependencies/EffectComposer.js
100644 → 100755
Empty file.
Empty file modified dependencies/FileSaver.min.js
100644 → 100755
Empty file.
Empty file modified dependencies/MaskPass.js
100644 → 100755
Empty file.
Empty file modified dependencies/OrbitControls.js
100644 → 100755
Empty file.
Empty file modified dependencies/OrthographicTrackballControls.js
100644 → 100755
Empty file.
Empty file modified dependencies/Projector.js
100644 → 100755
Empty file.
Empty file modified dependencies/RenderPass.js
100644 → 100755
Empty file.
Empty file modified dependencies/SSAOShader.js
100644 → 100755
Empty file.
Empty file modified dependencies/SVGLoader.js
100644 → 100755
Empty file.
Empty file modified dependencies/SVGRenderer.js
100644 → 100755
Empty file.
Empty file modified dependencies/ShaderPass.js
100644 → 100755
Empty file.
623 changes: 623 additions & 0 deletions dependencies/TrackballControls.js

Large diffs are not rendered by default.

Empty file modified dependencies/VRControls.js
100644 → 100755
Empty file.
Empty file modified dependencies/VREffect.js
100644 → 100755
Empty file.
Empty file modified dependencies/ViveController.js
100644 → 100755
Empty file.
Empty file modified dependencies/WebVR.js
100644 → 100755
Empty file.
Empty file modified dependencies/binary_stl_writer.js
100644 → 100755
Empty file.
Empty file modified dependencies/bootstrap.min.css
100644 → 100755
Empty file.
Empty file modified dependencies/flat-ui.min.css
100644 → 100755
Empty file.
Empty file modified dependencies/flat-ui.min.js
100644 → 100755
Empty file.
Empty file modified dependencies/jquery-3.1.1.min.js
100644 → 100755
Empty file.
Empty file modified dependencies/jquery-ui.min.css
100644 → 100755
Empty file.
Empty file modified dependencies/jquery-ui.min.js
100644 → 100755
Empty file.
Empty file modified dependencies/numeric-1.2.6.js
100644 → 100755
Empty file.
Empty file modified dependencies/numeric-1.2.6.min.js
100644 → 100755
Empty file.
Empty file modified favicon.ico
100644 → 100755
Empty file.
Empty file modified fonts/glyphicons/flat-ui-icons-regular.ttf
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
<script type="text/javascript" src="dependencies/flat-ui.min.js"></script>
<script type="text/javascript" src="dependencies/three.js"></script>
<script type="text/javascript" src="dependencies/binary_stl_writer.js"></script>
<script type="text/javascript" src="dependencies/OrthographicTrackballControls.js"></script>
<script type="text/javascript" src="dependencies/TrackballControls.js"></script>
<script type="text/javascript" src="dependencies/Projector.js"></script>
<script type="text/javascript" src="dependencies/SVGRenderer.js"></script>
<script type="text/javascript" src="dependencies/underscore-min.js"></script>
Expand Down
Empty file modified js/3dUI.js
100644 → 100755
Empty file.
12 changes: 7 additions & 5 deletions js/ViveInterface.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function initViveInterface(globals){
$status.html("No device connected.");
$("#VRoptions").show();

var mesh = new THREE.Mesh(new THREE.CubeGeometry(1, 1,1 ), new THREE.MeshLambertMaterial({color:0xff0000}));
var mesh = new THREE.Mesh(new THREE.CubeGeometry(1,1,1), new THREE.MeshLambertMaterial({color:0xff0000}));

var controls = new THREE.VRControls(globals.threeView.camera);
controls.standing = true;
Expand Down Expand Up @@ -44,16 +44,18 @@ function initViveInterface(globals){
document.body.appendChild(button);
var callback = button.onclick;
button.onclick = function () {
if (display.isPresenting) globals.vrEnabled = false;
else globals.vrEnabled = true;
globals.vrEnabled = !display.isPresenting;
var y = 0;
if (globals.vrEnabled) y = 1;
globals.threeView.modelWrapper.position.set(0,y,0);
// var scale = 0.01;
// globals.threeView.modelWrapper.scale.set(scale, scale, scale);
if (callback) callback();
};

} );
}

function disconnect(){

}

function render(){
Expand Down
Empty file modified js/beam.js
100644 → 100755
Empty file.
Empty file modified js/controls.js
100644 → 100755
Empty file.
Empty file modified js/crease.js
100644 → 100755
Empty file.
Empty file modified js/dynamic/GLBoilerplate.js
100644 → 100755
Empty file.
Empty file modified js/dynamic/GPUMath.js
100644 → 100755
Empty file.
Empty file modified js/dynamic/dynamicSolver.js
100644 → 100755
Empty file.
Empty file modified js/globals.js
100644 → 100755
Empty file.
Empty file modified js/importer.js
100644 → 100755
Empty file.
Empty file modified js/main.js
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions js/model.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function initModel(globals){
if (globals.colorMode == "axialStrain") geometry.attributes.color.needsUpdate = true;
geometry.computeVertexNormals();
// geometry.computeBoundingBox();
// geometry.computeBoundingSphere();
geometry.computeBoundingSphere();
}

var inited = false;
Expand Down Expand Up @@ -318,7 +318,7 @@ function initModel(globals){
geometry.computeBoundingSphere();
geometry.center();

var scale = 100/geometry.boundingSphere.radius;
var scale = 1/geometry.boundingSphere.radius;
globals.scale = scale;

object3D.geometry.dispose();
Expand Down
Empty file modified js/node.js
100644 → 100755
Empty file.
Empty file modified js/pattern.js
100644 → 100755
Empty file.
Empty file modified js/saveFOLD.js
100644 → 100755
Empty file.
Empty file modified js/saveSTL.js
100644 → 100755
Empty file.
Empty file modified js/staticSolver.js
100644 → 100755
Empty file.
115 changes: 60 additions & 55 deletions js/threeView.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ function initThreeView(globals) {

var scene = new THREE.Scene();
var modelWrapper = new THREE.Object3D();
var camera = new THREE.OrthographicCamera(window.innerWidth / -2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / -2, -10000, 10000);//-40, 40);

var camera = new THREE.PerspectiveCamera(70, window.innerWidth/window.innerHeight, 0.01, 1000);
// var camera = new THREE.OrthographicCamera(window.innerWidth / -2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / -2, -10000, 10000);//-40, 40);
var renderer = new THREE.WebGLRenderer({antialias: true});
var svgRenderer = new THREE.SVGRenderer();
var controls;

var depthMaterial, effectComposer, depthRenderTarget;
var ssaoPass;
// var depthMaterial, effectComposer, depthRenderTarget;
// var ssaoPass;

var animationRunning = false;
var pauseFlag = false;
Expand Down Expand Up @@ -45,52 +47,52 @@ function initThreeView(globals) {
var directionalLight5 = new THREE.DirectionalLight(0xffffff, 0.3);
directionalLight5.position.set(0, 30, -100);
scene.add(directionalLight5);
var ambientLight = new THREE.AmbientLight(0xffffff, 0.1);
// var ambientLight = new THREE.AmbientLight(0xffffff, 0.1);
// scene.add(ambientLight);
//scene.fog = new THREE.FogExp2(0xf4f4f4, 1.7);
//renderer.setClearColor(scene.fog.color);

scene.add(camera);

camera.zoom = 5;
camera.zoom = 25;
camera.updateProjectionMatrix();
camera.position.x = 200;
camera.position.y = 200;
camera.position.z = 200;
camera.position.x = 10;
camera.position.y = 10;
camera.position.z = 10;

controls = new THREE.OrthographicTrackballControls(camera, renderer.domElement);
controls.rotateSpeed = 1.5;
controls.zoomSpeed = 0.8;
controls = new THREE.TrackballControls(camera, renderer.domElement);
controls.rotateSpeed = 1.0;
controls.zoomSpeed = 1.2;
controls.noPan = true;
controls.staticMoving = true;
controls.dynamicDampingFactor = 0.3;
controls.addEventListener("change", render);

var renderPass = new THREE.RenderPass( scene, camera );
// var renderPass = new THREE.RenderPass( scene, camera );

// Setup depth pass
depthMaterial = new THREE.MeshDepthMaterial();
depthMaterial.depthPacking = THREE.RGBADepthPacking;
depthMaterial.blending = THREE.NoBlending;

var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
depthRenderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );

// Setup SSAO pass
ssaoPass = new THREE.ShaderPass( THREE.SSAOShader );
ssaoPass.renderToScreen = true;
//ssaoPass.uniforms[ "tDiffuse" ].value will be set by ShaderPass
ssaoPass.uniforms[ "tDepth" ].value = depthRenderTarget.texture;
ssaoPass.uniforms[ 'size' ].value.set( window.innerWidth, window.innerHeight );
ssaoPass.uniforms[ 'cameraNear' ].value = camera.near;
ssaoPass.uniforms[ 'cameraFar' ].value = camera.far;
ssaoPass.uniforms[ 'onlyAO' ].value = 0;
ssaoPass.uniforms[ 'aoClamp' ].value = 0.7;
ssaoPass.uniforms[ 'lumInfluence' ].value = 0.8;
// Add pass to effect composer
effectComposer = new THREE.EffectComposer( renderer );
effectComposer.addPass( renderPass );
effectComposer.addPass( ssaoPass );
// depthMaterial = new THREE.MeshDepthMaterial();
// depthMaterial.depthPacking = THREE.RGBADepthPacking;
// depthMaterial.blending = THREE.NoBlending;

// var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
// depthRenderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
//
// // Setup SSAO pass
// ssaoPass = new THREE.ShaderPass( THREE.SSAOShader );
// ssaoPass.renderToScreen = true;
// //ssaoPass.uniforms[ "tDiffuse" ].value will be set by ShaderPass
// ssaoPass.uniforms[ "tDepth" ].value = depthRenderTarget.texture;
// ssaoPass.uniforms[ 'size' ].value.set( window.innerWidth, window.innerHeight );
// ssaoPass.uniforms[ 'cameraNear' ].value = camera.near;
// ssaoPass.uniforms[ 'cameraFar' ].value = camera.far;
// ssaoPass.uniforms[ 'onlyAO' ].value = 0;
// ssaoPass.uniforms[ 'aoClamp' ].value = 0.7;
// ssaoPass.uniforms[ 'lumInfluence' ].value = 0.8;
// // Add pass to effect composer
// effectComposer = new THREE.EffectComposer( renderer );
// effectComposer.addPass( renderPass );
// effectComposer.addPass( ssaoPass );
}

function render() {
Expand Down Expand Up @@ -126,15 +128,15 @@ function initThreeView(globals) {
globals.vive.render();
return;
}
if (globals.ambientOcclusion) {
// Render depth into depthRenderTarget
scene.overrideMaterial = depthMaterial;
renderer.render(scene, camera, depthRenderTarget, true);
// Render renderPass and SSAO shaderPass
scene.overrideMaterial = null;
effectComposer.render();
return;
}
// if (globals.ambientOcclusion) {
// // Render depth into depthRenderTarget
// scene.overrideMaterial = depthMaterial;
// renderer.render(scene, camera, depthRenderTarget, true);
// // Render renderPass and SSAO shaderPass
// scene.overrideMaterial = null;
// effectComposer.render();
// return;
// }
renderer.render(scene, camera);
}

Expand All @@ -146,6 +148,7 @@ function initThreeView(globals) {
});
return;
}
controls.update();//todo put this above callback?
requestAnimationFrame(function(){
if (pauseFlag) {
pauseFlag = false;
Expand All @@ -172,23 +175,24 @@ function initThreeView(globals) {

function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.left = -window.innerWidth / 2;
camera.right = window.innerWidth / 2;
camera.top = window.innerHeight / 2;
camera.bottom = -window.innerHeight / 2;
// camera.left = -window.innerWidth / 2;
// camera.right = window.innerWidth / 2;
// camera.top = window.innerHeight / 2;
// camera.bottom = -window.innerHeight / 2;
camera.updateProjectionMatrix();

renderer.setSize(window.innerWidth, window.innerHeight);
controls.handleResize();

var width = window.innerWidth;
var height = window.innerHeight;
// var width = window.innerWidth;
// var height = window.innerHeight;

ssaoPass.uniforms[ 'size' ].value.set( width, height );
var pixelRatio = renderer.getPixelRatio();
var newWidth = Math.floor( width / pixelRatio ) || 1;
var newHeight = Math.floor( height / pixelRatio ) || 1;
depthRenderTarget.setSize( newWidth, newHeight );
effectComposer.setSize( newWidth, newHeight );
// ssaoPass.uniforms[ 'size' ].value.set( width, height );
// var pixelRatio = renderer.getPixelRatio();
// var newWidth = Math.floor( width / pixelRatio ) || 1;
// var newHeight = Math.floor( height / pixelRatio ) || 1;
// depthRenderTarget.setSize( newWidth, newHeight );
// effectComposer.setSize( newWidth, newHeight );

render();
}
Expand Down Expand Up @@ -242,6 +246,7 @@ function initThreeView(globals) {
scene: scene,
camera: camera,
renderer: renderer,
modelWrapper:modelWrapper,
running: running,
setScale:setScale,
saveSVG: saveSVG
Expand Down
Empty file modified logo-active.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 87df520

Please sign in to comment.