GSGLTetrakis
This commit is contained in:
parent
f325b6c303
commit
cf213a68fe
8 changed files with 92 additions and 6 deletions
|
|
@ -96,8 +96,14 @@ void GSClientDestroy(GSClient client) {
|
|||
free(client);
|
||||
}
|
||||
|
||||
static GSVector4 white = {1, 1, 1, 1};
|
||||
|
||||
static void scene(GSClient client) {
|
||||
GSGLSetColor(client->gl, white);
|
||||
|
||||
if(client->engine->param->render != NULL) client->engine->param->render(client->engine);
|
||||
|
||||
GSGLSetColor(client->gl, white);
|
||||
}
|
||||
|
||||
void GSClientStep(GSClient client) {
|
||||
|
|
@ -107,7 +113,6 @@ void GSClientStep(GSClient client) {
|
|||
char buf[512];
|
||||
char buf2[512];
|
||||
GSVersion ver;
|
||||
GSVector4 white = {1, 1, 1, 1};
|
||||
GSVector4 yellow = {1, 1, 0, 1};
|
||||
GSVector4 half = {0, 0, 0, 0.5};
|
||||
GSVector2 sq[4];
|
||||
|
|
@ -116,7 +121,6 @@ void GSClientStep(GSClient client) {
|
|||
GSGLClear(client->gl);
|
||||
GSGLCameraSetup(client->gl);
|
||||
GSGLSetLight(client->gl);
|
||||
GSGLSetColor(client->gl, white);
|
||||
|
||||
GSGLTextBold(client->gl, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ void GSGLEnd2D(GSGL gl) {
|
|||
}
|
||||
|
||||
void GSGLSetPosition(GSGL gl, GSVector3 pos) {
|
||||
glTranslatef(pos[0], pos[1], pos[2]);
|
||||
glTranslatef(pos[0], pos[1], -pos[2]);
|
||||
}
|
||||
|
||||
void GSGLSetRotation(GSGL gl, GSVector3 rot) {
|
||||
|
|
|
|||
|
|
@ -172,3 +172,44 @@ void GSGLTexturePrepareEx(GSGL gl, GLuint* texture, unsigned char* rgba, int wid
|
|||
void GSGLTexturePrepare(GSGL gl, GLuint* texture, unsigned char* rgba, int width, int height) {
|
||||
GSGLTexturePrepareEx(gl, texture, rgba, width, height, 1);
|
||||
}
|
||||
|
||||
/* who even uses this other than second reality? :) */
|
||||
void GSGLTetrakis(GSGL gl, GSNumber scale, GSVector4 col1, GSVector4 col2) {
|
||||
GSVector3 v[] = {
|
||||
{0, 1, 0},
|
||||
{-0.75, 0.75, -0.75},
|
||||
{0.75, 0.75, -0.75}};
|
||||
GSVector3 n;
|
||||
GSVector3 rot2 = {0, 90, 0};
|
||||
GSVector3 rot3 = {0, 0, 90};
|
||||
GSVector3 rot4 = {90, 0, 0};
|
||||
int i, j, k = 0;
|
||||
|
||||
for(i = 0; i < 3; i++) {
|
||||
for(j = 0; j < 3; j++) v[i][j] *= scale;
|
||||
}
|
||||
|
||||
GSMathNormal3x3(n, v[0], v[1], v[2]);
|
||||
|
||||
GSGLPushMatrix(gl);
|
||||
for(i = 0; i < 6; i++) {
|
||||
for(j = 0; j < 4; j++) {
|
||||
GSGLSetColor(gl, ((k + j) % 2) ? col2 : col1);
|
||||
GSGLPolygon(gl, 3, v, NULL, n);
|
||||
|
||||
GSGLSetRotation(gl, rot2);
|
||||
}
|
||||
|
||||
if(i == 3) {
|
||||
GSGLSetRotation(gl, rot4);
|
||||
k++;
|
||||
} else if(i == 4) {
|
||||
GSGLSetRotation(gl, rot4);
|
||||
GSGLSetRotation(gl, rot4);
|
||||
} else {
|
||||
GSGLSetRotation(gl, rot3);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
GSGLPopMatrix(gl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ void GSGLShadowInit(GSGL gl) {
|
|||
glUniform1i(glGetUniformLocation(gl->shadow_shader, "depth_texture"), 7);
|
||||
glUniform1i(glGetUniformLocation(gl->shadow_shader, "current_texture"), 0);
|
||||
glUniform1f(glGetUniformLocation(gl->shadow_shader, "enable_lighting"), 1);
|
||||
glUniform1f(glGetUniformLocation(gl->shadow_shader, "enable_texture"), 0);
|
||||
glUseProgram(0);
|
||||
|
||||
gl->shadow_use_shader = 1;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,16 @@ void GSGLTextureSet(GSGL gl, GLuint texture) {
|
|||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
if(texture == 0) {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
if(gl->shadow_use_shader) {
|
||||
glUniform1f(glGetUniformLocation(gl->shadow_shader, "enable_texture"), 0);
|
||||
}
|
||||
} else {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
if(gl->shadow_use_shader) {
|
||||
glUniform1f(glGetUniformLocation(gl->shadow_shader, "enable_texture"), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue