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.factory('ThreeEnv', function ($http, $log, $rootScope ) { | |
var demo, | |
rotateCamera = true, | |
canvas = document.getElementById('ttt-canvas'); | |
/** | |
* Initialize the 3D scene. |
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 () { | |
demo.jqContainer.mousedown(mouseDown); | |
demo.jqContainer.mouseup(mouseUp); | |
demo.jqContainer.mousemove(marqueeSelect); | |
$(document).mousemove(resetMarquee); | |
} | |
function resetMarquee () { | |
mouseup = true; | |
mousedown = 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
// http://howtocenterincss.com/#contentType=div&horizontal=center&vertical=middle&browser.IE=11 | |
<div style="display:flex;justify-content:center;align-items:center;"> | |
<div></div> | |
</div> |
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
.config(function($compileProvider) { | |
$compileProvider.debugInfoEnabled(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
# install brew | |
# | |
# download gource | |
# brew install all pre-reqs for gource. | |
# | |
# configure, make, make install | |
# | |
# use following script to output a movie. | |
# -s is seconds per day. In this example, 1 second is 10 days. 1/10 == 0.1 You'll want to tweak this value. | |
# |
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 || {}; | |
// This object manages all of the 4D objects. | |
// Between renders, it'll take the difference between the last render and the current time. | |
// This Time Delta is passed to each Object4D object. | |
// Each Object4D object will then move a distance based upon their individually set speed, | |
Demo.Manager = function () { | |
this.clock = new Demo.Clock(); |
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 = []; |
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
// 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 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. |
NewerOlder