mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-28 22:18:30 +00:00
Some code tweaks
This commit is contained in:
@@ -337,7 +337,7 @@ static int screenHeight; // Default framebuffer height
|
|||||||
// Lighting data
|
// Lighting data
|
||||||
static Light lights[MAX_LIGHTS]; // Lights pool
|
static Light lights[MAX_LIGHTS]; // Lights pool
|
||||||
static int lightsCount = 0; // Enabled lights counter
|
static int lightsCount = 0; // Enabled lights counter
|
||||||
static int lightsLocs[MAX_LIGHTS][8]; // 8 possible location points per light:
|
static int lightsLocs[MAX_LIGHTS][8]; // Lights location points in shader: 8 possible points per light:
|
||||||
// enabled, type, position, target, radius, diffuse, intensity, coneAngle
|
// enabled, type, position, target, radius, diffuse, intensity, coneAngle
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@@ -3713,7 +3713,7 @@ static void SetShaderLightsValues(Shader shader)
|
|||||||
} break;
|
} break;
|
||||||
case LIGHT_DIRECTIONAL:
|
case LIGHT_DIRECTIONAL:
|
||||||
{
|
{
|
||||||
Vector3 direction = { lights[i]->target.x - lights[i]->position.x, lights[i]->target.y - lights[i]->position.y, lights[i]->target.z - lights[i]->position.z };
|
Vector3 direction = VectorSubtract(lights[i]->target, lights[i]->position);
|
||||||
VectorNormalize(&direction);
|
VectorNormalize(&direction);
|
||||||
glUniform3f(lightsLocs[i][3], direction.x, direction.y, direction.z);
|
glUniform3f(lightsLocs[i][3], direction.x, direction.y, direction.z);
|
||||||
} break;
|
} break;
|
||||||
@@ -3721,7 +3721,7 @@ static void SetShaderLightsValues(Shader shader)
|
|||||||
{
|
{
|
||||||
glUniform3f(lightsLocs[i][2], lights[i]->position.x, lights[i]->position.y, lights[i]->position.z);
|
glUniform3f(lightsLocs[i][2], lights[i]->position.x, lights[i]->position.y, lights[i]->position.z);
|
||||||
|
|
||||||
Vector3 direction = { lights[i]->target.x - lights[i]->position.x, lights[i]->target.y - lights[i]->position.y, lights[i]->target.z - lights[i]->position.z };
|
Vector3 direction = VectorSubtract(lights[i]->target, lights[i]->position);
|
||||||
VectorNormalize(&direction);
|
VectorNormalize(&direction);
|
||||||
glUniform3f(lightsLocs[i][3], direction.x, direction.y, direction.z);
|
glUniform3f(lightsLocs[i][3], direction.x, direction.y, direction.z);
|
||||||
|
|
||||||
|
@@ -677,7 +677,8 @@ void ImageFormat(Image *image, int newFormat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply alpha mask to image
|
// Apply alpha mask to image
|
||||||
// NOTE: alphaMask must be should be same size as image
|
// NOTE 1: Returned image is RGBA - 32bit
|
||||||
|
// NOTE 2: alphaMask should be same size as image
|
||||||
void ImageAlphaMask(Image *image, Image alphaMask)
|
void ImageAlphaMask(Image *image, Image alphaMask)
|
||||||
{
|
{
|
||||||
if (image->format >= COMPRESSED_DXT1_RGB)
|
if (image->format >= COMPRESSED_DXT1_RGB)
|
||||||
|
Reference in New Issue
Block a user