Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix build system for source/ dir, fix closure errors.

  • Loading branch information...
commit 1befcdae1f3628058585159dbe1bb013fbcfb44b 1 parent 9f54154
David Humphrey authored
View
10 HEADER
@@ -0,0 +1,10 @@
+/*
+ Javascript port of CubicVR 3D engine for WebGL
+ by Charles J. Cliffe
+ http://www.cubicvr.org/
+
+ May be used under the terms of the MIT license.
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+/*globals alert: false */
View
53 Makefile
@@ -2,23 +2,64 @@
CUBICVR := CubicVR
SRC_DIR := .
DIST_DIR := $(SRC_DIR)/dist
-CUBICVR_SRC := $(SRC_DIR)/$(CUBICVR).js
CUBICVR_DIST := $(DIST_DIR)/$(CUBICVR).js
CUBICVR_MIN := $(DIST_DIR)/$(CUBICVR).min.js
CUBICVR_VS := $(SRC_DIR)/$(CUBICVR)_Core.vs
CUBICVR_FS := $(SRC_DIR)/$(CUBICVR)_Core.fs
TOOLS_DIR := $(SRC_DIR)/tools
TESTS_DIR := $(DIST_DIR)/tests
+SOURCE_DIR := $(SRC_DIR)/source
-compile = java -jar $(TOOLS_DIR)/closure/compiler.jar --js $(CUBICVR_DIST) \
+addheader = @@cat $(SRC_DIR)/HEADER > $(DIST_DIR)/header.tmp && \
+ cat $(1) >> $(DIST_DIR)/header.tmp && \
+ rm -f $(1) && \
+ mv $(DIST_DIR)/header.tmp $(1)
+
+#compile = java -jar $(TOOLS_DIR)/closure/compiler.jar --js $(CUBICVR_DIST) \
+# --compilation_level SIMPLE_OPTIMIZATIONS \
+# --js_output_file $(1)
+
+compile = java -jar $(TOOLS_DIR)/closure/compiler.jar $(shell for js in $(JS_SRCS) ; do echo --js $$js ; done) \
--compilation_level SIMPLE_OPTIMIZATIONS \
--js_output_file $(1)
+JS_SRCS := \
+ $(SOURCE_DIR)/CubicVR.js \
+ $(SOURCE_DIR)/CubicVR.COLLADA.js \
+ $(SOURCE_DIR)/CubicVR.CVRXML.js \
+ $(SOURCE_DIR)/CubicVR.Camera.js \
+ $(SOURCE_DIR)/CubicVR.GML.js \
+ $(SOURCE_DIR)/CubicVR.Landscape.js \
+ $(SOURCE_DIR)/CubicVR.Layout.js \
+ $(SOURCE_DIR)/CubicVR.Light.js \
+ $(SOURCE_DIR)/CubicVR.MainLoop.js \
+ $(SOURCE_DIR)/CubicVR.Material.js \
+ $(SOURCE_DIR)/CubicVR.Math.js \
+ $(SOURCE_DIR)/CubicVR.Mesh.js \
+ $(SOURCE_DIR)/CubicVR.Motion.js \
+ $(SOURCE_DIR)/CubicVR.Octree.js \
+ $(SOURCE_DIR)/CubicVR.Particles.js \
+ $(SOURCE_DIR)/CubicVR.PostProcess.js \
+ $(SOURCE_DIR)/CubicVR.Primitives.js \
+ $(SOURCE_DIR)/CubicVR.Renderer.js \
+ $(SOURCE_DIR)/CubicVR.Scene.js \
+ $(SOURCE_DIR)/CubicVR.Shader.js \
+ $(SOURCE_DIR)/CubicVR.Texture.js \
+ $(SOURCE_DIR)/CubicVR.UVMapper.js \
+ $(SOURCE_DIR)/CubicVR.Utility.js
+
# Convert shader file into js string, removing comments, whitespace, empty lines, and attach to window.CubicVR
stringify = ( echo '/* Auto Embed $(2) */' ; \
/bin/echo -n "window.CubicVR.$(1)=" ; \
python $(TOOLS_DIR)/stringify_shader.py $(2) )
+$(CUBICVR_DIST): $(DIST_DIR) $(JS_SRCS)
+ @@echo "Building $(CUBICVR_DIST)"
+ @@cat $(JS_SRCS) > $(CUBICVR_DIST)
+ @@$(call stringify,CubicVRCoreVS,$(CUBICVR_VS)) >> $(CUBICVR_DIST)
+ @@$(call stringify,CubicVRCoreFS,$(CUBICVR_FS)) >> $(CUBICVR_DIST)
+ @@$(call addheader,$(CUBICVR_DIST))
+
all: $(DIST_DIR) $(CUBICVR_DIST) $(CUBICVR_MIN)
@@echo "Finished, see $(DIST_DIR)"
@@ -26,13 +67,7 @@ $(DIST_DIR):
@@echo "Creating $(DIST_DIR)"
@@mkdir $(DIST_DIR)
-$(CUBICVR_DIST): $(DIST_DIR) $(CUBICVR_SRC)
- @@echo "Building $(CUBICVR_DIST)"
- @@cp $(CUBICVR_SRC) $(CUBICVR_DIST)
- @@$(call stringify,CubicVRCoreVS,$(CUBICVR_VS)) >> $(CUBICVR_DIST)
- @@$(call stringify,CubicVRCoreFS,$(CUBICVR_FS)) >> $(CUBICVR_DIST)
-
-$(CUBICVR_MIN): $(DIST_DIR) $(CUBICVR_SRC) $(CUBICVR_DIST)
+$(CUBICVR_MIN): $(DIST_DIR) $(CUBICVR_DIST)
@@echo "Building $(CUBICVR_MIN)"
@@$(call compile,$(CUBICVR_MIN))
View
12 source/CubicVR.COLLADA.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("COLLADA",function(base) {
@@ -693,7 +685,9 @@ CubicVR.RegisterModule("COLLADA",function(base) {
}
if (color.length === 3) {
- meshPart.colors.push([geoSources[colorRef]].data[color[0], geoSources[colorRef]].data[color[1], geoSources[colorRef]].data[color[2]]);
+ meshPart.colors.push([ geoSources[colorRef].data[color[0]],
+ geoSources[colorRef].data[color[1]],
+ geoSources[colorRef].data[color[2]] ]);
}
}
}
View
8 source/CubicVR.CVRXML.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("CVRXML",function(base) {
View
8 source/CubicVR.Camera.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Camera",function(base) {
View
8 source/CubicVR.GML.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("GML",function(base) {
View
8 source/CubicVR.Landscape.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Landscape",function(base) {
View
8 source/CubicVR.Layout.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Layout",function(base) {
View
8 source/CubicVR.Light.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Light", function(base) {
View
10 source/CubicVR.MainLoop.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("MainLoop",function(base) {
@@ -192,7 +184,7 @@ CubicVR.RegisterModule("MainLoop",function(base) {
scenes: [],
update: function () {},
start: function () {},
- stop: function () {},
+ stop: function () {}
}];
var timer = new Timer();
View
8 source/CubicVR.Material.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Material", function(base) {
var undef = base.undef;
View
14 source/CubicVR.Math.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Math",function (base) {
@@ -832,7 +824,7 @@ CubicVR.RegisterModule("Math",function (base) {
var y = aabb[0][1] < aabb[1][1] ? aabb[1][1] - aabb[0][1] : aabb[0][1] - aabb[1][1];
var z = aabb[0][2] < aabb[1][2] ? aabb[1][2] - aabb[0][2] : aabb[0][2] - aabb[1][2];
return [x,y,z];
- },
+ }
};
var plane = {
@@ -852,7 +844,7 @@ CubicVR.RegisterModule("Math",function (base) {
plane[1] = plane[1] / mag;
plane[2] = plane[2] / mag;
plane[3] = plane[3] / mag;
- },
+ }
};
var sphere = {
@@ -867,7 +859,7 @@ CubicVR.RegisterModule("Math",function (base) {
return true;
}
return false;
- },
+ }
};
var extend = {
View
8 source/CubicVR.Mesh.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Mesh",function(base) {
View
8 source/CubicVR.Motion.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Motion",function(base) {
View
8 source/CubicVR.Octree.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Octree",function(base) {
View
8 source/CubicVR.Particles.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Particles",function(base) {
View
8 source/CubicVR.PostProcess.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("PostProcess", function(base) {
View
8 source/CubicVR.Primitives.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Primitives",function(base) {
View
8 source/CubicVR.Renderer.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Renderer",function(base){
View
8 source/CubicVR.Scene.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Scene",function(base) {
View
8 source/CubicVR.Shader.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Shader",function(base) {
View
8 source/CubicVR.Texture.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Texture",function(base) {
View
8 source/CubicVR.UVMapper.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("UVMapper",function(base) {
View
10 source/CubicVR.Utility.js
@@ -1,11 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- https://github.com/cjcliffe/CubicVR.js/
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
CubicVR.RegisterModule("Util",function(base) {
@@ -226,7 +218,7 @@ CubicVR.RegisterModule("Util",function(base) {
}
var extend = {
- util: util,
+ util: util
};
return extend;
View
29 CubicVR.js → source/CubicVR.js
@@ -1,13 +1,3 @@
-/*
- Javascript port of CubicVR 3D engine for WebGL
- by Charles J. Cliffe
- http://www.cubicvr.org/
-
- May be used under the terms of the MIT license.
- http://www.opensource.org/licenses/mit-license.php
-*/
-
-/*globals alert: false */
(function(window, document, Math, nop, undef) {
@@ -672,22 +662,3 @@ var extend = {
registerModule("Core",function(base) { return extend; });
}(window, window.document, Math, function(){console.log('nop!');}));
-
-/* @cuthere */
-/* --- SNIP FOR MINIFICATION --- */
-
-// yes document.write is dirty, but it prevents race conditions since they're forced to load and parse now before this script completes
-(function() {
-
- var CubicVR_Modules = [
- "Math","Utility","Shader","MainLoop",
- "Texture","Material","Mesh","UVMapper","Renderer",
- "Light","Camera","Motion","Scene","PostProcess","Layout",
- "Primitives","COLLADA","GML","Particles","Landscape",
- "Octree","CVRXML",
- ];
-
- for (var i = 0; i < CubicVR_Modules.length; i++) {
- document.write('<script type="text/javascript" src="'+CubicVR.getScriptLocation()+'/source/CubicVR.'+CubicVR_Modules[i]+'.js"></script>');
- }
-})();
Please sign in to comment.
Something went wrong with that request. Please try again.