summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-10-19 11:42:51 +0000
committerrodri <rgl@antares-labs.eu>2024-10-19 11:42:51 +0000
commit12efa1d9e0ff3a32b018ee83d6ebee08c77972a9 (patch)
tree25cef8ab1693ee3224c121ff7cac86d55907566f
parenta09cfff78a96a10169a30324b75554827945fed4 (diff)
downloadlibgraphics-12efa1d9e0ff3a32b018ee83d6ebee08c77972a9.tar.gz
libgraphics-12efa1d9e0ff3a32b018ee83d6ebee08c77972a9.tar.bz2
libgraphics-12efa1d9e0ff3a32b018ee83d6ebee08c77972a9.zip
remove quaternion sandwich utils (now part of libgeometry.)HEADmaster
-rw-r--r--graphics.h6
-rw-r--r--render.c3
-rw-r--r--util.c15
3 files changed, 6 insertions, 18 deletions
diff --git a/graphics.h b/graphics.h
index 8d62e76..e58aca9 100644
--- a/graphics.h
+++ b/graphics.h
@@ -150,6 +150,8 @@ struct LightSource
/* spotlights */
double θu; /* umbra angle. anything beyond is unlit */
double θp; /* penumbra angle. anything within is fully lit */
+
+ LightSource *prev, *next;
};
struct Material
@@ -199,6 +201,8 @@ struct Scene
char *name;
Entity ents;
ulong nents;
+ LightSource lights;
+ ulong nlights;
Cubemap *skybox;
void (*addent)(Scene*, Entity*);
@@ -446,8 +450,6 @@ Point3 modulapt3(Point3, Point3);
Point3 minpt3(Point3, Point3);
Point3 maxpt3(Point3, Point3);
int eqpt3(Point3, Point3);
-Quaternion qsandwich(Quaternion, Quaternion);
-Point3 qsandwichpt3(Quaternion, Point3);
Memimage *rgba(ulong);
Memimage *dupmemimage(Memimage*);
diff --git a/render.c b/render.c
index 5d0954b..3f96f42 100644
--- a/render.c
+++ b/render.c
@@ -179,7 +179,7 @@ rasterize(Rastertask *task)
double dplen, perc;
float z, pcz;
uint ropts;
- int steep = 0, Δe, e, Δy;
+ int steep, Δe, e, Δy;
params = task->params;
prim = &task->p;
@@ -233,6 +233,7 @@ rasterize(Rastertask *task)
if(rectclipline(task->wr, &p0, &p1, &prim->v[0], &prim->v[1]) < 0)
break;
+ steep = 0;
/* transpose the points */
if(abs(p0.x-p1.x) < abs(p0.y-p1.y)){
steep = 1;
diff --git a/util.c b/util.c
index 8aeaaf2..ff76ab9 100644
--- a/util.c
+++ b/util.c
@@ -91,21 +91,6 @@ eqpt3(Point3 a, Point3 b)
return vec3len(subpt3(a, b)) < ε2;
}
-Quaternion
-qsandwich(Quaternion q, Quaternion p)
-{
- return mulq(mulq(q, p), invq(q));
-}
-
-Point3
-qsandwichpt3(Quaternion q, Point3 p)
-{
- Quaternion r;
-
- r = qsandwich(q, Quatvec(0, p));
- return Pt3(r.i, r.j, r.k, p.w);
-}
-
void
memsetf(void *dp, float v, usize len)
{