Skip to content

Commit

Permalink
cleaned demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Andor committed Aug 24, 2010
1 parent 0bbb138 commit 45117c3
Showing 1 changed file with 15 additions and 44 deletions.
59 changes: 15 additions & 44 deletions c3dl-dev/tests/points/mocap.js
@@ -1,5 +1,12 @@
/* This demo reads some mocap data from an xml file (selected through a dropDown List)
and displays a simple collada object to represent each point. */
/*
Copyright (c) 2008 Seneca College
Licenced under the MIT License (http://www.c3dl.org/index.php/mit-license/)
*/

/*
This demo reads some mocap data from an xml file (selected through a dropDown List)
and displays a simple collada object to represent each point.
*/

// Global variables
var cam;
Expand All @@ -12,10 +19,7 @@ var xmlDoc;
var x;
var frate;
var pointList;
var lineList;
var totaltime;
var things = [];
var pointsSmooth = true;
var sphereSize = 25;

var isDragging = false;
Expand Down Expand Up @@ -135,7 +139,6 @@ function canvasMain(canvasName)

function down(){}


function updateM(event)
{
// towards user
Expand All @@ -150,7 +153,6 @@ function updateM(event)
}
}


function pickCallback(pickingObj)
{
var objects = pickingObj.getObjects();
Expand All @@ -173,8 +175,6 @@ function pickCallback(pickingObj)
}
}



function changeKeyState(event, keyState)
{
switch( event.keyCode)
Expand All @@ -185,24 +185,11 @@ function changeKeyState(event, keyState)
}
}


function togglePointSmoothing()
{
scn.setPointSmooth(!scn.getPointSmooth());
}
function up(event)
{
//var glCanvas3D = c3dl.getContext();
var glCanvas3D = scn.getRenderer().getGLContext();

// S key
if(event.keyCode == 83)
{
// toggle point smoothing
scn.setPointSmooth(!scn.getPointSmooth());
}

// C color change
// C - color change
if(event.keyCode == 67)
{
for(var i = 0; i < pointList.length; i++)
Expand All @@ -223,7 +210,7 @@ function up(event)
}
}

//E
// E
if(event.keyCode == 69)
{
for(var i=0; i < 50; i++)
Expand All @@ -233,19 +220,13 @@ function up(event)
p.setPosition([0,0,i*10]);
scn.addObjectToScene(p);
}

//scn.setPointSize( scn.getPointSize() + 2);
}

// D
if(event.keyCode == 68)
{
scn.setPointSize( scn.getPointSize() - 2);
}

if(event.keyCode == 66)
{

}

// Q
if(event.keyCode == 81)
Expand All @@ -254,12 +235,11 @@ function up(event)
document.getElementById('debug').innerHTML = "Frame Rate = " + frate;
}

// R
// R - fix this
if(event.keyCode == 82)
{
cam.roll(0.1);
newScene("ff_3on3.combined_rom.xml");

//cam.roll(0.1);
//newScene("ff_3on3.combined_rom.xml");
}

// V change visibility
Expand All @@ -269,11 +249,9 @@ function up(event)
{
pointList[i].setVisible(!pointList[i].isVisible());
}
//pointList.setVisible( !pointList.getVisible());
}
}


function changePointRenderingMode(mode)
{
if(mode == 1)
Expand Down Expand Up @@ -323,9 +301,7 @@ function newScene(fName)

scn.setPointAttenuation([0.1, 0, 0]);


pointList = new Array();
//c3dl.debug.logInfo('new scene');

for(var i = 0; i < currentObjects.length; i++)
{
Expand All @@ -346,8 +322,6 @@ function newScene(fName)
}
}



function mouseUp(event)
{
// user released the LMB.
Expand All @@ -357,7 +331,6 @@ function mouseUp(event)
}
}


function mouseDown(evt)
{
// user pressed the LMB.
Expand All @@ -370,7 +343,6 @@ function mouseDown(evt)
}
}


function mouseMove(evt)
{
if(isDragging == true)
Expand All @@ -393,7 +365,6 @@ function mouseMove(evt)
}
}


function xevtpos(evt)
{
return 2 * (evt.clientX / evt.target.width) - 1;
Expand Down

0 comments on commit 45117c3

Please sign in to comment.