summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--camera.c2
-rw-r--r--graphics.h6
-rw-r--r--render.c18
-rw-r--r--texture.c4
4 files changed, 15 insertions, 15 deletions
diff --git a/camera.c b/camera.c
index 6c2be87..60f3c4a 100644
--- a/camera.c
+++ b/camera.c
@@ -34,7 +34,7 @@ skyboxfs(FSparams *sp)
Color c;
va = getvattr(&sp->v, "dir");
- c = cubemaptexture(sp->su->camera->scene->skybox, va->p, neartexsampler);
+ c = samplecubemap(sp->su->camera->scene->skybox, va->p, neartexsampler);
return c;
}
diff --git a/graphics.h b/graphics.h
index 70eeb71..691e97f 100644
--- a/graphics.h
+++ b/graphics.h
@@ -18,7 +18,7 @@ enum {
};
enum {
- RAWTexture,
+ RAWTexture, /* unmanaged */
sRGBTexture,
};
@@ -341,10 +341,10 @@ Texture *alloctexture(int, Memimage*);
void freetexture(Texture*);
Color neartexsampler(Texture*, Point2);
Color bilitexsampler(Texture*, Point2);
-Color texture(Texture*, Point2, Color(*)(Texture*, Point2));
+Color sampletexture(Texture*, Point2, Color(*)(Texture*, Point2));
Cubemap *readcubemap(char*[6]);
void freecubemap(Cubemap*);
-Color cubemaptexture(Cubemap*, Point3, Color(*)(Texture*, Point2));
+Color samplecubemap(Cubemap*, Point3, Color(*)(Texture*, Point2));
/* util */
double fmin(double, double);
diff --git a/render.c b/render.c
index 563df69..48cf346 100644
--- a/render.c
+++ b/render.c
@@ -15,10 +15,10 @@ col2ul(Color c)
{
uchar cbuf[4];
- cbuf[0] = fclamp(c.a, 0, 1)*0xFF;
- cbuf[1] = fclamp(c.b, 0, 1)*0xFF;
- cbuf[2] = fclamp(c.g, 0, 1)*0xFF;
- cbuf[3] = fclamp(c.r, 0, 1)*0xFF;
+ cbuf[0] = fclamp(c.b, 0, 1)*0xFF;
+ cbuf[1] = fclamp(c.g, 0, 1)*0xFF;
+ cbuf[2] = fclamp(c.r, 0, 1)*0xFF;
+ cbuf[3] = fclamp(c.a, 0, 1)*0xFF;
return cbuf[3]<<24 | cbuf[2]<<16 | cbuf[1]<<8 | cbuf[0];
}
@@ -27,10 +27,10 @@ ul2col(ulong l)
{
Color c;
- c.a = (l & 0xff)/255.0;
- c.b = (l>>8 & 0xff)/255.0;
- c.g = (l>>16 & 0xff)/255.0;
- c.r = (l>>24 & 0xff)/255.0;
+ c.b = (l & 0xff)/255.0;
+ c.g = (l>>8 & 0xff)/255.0;
+ c.r = (l>>16 & 0xff)/255.0;
+ c.a = (l>>24 & 0xff)/255.0;
return c;
}
@@ -52,6 +52,7 @@ pixeln(Framebuf *fb, Point p, Color c)
ulong *dst;
dst = fb->nb;
+ c.a = 1;
dst[Dx(fb->r)*p.y + p.x] = col2ul(c);
}
@@ -222,7 +223,6 @@ discard:
fsp.p = p;
c = params->fshader(&fsp);
pixel(params->fb, p, c);
- fsp.v.n.w = 1;
pixeln(params->fb, p, fsp.v.n);
delvattrs(&fsp.v);
}
diff --git a/texture.c b/texture.c
index 50ce200..86b2cbd 100644
--- a/texture.c
+++ b/texture.c
@@ -106,7 +106,7 @@ bilitexsampler(Texture *t, Point2 uv)
}
Color
-texture(Texture *t, Point2 uv, Color(*sampler)(Texture*,Point2))
+sampletexture(Texture *t, Point2 uv, Color(*sampler)(Texture*,Point2))
{
return sampler(t, uv);
}
@@ -173,7 +173,7 @@ freecubemap(Cubemap *cm)
* - “Cubemap Texture Selection”, OpenGL ES 2.0 § 3.7.5, November 2010
*/
Color
-cubemaptexture(Cubemap *cm, Point3 d, Color(*sampler)(Texture*,Point2))
+samplecubemap(Cubemap *cm, Point3 d, Color(*sampler)(Texture*,Point2))
{
Point2 uv;
double ax, ay, az, ma, sc, tc;