Skip to content

Commit

Permalink
Merge remote-tracking branch 'ack/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
David Perit committed Jun 4, 2012
2 parents b24e46d + 0d748fa commit 17b4896
Show file tree
Hide file tree
Showing 261 changed files with 18,042 additions and 106 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules/jake
node_modules/.bin/jake
13 changes: 13 additions & 0 deletions Jakefile
@@ -0,0 +1,13 @@
var PATH = process.env["PATH"].split( ':' );
var MODULES_BIN = process.cwd() + "/node_modules/.bin";
PATH.unshift( MODULES_BIN );
PATH = PATH.join( ':' );

process.env["PATH"] = PATH;

var jake = require( "jake" );

task( "default", [], require( "./tools/jake-tasks/default" ) );

desc( "start web server in project directory" );
task( "serve", [], require( "./tools/jake-tasks/serve" ) );
12 changes: 12 additions & 0 deletions LICENSE
@@ -0,0 +1,12 @@
Copyright (c) 2011, Mozilla Foundation
Copyright (c) 2011, Alan Kligman
Copyright (c) 2011, Robert Richter
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the Mozilla Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
107 changes: 107 additions & 0 deletions README.md
@@ -0,0 +1,107 @@
Gladius
=======

* [FAQ](https://github.com/gladiusjs/gladius-core/wiki/Faq)
* [IRC](irc://irc.mozilla.org/#games)
* [Mailing List](https://lists.mozilla.org/listinfo/community-games)
* [Twitter](https://twitter.com/#!/gladiusjs)
* [Contributors](https://github.com/gladiusjs/gladius-core/contributors)
* [Blog](http://blog.ottodestrukt.org) -- I usually blog about Gladius here

# Gladius is a 3D game engine

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.

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.

An engine instance is comprised of the engine core plus a set of extensions.

# Related projects

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

Start by cloning the repository or downloading a zipped version from github.
Inside the project directory you'll find pre-built versions of the following modules:

* gladius-core: the engine core; you'll definitely need to load this
* gladius-cubicvr: CubicVR rendering backend

We tested the examples with these module versions.
If you build your own modules, the examples might still work, but they also might not.
We're working on more modules to add support for user input, 2d and 3d physics, and additional 2d and 3d backends.

### Using requirejs

You can load these modules using requirejs:

````javascript
var Gladius = require( "gladius-core" );
var engine = new Gladius();
````

Check out the examples to see how this is done.

### Using a script tag

You can also load Gladius using a script tag:

````HTML
<script src="gladius-core.js"></script>
<script>
var engine = new Gladius();
</script>
````

If you load Gladius with a script tag you'll find a global engine constructor named Gladius.
Loading extensions this way will add them as properties on the global Gladius object.
For example:

````HTML
<script src="gladius-core.js"></script>
<script src="gladius-cubicvr.js"></script>
<script>
Gladius; // global engine constructor
Gladius["gladius-cubicvr"]; // gladius-cubicvr extension you loaded
</script>
````

## Examples

Check out the `examples` in the top-level project directory.
You will need a web server that can serve files from the project directory.
Follow these instructions if you would like to use the server that comes with Gladius.

1. Make sure you have a recent version of `node` installed (>=0.6). See [here](http://nodejs.org/) for details on how to do this for your platform.
2. Install `jake` globally.

npm install -g jake

3. Run the web server.

jake serve

4. Go to the following URL in your browser to view the examples. Be sure to use a recent version of Firefox or Chrome.

http://localhost:8080/examples

# Contributing

This repository contains only the compiled modules that you need to start using Gladius.
If you're interested in contributing to the core or other modules, you can find project repositories here:

* [gladius-core](https://github.com/gladiusjs/gladius-core)
* [gladius-cubicvr](https://github.com/gladiusjs/gladius-cubicvr)
* [gladius-box2d](https://github.com/gladiusjs/gladius-box2d)
* [gladius-input](https://github.com/gladiusjs/gladius-input)

We would also love to work with anyone interested in writing great examples or documentation.

# License and Notes

See [LICENSE](https://github.com/gladiusjs/gladius/blob/develop/LICENSE) for more information.

All our logos are handmade by [Sean Martell](https://twitter.com/#!/mart3ll).
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions examples/camera-rotate/camera-rotate.js
Expand Up @@ -36,7 +36,7 @@ document.addEventListener( "DOMContentLoaded", function( e ) {
[
{
type: engine["gladius-cubicvr"].Mesh,
url: 'procedural-mesh.js',
url: '../assets/procedural-mesh.js',
load: engine.loaders.procedural,
onsuccess: function( mesh ) {
resources.mesh = mesh;
Expand All @@ -46,7 +46,7 @@ document.addEventListener( "DOMContentLoaded", function( e ) {
},
{
type: engine["gladius-cubicvr"].MaterialDefinition,
url: 'procedural-material.js',
url: '../assets/procedural-material.js',
load: engine.loaders.procedural,
onsuccess: function( material ) {
resources.material = material;
Expand Down
99 changes: 44 additions & 55 deletions examples/cube/cube.js
@@ -1,66 +1,55 @@
document.addEventListener( "DOMContentLoaded", function( e ) {

require.config({
baseUrl: "../.."
var engine = new Gladius();

// Engine monitor setup
function monitor( engine ) {
debugger;
engine.detach( monitor );
}
document.addEventListener( "keydown", function( event ) {
var code = event.which || event.keyCode;
if( code === 0x4D && event.ctrlKey && event.altKey ) {
engine.attach( monitor );
}
});

require(
[ "gladius-core",
"gladius-cubicvr" ],
function( Gladius, cubicvrExtension ) {

var engine = new Gladius();
var cubicvrOptions = {
renderer: {
canvas: document.getElementById( "test-canvas" )
}
};
engine.registerExtension( Gladius["gladius-cubicvr"], cubicvrOptions );

// Engine monitor setup
function monitor( engine ) {
debugger;
engine.detach( monitor );
}
document.addEventListener( "keydown", function( event ) {
var code = event.which || event.keyCode;
if( code === 0x4D && event.ctrlKey && event.altKey ) {
engine.attach( monitor );
}
});
var resources = {};

var cubicvrOptions = {
renderer: {
canvas: document.getElementById( "test-canvas" )
engine.get(
[
{
type: engine["gladius-cubicvr"].Mesh,
url: '../assets/procedural-mesh.js',
load: engine.loaders.procedural,
onsuccess: function( mesh ) {
resources.mesh = mesh;
},
onfailure: function( error ) {
}
};
engine.registerExtension( cubicvrExtension, cubicvrOptions );

var resources = {};

engine.get(
[
{
type: engine["gladius-cubicvr"].Mesh,
url: 'procedural-mesh.js',
load: engine.loaders.procedural,
onsuccess: function( mesh ) {
resources.mesh = mesh;
},
onfailure: function( error ) {
}
},
{
type: engine["gladius-cubicvr"].MaterialDefinition,
url: 'procedural-material.js',
load: engine.loaders.procedural,
onsuccess: function( material ) {
resources.material = material;
},
onfailure: function( error ) {
}
}
],
{
oncomplete: game.bind( null, engine, resources )
},
{
type: engine["gladius-cubicvr"].MaterialDefinition,
url: '../assets/procedural-material.js',
load: engine.loaders.procedural,
onsuccess: function( material ) {
resources.material = material;
},
onfailure: function( error ) {
}
);

});
}
],
{
oncomplete: game.bind( null, engine, resources )
}
);

function game( engine, resources ) {
var space = new engine.simulation.Space();
Expand Down
3 changes: 2 additions & 1 deletion examples/cube/index.html
@@ -1,7 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../lib/require.js"></script>
<script src="../../gladius-core.js"></script>
<script src="../../gladius-cubicvr.js"></script>
<script src="cube.js"></script>
<title>Gladius Cube Example</title>
</head>
Expand Down
5 changes: 0 additions & 5 deletions examples/cube/procedural-material.js

This file was deleted.

43 changes: 0 additions & 43 deletions examples/cube/procedural-mesh.js

This file was deleted.

12 changes: 12 additions & 0 deletions node_modules/connect/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions node_modules/connect/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions node_modules/connect/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 17b4896

Please sign in to comment.