aboutsummaryrefslogtreecommitdiffstats
path: root/faqe.c
diff options
context:
space:
mode:
Diffstat (limited to 'faqe.c')
-rw-r--r--faqe.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/faqe.c b/faqe.c
index 3b81e24..e51aaf0 100644
--- a/faqe.c
+++ b/faqe.c
@@ -37,7 +37,7 @@ int main(int argc, char **argv)
SDL_GLContext *glc;
GLuint prog;
struct {
- GLint model, view, proj, tex;
+ GLint model, view, proj, tex, light;
} uni;
FILE *cube_file;
struct fmd cube_fmd;
@@ -46,6 +46,7 @@ int main(int argc, char **argv)
struct {
bool w, a, s, d, spc, lct;
} key = { 0 };
+ vec4 lipos;
float tlast;
setprogname(argc >= 1 && argv[0] != NULL ? argv[0] : "faqe");
@@ -91,6 +92,7 @@ int main(int argc, char **argv)
{ "view", &uni.view },
{ "proj", &uni.proj },
{ "tex", &uni.tex },
+ { "light", &uni.light },
{ 0 },
});
@@ -164,6 +166,10 @@ int main(int argc, char **argv)
camera_lookat(view, &cam);
+ lipos[0] = 3.0 * cosf(tnow / 10) * cosf(tnow / 20);
+ lipos[1] = 3.0 * sinf(tnow / 10);
+ lipos[2] = 3.0 * cosf(tnow / 10) * sinf(tnow / 20);
+
gl_clearcolor(0.2, 0.3, 0.3, 1.0);
gl_clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
mat4x4_identity(model);
@@ -171,6 +177,7 @@ int main(int argc, char **argv)
gl_prog_use(prog);
gl_uni_setm4fv(uni.view, 1, GL_FALSE, view[0]);
gl_uni_setm4fv(uni.model, 1, GL_FALSE, model[0]);
+ gl_uni_set3fv(uni.light, 1, lipos);
model_render(&cube_model);
gl_va_bind(0);