fix: .gitignore + add 44 language JSON files
This commit is contained in:
1 parent
e8fd68e27b
commit
8de545dd2c
227 files changed
+22603
No files matched your search
@@ -0,0 +1,26 @@
|
||||
#include "lighting.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
Light* light_create_dir(float r, float g, float b, float intensity, float dx, float dy, float dz) {
|
||||
Light* l = (Light*)calloc(1, sizeof(Light));
|
||||
l->type = LIGHT_DIR;
|
||||
l->color[0] = r; l->color[1] = g; l->color[2] = b;
|
||||
l->intensity = intensity;
|
||||
l->direction[0] = dx; l->direction[1] = dy; l->direction[2] = dz;
|
||||
float len = sqrtf(dx*dx + dy*dy + dz*dz);
|
||||
if (len > 0.0001f) { l->direction[0] /= len; l->direction[1] /= len; l->direction[2] /= len; }
|
||||
return l;
|
||||
}
|
||||
|
||||
Light* light_create_point(float r, float g, float b, float intensity, float x, float y, float z, float range) {
|
||||
Light* l = (Light*)calloc(1, sizeof(Light));
|
||||
l->type = LIGHT_POINT;
|
||||
l->color[0] = r; l->color[1] = g; l->color[2] = b;
|
||||
l->intensity = intensity;
|
||||
l->position[0] = x; l->position[1] = y; l->position[2] = z;
|
||||
l->range = range;
|
||||
return l;
|
||||
}
|
||||
|
||||
void light_destroy(Light* light) { free(light); }
|
||||
Reference in new issue
Block a user