Skip to content

Commit

Permalink
updated for new paths
Browse files Browse the repository at this point in the history
  • Loading branch information
spatializes committed Nov 24, 2014
1 parent 2fcaa66 commit f2ca7d5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 30 deletions.
Binary file removed .app.js.swp
Binary file not shown.
Binary file removed .generateThree.js.swp
Binary file not shown.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ node_modules

# Users Environment Variables
.lock-wscript

# vim temp files
*~
*.swp
*.swo
Binary file removed .three.html.swp
Binary file not shown.
23 changes: 3 additions & 20 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,21 @@ function handler (req, res) {

// Managing the root route
if (path == '/') {
index = fs.readFile(__dirname+'/public/index.html',
index = fs.readFile(__dirname+'/three.html',
function(error,data) {

if (error) {
res.writeHead(500);
return res.end("Error: unable to load index.html");
return res.end("Error: unable to load three.html");
}

res.writeHead(200,{'Content-Type': 'text/html'});
res.end(data);
});

// Send localIP to server
} else if (path == '/getIP') {
res.end(localIP);

// Managing the root for threejs
} else if (path == '/threejs') {
index = fs.readFile(__dirname+'/public/threejs/three.html',
function(error,data) {

if (error) {
res.writeHead(500);
return res.end("Error: unable to load threejs.html - " + error);
}

res.writeHead(200,{'Content-Type': 'text/html'});
res.end(data);
});
// Managing the route for the javascript files
} else if( /\.(js)$/.test(path) ) {
index = fs.readFile(__dirname+'/public'+path,
index = fs.readFile(__dirname+path,
function(error,data) {

if (error) {
Expand Down
9 changes: 3 additions & 6 deletions generateThree.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var dataRollxArray = [];
var dataRollyArray = [];
var dataRollzArray = [];
var accuracy = 2;
var serverIP;
var orderOfMag = (Math.PI/180);
var container;
var camera, scene, renderer;
Expand All @@ -25,9 +24,11 @@ var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;

//Connect to socket.io
socket = io.connect(serverIP + ':5000');
var serverIP = "localhost";
var socket = io.connect(serverIP + ':5000');
console.log('socket connected to: ' + serverIP);

// Start reading IMU data
runSocket();
init();
animate();
Expand All @@ -48,10 +49,6 @@ function runSocket() {
dataRollz = (dataArray[3] *= orderOfMag).toFixed(accuracy);

console.log(dataRollx + "," + dataRolly + "," + dataRollz);
$("#subHeading").replaceWith("<div id='subHeading'>" + data + "</div>");

$("#subHeading").append("<div>" + whiskey + " unlocks: 1 - " + unlocked1 + " 2 - " + unlocked2 + "</div>");
*/
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions three.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
</head>
<body>
<script src="lib/three.min.js"></script>
<script src="js/Projector.js"></script>
<script src="js/CanvasRenderer.js"></script>
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/socket.io.js"></script>
<script src="lib/Projector.js"></script>
<script src="lib/CanvasRenderer.js"></script>
<script src="lib/jquery-2.1.1.min.js"></script>
<script src="lib/socket.io.js"></script>
<script src="generateThree.js"></script>
</body>
</html>

0 comments on commit f2ca7d5

Please sign in to comment.