demo update
parent
6319b11df6
commit
d219cb88a3
|
@ -60,6 +60,12 @@ int main(int argc, char** argv) {
|
|||
array(light_t) directional_lights = 0;
|
||||
array_push(directional_lights, lit4);
|
||||
|
||||
array(light_t) all_lights = 0;
|
||||
array_push(all_lights, lit);
|
||||
array_push(all_lights, lit2);
|
||||
array_push(all_lights, lit3);
|
||||
array_push(all_lights, lit4);
|
||||
|
||||
bool initialized = 0;
|
||||
bool must_reload = 0;
|
||||
|
||||
|
@ -92,19 +98,20 @@ int main(int argc, char** argv) {
|
|||
camera_fps(&cam, mouse.x,mouse.y);
|
||||
|
||||
enum {
|
||||
POINT, SPOT, DIR
|
||||
POINT, SPOT, DIR, ALL
|
||||
};
|
||||
static unsigned mode = POINT;
|
||||
|
||||
if (input_down(KEY_1)) mode = POINT;
|
||||
if (input_down(KEY_2)) mode = SPOT;
|
||||
if (input_down(KEY_3)) mode = DIR;
|
||||
|
||||
if (input_down(KEY_4)) mode = ALL;
|
||||
light_t *lights = 0;
|
||||
switch (mode) {
|
||||
case POINT: lights = point_lights; break;
|
||||
case SPOT: lights = spot_lights; break;
|
||||
case DIR: lights = directional_lights; break;
|
||||
case ALL: lights = all_lights; break;
|
||||
}
|
||||
|
||||
// Animate light
|
||||
|
@ -131,6 +138,23 @@ int main(int argc, char** argv) {
|
|||
lights[0].dir = vec3(1,-1,-1);
|
||||
}
|
||||
|
||||
if (mode == ALL) {
|
||||
lights[0].pos = vec3(0, 5.5, 1);
|
||||
lights[0].pos.x += sinf(window_time()*2)*4.5f;
|
||||
lights[0].pos.y += cosf(window_time()*2)*1.0;
|
||||
lights[0].pos.z += cosf(window_time()*2)*6.0;
|
||||
|
||||
lights[1].pos = vec3(0, 7.5, 1);
|
||||
lights[1].pos.x += sinf(window_time()*4)*4.5f;
|
||||
lights[1].pos.y += cosf(window_time()*4)*1.0;
|
||||
lights[1].pos.z += cosf(window_time()*4)*6.0;
|
||||
|
||||
lights[2].pos = cam.position;
|
||||
lights[2].dir = cam.lookdir;
|
||||
|
||||
lights[3].dir = vec3(1,-1,-1);
|
||||
}
|
||||
|
||||
// Render shadowmap
|
||||
shadowmap_begin(&sm);
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue