From b7c3f36539569f5861b259b136ba2f9f14ae9e78 Mon Sep 17 00:00:00 2001 From: rodri Date: Fri, 5 Jul 2024 18:21:18 +0000 Subject: 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. --- med.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'med.c') diff --git a/med.c b/med.c index 3bdeff7..c3aa3eb 100644 --- a/med.c +++ b/med.c @@ -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 -- cgit v1.2.3