Permalink
Browse files

Open sourcing of Meshmoon WebRocket core codebase as realXtend WebTun…

…dra.
  • Loading branch information...
jonnenauha committed Apr 3, 2014
0 parents commit d1739e81c23f5574c6be98beaefe54a66475d7fd
Showing with 83,116 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +22 −0 COPYING
  3. +318 −0 Gruntfile.js
  4. +176 −0 LICENSE
  5. +72 −0 README.md
  6. +31 −0 html/client.html
  7. BIN html/img/icons/icon-camera.png
  8. +4 −0 html/img/icons/licences.md
  9. BIN html/img/realxtend_logo-doc-header.png
  10. BIN html/img/realxtend_logo.png
  11. +17 −0 package.json
  12. +152 −0 src/application/freecamera.js
  13. +743 −0 src/core/asset/AssetAPI.js
  14. +82 −0 src/core/asset/AssetCache.js
  15. +83 −0 src/core/asset/AssetFactory.js
  16. +597 −0 src/core/asset/AssetTransfer.js
  17. +48 −0 src/core/asset/BinaryAsset.js
  18. +370 −0 src/core/asset/IAsset.js
  19. +130 −0 src/core/asset/IHttpProxyResolver.js
  20. +48 −0 src/core/asset/TextAsset.js
  21. +275 −0 src/core/console/ConsoleAPI.js
  22. +428 −0 src/core/data/DataDeserializer.js
  23. +439 −0 src/core/data/DataSerializer.js
  24. +263 −0 src/core/event/EventAPI.js
  25. +33 −0 src/core/event/EventSubscription.js
  26. +203 −0 src/core/frame/FrameAPI.js
  27. +173 −0 src/core/framework/CoreStringUtils.js
  28. +109 −0 src/core/framework/ITundraPlugin.js
  29. +828 −0 src/core/framework/TundraClient.js
  30. +246 −0 src/core/framework/TundraLogging.js
  31. +169 −0 src/core/framework/TundraSDK.js
  32. +104 −0 src/core/input/IInputPlugin.js
  33. +666 −0 src/core/input/InputAPI.js
  34. +262 −0 src/core/input/InputGamepadPlugin.js
  35. +694 −0 src/core/input/InputTouchPlugin.js
  36. +149 −0 src/core/math/Color.js
  37. +37 −0 src/core/math/EasingCurve.js
  38. +265 −0 src/core/math/Transform.js
  39. +42 −0 src/core/network/ClientJoinedMessage.js
  40. +42 −0 src/core/network/ClientLeftMessage.js
  41. +89 −0 src/core/network/EntityActionMessage.js
  42. +129 −0 src/core/network/INetworkMessage.js
  43. +44 −0 src/core/network/INetworkMessageHandler.js
  44. +43 −0 src/core/network/LoginMessage.js
  45. +56 −0 src/core/network/LoginReplyMessage.js
  46. +164 −0 src/core/network/Network.js
  47. +106 −0 src/core/network/TundraMessageHandler.js
  48. +200 −0 src/core/renderer/IRenderSystem.js
  49. +187 −0 src/core/renderer/RaycastResult.js
  50. +917 −0 src/core/scene/Attribute.js
  51. +65 −0 src/core/scene/AttributeChange.js
  52. +750 −0 src/core/scene/Entity.js
  53. +68 −0 src/core/scene/EntityAction.js
  54. +508 −0 src/core/scene/IComponent.js
  55. +65 −0 src/core/scene/IDomIntegration.js
  56. +1,223 −0 src/core/scene/Scene.js
  57. +202 −0 src/core/script/IApplication.js
  58. +319 −0 src/core/script/ICameraApplication.js
  59. +914 −0 src/core/ui/UiAPI.js
  60. +38 −0 src/entity-components/EC_AnimationController.js
  61. +34 −0 src/entity-components/EC_Avatar.js
  62. +54 −0 src/entity-components/EC_Camera.js
  63. +220 −0 src/entity-components/EC_DynamicComponent.js
  64. +56 −0 src/entity-components/EC_EnvironmentLight.js
  65. +66 −0 src/entity-components/EC_Fog.js
  66. +44 −0 src/entity-components/EC_Hydrax.js
  67. +108 −0 src/entity-components/EC_Light.js
  68. +59 −0 src/entity-components/EC_Mesh.js
  69. +148 −0 src/entity-components/EC_Name.js
  70. +59 −0 src/entity-components/EC_Placeable.js
  71. +110 −0 src/entity-components/EC_Script.js
  72. +66 −0 src/entity-components/EC_Sky.js
  73. +124 −0 src/entity-components/EC_WaterPlane.js
  74. +45 −0 src/lib/bitarray.js
  75. +163 −0 src/lib/classy.js
  76. +15,009 −0 src/lib/jquery-ui.js
  77. +111 −0 src/lib/jquery.contextmenu.js
  78. +1,533 −0 src/lib/jquery.jgestures.js
  79. +8,816 −0 src/lib/jquery.js
  80. +122 −0 src/lib/jquery.mousewheel.js
  81. +17 −0 src/lib/jquery.titlealert.min.js
  82. +175 −0 src/lib/loglevel.js
  83. +38 −0 src/lib/polymer.min.js
  84. +36 −0 src/lib/require.min.js
  85. +445 −0 src/lib/signals.js
  86. +36,981 −0 src/lib/three.js
  87. +225 −0 src/lib/three/CSS3DRenderer.js
  88. +431 −0 src/lib/three/OBJLoader.js
  89. +167 −0 src/main.js
  90. +223 −0 src/plugins/dom-integration/TundraDomIntegration.js
  91. +25 −0 src/plugins/dom-integration/TundraDomIntegrationPlugin.js
  92. +1,062 −0 src/view/threejs/ThreeJsRenderer.js
  93. +165 −0 src/view/threejs/asset/ObjMeshAsset.js
  94. +51 −0 src/view/threejs/entity-components/EC_AnimationController_ThreeJs.js
  95. +237 −0 src/view/threejs/entity-components/EC_Camera_ThreeJs.js
  96. +114 −0 src/view/threejs/entity-components/EC_Fog_ThreeJs.js
  97. +525 −0 src/view/threejs/entity-components/EC_Mesh_ThreeJs.js
  98. +683 −0 src/view/threejs/entity-components/EC_Placeable_ThreeJs.js
  99. +131 −0 tools/snippets/SDK.client.html
  100. +22 −0 tools/snippets/SDK.post.inject.js
  101. +6 −0 tools/snippets/SDK.pre.inject.js
@@ -0,0 +1,3 @@
node_modules/
build/
build-temp/
22 COPYING
@@ -0,0 +1,22 @@
WebTundra is released with a permissive license. See LICENSE for more information.
CONTRIBUTIONS
This repository was originally developed by Adminotech Oy for the Meshmoon hosting platform.
The code was open sourced at 03.04.2014 with the Tundra license to the realXtend
WebTundra repository. Open sourcing was done to bring a web browser based SDK and client
to the core Tundra platform for everyone, and in hopes of that this code will be helpful
to the open source realXtend ecosystem and its users.
The repository from this point on has been developed further as open source for the common good by
Adminotech Oy and other contributors.
SPONSORS
University of Oulu,
Department of Computer Science and Engineering and UBIOulu
http://www.oulu.fi/cse/ http://www.ubioulu.fi/en/home
Adminotech Oy
http://adminotech.com/ http://meshmoon.com/
@@ -0,0 +1,318 @@
module.exports = function(grunt) {
var copyright = [
"/** Copyright realXtend project - http://realxtend.org/\n",
" Licensed under the Apache License, Version 2.0 (the \"License\");",
" you may not use this file except in compliance with the License.",
" You may obtain a copy of the License at\n",
" http://www.apache.org/licenses/LICENSE-2.0\n",
" Unless required by applicable law or agreed to in writing, software",
" distributed under the License is distributed on an \"AS IS\" BASIS,",
" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
" See the License for the specific language governing permissions and",
" limitations under the License.",
"*/\n"
].join("\n");
var processEC_Script = function(scriptPath) {
grunt.log.writeln("Processing " + scriptPath);
var contents = grunt.file.read(scriptPath)
if (contents.indexOf("define(") !== -1)
{
contents = grunt.config.get("requirejs").compile.options.onBuildCleanStart(contents);
contents = addEC_ScriptInstantiation(contents);
}
grunt.file.write(scriptPath, copyright + contents);
};
var addEC_ScriptInstantiation = function(contents) {
var i = contents.lastIndexOf("return");
if (i !== -1) {
var contentStart = contents.substring(0, i);
var contentEnd = contents.substring(i);
contentEnd = contentEnd.substring(0, contentEnd.indexOf(";"));
contentEnd = contentEnd.replace("return", "new");
contentEnd += "();\n";
contents = contentStart + contentEnd;
}
return contents;
};
var globalBuildDependencies = [];
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
clean : {
dest : { src : [ "build" ] },
src : { src : [ "build-temp" ] },
unwanted : { src : [ "build-temp/lib/polymer" ] },
doc : { src : [ "build/doc" ] },
build : { src : [ "build/build.txt", "build-temp" ] },
},
copy : {
sources : {
files : [
{ expand: true, cwd: "src/",
src : [ "lib/**",
"core/**",
"entity-components/**",
"view/**",
"plugins/**" ],
dest : "build-temp/" },
{ expand: true, cwd: "src/",
src : [ "application/**" ], dest : "build/" },
{ expand: true, cwd: "html/",
src : [ "img/**" ], dest : "build/" }
]
},
docassets : {
files : [
{ expand: true, cwd: "html/img/",
src : [ "realxtend_logo-doc-header.png" ], dest : "build/doc/assets/img/" },
]
}
},
compress : {
build : {
options : {
archive : "build/realxtend-webtundra-sdk-<%= pkg.version %>.zip",
pretty : true,
level : 9
},
files: [
{ expand : true, cwd: "build/",
src : [ "**" ],
dest : "realxtend-webtundra-sdk-<%= pkg.version %>/" }
]
}
},
requirejs : {
compile : {
options : {
baseUrl : "build-temp/",
optimize : "uglify",
name : "core/framework/TundraClient",
include : [
"view/threejs/ThreeJsRenderer"
],
skipProcessingModules : [
"lib/jquery.contextmenu",
"lib/three",
"lib/three/CSS3DRenderer",
"lib/three/OBJLoader",
"lib/loglevel",
"lib/signals",
"lib/polymer.min"
],
excludeGlobalModules : [
"lib/jquery",
"lib/jquery-ui",
"lib/jquery.mousewheel",
"lib/jquery.titlealert",
"lib/jquery.contextmenu",
"lib/three",
"lib/three/CSS3DRenderer",
"lib/three/OBJLoader",
"lib/loglevel",
"lib/signals",
"lib/polymer.min"
],
onBuildWrite : function(moduleName, path, contents) {
// Check if this module should not be bundled
var excludeFromBuild = false;
for (var i = 0; i < this.excludeGlobalModules.length; i++) {
if (moduleName.indexOf(this.excludeGlobalModules[i]) === 0) {
excludeFromBuild = true;
break;
}
}
// Skip processing for modules that do not use requirejs
for (var i = 0; i < this.skipProcessingModules.length; i++) {
if (moduleName.indexOf(this.skipProcessingModules[i]) === 0) {
grunt.log.writeln(" Skipping " + moduleName + " requirejs processing");
if (excludeFromBuild)
{
grunt.log.writeln(" Excluding " + moduleName + " from single file optimization");
return this.onBuildWriteDependency(moduleName, contents);
}
else
return contents;
}
}
var logging = false;
if (logging) grunt.log.writeln("=============================================", moduleName);
contents = this.onBuildCleanStart(contents, logging);
if (logging) grunt.log.writeln("-----------------------------------------");
contents = this.onBuildCleanEnd(contents, logging);
if (logging) grunt.log.writeln(" ");
if (excludeFromBuild)
{
grunt.log.writeln(" Excluding " + moduleName + " from single file optimization");
return this.onBuildWriteDependency(moduleName, contents);
}
else
return contents;
},
onBuildWriteDependency : function(moduleName, contents)
{
grunt.file.write("build/" + moduleName + ".js", contents);
globalBuildDependencies.push(moduleName + ".js");
return "";
},
onBuildCleanStart : function(contents, logging) {
var i = contents.indexOf("{");
if (i !== -1) {
if (logging === true) grunt.log.writeln(contents.substring(0, i+1));
contents = contents.substring(i+1);
}
return contents;
},
onBuildCleanEnd : function(contents, logging) {
var i = contents.lastIndexOf("return");
if (i !== -1) {
if (logging === true) grunt.log.writeln(contents.substring(i));
contents = contents.substring(0, i);
}
return contents;
},
out : function (compiledCode) {
grunt.file.write("build/realxtend-webtundra-sdk.js",
copyright +
grunt.file.read("tools/snippets/SDK.pre.inject.js") +
compiledCode +
grunt.file.read("tools/snippets/SDK.post.inject.js")
);
},
done : function(done, output) {
grunt.log.subhead("Running post-build operations");
grunt.log.writeln("Creating client.html");
var dependencyScriptTags = "";
for (var i = 0; i < globalBuildDependencies.length; i++)
dependencyScriptTags += '<script src="' + globalBuildDependencies[i] + '"></script>' + (i != globalBuildDependencies.length-1 ? '\n' : '');
grunt.log.writeln(dependencyScriptTags);
var contents = grunt.file.read("tools/snippets/SDK.client.html");
contents = contents.replace('<body>', '<body>\n\n' + dependencyScriptTags);
grunt.file.write("build/client.html", contents);
grunt.log.writeln("Creating LICENCE");
grunt.file.write("build/LICENCE", copyright);
grunt.log.writeln("Creating VERSION");
var pkgConfig = grunt.config.get("pkg");
grunt.file.write("build/VERSION", [
"Name realXtend WebTundra SDK",
"Description " + pkgConfig.description,
"Version " + pkgConfig.version,
"Homepage " + pkgConfig.homepage
].join("\n"));
done();
// Pre process scripts for uglifying
grunt.log.subhead("Running pre-build processing on applications");
var scripts = grunt.file.expand([ "build/application/*.webtundrajs", "build/application/*.js"]);
for (var i = 0; i < scripts.length; i++) {
processEC_Script(scripts[i]);
}
}
}
}
},
uglify : {
options : {
sourceMaps : false,
mangle : false,
beautify : false,
compress : true,
preserveComments : "some"
},
deps : {
files : {
"build/lib/three.js" : [ "build/lib/three.js" ],
"build/lib/three/CSS3DRenderer.js" : [ "build/lib/three/CSS3DRenderer.js" ],
"build/lib/three/OBJLoader.js" : [ "build/lib/three/OBJLoader.js" ],
"build/lib/jquery.js" : [ "build/lib/jquery.js" ],
"build/lib/jquery.mousewheel.js" : [ "build/lib/jquery.mousewheel.js" ],
"build/lib/jquery.contextmenu.js" : [ "build/lib/jquery.contextmenu.js" ],
"build/lib/jquery-ui.js" : [ "build/lib/jquery-ui.js" ],
"build/lib/loglevel.js" : [ "build/lib/loglevel.js" ],
"build/lib/signals.js" : [ "build/lib/signals.js" ]
}
}
},
yuidoc : {
compile : {
name : "realXtend WebTundra SDK",
description : "<%= pkg.description %>",
version : "<%= pkg.version %>",
url : "<%= pkg.homepage %>",
logo : "assets/img/realxtend_logo-doc-header.png",
options : {
paths : "src/",
exclude : "src/application/",
outdir : "build/doc",
nocode : true,
linkNatives : true,
attributesEmit : false,
selleck : false,
tabtospace : 4
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-contrib-yuidoc");
grunt.loadNpmTasks("grunt-contrib-requirejs");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-closure-tools");
grunt.registerTask("doc", "", [
"clean:doc",
"yuidoc",
"copy:docassets"
]);
grunt.registerTask("build", "", [
"clean:dest",
"clean:src",
"copy:sources",
"clean:unwanted",
"requirejs",
"clean:build",
"uglify:deps"
]);
grunt.registerTask("all", "", function() {
grunt.task.run([
"build",
"doc",
"compress:build"
]);
});
grunt.registerTask("default", ["all"]);
};
Oops, something went wrong.

0 comments on commit d1739e8

Please sign in to comment.