diff options
author | rodri <rgl@antares-labs.eu> | 2024-09-21 16:15:21 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-09-21 16:15:21 +0000 |
commit | a8c789be9ab0fec65004118b7df373e84900cb1a (patch) | |
tree | ec50773d05e4cd15f22dfc7ec19c4ddc8ec77a88 /camera.c | |
parent | d8f71404ffd54af08bc84dbb04e60cb07e83a021 (diff) | |
download | libgraphics-a8c789be9ab0fec65004118b7df373e84900cb1a.tar.gz libgraphics-a8c789be9ab0fec65004118b7df373e84900cb1a.tar.bz2 libgraphics-a8c789be9ab0fec65004118b7df373e84900cb1a.zip |
camera: add a Camv constructor.
Diffstat (limited to 'camera.c')
-rw-r--r-- | camera.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -96,22 +96,34 @@ verifycfg(Camera *c) } Camera * -Cam(Rectangle vr, Renderer *r, Projection p, double fov, double n, double f) +Camv(Viewport *v, Renderer *r, Projection p, double fov, double n, double f) { Camera *c; - c = newcamera(); - c->view = mkviewport(vr); - if(c->view == nil){ - werrstr("mkviewport: %r"); + if(v == nil || r == nil) return nil; - } + + c = newcamera(); + c->view = v; c->rctl = r; configcamera(c, p, fov, n, f); return c; } Camera * +Cam(Rectangle vr, Renderer *r, Projection p, double fov, double n, double f) +{ + Viewport *v; + + v = mkviewport(vr); + if(v == nil){ + werrstr("mkviewport: %r"); + return nil; + } + return Camv(v, r, p, fov, n, f); +} + +Camera * newcamera(void) { Camera *c; |