summaryrefslogtreecommitdiffhomepage
path: root/examples/models
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-12-24 13:51:24 +0100
committerraysan5 <[email protected]>2020-12-24 13:51:24 +0100
commitb68e522ffc39ebff8268c6b522a3bb965878ad16 (patch)
tree2699c3c28b033a5d2d92e8748d308f84e551d1de /examples/models
parentbab1b9c1c5cb416bd9125c1230288859eeafda30 (diff)
downloadraylib-b68e522ffc39ebff8268c6b522a3bb965878ad16.tar.gz
raylib-b68e522ffc39ebff8268c6b522a3bb965878ad16.zip
Updated several files while porting examples to web
Diffstat (limited to 'examples/models')
-rw-r--r--examples/models/rlights.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/examples/models/rlights.h b/examples/models/rlights.h
index 6593ab4a..19504473 100644
--- a/examples/models/rlights.h
+++ b/examples/models/rlights.h
@@ -33,8 +33,6 @@
#ifndef RLIGHTS_H
#define RLIGHTS_H
-#include "raylib.h"
-
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
@@ -68,10 +66,15 @@ extern "C" { // Prevents name mangling of functions
#endif
//----------------------------------------------------------------------------------
+// Global Variables Definition
+//----------------------------------------------------------------------------------
+int lightsCount = 0; // Current amount of created lights
+
+//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
-void CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader); // Defines a light and get locations from PBR shader
-void UpdateLightValues(Shader shader, Light light); // Send to PBR shader light values
+Light CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader); // Defines a light and get locations from PBR shader
+void UpdateLightValues(Shader shader, Light light); // Send to PBR shader light values
#ifdef __cplusplus
}
@@ -103,8 +106,7 @@ void UpdateLightValues(Shader shader, Light light);
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
-static Light lights[MAX_LIGHTS] = { 0 };
-static int lightsCount = 0; // Current amount of created lights
+// ...
//----------------------------------------------------------------------------------
// Module specific Functions Declaration
@@ -116,7 +118,7 @@ static int lightsCount = 0; // Current amount of created lights
//----------------------------------------------------------------------------------
// Defines a light and get locations from PBR shader
-void CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader)
+Light CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader)
{
Light light = { 0 };
@@ -146,10 +148,10 @@ void CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader
light.colorLoc = GetShaderLocation(shader, colorName);
UpdateLightValues(shader, light);
-
- lights[lightsCount] = light;
lightsCount++;
}
+
+ return light;
}
// Send to PBR shader light values