As mentioned above, the file index.c is quite interesting, for several reasons: first, as this file includes all others Raydium
's files, you can have an overview of the whole project, just by looking at this.
It can also be used as a "quick help", since all variables are declared here, and not in the corresponding files. I mean, for example, that "raydium_light_intensity...?" will be declared in index.c, not in light.c . There's many reasons for using such "style", but you must only retain that it is simpler for you :)
Ok, after this little disclaimer, we can have a look to the first part of our file.
After usual #include (nothing interesting here), we find some #defines.
1. generic limits
The first #define block determine limits of your application, and here you are the actual values for basic defines:
#define RAYDIUM_MAX_VERTICES 500000
#define RAYDIUM_MAX_TEXTURES 256
#define RAYDIUM_MAX_LIGHTS 8
#define RAYDIUM_MAX_NAME_LEN 255
#define RAYDIUM_MAX_OBJECTS 1024
- As you may expect, MAX_VERTICES defines the amount of memory you'll waste with vertex tables. These tables will contain all loaded objects, then remember each time you draw something (object), Raydium loads it (if not already done). Currently, there is no "delete" mechanism implemented (except by deleting all objects). Let me give you a scale: with an Athlon XP1900+, GeForce 3, actual Raydium devel. version 0.31, with around 100 000 vertices, losts of options (sky, blending, 2 lights, 15 textures, ...), Raydium renders ~ 45 FPS. Beyond this, a very correct object uses less than 10 000 vertices. So 500 000 vertices, the actual default, is quite large. It's also important to talk about memory: Linux is very efficient on this point, and allocates only "really used" memory. Under Linux, with the above scene, Raydium used about 20 MB (data only), instead of "much more" (~ 5x). I haven't made any test about this under Windows, but we can expect worse results.
- There's nothing really important to say about MAX_TEXTURES, since that doesn't influence the amount of memory used. You are not limited to 8 bits values, but 256 seems very comfortable (and you must pay attention to the capacities of your 3D hardware !)
- The next define, MAX_LIGHTS is very important: OpenGL, for now (version 1.3 and lower), impose 8 lights at least, and all current hardware doesn't manage more. If this situation is likely to evolve, we will move this #define to a variable, and will ask hardware for its capacities at initialization, but, for the moment, do not exceed 8.
- Next, NAME_LEN, limits the maximum length of strings (textures and objects names) used by Raydium. Default value should be perfect. (avoid higher values, since it could slow down name searches)
- MAX_OBJECTS use the same mechanism as MAX_TEXTURES, and addition with the fact that hardware is not concerned, it can be ignored.
2. options and parameters
This is the next part of our #define section, I will not explain these constants here, but in respective sections, so you'll have just you to remember they're declared here.
Return to RaydiumApiReference