Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
.dist
*~
137 changes: 137 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# NOTES:
#
# Requires: java
#
# make - builds c3dl-DEV-VERSION.js and c3dl-DEV-VERSION.min.js in dist/
#
# make VERSION=1.2 -builds c3dl-1.2.js and c3dl-1.2.min.js in dist/
#
# make clean - delete dist/

VERSION ?= DEV-VERSION
NULL :=
SRC_DIR := .
C3DL := c3dl
C3DL_DIR := $(SRC_DIR)/$(C3DL)
TOOLS_DIR := $(SRC_DIR)/tools
DIST_DIR := $(SRC_DIR)/dist

C3DL_DIST := $(DIST_DIR)/$(C3DL)-$(VERSION).js
C3DL_MIN := $(DIST_DIR)/$(C3DL)-$(VERSION).min.js

# Add any c3dl JS files below
JS_SOURCES := $(C3DL_DIR)/c3dlnamespace.js \
$(C3DL_DIR)/constants.js \
$(C3DL_DIR)/effects/effect_docs.js \
$(C3DL_DIR)/debug.js \
$(C3DL_DIR)/renderer/renderer.js \
$(C3DL_DIR)/renderer/rendererwebgl.js \
$(C3DL_DIR)/renderer/programobject.js \
$(C3DL_DIR)/math/mjs.js \
$(C3DL_DIR)/math/mathutils.js \
$(C3DL_DIR)/math/vector.js \
$(C3DL_DIR)/math/matrix.js \
$(C3DL_DIR)/math/quaternion.js \
$(C3DL_DIR)/matrixstack.js \
$(C3DL_DIR)/camera/camera.js \
$(C3DL_DIR)/camera/freecamera.js \
$(C3DL_DIR)/camera/orbitcamera.js \
$(C3DL_DIR)/enclosure/boundingsphere.js \
$(C3DL_DIR)/enclosure/boundingvolume.js \
$(C3DL_DIR)/enclosure/visualboundingsphere.js \
$(C3DL_DIR)/enclosure/obb.js \
$(C3DL_DIR)/enclosure/aabb.js \
$(C3DL_DIR)/actors/actor.js \
$(C3DL_DIR)/actors/primitive.js \
$(C3DL_DIR)/actors/point.js \
$(C3DL_DIR)/actors/line.js \
$(C3DL_DIR)/shapes/shape.js \
$(C3DL_DIR)/shapes/cube.js \
$(C3DL_DIR)/shapes/plane.js \
$(C3DL_DIR)/shapes/sphere.js \
$(C3DL_DIR)/shapes/custom.js \
$(C3DL_DIR)/shapes/customplane.js \
$(C3DL_DIR)/frustum_culling/frustum.js \
$(C3DL_DIR)/frustum_culling/plane.js \
$(C3DL_DIR)/scene.js \
$(C3DL_DIR)/texture/texture.js \
$(C3DL_DIR)/texture/texturemanager.js \
$(C3DL_DIR)/texture/textureutils.js \
$(C3DL_DIR)/collada/colladamanager.js \
$(C3DL_DIR)/collada/colladaloader.js \
$(C3DL_DIR)/collada/colladaqueue.js \
$(C3DL_DIR)/collada/geometry.js \
$(C3DL_DIR)/collada/primitiveset.js \
$(C3DL_DIR)/light/light.js \
$(C3DL_DIR)/light/positionallight.js \
$(C3DL_DIR)/light/directionallight.js \
$(C3DL_DIR)/light/spotlight.js \
$(C3DL_DIR)/material.js \
$(C3DL_DIR)/collada/collada.js \
$(C3DL_DIR)/scenegraph/scenenode.js \
$(C3DL_DIR)/utilities/utilities.js \
$(C3DL_DIR)/shaders/model/light/light_vs.js \
$(C3DL_DIR)/shaders/model/material/material.js \
$(C3DL_DIR)/shaders/model/standard/model_fs.js \
$(C3DL_DIR)/shaders/model/standard/model_vs.js \
$(C3DL_DIR)/shaders/model/standard/std_callback.js \
$(C3DL_DIR)/shaders/particle_system/psys_vs.js \
$(C3DL_DIR)/shaders/particle_system/psys_fs.js \
$(C3DL_DIR)/shaders/point/point/point_vs.js \
$(C3DL_DIR)/shaders/point/point/point_fs.js \
$(C3DL_DIR)/shaders/point/sphere/point_sphere_vs.js \
$(C3DL_DIR)/shaders/point/sphere/point_sphere_fs.js \
$(C3DL_DIR)/shaders/line/line_vs.js \
$(C3DL_DIR)/shaders/line/line_fs.js \
$(C3DL_DIR)/shaders/bounding_sphere/bounding_sphere_vs.js \
$(C3DL_DIR)/shaders/bounding_sphere/bounding_sphere_fs.js \
$(C3DL_DIR)/shaders/model/greyscale/greyscale_vs.js \
$(C3DL_DIR)/shaders/model/greyscale/greyscale_fs.js \
$(C3DL_DIR)/shaders/model/greyscale/greyscale_callback.js \
$(C3DL_DIR)/shaders/model/sepia/sepia_vs.js \
$(C3DL_DIR)/shaders/model/sepia/sepia_fs.js \
$(C3DL_DIR)/shaders/model/sepia/sepia_callback.js \
$(C3DL_DIR)/shaders/model/cartoon/cartoon_vs.js \
$(C3DL_DIR)/shaders/model/cartoon/cartoon_fs.js \
$(C3DL_DIR)/shaders/model/cartoon/cartoon_callback.js \
$(C3DL_DIR)/shaders/model/gooch/gooch_vs.js \
$(C3DL_DIR)/shaders/model/gooch/gooch_fs.js \
$(C3DL_DIR)/shaders/model/gooch/gooch_callback.js \
$(C3DL_DIR)/shaders/model/solid_color/solid_color_vs.js \
$(C3DL_DIR)/shaders/model/solid_color/solid_color_fs.js \
$(C3DL_DIR)/shaders/model/solid_color/solid_color_callback.js \
$(C3DL_DIR)/effects/effecttemplate.js \
$(C3DL_DIR)/effects/effect.js \
$(C3DL_DIR)/particle_system/particlesystem.js \
$(C3DL_DIR)/particle_system/particle.js \
$(C3DL_DIR)/init.js \
$(C3DL_DIR)/interaction/collision.js \
$(C3DL_DIR)/interaction/picking.js \
$(C3DL_DIR)/interaction/pickingresult.js \
$(NULL)

CLOSURE := java -jar $(TOOLS_DIR)/closure/compiler.jar

c3dl: $(DIST_DIR) $(C3DL_DIST) $(C3DL_MIN)
@@echo "Finishied. See $(DIST_DIR)"

$(DIST_DIR):
@@mkdir -p $(DIST_DIR)

$(C3DL_DIST): $(DIST_DIR)
@@echo "Building $(C3DL_DIST)"
@@cat $(JS_SOURCES) > $(C3DL_DIST)

$(C3DL_MIN): $(DIST_DIR)
@@echo "Building $(C3DL_MIN)"
@@$(CLOSURE) $(shell for js in $(JS_SOURCES) ; do echo --js $$js ; done) \
--compilation_level SIMPLE_OPTIMIZATIONS \
--js_output_file $(C3DL_MIN)

advanced: $(DIST_DIR)
@@echo "Building $(C3DL_MIN) with advanced optimizations"
@@$(CLOSURE) $(shell for js in $(JS_SOURCES) ; do echo --js $$js ; done) \
--compilation_level ADVANCED_OPTIMIZATIONS \
--js_output_file $(C3DL_MIN)
clean:
@@rm -fr $(DIST_DIR)
2 changes: 1 addition & 1 deletion c3dl-dev/J3DXplorer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<head>
<title>Cavas3D test environment</title>
<!--Our directory structure is 2 above. If you download the entire repository as is, this will run-->
<script language="javascript" src="../../c3dl/c3dapi.js"></script>
<script type="application/javascript" src="../../dist/c3dl-DEV-VERSION.js" ></script>
<script language="javascript" src="J3DXplorer.js"></script>

</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/asteroids3/asteroids.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<title></title>
<!-- Set the path to the c3dl library and load the script -->
<link rel="stylesheet" href="style.css"/>
<script type="application/javascript" src="../../c3dl/c3dlapi.js" ></script>
<script type="application/javascript" src="../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="asteroids.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/psys_test2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<head>
<title>C3DL test environment: particle system</title>

<script language="javascript" src="../../c3dl/c3dapi.js"></script>
<script type="application/javascript" src="../../dist/c3dl-DEV-VERSION.js" ></script>
<script language="javascript" src="psys.js"></script>
<link rel="stylesheet" href="style.css" type = "text/css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/aabb/aabbtest.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>AABB Test</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="test.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/backBearing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<html>
<head>
<title>C3DL Picking Back-Bearing test</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="test.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
<style>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/center/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<html>
<head>
<title>C3DL Collada Loading Tests</title>
<script language="javascript" src="../../../c3dl/c3dapi.js"></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script language="javascript" src="test.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
<style>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/collada/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<html>
<head>
<title>C3DL Collada Loading Tests</title>
<script language="javascript" src="../../../c3dl/c3dapi.js"></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script language="javascript" src="test.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
<style>
Expand Down
1,968 changes: 984 additions & 984 deletions c3dl-dev/tests/collada/models/move_widget.dae

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion c3dl-dev/tests/collision/collision.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Collision</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="collision.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/effects/test1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<html>
<head>
<title>C3DL Effect Tests</title>
<script language="javascript" src="../../../../c3dl/c3dapi.js"></script>
<script type="application/javascript" src="../../../../dist/c3dl-DEV-VERSION.js" ></script>
<script language="javascript" src="test.js"></script>
<link rel="stylesheet" type="text/css" href="../../style.css"/>
<style>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/frustum culling/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Frustum Culling</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="fc.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/lines/lines.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<html>
<head>
<title>C3DL Line Test</title>
<script language="javascript" src="../../../c3dl/c3dapi.js"></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script language="javascript" src="lines.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css"/>
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/points/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<!-- Set the path to the c3dl library and load the script -->
<script type="application/javascript"> var SCRIPT_PATH = '../../../canvas3dapi/'</script>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="mocap.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/scene pause/scenepause.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Scene Pause</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="scenepause.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/shapes/shapes.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Shape Test</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="shapes.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/sizeTest/size.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Set Size Test</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="test.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/speed test/speed.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Speed</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="speed.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/static objects/static.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Static Test</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="static.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/texture/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Texture</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="texture.js"></script>
<script type="application/javascript" src="canvasclock.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/update texture/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>BoundingBox</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="updatetexture.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/velocity/avel.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Angular Velocity</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="angvelocity.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
2 changes: 1 addition & 1 deletion c3dl-dev/tests/velocity/vel.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Velocity</title>
<script type="application/javascript" src="../../../c3dl/c3dapi.js" ></script>
<script type="application/javascript" src="../../../dist/c3dl-DEV-VERSION.js" ></script>
<script type="application/javascript" src="velocity.js"></script>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
Expand Down
13 changes: 8 additions & 5 deletions c3dl/c3dapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var parts = scripts[scripts.length - 1].src.split("/");
parts.pop();
var basePath = parts.join("/");
var head = document.getElementsByTagName("head")[0];
basePath += "/";

/**
@private
Expand All @@ -26,11 +27,13 @@ var head = document.getElementsByTagName("head")[0];
*/
c3dl_require = function (path)
{
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="' + basePath + "/" + path + '">');
document.write('</' + 'script' + '>');
var s = window.document.createElement('script');
s.type = 'text/javascript';
s.onload = function(){
window.document.head.removeChild(s);
};
s.src = basePath + path;
window.document.head.appendChild(s);
}

//Some classes depend on others, so the order of the following lines should not be
Expand Down
2 changes: 1 addition & 1 deletion c3dl/c3dlnamespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ var c3dl =
}
tmpparent.prototype.constructor.apply(o);
delete o.__parent;
},
}
};
1 change: 1 addition & 0 deletions c3dl/collada/collada.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ c3dl.Collada.prototype.init = function (daePath) {
// this will be called if the scene is being initialized and we are
// placing collada objects in the manager.
c3dl.ColladaQueue.pushBack(this);
this.sceneGraph = c3dl.ColladaManager.getSceneGraphCopy(this.path);
}
if (this.isReady()) {
c3dl.pushMatrix();
Expand Down
4 changes: 2 additions & 2 deletions c3dl/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ try{
Float32Array = WebGLFloatArray;
}

const C3DL_FLOAT_ARRAY = Float32Array;
const C3DL_UINT_ARRAY = Uint8Array;
var C3DL_FLOAT_ARRAY = Float32Array;
var C3DL_UINT_ARRAY = Uint8Array;

//Used to for temp vectors and matrixs needed in update loops
c3dl.mat1 = new C3DL_FLOAT_ARRAY(16);
Expand Down
Loading