summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-03-25 22:28:39 +0000
committerrodri <rgl@antares-labs.eu>2024-03-25 22:28:39 +0000
commitaf89f884a13a8ee2cc7d9d09cc88a3fbb145f177 (patch)
treed91e7c197f0f29cfd2722ff42023303ad74e61aa
parent231a3c4ea98d9448b96ab12aa3b34be30ecad0f2 (diff)
download3dee-af89f884a13a8ee2cc7d9d09cc88a3fbb145f177.tar.gz
3dee-af89f884a13a8ee2cc7d9d09cc88a3fbb145f177.tar.bz2
3dee-af89f884a13a8ee2cc7d9d09cc88a3fbb145f177.zip
use the new renderer interface.
-rw-r--r--main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/main.c b/main.c
index e0cff2d..1145ed8 100644
--- a/main.c
+++ b/main.c
@@ -44,7 +44,7 @@ Mousectl *mctl;
Keyboardctl *kctl;
Channel *drawc;
int kdown;
-Shader *shader;
+Shadertab *shader;
Model *model;
Entity *subject;
Scene *scene;
@@ -413,7 +413,7 @@ boxshader(FSparams *sp)
return Pt3(uv.x, uv.y, smoothstep(0,1,uv.x+uv.y), 1);
}
-Shader shadertab[] = {
+Shadertab shadertab[] = {
{ "triangle", ivshader, triangleshader },
{ "circle", ivshader, circleshader },
{ "box", ivshader, boxshader },
@@ -423,7 +423,7 @@ Shader shadertab[] = {
{ "gouraud", gouraudvshader, gouraudshader },
{ "phong", phongvshader, phongshader },
};
-Shader *
+Shadertab *
getshader(char *name)
{
int i;
@@ -729,6 +729,7 @@ void
threadmain(int argc, char *argv[])
{
Viewport *v;
+ Renderer *rctl;
Channel *keyc;
char *texpath, *norpath, *sname, *mdlpath;
int i, fd;
@@ -783,10 +784,12 @@ threadmain(int argc, char *argv[])
refreshmodel(model);
}
- if(initdraw(nil, nil, "3d") < 0)
- sysfatal("initdraw: %r");
if(memimageinit() != 0)
sysfatal("memimageinit: %r");
+ if((rctl = initgraphics()) == nil)
+ sysfatal("initgraphics: %r");
+ if(initdraw(nil, nil, "3d") < 0)
+ sysfatal("initdraw: %r");
if((mctl = initmouse(nil, screen)) == nil)
sysfatal("initmouse: %r");
@@ -796,6 +799,7 @@ threadmain(int argc, char *argv[])
placecamera(&cams[i], camcfgs[i].p, camcfgs[i].lookat, camcfgs[i].up);
configcamera(&cams[i], v, camcfgs[i].fov, camcfgs[i].clipn, camcfgs[i].clipf, camcfgs[i].ptype);
cams[i].s = scene;
+ cams[i].rctl = rctl;
}
maincam = &cams[3];
light.p = Pt3(0,100,100,1);