Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'develop' into NoComplyTempTest

  • Loading branch information...
commit ef1b2bcd68c760f10111670b895983444f9044f8 2 parents ae1f5fb + 4bc81ac
@dmose authored
View
39 README.md
@@ -1,33 +1,42 @@
-# Gladius
+Gladius
+=======
-Gladius is a game engine, written entirely in JavaScript, and designed to run in the browser. We leverage existing web technologies whenever possible and where gaps exist in support for games, we develop new solutions.
+* [FAQ](https://github.com/gladiusjs/gladius-core/wiki/Faq)
+* [IRC](irc://irc.mozilla.org/#games)
+* [Mailing List](https://lists.mozilla.org/listinfo/community-games)
-## Version
+# Gladius is a 3D game engine
-Gladius follows the Semantic Versioning Specification. See http://semver.org for full details.
+Gladius is a 3D game engine, written entirely in JavaScript, and designed to run in the browser. We leverage existing web technologies whenever possible and where gaps exist in support for games, we develop new solutions.
-## Reporting Issues
+The engine consists of a core set of functionality that is common to all games and simulations like the game loop, messaging, tasks and timers. Common components like the spatial transform are also provided by the core. More specialized funcionality, like graphics or physics, is encapsulated into engine extensions that are designed to run on top of the core. A common set of extensions is maintained as part of this project, and support for third-party extensions is a strong design objective.
-Please report issues through the github project. Questions and discussions happen in #games on irc.mozilla.org, and on the paladin-dev mailing list at https://groups.google.com/group/paladin-dev.
+An engine instance is comprised of the engine core plus a set of extensions.
-## Getting Started
+# Related projects
-Make sure to clone all submodules. This can be done using 'make submodule'.
+We are also building a set of tools and libraries for building games. They are designed to be generally useful and reusable in other projects as well.
+
+<b>Check out our [roadmap](https://github.com/gladiusjs/gladius-core/wiki/Roadmap) for more details.<b>
+
+# Getting Started
+
+Make sure to clone using `--recursive` or run `make submodule` in the project directory after cloning.
## Build and Test
-No building is needed for development workflows. To build the engine for distribution, run make in the top-level
+No building is needed for development workflows.
+
+To build the engine for distribution, run make in the top-level
project directory. The build process produces a javascript file containing the entire engine and its dependencies
and also a minified version of that file.
Run unit tests by opening test/ directory in a web browser. Tests run automatically and failures are marked in red.
-## Examples and Help
-
-## Contributing
+## Examples and tutorial
-See https://wiki.mozilla.org/Paladin/Workflow for details about git workflow, testing, and code reviews.
+A short tutorial is provided [here](https://github.com/gladiusjs/gladius-core/wiki/Tutorial). Examples are available from the top-level project directory.
-## License
+# License
-See LICENSE for more information.
+See [LICENSE](https://github.com/gladiusjs/gladius-core/blob/develop/LICENSE) for more information.
View
112 example/collada/collada.js
@@ -1,62 +1,62 @@
document.addEventListener("DOMContentLoaded", function (e) {
var canvas = document.getElementById("test-canvas");
- var resources = {};
var game = function (engine) {
- var space = new engine.core.Space();
- var math = engine.math;
+ var space = new engine.core.Space();
+ var math = engine.math;
- function colladaLoader(url, onsuccess, onfailure) {
- // XXX figure out why this is necessary
- window.CubicVR = engine.graphics.target.context;
+ // This is our loader function, which currently uses CubicVR's collada
+ // loader. The loader has not yet been factored into its own library, so
+ // this is still necessary.
+ function colladaLoader(url, onsuccess, onfailure) {
+ // This is a hack to make CubicVR available to the resource
+ window.CubicVR = engine.graphics.target.context;
- try {
- var context = engine.graphics.target.context;
-
- // This needs wrapping.
- var scene = context.loadCollada(url, "model");
- onsuccess(scene);
- } catch (e) {
- onfailure(e);
- }
- }
-
- //
- var CubicVR = engine.graphics.target.context;
- CubicVR.setGlobalAmbient([1, 1, 1]);
+ // CubicVR wants the directory where the dae file resides.
+ var dir = url.match(/.*\//i);
- //
- var run = function () {
+ try {
+ var context = engine.graphics.target.context;
+ var scene = context.loadCollada(url, dir);
+ onsuccess(scene);
+ }
+ catch (e) {
+ onfailure(e);
+ }
+ }
- canvas = engine.graphics.target.element;
+ var run = function () {
- var camera = new space.Entity({
- name: 'camera',
- components: [
- new engine.core.component.Transform({
- position: math.Vector3(3, 3, 3)
- }), new engine.graphics.component.Camera({
- active: true,
- width: canvas.width,
- height: canvas.height,
- fov: 60
- })]
- });
- camera.find('Camera').target = math.Vector3(0, 0, 0);
+ var task = new engine.scheduler.Task({
+ schedule: {
+ phase: engine.scheduler.phases.UPDATE
+ },
+ callback: function () {}
+ });
- var task = new engine.scheduler.Task({
- schedule: {
- phase: engine.scheduler.phases.UPDATE
- },
- callback: function () {}
- });
+ canvas = engine.graphics.target.element;
- // Start the engine!
- engine.run();
- };
+ var camera = new space.Entity({
+ name: 'camera',
+ components: [
+ new engine.core.component.Transform({
+ position: math.Vector3(3, 3, 3)
+ }), new engine.graphics.component.Camera({
+ active: true,
+ width: canvas.width,
+ height: canvas.height,
+ fov: 60
+ })]
+ });
+ camera.find('Camera').target = math.Vector3(0, 0, 0);
- engine.core.resource.get([{
+ // Start the engine!
+ engine.run();
+ };
+
+ engine.core.resource.get(
+ [{
type: engine.core.resource.Collada,
url: "model/cube.dae",
load: colladaLoader,
@@ -69,20 +69,24 @@ document.addEventListener("DOMContentLoaded", function (e) {
rotation: instance.rotations[0],
scale: instance.scales[0]
}),
-
new engine.graphics.component.Model(
- instance.meshes[0]),
+ instance.meshes[0])
]
- })// entity
+ });
},
onfailure: function (error) {
console.log("error loading collada resource: " + error);
}
- }],{
+ }],
+ {
+ // This will run the example once get() has finished loading our
oncomplete: run
- });
- };
-
+ }
+ );
+ };
+
+ // Here we create a gladius instance asynchronously. The supplied callback,
+ // game, is invoked when the instance is ready to use.
gladius.create({
debug: true,
services: {
@@ -94,5 +98,5 @@ document.addEventListener("DOMContentLoaded", function (e) {
}
}
}, game);
-
+
});
View
26 example/collada/index.html
@@ -3,9 +3,33 @@
<head>
<script src="../../src/gladius.js"></script>
<script src="collada.js"></script>
+ <title>Collada Example (experimental)</title>
</head>
<body>
- <canvas id="test-canvas" width="500" height="500"></canvas>
+ <canvas style="float: left; margin: 10px;"
+ id="test-canvas" width="500" height="500">
+ </canvas>
+
+ <h2>
+ <font color="red"><b>EXPERIMENTAL</b></font>
+ </h2>
+ <p>
+ This is a partial demonstration of how to create a custom loader for a
+ new resource type, in this case a model from a collada file. Note that
+ the collada resource type is currently implemented in the engine core.
+ </p>
+ <p>
+ A complete implementation would provide access to raw meshes and
+ materials rather than creating new entities, and would generate entity
+ templates, which the engine does not yet support. Finally, the loader
+ itself is intended to be generic enough to load resources for arbitrary
+ rendering backends.
+ </p>
+ <p>
+ Once the implementation is unit tested and no longer experimental,
+ the collada resource and loader will be fully supported as part of the
+ engine core.
+ </p>
</body>
<div id="out"></div>
</html>
View
8 example/collision-cubes/index.html
@@ -6,10 +6,14 @@
<script src="collision-cubes.js"></script>
</head>
<body>
+ <canvas style="float: left; margin: 10px"
+ id="test-canvas" width="500" height="500">
+ </canvas>
+
+ <p>
Move the cube around with W, A, S, D. Rotate the cube with Q and E.
Try moving your cube into the other one!
- <P>
- <canvas id="test-canvas" width="500" height="500"></canvas>
+ </p>
<div id="out"></div>
</body>
</html>
View
3  example/cube/index.html
@@ -6,7 +6,8 @@
<title>Gladius Cube Example</title>
</head>
<body>
- <canvas style="float: left;" id="test-canvas" width="500" height="500">
+ <canvas style="float: left; margin: 10px"
+ id="test-canvas" width="500" height="500">
</canvas>
<p>
View
4 example/sprites/index.html
@@ -12,7 +12,9 @@
<title>Gladius/Sprite-Viking-Blitr Example</title>
</head>
<body>
- <canvas style="float: left;" id="test-canvas" width="500" height="500"></canvas>
+ <canvas style="float: left; margin: 10px;"
+ id="test-canvas" width="500" height="500">
+ </canvas>
<p>
This example shows how to extend Gladius to create animated models
Please sign in to comment.
Something went wrong with that request. Please try again.