Skip to content

Commit

Permalink
eyeballs stereoscopy
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-armour committed Oct 6, 2016
1 parent d2e49c4 commit a476860
Show file tree
Hide file tree
Showing 10 changed files with 496 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cookbook-html/templates/core1/0-cor-core/core-r1.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@

'<h3>' +
'<a href=http://' + DEF.user + '/github.io/ title="' + DEF.user + ' - ' + DEF.titleTagline + '" >' + DEF.logo + '</a> &raquo; ' +
'<a href=http://' + DEF.user + '.github.io/templates/ title="your happy mappy place" > Templates </a> &raquo; ' +
'<a href=http://' + DEF.user + '.github.io/templates/ title="your happy templates place" > Templates </a> &raquo; ' +
'</h3>' +
'<h2>' +
'<a href="" title="Click here to refresh this page" >' + document.title + '</a> ~ ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
DEF.user = 'jaanga';
DEF.repo = 'terrain3';


DEF.urlGITHubAPITreeContents = 'https://api.github.com/repos/' + DEF.user + '/' + DEF.repo + '/git/trees/' + DEF.branch + '?recursive=1';


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

//DEF.urlGHPages = './terrain3/';
// DEF.urlGHPages = './terrain3/';

var RED = RED || {};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<!doctype html>
<html lang=en >
<head>
<meta charset=utf-8 >
<title>webSite via GitHub API2 R4 Templates</title>
<meta name=viewport content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no' >
<meta name=description content='Request details of all files in a GitHub repository.
Creates a file explorer with menu.
Enables browsing and viewing of selected files.
Menu has breadcrumbs and other useful links.
' >
<meta name=keywords content='CMS,JavaScript,GitHub Developer API,GitHub,FOSS,STEM' >
<meta name=date content='2016-08-26' >
</head>
<body>
<script src=https://cdnjs.cloudflare.com/ajax/libs/showdown/1.4.3/showdown.min.js ></script>
<script src=../core1/0-def-defaults/defaults-r1.js ></script>
<script>
// https://github.com/showdownjs/showdown

DEF.branch = 'master';
DEF.user = 'jaanga';
DEF.repo = 'jaanga.github.io';

// DEF.searchInFolder = '../../';

DEF.urlGHPages = 'https://' + DEF.user + '.github.io/' + DEF.repo + '/';

DEF.readmeURL = DEF.urlGHPages + DEF.searchInFolder;
// DEF.urlReadMeFile = DEF.urlGHPages + '#readme.md';
DEF.urlReadMeFile = '../../home/r5/readme.md';

DEF.urlSource = 'https://github.com/' + DEF.user + '/' + DEF.repo + '/tree/' + DEF.branch + '/';

DEF.urlGITHubAPITreeContents = 'https://api.github.com/repos/' + DEF.user + '/' + DEF.repo + '/git/trees/' + DEF.branch + '?recursive=1';

// DEF.defaultFile = '#../../home/r5/readme.md';

</script>
<script src=../core1/0-cor-core/core-r1.js ></script>
<script src=../core1/1-key-api-key/api-key-r1.js ></script>
<script src=../core1/tre-tree/get-tree-r2.js ></script>
<script src=../core1/ifr-iframe-carousel/iframe-carousel-r1.js ></script>
<script src=../core1/red-readme-getter/readme-getter-r2.js ></script>
<!--
<script src=https://jaanga.github.io/cookbook-html/templates/core1/0-def-defaults/defaults-r1.js ></script>
<script src=https://jaanga.github.io/cookbook-html/templates/core1/0-cor-core/core-r1.js ></script>
<script src=https://jaanga.github.io/cookbook-html/templates/core1/1-key-api-key/api-key-r1.js ></script>
<script src=https://jaanga.github.io/cookbook-html/templates/core1/tre-tree/get-tree-r2.js ></script>
<script src=https://jaanga.github.io/cookbook-html/templates/core1/ifr-iframe-carousel/iframe-carousel-r1.js ></script>
<script src=https://jaanga.github.io/cookbook-html/templates/core1/red-readme-getter/readme-getter-r2.js ></script>
-->
<script>


init();

function init() {

// location.hash ='../../../../../readme.md';

COR.initThreeColumns();

COR.menu.innerHTML =

COR.getMenuBreadCrumbs() +

TRE.getMenuDetailsTableOfContents() +

TRE.getMenuDetailsPageActions() +

TRE.getMenuRepositoryEvents() +

TRE.getMenuDetailsRepositoryStatistics() +

KEY.getMenuDetailsAPIKey() +

KEY.getMenuDetailsAPIRates() +

COR.getMenuDetailsAbout() +

COR.getMenuFooter() +

b;

window.addEventListener ( 'hashchange', onHashChange, false );

TRE.getGitHubRepoTreeContents(); // calls onHashChange();

}


function onHashChange() {

var item;

clearInterval( IFR.timer );

item = location.hash ? location.hash.slice( 1 ) : DEF.searchInFolder;

if ( item.endsWith( '.md' ) === true ) {

COR.setMenuBreadCrumbs( DEF.searchInFolder );

COR.requestFile( TRE.urlGITHubAPITreeContents + item, function callbackMD( xhr ) {

if ( xhr.target.status !== 404 ) {

COR.contents.innerHTML = COR.converter.makeHtml( xhr.target.responseText );

}

} );


} else if ( item.endsWith( '.html' ) === true ) {

COR.setMenuBreadCrumbs( item );

COR.contents.innerHTML = RED.setReadMe( item );


} else {

COR.setMenuBreadCrumbs( item );

TRE.getFilesFromFolder( item );

if ( DEF.carousels.includes( item ) === true ) {

if ( item === '/' ) { DEF.includeFullScreenChoices = false; } else { DEF.includeFullScreenChoices = true; }

DEF.includeFullScreenChoices = item === '/' ? false : true;

COR.requestFile( DEF.readmeURL + '/' + item + '/readme-body.md', RED.callback );

} else {
console.log( '', DEF.urlGHPages, item );
COR.requestFile( DEF.urlGHPages + item + '/' + DEF.defaultFile, function callbackMD( xhr ) {

COR.contents.innerHTML = COR.converter.makeHtml( xhr.target.responseText );

} );

}

KEY.getRateLimits();

if ( !TRErepoStats.innerHTML ) {

TRE.setMenuDetailsRepositoryStatistics();
TRE.getUpdates();

}

}

}

</script>
</body>
</html>
182 changes: 182 additions & 0 deletions cookbook-threejs/objects/eyballs/eyballs-locations-of-stereoscopy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<!doctype html>
<html lang=en >
<head>
<meta charset=utf-8 >
<title>Eyeballs - Locations of Stereoscopy R1</title>
<meta name=viewport content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no' >
<meta name=description content='What happens to steroscopy at the periphery of the visual field?' >
<meta name=keywords content='Vision,WebGL,Three.js,JavaScript,GitHub,FOSS,3D,STEM' >
<meta name=date content='' >
</head>
<body>
<!--
<script src=http://mrdoob.github.io/three.js/build/three.min.js ></script>
<script src=http://mrdoob.github.io/three.js/examples/js/controls/OrbitControls.js ></script>
<script src=http://mrdoob.github.io/three.js/examples/js/libs/stats.min.js ></script>
-->
<script src=http://rawgit.com/mrdoob/three.js/dev/build/three.min.js ></script>
<script src=http://rawgit.com/mrdoob/three.js/dev/examples/js/controls/OrbitControls.js ></script>
<script src=http://rawgit.com/mrdoob/three.js/dev/examples/js/libs/stats.min.js ></script>

<script>

var step = 0;
var radius = 50;
var sectors = 50;
var pi = Math.PI;

var stats, renderer, scene, camera, controls;
var geometry, material, mesh;
var gridHelper, axisHelper;

init();
animate();

function init() {

var css, menu;

css = document.head.appendChild( document.createElement( 'style' ) );
css.innerHTML =

'body { background-color: #fee; font: 12pt monospace; margin: 0; overflow: hidden; }' +
'a {text-decoration: none; }' +
'button { background-color: #eee; border: 2px #eee solid; color: #888; }' +
'h2 { margin: 0 }' +

'';
var b = '<br>';
menu = document.body.appendChild( document.createElement( 'div' ) );
menu.style.cssText = 'margin: 0 20px; position: absolute; ';
menu.innerHTML =

'<h2>' +
'<a href="" >' + document.title + '</a> ' +
'<a href=http://jaanga.github.io/ >&#x24D8;</a>' +
'</h2>' +

'<div id=info >' +
'Imagine two 360 x 180 cameras side by side.' + b
'</div>' +

'';

stats = new Stats();
stats.domElement.style.cssText = 'position: absolute; right: 0; top: 0;' ;
document.body.appendChild( stats.domElement );

window.addEventListener( 'resize', onWindowResize, false );

renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setClearColor( 0xffffff );
// renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.set( 100, 100, 100 );

controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.maxDistance = 800;

scene = new THREE.Scene();

// helpers

geometry = new THREE.BoxGeometry( 100, 2, 100 );
material = new THREE.MeshNormalMaterial();
mesh = new THREE.Mesh( geometry, material );
mesh.position.set( 0, -11, 0 );
scene.add( mesh );

gridHelper = new THREE.GridHelper( 50, 10 );
gridHelper.position.set( 0, -10, 0 );
scene.add( gridHelper );

axisHelper = new THREE.AxisHelper( 50 );
scene.add( axisHelper );

// assets


loader = new THREE.TextureLoader();
loader.crossOrigin = '';
texture = loader.load( '../textures/iris2.png' );
texture.minFilter = texture.magFilter = THREE.NearestFilter;

geometry = new THREE.SphereGeometry( 10, 50, 25 );
material = new THREE.MeshBasicMaterial( { color: 0xf0f0f0, map: texture } );
eb1 = new THREE.Mesh( geometry, material );
eb1.position.set( 0, 20, 15 );
scene.add( eb1 );

eb2 = new THREE.Mesh( geometry, material );
eb2.position.set( 0, 20, -15 );
scene.add( eb2 );

geometry = new THREE.PlaneGeometry( 10, 30, 2, sectors );
material = new THREE.MeshNormalMaterial( { wireframe: true } );
disc = new THREE.Mesh( geometry, material );
disc.position.set( 0, 0, 0 );
scene.add( disc );


var latitude = 1

for ( var y = 0; y <= sectors; y++ ) {

disc.geometry.vertices[ 3 * y ] = eb1.position;

disc.geometry.vertices[ 3 * y + 1 ].x = radius * Math.sin( latitude ) * Math.cos( y * 2 * Math.PI / sectors );
disc.geometry.vertices[ 3 * y + 1 ].y = 20 + radius * Math.sin( latitude ) * Math.sin( y * 2 * Math.PI / sectors );
disc.geometry.vertices[ 3 * y + 1 ].z = radius * Math.cos( latitude ) * Math.cos( y * 2 * Math.PI / sectors );

disc.geometry.vertices[ 3 * y + 2 ] = eb2.position;

}

}


function onWindowResize() {

camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();

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

}

function animate() {

requestAnimationFrame( animate );
controls.update();
stats.update();
renderer.render( scene, camera );

step += 0.02;

eb2.rotation.y = eb1.rotation.y = 0.5 * Math.PI * ( Math.cos( step ) );



for ( var y = 0; y <= sectors; y++ ) {

var latitude = 0.5 * pi + 1.6 * Math.cos( step );
// disc.geometry.vertices[ 3 * y ] = eb1.position;

disc.geometry.vertices[ 3 * y + 1 ].x = radius * Math.sin( latitude ) * Math.cos( y * 2 * Math.PI / sectors );
disc.geometry.vertices[ 3 * y + 1 ].y = 20 + radius * Math.sin( y * 2 * Math.PI / sectors );
disc.geometry.vertices[ 3 * y + 1 ].z = radius * Math.cos( latitude ) * Math.cos( y * 2 * Math.PI / sectors );

// disc.geometry.vertices[ 3 * y + 2 ] = eb2.position;
disc.geometry.verticesNeedUpdate = true

}

}

</script>
</body>
</html>
Binary file added cookbook-threejs/textures/iris.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cookbook-threejs/textures/iris2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions cookbook-threejs/textures/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

iris https://www.pinterest.com/explore/iris-eye/
Loading

0 comments on commit a476860

Please sign in to comment.