Skip to content
Permalink
Browse files

everything omg!!

  • Loading branch information
Matt
Matt committed Jul 28, 2010
1 parent e1e29b7 commit fb9298d67e5dc2dd35396d93bcca7875ffab41c7
Showing with 3,723 additions and 548 deletions.
  1. +9 −11 c3dl-dev/demos/rts/source/main.js
  2. +0 −197 c3dl-dev/tests/frustum culling/box.dae
  3. +84 −12 c3dl-dev/tests/frustum culling/fc.js
  4. BIN c3dl-dev/tests/frustum culling/images/duck/duck.png
  5. BIN c3dl-dev/tests/frustum culling/images/firehall/firehall.png
  6. BIN c3dl-dev/tests/frustum culling/images/firehall/firehall_plane.png
  7. BIN c3dl-dev/tests/frustum culling/images/fly_plane_polylist/plane.png
  8. BIN c3dl-dev/tests/frustum culling/images/gingerbread/gingerbread.png
  9. BIN c3dl-dev/tests/frustum culling/images/old_cottage/old_cottage.png
  10. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture0.jpg
  11. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture1.jpg
  12. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture10.jpg
  13. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture11.jpg
  14. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture12.jpg
  15. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture13.jpg
  16. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture14.jpg
  17. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture15.jpg
  18. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture16.jpg
  19. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture17.jpg
  20. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture2.jpg
  21. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture3.jpg
  22. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture4.jpg
  23. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture5.jpg
  24. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture6.jpg
  25. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture7.jpg
  26. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture8.jpg
  27. BIN c3dl-dev/tests/frustum culling/images/swiss_army_knife/texture9.jpg
  28. BIN c3dl-dev/tests/frustum culling/images/teapot/teapot.png
  29. +37 −3 c3dl-dev/tests/frustum culling/index.html
  30. +378 −0 c3dl-dev/tests/frustum culling/obj.dae
  31. +198 −0 c3dl-dev/tests/scene pause/duck.dae
  32. BIN c3dl-dev/tests/scene pause/duck.jpg
  33. +12 −0 c3dl-dev/tests/scene pause/scenepause.html
  34. +34 −0 c3dl-dev/tests/scene pause/scenepause.js
  35. +1 −0 c3dl-dev/tests/velocity/angvelocity.js
  36. +7 −6 c3dl/actors/actor.js
  37. +4 −4 c3dl/actors/line.js
  38. +2 −1 c3dl/c3dapi.js
  39. +169 −10 c3dl/collada/collada.js
  40. +19 −13 c3dl/collada/colladaloader.js
  41. +62 −60 c3dl/collada/geometry.js
  42. +39 −5 c3dl/collada/primitiveset.js
  43. +8 −1 c3dl/constants.js
  44. +202 −0 c3dl/enclosure/boundingbox.js
  45. +68 −28 c3dl/enclosure/boundingsphere.js
  46. +33 −10 c3dl/frustum_culling/frustum.js
  47. +1 −1 c3dl/frustum_culling/plane.js
  48. +29 −23 c3dl/interaction/picking.js
  49. +11 −11 c3dl/math/matrix.js
  50. +3 −3 c3dl/math/quaternion.js
  51. +5 −5 c3dl/math/vector.js
  52. +6 −6 c3dl/particle_system/particle.js
  53. +14 −14 c3dl/particle_system/particlesystem.js
  54. +13 −17 c3dl/renderer/rendererwebgl.js
  55. +88 −47 c3dl/scene.js
  56. +69 −60 c3dl/scenegraph/scenenode.js
  57. +198 −0 tutorials/tutorial2/duck.dae
  58. BIN tutorials/tutorial2/duck.jpg
  59. +11 −0 tutorials/tutorial2/tutorial2.html
  60. +72 −0 tutorials/tutorial2/tutorial2.js
  61. +198 −0 tutorials/tutorial3/duck.dae
  62. BIN tutorials/tutorial3/duck.jpg
  63. +11 −0 tutorials/tutorial3/tutorial3.html
  64. +92 −0 tutorials/tutorial3/tutorial3.js
  65. +198 −0 tutorials/tutorial5/duck.dae
  66. BIN tutorials/tutorial5/duck.jpg
  67. +11 −0 tutorials/tutorial5/tutorial5.html
  68. +115 −0 tutorials/tutorial5/tutorial5.js
  69. +198 −0 tutorials/tutorial6/duck.dae
  70. BIN tutorials/tutorial6/duck.jpg
  71. +11 −0 tutorials/tutorial6/index.html
  72. +101 −0 tutorials/tutorial6/tutorial6.js
  73. +198 −0 tutorials/tutorial7/duck.dae
  74. BIN tutorials/tutorial7/duck.jpg
  75. +10 −0 tutorials/tutorial7/tutorial7.html
  76. +119 −0 tutorials/tutorial7/tutorial7.js
  77. +198 −0 tutorials/tutorial8/duck.dae
  78. BIN tutorials/tutorial8/duck.jpg
  79. +141 −0 tutorials/tutorial8/teapot.dae
  80. BIN tutorials/tutorial8/teapot.png
  81. +10 −0 tutorials/tutorial8/tutorial8.html
  82. +71 −0 tutorials/tutorial8/tutorial8.js
  83. +10 −0 tutorials/tutorial8/tutorial8b.html
  84. +145 −0 tutorials/tutorial8/tutorial8b.js
@@ -51,24 +51,22 @@ function loadLevel(board) {
switch (board[z][x]) {
case 0:
{
var earth = new c3dl.Collada();
earth.init(PLANE_PATH);
// move down y to prevent z-fighting with planes
// under models
earth.scale([3,1,3]);
earth.translate([z*30,-0.5,x*30]);
//set the id for later use during picking
earth.id = i;
scn.addObjectToScene(earth);
var earth = new c3dl.Collada();
earth.init(PLANE_PATH);
// move down y to prevent z-fighting with planes
// under models
earth.scale([3,1,3]);
earth.translate([z*30,-0.5,x*30]);
//set the id for later use during picking
scn.addObjectToScene(earth);
}break;
case 1:
{
var townHall = new c3dl.Collada();
townHall.init(BARRACKS_PATH);
townHall.translate([z*10,0,x*10]);
scn.addObjectToScene(townHall);

var earth = new c3dl.Collada();
var earth = new c3dl.Collada();
earth.init(PLANE_PATH);
// move down y to prevent z-fighting with planes
// under models

This file was deleted.

@@ -1,7 +1,28 @@
c3dl.addMainCallBack(canvasMain, "test");
c3dl.addModel("box.dae");
c3dl.addModel("obj.dae");
var timesincelastchange=0;
var box;
var obj;
var cam = [];
cam[0] = new c3dl.FreeCamera();
cam[1] = new c3dl.FreeCamera();
cam[2] = new c3dl.FreeCamera();
cam[3] = new c3dl.FreeCamera();
cam[4] = new c3dl.FreeCamera();
cam[5] = new c3dl.FreeCamera();
cam[0].setPosition([0, 0, 50]);
cam[0].setLookAtPoint([0.0, 0.0, 0.0]);
cam[1].setPosition([0, 0, -50]);
cam[1].setLookAtPoint([0.0, 0.0, 0.0]);
cam[2].setPosition([0, 50, 0]);
cam[2].setLookAtPoint([0.01, 0.0, 0.0]);
cam[3].setPosition([0, -50, 0]);
cam[3].setLookAtPoint([0.01, 0.0, 0.0]);
cam[4].setPosition([50, 0, 0]);
cam[4].setLookAtPoint([0.0, 0.0, 0.0]);
cam[5].setPosition([-50, 0, 0]);
cam[5].setLookAtPoint([0.0, 0.0, 0.0]);
var start = +new Date();
var currentCam = 0;
function canvasMain(canvasName){
scn = new c3dl.Scene();
scn.setCanvasTag(canvasName);
@@ -11,21 +32,72 @@ function canvasMain(canvasName){
scn.init(canvasName);
if(renderer.isReady() )
{
var now = new Date();
box = new c3dl.Collada();
box.init("box.dae");
box.setPosition(new Array(0.0, 0.0, 0));
box.setLinearVel(new Array(0.001, 0.0, 0.0));
scn.addObjectToScene(box);
var cam = new c3dl.FreeCamera();
cam.setPosition(new Array(10, 20, 30.0));
cam.setLookAtPoint(new Array(0.0, 0.0, 0.0));
scn.setCamera(cam);

obj = new c3dl.Collada();
obj.init("obj.dae");
obj.setPosition(new Array(0.0, 0.0, 0));
obj.scale([0.5,0.5,0.5]);
scn.addObjectToScene(obj);
scn.setCamera(cam[0]);
scn.setUpdateCallback(test);
scn.startScene();
}
}
function test(){
scn.setCamera(cam[currentCam]);
document.getElementById('fps').value = scn.getFPS();
var checker;
var camera = scn.getCamera();
camera.applyToWorld(scn.getCanvas().width / scn.getCanvas().height);
var projMatrix = camera.getProjectionMatrix();
var viewMatrix = camera.getViewMatrix();
var frustumMatrix = c3dl.multiplyMatrixByMatrix(projMatrix,viewMatrix);
var frustumCulling = new Frustum(frustumMatrix);
//Culling using spheres
var boundingSpheres = obj.getBoundingSpheres();
for (var j = 0; j < boundingSpheres.length; j++) {
checker = frustumCulling.sphereInFrustum(boundingSpheres[j]);
if (checker === "INSIDE") {
break;
}
}
document.getElementById('InOut').value = checker;

}

function nextCam() {
(currentCam === 5) ? currentCam = 0 : currentCam++;
}
function prevCam() {
(currentCam === 0) ? currentCam = 5 : currentCam--;
}

function blastOff() {
var velocity = [0,0,0];
if (document.getElementById('X').checked) {
if (document.getElementById('Xlist').value === "Xpos") {
velocity = [0.01, velocity[1],velocity[2]];
}
else {
velocity = [-0.01, velocity[1],velocity[2]];
}
}
if (document.getElementById('Y').checked) {
if (document.getElementById('Ylist').value === "Ypos") {
velocity = [velocity[0], 0.01,velocity[2]];
}
else {
velocity = [velocity[0], -0.01,velocity[2]];
}
}
if (document.getElementById('Z').checked) {
if (document.getElementById('Zlist').value === "Zpos") {
velocity = [velocity[0], velocity[1],0.01];
}
else {
velocity = [velocity[0], velocity[1],-1];
}
}
obj.setPosition(new Array(0.0, 0.0, 0));
obj.setLinearVel(velocity);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,8 +5,42 @@
<script type="application/javascript" src="fc.js"></script>
</head>
<body>

<canvas id="test" style="border: 2px solid blue" width="500" height="500"></canvas>
<input type="label" id="fps" value="">
<table>
<tr>
<td><canvas id="test" style="border: 2px solid blue" width="500" height="500"></canvas><td/>
<td>
<input type="button" id="NCam" value="Next Cam" onclick="nextCam();">
<input type="button" id="PCam" value="Previous Cam" onclick="prevCam();">
<br/>
Select Axis:
<br/>
<input type="checkbox" id="X" value=""> X
<SELECT id="Xlist">
<OPTION VALUE="Xpos"> Positive
<OPTION VALUE="Xneg"> Negative
</SELECT>
<br/>
<input type="checkbox" id="Y" value=""> Y
<SELECT id="Ylist">
<OPTION VALUE="Ypos"> Positive
<OPTION VALUE="Yneg"> Negative
</SELECT>
<br/>
<input type="checkbox" id="Z" value=""> Z
<SELECT id="Zlist">
<OPTION VALUE="Zpos"> Positive
<OPTION VALUE="Zneg"> Negative
</SELECT>
<br/>
<input type="button" id="fire" value="Fire!" onclick="blastOff();"/>
<br/>
Object:<input type="text" id="InOut" value="">
</td>
</tr>
<tr>
<td> FPS:<input type="text" id="fps" value=""><td/>
<td></td>
</tr>
<table>
</body>
</html>

0 comments on commit fb9298d

Please sign in to comment.
You can’t perform that action at this time.