blackberry/GamePlay — pull request #688 by sgrenier (2013-01-15 23:49:24+00:00)
Title: Terrain support and other minor features and fixes

Terrain support:
- Added Terrain class for rendering heightmap based terrains. Features include LOD support, multiple surface layers (texture splatting), programatic creation or from PNG or RAW8/RAW16 files, full transform support (including scale), physics, patch visibility culling, vertical skirts for fixing cracks and more.
- Added a object-space normal map generation to gameplay-encoder, which is useful for generating terrain normal maps. This option can generate normal maps from PNG, RAW8 and RAW16 heightmap images.

Scene changes:
- Added support for defining terrains in .scene files, both inline and through external references.
- Added support for setting a light color and light direction on scene. This can be used to bind directional light information for simple lit scenes that have at least one main directional light source (i.e. the Sun).
- Added material auto binding support for SCENE_AMBIENT_COLOR, SCENE_LIGHT_COLOR and SCENE_LIGHT_DIRECTION.
- Added support for defining inline camera's in .scene files.
- Added support for defining .scene files without a 'path' (GPB/bundle) file. New nodes can now be created in the .scene file if an ID is used that does not exist in the bundle. This changes scene loading behavior so that it is no longer an error when a node is found that does not exist in the bundle. Instead, a new empty node is created when this occurs.
- Added static Scene::getScene(const char*) to query currently active scenes in a game.
- Change to allow multiple translate, rotate and scale commands in a single node entity within .scene files. The commands are applied in the order that they are declared.

Misc changes:
- Added support for setting the depth compare function on materials.
- Added support for texture/sampler arrays being passed to materials.
- Added support for loading uncompressed DDS textures for the following formats: R8G8B8, A8R8G8B8, A8B8G8R8, X8R8G8B8, X8B8G8R8
- Added methods to PhysicsCollisionObject to allow conversion to subclass types (i.e. PhysicsRigidBody, PhysicsCharacter, etc) from script.
- Added glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST) to prefer higher quality mipmap generation.
- Added support for preprocessor directive NO_LUA_BINDINGS in the gameplay project to omit inclusion of generated lua bindings in compilation. This does not disable the LUA runtime, but simply prevents all generated lua bindings from being compiled into gameplay. This is mainly a development feature to speed up compile time when making frequent changes to gameplay header files (which otherwise would result in a recompile of all lua bindings). In order for this to work you also need to remove all lua_ files from your project.
- Changed default texture minification mode from GL_LINEAR_MIPMAP_LINEAR to GL_NEAREST_MIPMAP_LINEAR for newly created textures with mipmaps, since this is the expected OpenGL default value.
- Updated Lua generator to only write generated files if they differ from existing files. This will reduce both build times and committing of unchanged script binding files.
- Fixed some minor memory leaks and possible access violations when calling Game::exit() from script.
- Fixed typo in PhysicsRigidBody::Parameters constructor initializer that caused restitution to not get initialized properly, which could lead to erratic behavior for the rigid body.
- Fixed an issue where physics debug drawing for large scenes would cause the internal MeshBatch to grow to an enormous size, using large amounts of memory.