2016-06-16 14:08:09 +02:00
|
|
|
namespace rw {
|
|
|
|
|
2016-07-05 11:36:43 +02:00
|
|
|
enum RenderState
|
|
|
|
{
|
|
|
|
VERTEXALPHA = 0,
|
|
|
|
SRCBLEND,
|
|
|
|
DESTBLEND,
|
|
|
|
ZTESTENABLE,
|
|
|
|
ZWRITEENABLE,
|
|
|
|
// TODO:
|
|
|
|
// fog enable, color, type, density
|
|
|
|
// ? cullmode
|
|
|
|
// ? shademode
|
|
|
|
// ???? stencil
|
|
|
|
|
|
|
|
// platform specific or opaque?
|
|
|
|
ALPHATESTFUNC,
|
|
|
|
ALPHATESTREF,
|
|
|
|
ZTESTFUNC,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum AlphaTestFunc
|
|
|
|
{
|
|
|
|
ALPHANEVER = 0,
|
|
|
|
ALPHALESS,
|
|
|
|
ALPHAGREATERTHAN
|
|
|
|
};
|
|
|
|
|
|
|
|
enum BlendFunction
|
|
|
|
{
|
|
|
|
BLENDZERO = 0,
|
|
|
|
BLENDONE,
|
|
|
|
BLENDSRCCOLOR,
|
|
|
|
BLENDINVSRCCOLOR,
|
|
|
|
BLENDSRCALPHA,
|
|
|
|
BLENDINVSRCALPHA,
|
|
|
|
BLENDDESTALPHA,
|
|
|
|
BLENDINVDESTALPHA,
|
|
|
|
BLENDDESTCOLOR,
|
|
|
|
BLENDINVDESTCOLOR,
|
|
|
|
BLENDSRCALPHASAT,
|
|
|
|
// TODO: add more perhaps
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ZTestFunc
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2016-06-27 21:59:35 +02:00
|
|
|
// This is for platform independent things
|
2016-06-21 23:16:09 +02:00
|
|
|
// TODO: move more stuff into this
|
2016-06-16 14:08:09 +02:00
|
|
|
struct Engine
|
2016-06-21 23:16:09 +02:00
|
|
|
{
|
2016-06-23 16:39:34 +02:00
|
|
|
void *currentCamera;
|
|
|
|
void *currentWorld;
|
2016-06-21 23:16:09 +02:00
|
|
|
|
2016-06-25 17:58:52 +02:00
|
|
|
static void init(void);
|
|
|
|
};
|
2016-06-21 23:16:09 +02:00
|
|
|
|
2016-06-25 17:58:52 +02:00
|
|
|
extern Engine *engine;
|
2016-06-21 23:16:09 +02:00
|
|
|
|
2016-06-27 21:59:35 +02:00
|
|
|
// This is for platform driver implementations
|
2016-06-21 23:16:09 +02:00
|
|
|
struct Driver
|
2016-06-16 14:08:09 +02:00
|
|
|
{
|
|
|
|
ObjPipeline *defaultPipeline;
|
|
|
|
int32 rasterNativeOffset;
|
|
|
|
|
2016-06-21 23:16:09 +02:00
|
|
|
void (*beginUpdate)(Camera*);
|
|
|
|
void (*endUpdate)(Camera*);
|
|
|
|
|
2016-07-05 11:36:43 +02:00
|
|
|
void (*setRenderState)(int32 state, uint32 value);
|
|
|
|
uint32 (*getRenderState)(int32 state);
|
|
|
|
|
2016-06-16 14:08:09 +02:00
|
|
|
void (*rasterCreate)(Raster*);
|
|
|
|
uint8 *(*rasterLock)(Raster*, int32 level);
|
|
|
|
void (*rasterUnlock)(Raster*, int32 level);
|
|
|
|
int32 (*rasterNumLevels)(Raster*);
|
|
|
|
void (*rasterFromImage)(Raster*, Image*);
|
2016-06-27 21:59:35 +02:00
|
|
|
|
|
|
|
static PluginList s_plglist[NUM_PLATFORMS];
|
|
|
|
static void open(void);
|
2016-06-29 12:53:02 +02:00
|
|
|
static int32 registerPlugin(int32 platform, int32 size, uint32 id,
|
2016-06-27 21:59:35 +02:00
|
|
|
Constructor ctor, Destructor dtor){
|
|
|
|
return s_plglist[platform].registerPlugin(size, id,
|
|
|
|
ctor, dtor, nil);
|
|
|
|
}
|
2016-06-16 14:08:09 +02:00
|
|
|
};
|
|
|
|
|
2016-06-27 21:59:35 +02:00
|
|
|
extern Driver *driver[NUM_PLATFORMS];
|
2016-06-21 23:16:09 +02:00
|
|
|
#define DRIVER driver[rw::platform]
|
2016-06-16 14:08:09 +02:00
|
|
|
|
2016-07-05 11:36:43 +02:00
|
|
|
inline void setRenderState(int32 state, uint32 value){
|
|
|
|
DRIVER->setRenderState(state, value); }
|
|
|
|
|
|
|
|
inline uint32 getRenderState(int32 state){
|
|
|
|
return DRIVER->getRenderState(state); }
|
|
|
|
|
2016-06-16 14:08:09 +02:00
|
|
|
namespace null {
|
2016-06-21 23:16:09 +02:00
|
|
|
void beginUpdate(Camera*);
|
|
|
|
void endUpdate(Camera*);
|
|
|
|
|
2016-07-05 11:36:43 +02:00
|
|
|
void setRenderState(int32 state, uint32 value);
|
|
|
|
uint32 getRenderState(int32 state);
|
|
|
|
|
2016-06-16 14:08:09 +02:00
|
|
|
void rasterCreate(Raster*);
|
|
|
|
uint8 *rasterLock(Raster*, int32 level);
|
|
|
|
void rasterUnlock(Raster*, int32 level);
|
|
|
|
int32 rasterNumLevels(Raster*);
|
|
|
|
void rasterFromImage(Raster*, Image*);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|