This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
tttApp.directive("selectcube", function(ThreeEnv){ | |
return { | |
restrict: "A", | |
link: function(scope, element){ | |
var offsetLeft = element[0].offsetLeft, | |
offsetTop = element[0].offsetTop, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
tttApp.controller('TTTController', function ($scope, ThreeEnv) { | |
$scope.dims = 3; | |
$scope.usercolor = "#0000FF"; | |
$scope.username = "Player1"; | |
$scope.userfirst = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//inject the module as such | |
var myApp = angular.module("myApp", ['ngExceptions']) | |
// put this in one file. | |
(function(window, angular) {'use strict'; | |
/** | |
* @ngdoc module | |
* @name ngExceptions | |
* @description | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getScopes(root) { | |
var scopes = []; | |
function traverse(scope) { | |
scopes.push(scope); | |
if (scope.$$nextSibling) | |
traverse(scope.$$nextSibling); | |
if (scope.$$childHead) | |
traverse(scope.$$childHead); | |
} | |
traverse(root); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This gulpfile will copy static libraries and a index.html file as well as | |
* merge, babelify and uglify the rest of the javascript project. | |
* | |
* TODO: | |
* - Separate media, libs and src with different watchers. | |
* - Media and libs should only be copied to dist if they are different sizes. | |
* | |
* The expected project is to be laid out as such: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function listeners () { | |
document.addEventListener('click', castRay, false); | |
} | |
function castRay (event) { | |
event.preventDefault(); | |
var mouse = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init() { | |
$('#jqv').text($.fn.jquery); | |
$('#tjsv').text(THREE.REVISION); | |
demo = new Demo.Scene("ray-intersection"); | |
demo.rotateCamera = true; | |
listeners(); | |
// start the animation | |
// this also does all of the setup. i've encapsulated all of this work for brevity. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loop through all the rays and look to see if all of their collisions objects show the same values. | |
// | |
// essentially, a ray will intersect all faces in one particular direction. 3 cubes = 6 faces = 6 intersections | |
// if all of the intersections show a 'selection' has take place, it'll check the selection types (ttt property) | |
function checkForTTT(){ | |
var i,j, | |
collisions, | |
ticUser1, | |
ticUser2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createRays() { | |
var setup = { | |
xDirection: xDirection = new THREE.Vector3(-1,0,0), | |
yDirection: yDirection = new THREE.Vector3(0,-1,0), | |
zDirection: zDirection = new THREE.Vector3(0,0,-1), | |
xy1Direction: xy1Direction = new THREE.Vector3(-1,-1,0).normalize(), | |
xy2Direction: xy2Direction = new THREE.Vector3(-1,1,0).normalize(), | |
xz1Direction: xz1Direction = new THREE.Vector3(-1,0,-1).normalize(), | |
xz2Direction: xz2Direction = new THREE.Vector3(-1,0,1).normalize(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Demo = Demo || {}; | |
Demo.Cache = Demo.Cache || {}; | |
Demo.Cache = function (context) { | |
this.context = context; | |
this._cachedVertices = []; | |
this._cachedCentroidPoints = []; |
OlderNewer