QUARK3D for ARM.

Presentation:

Quark3D is a 3D graphic library for ARM based machines. It currently support palm, pocket pc, smartphone, and symbian (ngage/serie 60).

3D features:

- Textured / Untextured modes.
- Perspective correction.
- Z buffer.
- Gouraud shading.
- Wireframe.
- Immediate draw with separate triangles or using triangle list.
- 2D: Sprite, billboard, lines, pixels, text.
- Alpha transparency (fixed 50% (source) / 50% (background)).
- Alpha keyed color. (binary transparency).
- Include fast fixed point math library for matrix, vector normalize, cross product.
- Use OpenGL type 3D axis. (direct orient, +x on righ, +y on top, +z back)
- 15 tutorials.
- Full code of library and tools in registered version. (use ARM GCC)

Palm / armlet enhancements:

- Full code run in ARM mode, including keyboard and pen access, return to 68k mode is done only for OS events.
- Standard c++ code can be used for applications, no OS specific functions are required.
- Global variables allowed.
- No limitations in code size. (except machine memory)
- No limitations in files size (except machine memory)
- Standard c functions to access files, with fopen/fread and path.
    Files are compressed using advanced compression method.
- Standard c functions to alloc memory, with malloc/realloc/free.
- Automatic save of configuration datas.

Symbian:

- A loader is used to import GCC ARM code and datas. The entire 3D application can be written with GCC. This solve problems of global variables that are not supported with symbian compiler. The loader automatically alloc memory requested for GCC arm code + datas and must not be recompiled if GCC code is changed. (only the sis file need to be rebuilt to test on target machine)

WinCE:

- 3D applications can be compiled with embedded visual studio (project file included) or with GCC. The GCC version is more fast for triangle drawing (about 10%).

Use of GCC for all target machines allow to maintain only one project file for all machines. Only one header file must be modifyed to specify the target.

Tools:

 - pak.exe:
Compact a directory content, including subdirectory. The result file is used as package for file access in ARM code (read only) .The base of directory is used as root ('/') for file access into ARM code.

- recsplit.exe: (required only for palm)
Used to split files in blocks < 64k. This allow to export files > 64 into final prc. (max size of records with palmOS must be < 64k). The subfiles are batched at program start.

- Emullet.exe & EmullerCheck.exe:
This is an ARM cpu emulator. It allow to test ARM programs without the need to build installable file for target and upload it. Allow too to make some checks on ARM code (memory access aligned and address range). Display error message if a problem occur (instead of a palm reset or program exit). Works only with GCC compiled code. (not with pure embedded visual c++)

However, this emulator is slow and not able to emulate a palm at full speed. (about 40mhz ARM on a duron 1.2ghz), then there are 2 versions.
  Emullet.exe is the fastest one, but do not check address range and alignment of accessed datas.
  EmulletCheck.exe do access checks but is more slow. (can be used if error occur using Emullet.exe or on fast machines)

Emullet.exe use by default the final linked arm file 'armlet.raw', and 'data.pak' data file (optional) if the command line is empty. If not empty, other files can be used (1 or 2 files required: first = raw, second = pak). The program can detect target machine and adapt specific parameters (screen size, requested memory, screen color format)

3D tools:

- AseToMsh.exe:
Allow to import geometry datas from 3DSMAX. (textured/not textured mesh with or without vertex color)
AseToMsh.exe require an ASE format geometry file (text) that can be produced with 3DSMAX using 'export' option.
The program import a scene and create a mesh file (.msh) for each mesh found in scene.

-MstToMtx.exe:
Produce a simple geometry text file that can be used to include some geometry data into code.
MstToMtx.exe require a .msh file in input (binary) and produce a .mtx file (text)

Limitations:

On GCC code only.

- Base C++ allowed: - no constructors/destructors, 'new' and 'delete' not available.
  heriting and virtual not tested.
- Strings: Initialized arrays of strings pointers must be accessed via a macro (that adjust address). It is not required for other strings.

  ex: const char *StrArray[3] = { "Text0", "Text1", "Text2" };
  ex: const char *String = "Hello";  (1 element)

must be accessed unsing 'PICSTR' macro.
  ex: const char *Str = PICSTR(StrArray[2]);

- File access: - Access for read only. fopen("File.bin", "wb"); will fail.
- Access to files with absolute path required. (path like ../../Data will fail)
- Memory: 
      - total heap memory size available for malloc/realloc must be defined at program start and cannot be adjusted later. (then user must init alloc with the maximum size that the program will require)

library:

- only a subset of <stdlib.h>, <string.h>, <stdio.h> functions are available.

Available functions are:
malloc
realloc
free
memset
memcpy
memmove
strlen
strcpy
strcat
itoa
qsort
rand
fopen
fclose
_fcloseall
fseek
ftell

Other functions that may be required can be easily added by user.

Requirements:

- Palm machine with ARM cpu and PalmOS version >= 5.0
- Pocket pc with ARM cpu.
- Smartphone with ARM cpu.
- Symbian phone serie 60 (ex: ngage)
- Color screen with 65k colors in RGB565 format (R hight bits, Blue low bits) or 4096colors in RGB444.
- more than 450kb of available memory  for a 320*320 screen. more than 200k for a 176*220 screen (required for Quark3d alone (code + frame buffer + z buffer + working datas)), then must be added user application code + data and size of user application files.

Compilers:

GCC can be used for all versions. In not palm machine, GCC code is used as a palm armlet.

Embedded visual studio can be used to compile full WinCE versions. (ppc and smartphone only)

Symbian compiler must be used to recompile symbian armlet loader.

For GCC, Cygwin and prc-tools (including arm tools) can be dowloaded at. (http://www.palmos.com/dev/tools/gcc/)

A small version of palm sdk, including ARM tools can be downloaded here (13mb).

Visual studio required to compile x86 windows version (used to develop/debug)  and tools.

Directory and files:

The registered version contain followin directory:

Armlet:  Contain main armlet entry source code and makefile for GCC. produce armlet.o (object) that is copyed into ../Lib directory.

AseToMsk : Contain AseToMsh tool source code and project file for visual studio.

Data : contain datas for tutorials (mesh, textures). This directory is used to create a Data.pak file with pak.exe program, that is a compressed image of directory content, including subdirectory. This pak file can be used in ARM code to access some files using fopen/fread.

Demos: contain actually 16 tutorials to show use of library + makefile for GCC.

Emullet: contain ARM emulator source code and project file for visual studio.

Lib: contain ARM library used to compile a 3d application. Contain Armlet.o (entry code) Libutil.l (stdlib replacement) and Quark3d.l (3D library). These library are used to produce a 3D application. They can be built using makefiles in /Armlet /Libutil /VGpu directory.

LibUtil: contain ARM souce code used to replace stdlib (malloc/fopen, etc..) and makefile for GCC. Produce libutil.l that is copyed into ../Lib directory

MDemos : contain source code of demo showing all tutorials and makefile for GCC.

MshToMtx: Contain MshToMtx tool source code and project file for visual studio.

Packer: Contain Pak tool source code and project file for visual studio, contain too zzlib library (a data compression library that is in GPL)

Packer: Contain source of tool used to a split file to records < 64k (palm specific) + project file for visual studio

Symbian: Contain symbian Quark3d sources and project files (GCC code loader)

VGpu: Contain main Quark3D ARM source code with makefile for GCC.

Web: Contain this web page + datas + compiled demos.

Win: Contain Quark3d application for visual stutio and project file. Code use same call structure that palm version and allow to develop/debug applications with visual. Then when application works under windows, it can be compiled/tested on palm without code changes.

WinCE: Contain version for pocket pc compiled with GCC. The GCC code is used as a palm armlet. Contain Embedded visual studio project file for an armlet loader.

WinCEs : Contain Embedded visual studio project file to compile all with visual studio (GCC not used).

Files:

Emullet.exe : compiled ARM emulator.
EmulletCheck.exe : compiled ARM emulator that check memory access (more slow than Emullet.exe)
Pak.exe : compiled directory compression tool.
RecSplit : compiled RecSplit tool

Defines.h : main define.h file, allow to select parameters for target machine and program to compile.

PalmMain.c : main palm OS code. (68k)

Licence.txt : licence file

Makefile: makefile for palm target.

BuildAll.bat: Batch to rebuild all GCC sources. Call makefiles in Armlet/Libutil/VGpu, updates all library in Lib directory. Must be used if defines.h file modifyed. Currently build also the full demo for palm. (prc).

DefDataPak.bat: call Pak utility with options to create pak image of /Data directory (used in demo)

Downloads:

Palm demos:

  - For a 320*320 screen .
  - For a 160*160 screen .

PPC demo:

 - ppc 2003 or more .

Smartphone:

 - For a 176*220 screen

Symbian: (ngage or serie60)

- For a 176*208 screen

SDK:

Small Cygwin SDK including ARM tools: (13mb)

Dev evaluation version:

A evaluation version, that allow to compile is available here. (700kb)

It include a simple HelloWorld, and source code of demos.

Limitations of this version are:
  - Support only for palm and pocket pc.
  - Max available memory for malloc/realloc is fixed to 256kb.
  - Licence for personnal use or freeware.

Notes:

- Actually Quark3D  have been tested actually only on few machines. Please report me if it works (or not) on your machine, then I will create a list of compatible models, or make some changes to support all models.

- The PPC demo contain 2 executables, QuarkCE.exe is compiled with GCC (QuarkGCC icon), and QuarkCEv is compiled with embedded visual studio (Quark Icon). It allow to compare speed of 2 versions. GCC version is more fast to draw triangles, and embedded visual studio is more fast for line/pixel/sprite drawing.

The registered version of Quark3d can be downloaded at www.palmgear.com .This version contain all sources, project files, tools + datas, and licence for commercial applications.

Souces of demos can be downloade here .

More informations about API can be found here (old version for ppc only). Note that several simplifications have been done in this new version. Raster states have been removed, plus some minor changes.

contatc: pierrel5@free.fr