-
Notifications
You must be signed in to change notification settings - Fork 8
/
glMaterial.c
62 lines (53 loc) · 1.44 KB
/
glMaterial.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "pspgl_internal.h"
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;
}
#if 0
unsigned components;
/* glColorMaterial? */
components = 0;
if (pspgl_curctx->material.ambient)
components |= GE_AMBIENT;
if ((getReg(CMD_MATERIAL_SPC_C) & 0xffffff) != 0)
components |= GE_SPECULAR;
if ((getReg(CMD_MATERIAL_DIF_C) & 0xffffff) != 0)
components |= GE_DIFFUSE;
sendCommandi(CMD_MATERIAL, components);
#endif
}
void glMaterialf (GLenum face, GLenum pname, GLfloat param)
{
glMaterialfv(face, pname, ¶m);
}
void glMateriali (GLenum face, GLenum pname, GLint param)
{
glMaterialf(face, pname, param);
}