void sceGuLightAtt(int light, float atten0, float atten1, float atten2) { GuLightSettings* settings = &light_settings[light]; sendCommandf(settings->constant,atten0); sendCommandf(settings->linear,atten1); sendCommandf(settings->quadratic,atten2); }
void sceGuLight(int light, int type, int components, const ScePspFVector3* position) { GuLightSettings* settings = &light_settings[light]; sendCommandf(settings->row0[2],position->x); sendCommandf(settings->row0[3],position->y); sendCommandf(settings->row1[0],position->z); int kind = 2; if (components != 8) kind = (components^6) < 1 ? 1 : 0; sendCommandi(settings->row0[1],((type & 0x03) << 8)|kind); }
void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params) { switch (pname) { case GL_AMBIENT: pspgl_curctx->material.ambient = COLOR4(params); /* material ambient is overloaded by glColor() */ if (getReg(CMD_ENA_LIGHTING) & 0xff) { sendCommandi(CMD_MATERIAL_AMB_C, pspgl_curctx->material.ambient); sendCommandi(CMD_MATERIAL_AMB_A, pspgl_curctx->material.ambient >> 24); } break; case GL_EMISSION: sendCommandi(CMD_MATERIAL_EMS_C, COLOR3(params)); break; case GL_DIFFUSE: sendCommandi(CMD_MATERIAL_DIF_C, COLOR3(params)); break; case GL_AMBIENT_AND_DIFFUSE: glMaterialfv(face, GL_AMBIENT, params); glMaterialfv(face, GL_DIFFUSE, params); break; case GL_SPECULAR: sendCommandi(CMD_MATERIAL_SPC_C, COLOR3(params)); break; case GL_SHININESS: sendCommandf(CMD_MATERIAL_SPEC_POW, params[0]); break; default: GLERROR(GL_INVALID_ENUM); return; }
void sceGuSetMatrix(int type, const ScePspFMatrix4* matrix) { unsigned int i,j; const float* fmatrix = (const float*)matrix; switch (type) { case 0: { sendCommandf(62,0); // 4*4 - most probably projection for (i = 0; i < 16; ++i) sendCommandf(63,fmatrix[i]); } break; case 1: { sendCommandf(60,0); // 4*4 -> 3*4 - view matrix? for (i = 0; i < 4; ++i) { for (j = 0; j < 3; ++j) sendCommandf(61,fmatrix[j+i*4]); } } break; case 2: { sendCommandf(58,0); // 4*4 -> 3*4 - ??? for (i = 0; i < 4; ++i) { for (j = 0; j < 3; ++j) sendCommandf(59,fmatrix[j+i*4]); } } break; case 3: { sendCommandf(64,0); // 4*4 -> 3*4 - ??? for (i = 0; i < 4; ++i) { for (j = 0; j < 3; ++j) sendCommandf(65,fmatrix[j+i*4]); } } break; } }