add more api
This commit is contained in:
parent
3a63249e18
commit
b8c714696f
3 changed files with 49 additions and 6 deletions
|
|
@ -37,7 +37,10 @@ GSDECL void GSGLClear(GSGL gl);
|
||||||
GSDECL void GSGLIgnoreDepth(GSGL gl);
|
GSDECL void GSGLIgnoreDepth(GSGL gl);
|
||||||
GSDECL void GSGLCareDepth(GSGL gl);
|
GSDECL void GSGLCareDepth(GSGL gl);
|
||||||
GSDECL void GSGLSetLight(GSGL gl);
|
GSDECL void GSGLSetLight(GSGL gl);
|
||||||
GSDECL void GSGLPolygon(GSGL gl, int pairs, GSVector3* vert, GSVector2* tex);
|
GSDECL void GSGLPolygon(GSGL gl, int pairs, GSVector3* vert, GSVector2* tex, GSVector3 norm);
|
||||||
|
GSDECL void GSGLPolygon2D(GSGL gl, int pairs, GSVector2* vert, GSVector2* tex);
|
||||||
|
GSDECL void GSGLBegin2D(GSGL gl);
|
||||||
|
GSDECL void GSGLEnd2D(GSGL gl);
|
||||||
|
|
||||||
/* gl_camera.c */
|
/* gl_camera.c */
|
||||||
GSDECL void GSGLCameraPerspective(GSGL gl, GSNumber width, GSNumber height);
|
GSDECL void GSGLCameraPerspective(GSGL gl, GSNumber width, GSNumber height);
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,52 @@ void GSGLSetLight(GSGL gl) {
|
||||||
glLightfv(GL_LIGHT0, GL_POSITION, f);
|
glLightfv(GL_LIGHT0, GL_POSITION, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSGLPolygon(GSGL gl, int pairs, GSVector3* vert, GSVector2* tex) {
|
void GSGLPolygon(GSGL gl, int pairs, GSVector3* vert, GSVector2* tex, GSVector3 norm) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
|
glNormal3f(norm[0], norm[1], norm[2]);
|
||||||
for(i = 0; i < pairs; i++) {
|
for(i = 0; i < pairs; i++) {
|
||||||
if(tex != NULL) glTexCoord2f(tex[i][0], tex[i][1]);
|
if(tex != NULL) glTexCoord2f(tex[i][0], tex[i][1]);
|
||||||
glVertex3f(vert[i][0], vert[i][1], vert[i][2]);
|
glVertex3f(vert[i][0], vert[i][1], vert[i][2]);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSGLPolygon2D(GSGL gl, int pairs, GSVector2* vert, GSVector2* tex) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
glBegin(GL_POLYGON);
|
||||||
|
for(i = 0; i < pairs; i++) {
|
||||||
|
if(tex != NULL) glTexCoord2f(tex[i][0], tex[i][1]);
|
||||||
|
glVertex2f(vert[i][0], vert[i][1]);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GSGLBegin2D(GSGL gl) {
|
||||||
|
GSGLIgnoreDepth(gl);
|
||||||
|
GSGLShadowDisable(gl);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, gl->engine->width, gl->engine->height, 0, -1, 1);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GSGLEnd2D(GSGL gl) {
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
|
GSGLShadowEnable(gl);
|
||||||
|
GSGLCareDepth(gl);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ void GSSkyBoxDraw(GSSkyBox skybox) {
|
||||||
int i;
|
int i;
|
||||||
GSVector3 v[4];
|
GSVector3 v[4];
|
||||||
GSVector2 t[4];
|
GSVector2 t[4];
|
||||||
|
GSVector3 n = {0, 0, 0};
|
||||||
GSNumber s = 0.0001;
|
GSNumber s = 0.0001;
|
||||||
|
|
||||||
t[0][0] = 0, t[0][1] = 0;
|
t[0][0] = 0, t[0][1] = 0;
|
||||||
|
|
@ -60,7 +61,7 @@ void GSSkyBoxDraw(GSSkyBox skybox) {
|
||||||
for(i = 0; i < 6; i++) {
|
for(i = 0; i < 6; i++) {
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
int j, k;
|
int j, k;
|
||||||
|
|
||||||
if(i == 0) {
|
if(i == 0) {
|
||||||
tex = skybox->left;
|
tex = skybox->left;
|
||||||
|
|
||||||
|
|
@ -114,7 +115,7 @@ void GSSkyBoxDraw(GSSkyBox skybox) {
|
||||||
|
|
||||||
GSGLTextureSet(gl, tex);
|
GSGLTextureSet(gl, tex);
|
||||||
|
|
||||||
GSGLPolygon(gl, 4, v, t);
|
GSGLPolygon(gl, 4, v, t, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
GSGLTextureSet(gl, 0);
|
GSGLTextureSet(gl, 0);
|
||||||
|
|
@ -125,7 +126,7 @@ void GSSkyBoxDraw(GSSkyBox skybox) {
|
||||||
|
|
||||||
void GSSkyBoxClose(GSSkyBox skybox) {
|
void GSSkyBoxClose(GSSkyBox skybox) {
|
||||||
GLuint* ptr[6];
|
GLuint* ptr[6];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ptr[0] = &skybox->left;
|
ptr[0] = &skybox->left;
|
||||||
ptr[1] = &skybox->right;
|
ptr[1] = &skybox->right;
|
||||||
|
|
@ -134,7 +135,7 @@ void GSSkyBoxClose(GSSkyBox skybox) {
|
||||||
ptr[4] = &skybox->up;
|
ptr[4] = &skybox->up;
|
||||||
ptr[5] = &skybox->down;
|
ptr[5] = &skybox->down;
|
||||||
|
|
||||||
for(i = 0; i < 6; i++){
|
for(i = 0; i < 6; i++) {
|
||||||
if(*ptr[i] > 0) GSGLTextureDelete(skybox->engine->client->gl, *ptr[i]);
|
if(*ptr[i] > 0) GSGLTextureDelete(skybox->engine->client->gl, *ptr[i]);
|
||||||
}
|
}
|
||||||
free(skybox);
|
free(skybox);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue