-
Notifications
You must be signed in to change notification settings - Fork 8
/
glFog.c
63 lines (51 loc) · 1.03 KB
/
glFog.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
62
#include "pspgl_internal.h"
void glFogf (GLenum pname, GLfloat param)
{
float distance;
GLenum error;
error = GL_INVALID_VALUE;
switch (pname) {
case GL_FOG_MODE:
if (param != GL_LINEAR)
goto out_error;
break;
case GL_FOG_START:
pspgl_curctx->fog.near = param;
distance = pspgl_curctx->fog.far - pspgl_curctx->fog.near;
if (unlikely(distance == 0))
goto out_error;
distance = 1.0f / distance;
sendCommandf(CMD_FOG_NEAR, distance);
break;
case GL_FOG_END:
pspgl_curctx->fog.far = param;
sendCommandf(CMD_FOG_FAR, pspgl_curctx->fog.far);
break;
/**
case XXXX:
pspgl_curctx->fog.XXXXX = param;
sendCommandf(248, ??fog type??);
break;
*/
default:
error = GL_INVALID_ENUM;
goto out_error;
}
return;
out_error:
GLERROR(error);
}
void glFogi (GLenum pname, GLint param)
{
glFogf(pname, (GLfloat) param);
}
void glFogfv (GLenum pname, const GLfloat *param)
{
switch (pname) {
case GL_FOG_COLOR:
sendCommandi(CMD_FOG_COLOR, COLOR3(param));
break;
default:
glFogf(pname, param[0]);
}
}