diff options
author | rodri <rgl@antares-labs.eu> | 2024-07-05 18:21:18 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-07-05 18:21:18 +0000 |
commit | b7c3f36539569f5861b259b136ba2f9f14ae9e78 (patch) | |
tree | bf373888f3680c41c9d20d4452f6a619ac78191a /med.c | |
parent | 27724b010694549f17cad50158cf73ca035e9cad (diff) | |
download | 3dee-b7c3f36539569f5861b259b136ba2f9f14ae9e78.tar.gz 3dee-b7c3f36539569f5861b259b136ba2f9f14ae9e78.tar.bz2 3dee-b7c3f36539569f5861b259b136ba2f9f14ae9e78.zip |
adapt to the new texture interface and fix the identvshader.
the identvshader was used for the toon shader as well,
and that forced it to do a light computation when its
fragment shader won't ever use it. split it in two
vshaders, each for their own purpose, so we don't get
slow identity rendering.
Diffstat (limited to 'med.c')
-rw-r--r-- | med.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -92,7 +92,7 @@ LightSource light; /* global point light */ static int doprof; static int showhud; -Color (*tsampler)(Memimage*,Point2); +Color (*tsampler)(Texture*,Point2); static int min(int a, int b) @@ -358,7 +358,6 @@ phongshader(FSparams *sp) else{ /* TODO implement this on the VS instead and apply Gram-Schmidt here */ n = texture(sp->v.mtl->normalmap, sp->v.uv, neartexsampler); - n = linear2srgb(n); /* TODO not all textures require color space conversion */ n = normvec3(subpt3(mulpt3(n, 2), Vec3(1,1,1))); TBN.p = Pt3(0,0,0,1); @@ -396,11 +395,9 @@ phongshader(FSparams *sp) Point3 identvshader(VSparams *sp) { - sp->v->n = model2world(sp->su->entity, sp->v->n); - sp->v->p = model2world(sp->su->entity, sp->v->p); if(sp->v->mtl != nil) sp->v->c = sp->v->mtl->diffuse; - return world2clip(sp->su->camera, sp->v->p); + return world2clip(sp->su->camera, model2world(sp->su->entity, sp->v->p)); } Color |