add getter functions
This commit is contained in:
parent
26dfe69e5f
commit
2009490151
142
src/external/rlsw.h
vendored
142
src/external/rlsw.h
vendored
|
|
@ -87,6 +87,39 @@
|
||||||
#define GL_CULL_FACE 0x0B44
|
#define GL_CULL_FACE 0x0B44
|
||||||
#define GL_BLEND 0x0BE2
|
#define GL_BLEND 0x0BE2
|
||||||
|
|
||||||
|
#define GL_VENDOR 0x1F00
|
||||||
|
#define GL_RENDERER 0x1F01
|
||||||
|
#define GL_VERSION 0x1F02
|
||||||
|
#define GL_EXTENSIONS 0x1F03
|
||||||
|
|
||||||
|
//#define GL_ATTRIB_STACK_DEPTH 0x0BB0
|
||||||
|
//#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
|
||||||
|
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||||
|
//#define GL_COLOR_WRITEMASK 0x0C23
|
||||||
|
//#define GL_CURRENT_INDEX 0x0B01
|
||||||
|
#define GL_CURRENT_COLOR 0x0B00
|
||||||
|
#define GL_CURRENT_NORMAL 0x0B02
|
||||||
|
//#define GL_CURRENT_RASTER_COLOR 0x0B04
|
||||||
|
//#define GL_CURRENT_RASTER_DISTANCE 0x0B09
|
||||||
|
//#define GL_CURRENT_RASTER_INDEX 0x0B05
|
||||||
|
//#define GL_CURRENT_RASTER_POSITION 0x0B07
|
||||||
|
//#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
|
||||||
|
//#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
|
||||||
|
#define GL_CURRENT_TEXTURE_COORDS 0x0B03
|
||||||
|
//#define GL_INDEX_CLEAR_VALUE 0x0C20
|
||||||
|
//#define GL_INDEX_MODE 0x0C30
|
||||||
|
//#define GL_INDEX_WRITEMASK 0x0C21
|
||||||
|
#define GL_MODELVIEW_MATRIX 0x0BA6
|
||||||
|
#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
|
||||||
|
//#define GL_NAME_STACK_DEPTH 0x0D70
|
||||||
|
#define GL_PROJECTION_MATRIX 0x0BA7
|
||||||
|
#define GL_PROJECTION_STACK_DEPTH 0x0BA4
|
||||||
|
//#define GL_RENDER_MODE 0x0C40
|
||||||
|
//#define GL_RGBA_MODE 0x0C31
|
||||||
|
#define GL_TEXTURE_MATRIX 0x0BA8
|
||||||
|
#define GL_TEXTURE_STACK_DEPTH 0x0BA5
|
||||||
|
#define GL_VIEWPORT 0x0BA2
|
||||||
|
|
||||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||||
|
|
||||||
|
|
@ -185,6 +218,24 @@ typedef enum {
|
||||||
SW_BLEND = GL_BLEND
|
SW_BLEND = GL_BLEND
|
||||||
} SWstate;
|
} SWstate;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SW_VENDOR = GL_VENDOR,
|
||||||
|
SW_RENDERER = GL_RENDERER,
|
||||||
|
SW_VERSION = GL_VERSION,
|
||||||
|
SW_EXTENSIONS = GL_EXTENSIONS,
|
||||||
|
SW_COLOR_CLEAR_VALUE = GL_COLOR_CLEAR_VALUE,
|
||||||
|
SW_CURRENT_COLOR = GL_CURRENT_COLOR,
|
||||||
|
SW_CURRENT_NORMAL = GL_CURRENT_NORMAL,
|
||||||
|
SW_CURRENT_TEXTURE_COORDS = GL_CURRENT_TEXTURE_COORDS,
|
||||||
|
SW_MODELVIEW_MATRIX = GL_MODELVIEW_MATRIX,
|
||||||
|
SW_MODELVIEW_STACK_DEPTH = GL_MODELVIEW_STACK_DEPTH,
|
||||||
|
SW_PROJECTION_MATRIX = GL_PROJECTION_MATRIX,
|
||||||
|
SW_PROJECTION_STACK_DEPTH = GL_PROJECTION_STACK_DEPTH,
|
||||||
|
SW_TEXTURE_MATRIX = GL_TEXTURE_MATRIX,
|
||||||
|
SW_TEXTURE_STACK_DEPTH = GL_TEXTURE_STACK_DEPTH,
|
||||||
|
SW_VIEWPORT = GL_VIEWPORT
|
||||||
|
} SWget;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SW_COLOR_BUFFER_BIT = GL_COLOR_BUFFER_BIT,
|
SW_COLOR_BUFFER_BIT = GL_COLOR_BUFFER_BIT,
|
||||||
SW_DEPTH_BUFFER_BIT = GL_DEPTH_BUFFER_BIT
|
SW_DEPTH_BUFFER_BIT = GL_DEPTH_BUFFER_BIT
|
||||||
|
|
@ -291,6 +342,9 @@ bool swResizeFramebuffer(int w, int h);
|
||||||
void swEnable(SWstate state);
|
void swEnable(SWstate state);
|
||||||
void swDisable(SWstate state);
|
void swDisable(SWstate state);
|
||||||
|
|
||||||
|
void swGetFloatv(SWget name, float* v);
|
||||||
|
const char* glGetString(SWget name);
|
||||||
|
|
||||||
void swViewport(int x, int y, int width, int height);
|
void swViewport(int x, int y, int width, int height);
|
||||||
void swScissor(int x, int y, int width, int height);
|
void swScissor(int x, int y, int width, int height);
|
||||||
|
|
||||||
|
|
@ -2824,6 +2878,94 @@ void swDisable(SWstate state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swGetIntegerv(SWget name, int* v)
|
||||||
|
{
|
||||||
|
switch (name) {
|
||||||
|
case SW_MODELVIEW_STACK_DEPTH:
|
||||||
|
*v = SW_MODELVIEW_STACK_DEPTH;
|
||||||
|
break;
|
||||||
|
case SW_PROJECTION_STACK_DEPTH:
|
||||||
|
*v = SW_PROJECTION_STACK_DEPTH;
|
||||||
|
break;
|
||||||
|
case SW_TEXTURE_STACK_DEPTH:
|
||||||
|
*v = SW_TEXTURE_STACK_DEPTH;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RLSW.errCode = SW_INVALID_ENUM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void swGetFloatv(SWget name, float* v)
|
||||||
|
{
|
||||||
|
switch (name) {
|
||||||
|
case SW_COLOR_CLEAR_VALUE:
|
||||||
|
v[0] = RLSW.clearColor[0];
|
||||||
|
v[1] = RLSW.clearColor[1];
|
||||||
|
v[2] = RLSW.clearColor[2];
|
||||||
|
v[3] = RLSW.clearColor[3];
|
||||||
|
break;
|
||||||
|
case SW_CURRENT_COLOR:
|
||||||
|
v[0] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].color[0];
|
||||||
|
v[1] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].color[1];
|
||||||
|
v[2] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].color[2];
|
||||||
|
v[3] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].color[3];
|
||||||
|
break;
|
||||||
|
case SW_CURRENT_NORMAL:
|
||||||
|
v[0] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].normal[0];
|
||||||
|
v[1] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].normal[1];
|
||||||
|
v[2] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].normal[2];
|
||||||
|
break;
|
||||||
|
case SW_CURRENT_TEXTURE_COORDS:
|
||||||
|
v[0] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].texcoord[0];
|
||||||
|
v[1] = RLSW.vertexBuffer[RLSW.vertexCounter - 1].texcoord[1];
|
||||||
|
break;
|
||||||
|
case SW_MODELVIEW_MATRIX:
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
v[i] = RLSW.stackModelview[RLSW.stackModelviewCounter - 1][i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SW_PROJECTION_MATRIX:
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
v[i] = RLSW.stackProjection[RLSW.stackProjectionCounter - 1][i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SW_TEXTURE_MATRIX:
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
v[i] = RLSW.stackTexture[RLSW.stackTextureCounter - 1][i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RLSW.errCode = SW_INVALID_ENUM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* glGetString(SWget name)
|
||||||
|
{
|
||||||
|
const char* result = NULL;
|
||||||
|
|
||||||
|
switch (name) {
|
||||||
|
case SW_VENDOR:
|
||||||
|
result = "RLSW Header";
|
||||||
|
break;
|
||||||
|
case SW_RENDERER:
|
||||||
|
result = "RLSW Software Renderer";
|
||||||
|
break;
|
||||||
|
case SW_VERSION:
|
||||||
|
result = "RLSW 1.0";
|
||||||
|
break;
|
||||||
|
case SW_EXTENSIONS:
|
||||||
|
result = "None";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RLSW.errCode = SW_INVALID_ENUM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void swViewport(int x, int y, int width, int height)
|
void swViewport(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
if (x <= -width || y <= -height) {
|
if (x <= -width || y <= -height) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user