-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexander Shishkin <[email protected]>
- Loading branch information
Showing
27 changed files
with
597 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "light.h" | ||
|
||
void light_update(struct light *light, int idx) | ||
{ | ||
// view_update(&light->view[idx], &light->pos[idx * 3], -90, 0, 0); | ||
// mat4x4_look_at(light->view->view_mx.m, ) | ||
} | ||
|
||
void light_set_pos(struct light *light, int idx, float pos[3]) | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < 3; i++) | ||
light->pos[idx * 3 + i] = pos[i]; | ||
|
||
light_update(light, idx); | ||
} | ||
|
||
void light_set_color(struct light *light, int idx, float color[3]) | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < 3; i++) | ||
light->color[idx * 3 + i] = color[i]; | ||
} | ||
|
||
void light_set_attenuation(struct light *light, int idx, float attenuation[3]) | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < 3; i++) | ||
light->attenuation[idx * 3 + i] = attenuation[i]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
#ifndef __CLAP_LIGHT_H__ | ||
#define __CLAP_LIGHT_H__ | ||
|
||
#include "common.h" | ||
#include "render.h" | ||
#include "display.h" | ||
#include "view.h" | ||
|
||
#define LIGHTS_MAX 4 | ||
|
||
struct light { | ||
GLfloat pos[3 * LIGHTS_MAX]; | ||
GLfloat color[3 * LIGHTS_MAX]; | ||
GLfloat attenuation[3 * LIGHTS_MAX]; | ||
GLfloat dir[3 * LIGHTS_MAX]; | ||
struct view view[LIGHTS_MAX]; | ||
texture_t *shadow[LIGHTS_MAX]; | ||
}; | ||
|
||
void light_update(struct light *light, int idx); | ||
void light_set_pos(struct light *light, int idx, float pos[3]); | ||
void light_set_color(struct light *light, int idx, float color[3]); | ||
void light_set_attenuation(struct light *light, int idx, float attenuation[3]); | ||
|
||
#endif /* __CLAP_LIGHT_H__ */ |
Oops, something went wrong.