The Cube Port is based on the content and code available from Cube “Final” (August 2005) at http://sourceforge.net/project/showfiles.php?group_id=91993
Download iphone Cube source v1.6 - 300Kb Note: This only includes the source code
The code is provided as-is with no warranty.
Please feel free to Contact us if you wish to discuss commercial support.
Some detail about the source changes can be found on the Cube page, and so far as possible source changes are marked with:
// RbrtPntn - ...
The code that interfaces the Cube C++ to the interface Objective-C is held in “iphone.m” and “iphone.h”. Within the header are a few useful #defines - in particular all iphone specific code is surrounded by:
and in theory (and for initial testing) the code can be built as a desktop application by undefining this (note: you'll have to provide the original ”.jpg” files as a desktop application won't be able to decompress the pvrtc data).
SDL in terms of keyboard/mouse/window interfacing was replaced by Objective-C.
SDL_image was redundant as CoreImage loads images quite nicely, and we have custom loading code for our ”.pmt” files.
SDL_mixer was replaced by a version of Apple's SoundEngine code as found in their CrashLanding sample code. The SoundEngine code was enhanced to give multiple channels for effects.
SDL_thread was replaced by basic pthread equivalents.
Lurking threading bugs resulted in this code being replaced by a backport of some Sauerbraten code.
Geometry is batched by texture and texture axis to minimise state change. Generates triangle soup (Note: potential memory overflow bugs here). Texture coordinates are generated by passing in the vertices as texture coordinates and setting up an appropriate textxure matrix so as to do emulate glTexGen - this simplifies much of the code and reduces the work load on the CPU.
Optimise the vertices upon loading, and cache as much as possible in VBOs. Frame interpolation is disabled if models are too far away and it instead uses the nearest frame.