summaryrefslogtreecommitdiff
path: root/med.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-08-27 12:06:45 +0000
committerrodri <rgl@antares-labs.eu>2024-08-27 12:06:45 +0000
commit3b06ad551d6706907b0d6cbf25807e1ef7e62ca9 (patch)
tree8094b9befe8586391fc5bbac7de000362afa9ef0 /med.c
parent981b643df2def9846c112469e94644500015b8e6 (diff)
download3dee-3b06ad551d6706907b0d6cbf25807e1ef7e62ca9.tar.gz
3dee-3b06ad551d6706907b0d6cbf25807e1ef7e62ca9.tar.bz2
3dee-3b06ad551d6706907b0d6cbf25807e1ef7e62ca9.zip
remove duplicate min and max functions.
Diffstat (limited to 'med.c')
-rw-r--r--med.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/med.c b/med.c
index 1f5949a..1ca8ce7 100644
--- a/med.c
+++ b/med.c
@@ -106,18 +106,6 @@ static int doprof;
static int showhud;
Color (*tsampler)(Texture*,Point2);
-static int
-min(int a, int b)
-{
- return a < b? a: b;
-}
-
-static int
-max(int a, int b)
-{
- return a > b? a: b;
-}
-
static Point3
Vecquat(Quaternion q)
{
@@ -291,13 +279,13 @@ gouraudvshader(VSparams *sp)
ambient = mulpt3(lightc, Ka);
ambient = modulapt3(ambient, m.diffuse);
- Kd = fmax(0, dotvec3(sp->v->n, lightdir));
+ Kd = max(0, dotvec3(sp->v->n, lightdir));
diffuse = mulpt3(lightc, Kd);
diffuse = modulapt3(diffuse, m.diffuse);
lookdir = normvec3(subpt3(sp->su->camera->p, pos));
lightdir = qrotate(lightdir, sp->v->n, PI);
- spec = pow(fmax(0, dotvec3(lookdir, lightdir)), m.shininess);
+ spec = pow(max(0, dotvec3(lookdir, lightdir)), m.shininess);
specular = mulpt3(lightc, spec*Ks);
specular = modulapt3(specular, m.specular);
@@ -403,7 +391,7 @@ phongshader(FSparams *sp)
ambient = mulpt3(lightc, Ka);
ambient = modulapt3(ambient, m.diffuse);
- Kd = fmax(0, dotvec3(n, lightdir));
+ Kd = max(0, dotvec3(n, lightdir));
diffuse = mulpt3(lightc, Kd);
diffuse = modulapt3(diffuse, m.diffuse);
@@ -412,7 +400,7 @@ phongshader(FSparams *sp)
lookdir = normvec3(subpt3(sp->su->camera->p, pos));
lightdir = qrotate(lightdir, n, PI);
- spec = pow(fmax(0, dotvec3(lookdir, lightdir)), m.shininess);
+ spec = pow(max(0, dotvec3(lookdir, lightdir)), m.shininess);
specular = mulpt3(lightc, spec*Ks);
specular = modulapt3(specular, m.specular);