mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-11-04 01:34:19 +00:00 
			
		
		
		
	reviewed ALL non-external files to follow raylib's convention of no spaces around / or * (#5153)
This commit is contained in:
		@@ -30,13 +30,13 @@ void ProcessAudio(void *buffer, unsigned int frames)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    for (unsigned int frame = 0; frame < frames; frame++)
 | 
					    for (unsigned int frame = 0; frame < frames; frame++)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        float *left = &samples[frame * 2 + 0], *right = &samples[frame * 2 + 1];
 | 
					        float *left = &samples[frame*2 + 0], *right = &samples[frame*2 + 1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        *left = powf(fabsf(*left), exponent) * ( (*left < 0.0f)? -1.0f : 1.0f );
 | 
					        *left = powf(fabsf(*left), exponent)*( (*left < 0.0f)? -1.0f : 1.0f );
 | 
				
			||||||
        *right = powf(fabsf(*right), exponent) * ( (*right < 0.0f)? -1.0f : 1.0f );
 | 
					        *right = powf(fabsf(*right), exponent)*( (*right < 0.0f)? -1.0f : 1.0f );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        average += fabsf(*left) / frames;   // accumulating average volume
 | 
					        average += fabsf(*left)/frames;   // accumulating average volume
 | 
				
			||||||
        average += fabsf(*right) / frames;
 | 
					        average += fabsf(*right)/frames;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Moving history to the left
 | 
					    // Moving history to the left
 | 
				
			||||||
@@ -99,7 +99,7 @@ int main(void)
 | 
				
			|||||||
            DrawRectangle(199, 199, 402, 34, LIGHTGRAY);
 | 
					            DrawRectangle(199, 199, 402, 34, LIGHTGRAY);
 | 
				
			||||||
            for (int i = 0; i < 400; i++)
 | 
					            for (int i = 0; i < 400; i++)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DrawLine(201 + i, 232 - (int)(averageVolume[i] * 32), 201 + i, 232, MAROON);
 | 
					                DrawLine(201 + i, 232 - (int)(averageVolume[i]*32), 201 + i, 232, MAROON);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            DrawRectangleLines(199, 199, 402, 34, GRAY);
 | 
					            DrawRectangleLines(199, 199, 402, 34, GRAY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -115,7 +115,7 @@ int main(void)
 | 
				
			|||||||
            float fp = (float)(mousePosition.y);
 | 
					            float fp = (float)(mousePosition.y);
 | 
				
			||||||
            frequency = 40.0f + (float)(fp);
 | 
					            frequency = 40.0f + (float)(fp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            float pan = (float)(mousePosition.x) / (float)screenWidth;
 | 
					            float pan = (float)(mousePosition.x)/(float)screenWidth;
 | 
				
			||||||
            SetAudioStreamPan(stream, pan);
 | 
					            SetAudioStreamPan(stream, pan);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -141,7 +141,7 @@ int main(void)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Scale read cursor's position to minimize transition artifacts
 | 
					            // Scale read cursor's position to minimize transition artifacts
 | 
				
			||||||
            //readCursor = (int)(readCursor * ((float)waveLength / (float)oldWavelength));
 | 
					            //readCursor = (int)(readCursor*((float)waveLength/(float)oldWavelength));
 | 
				
			||||||
            oldFrequency = frequency;
 | 
					            oldFrequency = frequency;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -148,8 +148,8 @@ int main(void)
 | 
				
			|||||||
static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
 | 
					static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static float low[2] = { 0.0f, 0.0f };
 | 
					    static float low[2] = { 0.0f, 0.0f };
 | 
				
			||||||
    static const float cutoff = 70.0f / 44100.0f; // 70 Hz lowpass filter
 | 
					    static const float cutoff = 70.0f/44100.0f; // 70 Hz lowpass filter
 | 
				
			||||||
    const float k = cutoff / (cutoff + 0.1591549431f); // RC filter formula
 | 
					    const float k = cutoff/(cutoff + 0.1591549431f); // RC filter formula
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Converts the buffer data before using it
 | 
					    // Converts the buffer data before using it
 | 
				
			||||||
    float *bufferData = (float *)buffer;
 | 
					    float *bufferData = (float *)buffer;
 | 
				
			||||||
@@ -158,8 +158,8 @@ static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
 | 
				
			|||||||
        const float l = bufferData[i];
 | 
					        const float l = bufferData[i];
 | 
				
			||||||
        const float r = bufferData[i + 1];
 | 
					        const float r = bufferData[i + 1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        low[0] += k * (l - low[0]);
 | 
					        low[0] += k*(l - low[0]);
 | 
				
			||||||
        low[1] += k * (r - low[1]);
 | 
					        low[1] += k*(r - low[1]);
 | 
				
			||||||
        bufferData[i] = low[0];
 | 
					        bufferData[i] = low[0];
 | 
				
			||||||
        bufferData[i + 1] = low[1];
 | 
					        bufferData[i + 1] = low[1];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -294,7 +294,7 @@ void UpdateCameraPlayerBoundsPush(Camera2D *camera, Player *player, EnvItem *env
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Vector2 bboxWorldMin = GetScreenToWorld2D((Vector2){ (1 - bbox.x)*0.5f*width, (1 - bbox.y)*0.5f*height }, *camera);
 | 
					    Vector2 bboxWorldMin = GetScreenToWorld2D((Vector2){ (1 - bbox.x)*0.5f*width, (1 - bbox.y)*0.5f*height }, *camera);
 | 
				
			||||||
    Vector2 bboxWorldMax = GetScreenToWorld2D((Vector2){ (1 + bbox.x)*0.5f*width, (1 + bbox.y)*0.5f*height }, *camera);
 | 
					    Vector2 bboxWorldMax = GetScreenToWorld2D((Vector2){ (1 + bbox.x)*0.5f*width, (1 + bbox.y)*0.5f*height }, *camera);
 | 
				
			||||||
    camera->offset = (Vector2){ (1 - bbox.x)*0.5f * width, (1 - bbox.y)*0.5f*height };
 | 
					    camera->offset = (Vector2){ (1 - bbox.x)*0.5f*width, (1 - bbox.y)*0.5f*height };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (player->position.x < bboxWorldMin.x) camera->target.x = player->position.x;
 | 
					    if (player->position.x < bboxWorldMin.x) camera->target.x = player->position.x;
 | 
				
			||||||
    if (player->position.y < bboxWorldMin.y) camera->target.y = player->position.y;
 | 
					    if (player->position.y < bboxWorldMin.y) camera->target.y = player->position.y;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,8 +100,8 @@ int main(void)
 | 
				
			|||||||
                camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
 | 
					                camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
 | 
				
			||||||
                camera.projection = CAMERA_ORTHOGRAPHIC;
 | 
					                camera.projection = CAMERA_ORTHOGRAPHIC;
 | 
				
			||||||
                camera.fovy = 20.0f; // near plane width in CAMERA_ORTHOGRAPHIC
 | 
					                camera.fovy = 20.0f; // near plane width in CAMERA_ORTHOGRAPHIC
 | 
				
			||||||
                CameraYaw(&camera, -135 * DEG2RAD, true);
 | 
					                CameraYaw(&camera, -135*DEG2RAD, true);
 | 
				
			||||||
                CameraPitch(&camera, -45 * DEG2RAD, true, true, false);
 | 
					                CameraPitch(&camera, -45*DEG2RAD, true, true, false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else if (camera.projection == CAMERA_ORTHOGRAPHIC)
 | 
					            else if (camera.projection == CAMERA_ORTHOGRAPHIC)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -263,7 +263,7 @@ static void UpdateCameraAngle(Camera *camera)
 | 
				
			|||||||
    // Rotate view vector around right axis
 | 
					    // Rotate view vector around right axis
 | 
				
			||||||
    float pitchAngle = -lookRotation.y - 
 | 
					    float pitchAngle = -lookRotation.y - 
 | 
				
			||||||
    lean.y;
 | 
					    lean.y;
 | 
				
			||||||
    pitchAngle = Clamp(pitchAngle, -PI / 2 + 0.0001f, PI / 2 - 0.0001f); // Clamp angle so it doesn't go past straight up or straight down
 | 
					    pitchAngle = Clamp(pitchAngle, -PI/2 + 0.0001f, PI/2 - 0.0001f); // Clamp angle so it doesn't go past straight up or straight down
 | 
				
			||||||
    Vector3 pitch = Vector3RotateByAxisAngle(yaw, right, pitchAngle);
 | 
					    Vector3 pitch = Vector3RotateByAxisAngle(yaw, right, pitchAngle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Head animation
 | 
					    // Head animation
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,7 @@ int main(void)
 | 
				
			|||||||
    cameraPlayer2.position.x = -3.0f;
 | 
					    cameraPlayer2.position.x = -3.0f;
 | 
				
			||||||
    cameraPlayer2.position.y = 3.0f;
 | 
					    cameraPlayer2.position.y = 3.0f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    RenderTexture screenPlayer2 = LoadRenderTexture(screenWidth / 2, screenHeight);
 | 
					    RenderTexture screenPlayer2 = LoadRenderTexture(screenWidth/2, screenHeight);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Build a flipped rectangle the size of the split view to use for drawing later
 | 
					    // Build a flipped rectangle the size of the split view to use for drawing later
 | 
				
			||||||
    Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
 | 
					    Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,7 +101,7 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            DrawText("Try clicking on the box with your mouse!", 240, 10, 20, DARKGRAY);
 | 
					            DrawText("Try clicking on the box with your mouse!", 240, 10, 20, DARKGRAY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (collision.hit) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
 | 
					            if (collision.hit) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30))/2, (int)(screenHeight*0.1f), 30, GREEN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DrawText("Right click mouse to toggle camera controls", 10, 430, 10, GRAY);
 | 
					            DrawText("Right click mouse to toggle camera controls", 10, 430, 10, GRAY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,7 +91,7 @@ int main(void)
 | 
				
			|||||||
                int x = (int)(((float)i)/dpiScale.x);
 | 
					                int x = (int)(((float)i)/dpiScale.x);
 | 
				
			||||||
                if (odd) DrawRectangle(x, pixelGridTop, (int)cellSizePx, pixelGridBottom - pixelGridTop, CLITERAL(Color){ 0, 121, 241, 100 });
 | 
					                if (odd) DrawRectangle(x, pixelGridTop, (int)cellSizePx, pixelGridBottom - pixelGridTop, CLITERAL(Color){ 0, 121, 241, 100 });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                DrawLine(x, pixelGridTop, (int)(((float)i) / dpiScale.x), pixelGridLabelY - 10, GRAY);
 | 
					                DrawLine(x, pixelGridTop, (int)(((float)i)/dpiScale.x), pixelGridLabelY - 10, GRAY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if ((x - lastTextX) >= minTextSpace)
 | 
					                if ((x - lastTextX) >= minTextSpace)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ int main(void)
 | 
				
			|||||||
    //SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
 | 
					    //SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI);
 | 
				
			||||||
    InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
 | 
					    InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Vector2 ballPosition = { GetScreenWidth() / 2.0f, GetScreenHeight() / 2.0f };
 | 
					    Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
 | 
				
			||||||
    Vector2 ballSpeed = { 5.0f, 4.0f };
 | 
					    Vector2 ballSpeed = { 5.0f, 4.0f };
 | 
				
			||||||
    float ballRadius = 20;
 | 
					    float ballRadius = 20;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            EndMode3D();
 | 
					            EndMode3D();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DrawText("Enemy: 100 / 100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK);
 | 
					            DrawText("Enemy: 100/100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DrawText(TextFormat("Cube position in screen space coordinates: [%i, %i]", (int)cubeScreenPosition.x, (int)cubeScreenPosition.y), 10, 10, 20, LIME);
 | 
					            DrawText(TextFormat("Cube position in screen space coordinates: [%i, %i]", (int)cubeScreenPosition.x, (int)cubeScreenPosition.y), 10, 10, 20, LIME);
 | 
				
			||||||
            DrawText("Text 2d should be always on top of the cube", 10, 40, 20, GRAY);
 | 
					            DrawText("Text 2d should be always on top of the cube", 10, 40, 20, GRAY);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -127,8 +127,8 @@ int main(void)
 | 
				
			|||||||
		if (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE))
 | 
							if (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			const Vector2 mouseDelta = GetMouseDelta();
 | 
								const Vector2 mouseDelta = GetMouseDelta();
 | 
				
			||||||
			camerarot.x = mouseDelta.x * 0.05f;
 | 
								camerarot.x = mouseDelta.x*0.05f;
 | 
				
			||||||
			camerarot.y = mouseDelta.y * 0.05f;
 | 
								camerarot.y = mouseDelta.y*0.05f;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -138,14 +138,14 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		UpdateCameraPro(&camera,
 | 
							UpdateCameraPro(&camera,
 | 
				
			||||||
			(Vector3) {
 | 
								(Vector3) {
 | 
				
			||||||
			(IsKeyDown(KEY_W) || IsKeyDown(KEY_UP)) * 0.1f -      // Move forward-backward
 | 
								(IsKeyDown(KEY_W) || IsKeyDown(KEY_UP))*0.1f -      // Move forward-backward
 | 
				
			||||||
				(IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN)) * 0.1f,
 | 
									(IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f,
 | 
				
			||||||
				(IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT)) * 0.1f -   // Move right-left
 | 
									(IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT))*0.1f -   // Move right-left
 | 
				
			||||||
				(IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT)) * 0.1f,
 | 
									(IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT))*0.1f,
 | 
				
			||||||
				0.0f                                                // Move up-down
 | 
									0.0f                                                // Move up-down
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
			camerarot,
 | 
								camerarot,
 | 
				
			||||||
			GetMouseWheelMove() * -2.0f);                              // Move to target (zoom)
 | 
								GetMouseWheelMove()*-2.0f);                              // Move to target (zoom)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Cycle between models on mouse click
 | 
							// Cycle between models on mouse click
 | 
				
			||||||
		if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1) % MAX_VOX_FILES;
 | 
							if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1) % MAX_VOX_FILES;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,9 +79,9 @@ int main(void)
 | 
				
			|||||||
            // Projection from XYZW to XYZ from perspective point (0, 0, 0, 3)
 | 
					            // Projection from XYZW to XYZ from perspective point (0, 0, 0, 3)
 | 
				
			||||||
            // NOTE: Trace a ray from (0, 0, 0, 3) > p and continue until W = 0
 | 
					            // NOTE: Trace a ray from (0, 0, 0, 3) > p and continue until W = 0
 | 
				
			||||||
            float c = 3.0f/(3.0f - p.w);
 | 
					            float c = 3.0f/(3.0f - p.w);
 | 
				
			||||||
            p.x = c * p.x;
 | 
					            p.x = c*p.x;
 | 
				
			||||||
            p.y = c * p.y;
 | 
					            p.y = c*p.y;
 | 
				
			||||||
            p.z = c * p.z;
 | 
					            p.z = c*p.z;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Split XYZ coordinate and W values later for drawing
 | 
					            // Split XYZ coordinate and W values later for drawing
 | 
				
			||||||
            transformed[i] = (Vector3){ p.x, p.y, p.z };
 | 
					            transformed[i] = (Vector3){ p.x, p.y, p.z };
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ void main()
 | 
				
			|||||||
                light = normalize(lights[i].position - fragPosition);
 | 
					                light = normalize(lights[i].position - fragPosition);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            float NdotL = max(dot(normal, light), 0.0);
 | 
					            float NdotL = max(dot(normal, light), 0.0);
 | 
				
			||||||
            lightDot += lights[i].color.rgb * NdotL;
 | 
					            lightDot += lights[i].color.rgb*NdotL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (NdotL > 0.0)
 | 
					            if (NdotL > 0.0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -56,8 +56,8 @@ void main()
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vec4 finalColor = (fragColor * ((colDiffuse + vec4(specular, 1.0)) * vec4(lightDot, 1.0)));
 | 
					    vec4 finalColor = (fragColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
 | 
				
			||||||
    finalColor += fragColor * (ambient / 10.0) * colDiffuse;
 | 
					    finalColor += fragColor*(ambient/10.0)*colDiffuse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    finalColor = pow(finalColor, vec4(1.0/2.2)); // gamma correction
 | 
					    finalColor = pow(finalColor, vec4(1.0/2.2)); // gamma correction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,9 +20,9 @@ varying vec3 fragNormal;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void main()
 | 
					void main()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    fragPosition = vec3(matModel * vec4(vertexPosition, 1.0));
 | 
					    fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
 | 
				
			||||||
    fragColor = vertexColor;
 | 
					    fragColor = vertexColor;
 | 
				
			||||||
    fragNormal = normalize(vec3(matNormal * vec4(vertexNormal, 1.0)));
 | 
					    fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gl_Position = mvp * vec4(vertexPosition, 1.0);
 | 
					    gl_Position = mvp*vec4(vertexPosition, 1.0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,7 @@ void main()
 | 
				
			|||||||
                light = normalize(lights[i].position - fragPosition);
 | 
					                light = normalize(lights[i].position - fragPosition);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            float NdotL = max(dot(normal, light), 0.0);
 | 
					            float NdotL = max(dot(normal, light), 0.0);
 | 
				
			||||||
            lightDot += lights[i].color.rgb * NdotL;
 | 
					            lightDot += lights[i].color.rgb*NdotL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (NdotL > 0.0)
 | 
					            if (NdotL > 0.0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -53,8 +53,8 @@ void main()
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vec4 finalColor = (fragColor * ((colDiffuse + vec4(specular, 1.0)) * vec4(lightDot, 1.0)));
 | 
					    vec4 finalColor = (fragColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
 | 
				
			||||||
    finalColor += fragColor * (ambient / 10.0) * colDiffuse;
 | 
					    finalColor += fragColor*(ambient/10.0)*colDiffuse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    finalColor = pow(finalColor, vec4(1.0/2.2)); // gamma correction
 | 
					    finalColor = pow(finalColor, vec4(1.0/2.2)); // gamma correction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,9 +16,9 @@ varying vec3 fragNormal;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void main()
 | 
					void main()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    fragPosition = vec3(matModel * vec4(vertexPosition, 1.0));
 | 
					    fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
 | 
				
			||||||
    fragColor = vertexColor;
 | 
					    fragColor = vertexColor;
 | 
				
			||||||
    fragNormal = normalize(vec3(matNormal * vec4(vertexNormal, 1.0)));
 | 
					    fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gl_Position = mvp * vec4(vertexPosition, 1.0);
 | 
					    gl_Position = mvp*vec4(vertexPosition, 1.0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -297,7 +297,7 @@ static void DrawRectangleV(Vector2 position, Vector2 size, Color color)
 | 
				
			|||||||
// Draw a grid centered at (0, 0, 0)
 | 
					// Draw a grid centered at (0, 0, 0)
 | 
				
			||||||
static void DrawGrid(int slices, float spacing)
 | 
					static void DrawGrid(int slices, float spacing)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int halfSlices = slices / 2;
 | 
					    int halfSlices = slices/2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rlBegin(RL_LINES);
 | 
					    rlBegin(RL_LINES);
 | 
				
			||||||
        for (int i = -halfSlices; i <= halfSlices; i++)
 | 
					        for (int i = -halfSlices; i <= halfSlices; i++)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,22 +1,22 @@
 | 
				
			|||||||
/*******************************************************************************************
 | 
					/*******************************************************************************************
 | 
				
			||||||
 *
 | 
					*
 | 
				
			||||||
 *  raylib [shaders] example - normal map
 | 
					* raylib [shaders] example - normal map
 | 
				
			||||||
 *
 | 
					*
 | 
				
			||||||
 *   Example complexity rating: [★★★★] 4/4
 | 
					*  Example complexity rating: [★★★★] 4/4
 | 
				
			||||||
 *
 | 
					*
 | 
				
			||||||
 *   NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
 | 
					*  NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
 | 
				
			||||||
 *         OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
 | 
					*        OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
 | 
				
			||||||
 *
 | 
					*
 | 
				
			||||||
 *   Example originally created with raylib 5.6, last time updated with raylib 5.6
 | 
					*  Example originally created with raylib 5.6, last time updated with raylib 5.6
 | 
				
			||||||
 *
 | 
					*
 | 
				
			||||||
 *   Example contributed by Jeremy Montgomery (@Sir_Irk) and reviewed by Ramon Santamaria (@raysan5)
 | 
					*  Example contributed by Jeremy Montgomery (@Sir_Irk) and reviewed by Ramon Santamaria (@raysan5)
 | 
				
			||||||
 *
 | 
					*
 | 
				
			||||||
 *   Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
 | 
					*  Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
 | 
				
			||||||
 *   BSD-like license that allows static linking with closed source software
 | 
					*  BSD-like license that allows static linking with closed source software
 | 
				
			||||||
 *
 | 
					*
 | 
				
			||||||
 *   Copyright (c) 2025-2025 Jeremy Montgomery (@Sir_Irk) and Ramon Santamaria (@raysan5)
 | 
					*  Copyright (c) 2025-2025 Jeremy Montgomery (@Sir_Irk) and Ramon Santamaria (@raysan5)
 | 
				
			||||||
 *k
 | 
					*
 | 
				
			||||||
 ********************************************************************************************/
 | 
					********************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <raylib.h>
 | 
					#include <raylib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -115,22 +115,22 @@ int main(void)
 | 
				
			|||||||
        if (IsKeyDown(KEY_LEFT))
 | 
					        if (IsKeyDown(KEY_LEFT))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (lightDir.x < 0.6f)
 | 
					            if (lightDir.x < 0.6f)
 | 
				
			||||||
                lightDir.x += cameraSpeed * 60.0f * dt;
 | 
					                lightDir.x += cameraSpeed*60.0f*dt;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (IsKeyDown(KEY_RIGHT))
 | 
					        if (IsKeyDown(KEY_RIGHT))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (lightDir.x > -0.6f)
 | 
					            if (lightDir.x > -0.6f)
 | 
				
			||||||
                lightDir.x -= cameraSpeed * 60.0f * dt;
 | 
					                lightDir.x -= cameraSpeed*60.0f*dt;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (IsKeyDown(KEY_UP))
 | 
					        if (IsKeyDown(KEY_UP))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (lightDir.z < 0.6f)
 | 
					            if (lightDir.z < 0.6f)
 | 
				
			||||||
                lightDir.z += cameraSpeed * 60.0f * dt;
 | 
					                lightDir.z += cameraSpeed*60.0f*dt;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (IsKeyDown(KEY_DOWN))
 | 
					        if (IsKeyDown(KEY_DOWN))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (lightDir.z > -0.6f)
 | 
					            if (lightDir.z > -0.6f)
 | 
				
			||||||
                lightDir.z -= cameraSpeed * 60.0f * dt;
 | 
					                lightDir.z -= cameraSpeed*60.0f*dt;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        lightDir = Vector3Normalize(lightDir);
 | 
					        lightDir = Vector3Normalize(lightDir);
 | 
				
			||||||
        lightCam.position = Vector3Scale(lightDir, -15.0f);
 | 
					        lightCam.position = Vector3Scale(lightDir, -15.0f);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,12 +130,12 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        while ((fabs(spots[i].speed.x) + fabs(spots[i].speed.y)) < 2)
 | 
					        while ((fabs(spots[i].speed.x) + fabs(spots[i].speed.y)) < 2)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            spots[i].speed.x = GetRandomValue(-400, 40) / 10.0f;
 | 
					            spots[i].speed.x = GetRandomValue(-400, 40)/10.0f;
 | 
				
			||||||
            spots[i].speed.y = GetRandomValue(-400, 40) / 10.0f;
 | 
					            spots[i].speed.y = GetRandomValue(-400, 40)/10.0f;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        spots[i].inner = 28.0f * (i + 1);
 | 
					        spots[i].inner = 28.0f*(i + 1);
 | 
				
			||||||
        spots[i].radius = 48.0f * (i + 1);
 | 
					        spots[i].radius = 48.0f*(i + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SetShaderValue(shdrSpot, spots[i].positionLoc, &spots[i].position.x, SHADER_UNIFORM_VEC2);
 | 
					        SetShaderValue(shdrSpot, spots[i].positionLoc, &spots[i].position.x, SHADER_UNIFORM_VEC2);
 | 
				
			||||||
        SetShaderValue(shdrSpot, spots[i].innerLoc, &spots[i].inner, SHADER_UNIFORM_FLOAT);
 | 
					        SetShaderValue(shdrSpot, spots[i].innerLoc, &spots[i].inner, SHADER_UNIFORM_FLOAT);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -133,7 +133,7 @@ int main(void)
 | 
				
			|||||||
static void UpdateClock(Clock *clock)
 | 
					static void UpdateClock(Clock *clock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    time_t rawtime;
 | 
					    time_t rawtime;
 | 
				
			||||||
    struct tm * timeinfo;
 | 
					    struct tm *timeinfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    time(&rawtime);
 | 
					    time(&rawtime);
 | 
				
			||||||
    timeinfo = localtime(&rawtime);
 | 
					    timeinfo = localtime(&rawtime);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,8 +46,8 @@ int main(void)
 | 
				
			|||||||
    InitWindow(screenWidth, screenHeight, "raylib [shapes] example - double pendulum");
 | 
					    InitWindow(screenWidth, screenHeight, "raylib [shapes] example - double pendulum");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Simulation Paramters
 | 
					    // Simulation Paramters
 | 
				
			||||||
    float l1 = 15, m1 = 0.2, theta1 = DEG2RAD * 170, w1 = 0;
 | 
					    float l1 = 15, m1 = 0.2, theta1 = DEG2RAD*170, w1 = 0;
 | 
				
			||||||
    float l2 = 15, m2 = 0.1, theta2 = DEG2RAD * 0, w2 = 0;
 | 
					    float l2 = 15, m2 = 0.1, theta2 = DEG2RAD*0, w2 = 0;
 | 
				
			||||||
    float lengthScaler = 0.1;
 | 
					    float lengthScaler = 0.1;
 | 
				
			||||||
    float totalM = m1 + m2;
 | 
					    float totalM = m1 + m2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -56,8 +56,8 @@ int main(void)
 | 
				
			|||||||
    previousPosition.y += (screenHeight/2 - 100);
 | 
					    previousPosition.y += (screenHeight/2 - 100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Scale length
 | 
					    // Scale length
 | 
				
			||||||
    float L1 = l1 * lengthScaler;
 | 
					    float L1 = l1*lengthScaler;
 | 
				
			||||||
    float L2 = l2 * lengthScaler;
 | 
					    float L2 = l2*lengthScaler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Draw parameters
 | 
					    // Draw parameters
 | 
				
			||||||
    int lineThick = 20, trailThick = 2;
 | 
					    int lineThick = 20, trailThick = 2;
 | 
				
			||||||
@@ -76,26 +76,26 @@ int main(void)
 | 
				
			|||||||
        // Update
 | 
					        // Update
 | 
				
			||||||
        //----------------------------------------------------------------------------------
 | 
					        //----------------------------------------------------------------------------------
 | 
				
			||||||
        float dt = GetFrameTime();
 | 
					        float dt = GetFrameTime();
 | 
				
			||||||
        float step = dt / SIMULATION_STEPS, step2 = step * step;
 | 
					        float step = dt/SIMULATION_STEPS, step2 = step*step;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Update Physics - larger steps = better approximation
 | 
					        // Update Physics - larger steps = better approximation
 | 
				
			||||||
        for (int i = 0; i < SIMULATION_STEPS; ++i)
 | 
					        for (int i = 0; i < SIMULATION_STEPS; ++i)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            float delta = theta1 - theta2;
 | 
					            float delta = theta1 - theta2;
 | 
				
			||||||
            float sinD = sinf(delta), cosD = cosf(delta), cos2D = cosf(2*delta);
 | 
					            float sinD = sinf(delta), cosD = cosf(delta), cos2D = cosf(2*delta);
 | 
				
			||||||
            float ww1 = w1 * w1, ww2 = w2 * w2;
 | 
					            float ww1 = w1*w1, ww2 = w2*w2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Calculate a1
 | 
					            // Calculate a1
 | 
				
			||||||
            float a1 = (-G*(2*m1 + m2)*sinf(theta1)
 | 
					            float a1 = (-G*(2*m1 + m2)*sinf(theta1)
 | 
				
			||||||
                         - m2*G*sinf(theta1 - 2*theta2)
 | 
					                         - m2*G*sinf(theta1 - 2*theta2)
 | 
				
			||||||
                         - 2*sinD*m2*(ww2*L2 + ww1*L1*cosD))
 | 
					                         - 2*sinD*m2*(ww2*L2 + ww1*L1*cosD))
 | 
				
			||||||
                         / (L1*(2*m1 + m2 - m2*cos2D));
 | 
					                        /(L1*(2*m1 + m2 - m2*cos2D));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Calculate a2
 | 
					            // Calculate a2
 | 
				
			||||||
            float a2 = (2*sinD*(ww1*L1*totalM
 | 
					            float a2 = (2*sinD*(ww1*L1*totalM
 | 
				
			||||||
                         + G*totalM*cosf(theta1)
 | 
					                         + G*totalM*cosf(theta1)
 | 
				
			||||||
                         + ww2*L2*m2*cosD))
 | 
					                         + ww2*L2*m2*cosD))
 | 
				
			||||||
                         / (L2*(2*m1 + m2 - m2*cos2D));
 | 
					                        /(L2*(2*m1 + m2 - m2*cos2D));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Update thetas
 | 
					            // Update thetas
 | 
				
			||||||
            theta1 += w1*step + 0.5f*a1*step2;
 | 
					            theta1 += w1*step + 0.5f*a1*step2;
 | 
				
			||||||
@@ -118,7 +118,7 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // Draw trail
 | 
					            // Draw trail
 | 
				
			||||||
            DrawCircleV(previousPosition, trailThick, RED);
 | 
					            DrawCircleV(previousPosition, trailThick, RED);
 | 
				
			||||||
            DrawLineEx(previousPosition, currentPosition, trailThick * 2, RED);
 | 
					            DrawLineEx(previousPosition, currentPosition, trailThick*2, RED);
 | 
				
			||||||
        EndTextureMode();
 | 
					        EndTextureMode();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Update previous position
 | 
					        // Update previous position
 | 
				
			||||||
@@ -135,12 +135,12 @@ int main(void)
 | 
				
			|||||||
            DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
 | 
					            DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Draw double pendulum
 | 
					            // Draw double pendulum
 | 
				
			||||||
            DrawRectanglePro((Rectangle){ screenWidth/2, screenHeight/2 - 100, 10 * l1, lineThick },
 | 
					            DrawRectanglePro((Rectangle){ screenWidth/2, screenHeight/2 - 100, 10*l1, lineThick },
 | 
				
			||||||
                (Vector2){0, lineThick * 0.5}, 90 - RAD2DEG * theta1, RAYWHITE);
 | 
					                (Vector2){0, lineThick*0.5}, 90 - RAD2DEG*theta1, RAYWHITE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Vector2 endpoint1 = CalculatePendulumEndPoint(l1, theta1);
 | 
					            Vector2 endpoint1 = CalculatePendulumEndPoint(l1, theta1);
 | 
				
			||||||
            DrawRectanglePro((Rectangle){ screenWidth/2 + endpoint1.x, screenHeight/2 - 100 + endpoint1.y, 10 * l2, lineThick },
 | 
					            DrawRectanglePro((Rectangle){ screenWidth/2 + endpoint1.x, screenHeight/2 - 100 + endpoint1.y, 10*l2, lineThick },
 | 
				
			||||||
                (Vector2){0, lineThick * 0.5}, 90 - RAD2DEG * theta2, RAYWHITE);
 | 
					                (Vector2){0, lineThick*0.5}, 90 - RAD2DEG*theta2, RAYWHITE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        EndDrawing();
 | 
					        EndDrawing();
 | 
				
			||||||
        //----------------------------------------------------------------------------------
 | 
					        //----------------------------------------------------------------------------------
 | 
				
			||||||
@@ -159,7 +159,7 @@ int main(void)
 | 
				
			|||||||
// Calculate Pendulum End Point
 | 
					// Calculate Pendulum End Point
 | 
				
			||||||
static Vector2 CalculatePendulumEndPoint(float l, float theta)
 | 
					static Vector2 CalculatePendulumEndPoint(float l, float theta)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (Vector2){ 10 * l * sin(theta), 10 * l * cos(theta) };
 | 
					    return (Vector2){ 10*l*sin(theta), 10*l*cos(theta) };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Calculate Double Pendulum End Point
 | 
					// Calculate Double Pendulum End Point
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ int main(void)
 | 
				
			|||||||
            GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", TextFormat("%.2f", segments), &segments, 0, 100);
 | 
					            GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", TextFormat("%.2f", segments), &segments, 0, 100);
 | 
				
			||||||
            //------------------------------------------------------------------------------
 | 
					            //------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            minSegments = truncf(ceilf((endAngle - startAngle) / 90));
 | 
					            minSegments = truncf(ceilf((endAngle - startAngle)/90));
 | 
				
			||||||
            DrawText(TextFormat("MODE: %s", (segments >= minSegments)? "MANUAL" : "AUTO"), 600, 200, 10, (segments >= minSegments)? MAROON : DARKGRAY);
 | 
					            DrawText(TextFormat("MODE: %s", (segments >= minSegments)? "MANUAL" : "AUTO"), 600, 200, 10, (segments >= minSegments)? MAROON : DARKGRAY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DrawFPS(10, 10);
 | 
					            DrawFPS(10, 10);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,8 +46,8 @@ int main(void)
 | 
				
			|||||||
        //----------------------------------------------------------------------------------
 | 
					        //----------------------------------------------------------------------------------
 | 
				
			||||||
        float width = GetScreenWidth()/2.0f, height = GetScreenHeight()/6.0f;
 | 
					        float width = GetScreenWidth()/2.0f, height = GetScreenHeight()/6.0f;
 | 
				
			||||||
        Rectangle rec = {
 | 
					        Rectangle rec = {
 | 
				
			||||||
            GetScreenWidth() / 2.0f - width/2,
 | 
					            GetScreenWidth()/2.0f - width/2,
 | 
				
			||||||
            GetScreenHeight() / 2.0f - 5*(height/2),
 | 
					            GetScreenHeight()/2.0f - 5*(height/2),
 | 
				
			||||||
            width, height
 | 
					            width, height
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        //--------------------------------------------------------------------------------------
 | 
					        //--------------------------------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -129,8 +129,8 @@ void SetupLight(int slot, float x, float y, float radius)
 | 
				
			|||||||
    lights[slot].mask = LoadRenderTexture(GetScreenWidth(), GetScreenHeight());
 | 
					    lights[slot].mask = LoadRenderTexture(GetScreenWidth(), GetScreenHeight());
 | 
				
			||||||
    lights[slot].outerRadius = radius;
 | 
					    lights[slot].outerRadius = radius;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    lights[slot].bounds.width = radius * 2;
 | 
					    lights[slot].bounds.width = radius*2;
 | 
				
			||||||
    lights[slot].bounds.height = radius * 2;
 | 
					    lights[slot].bounds.height = radius*2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    MoveLight(slot, x, y);
 | 
					    MoveLight(slot, x, y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -248,7 +248,7 @@ int main(void)
 | 
				
			|||||||
                if (sz.x > 300) { sz.y *= sz.x/300; sz.x = 300; }
 | 
					                if (sz.x > 300) { sz.y *= sz.x/300; sz.x = 300; }
 | 
				
			||||||
                else if (sz.x < 160) sz.x = 160;
 | 
					                else if (sz.x < 160) sz.x = 160;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Rectangle msgRect = { selectedPos.x - 38.8f, selectedPos.y, 2 * horizontalPadding + sz.x, 2 * verticalPadding + sz.y };
 | 
					                Rectangle msgRect = { selectedPos.x - 38.8f, selectedPos.y, 2*horizontalPadding + sz.x, 2*verticalPadding + sz.y };
 | 
				
			||||||
                msgRect.y -= msgRect.height;
 | 
					                msgRect.y -= msgRect.height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // Coordinates for the chat bubble triangle
 | 
					                // Coordinates for the chat bubble triangle
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,10 +78,10 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            switch (blendMode)
 | 
					            switch (blendMode)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                case BLEND_ALPHA: DrawText("Current: BLEND_ALPHA", (screenWidth / 2) - 60, 370, 10, GRAY); break;
 | 
					                case BLEND_ALPHA: DrawText("Current: BLEND_ALPHA", (screenWidth/2) - 60, 370, 10, GRAY); break;
 | 
				
			||||||
                case BLEND_ADDITIVE: DrawText("Current: BLEND_ADDITIVE", (screenWidth / 2) - 60, 370, 10, GRAY); break;
 | 
					                case BLEND_ADDITIVE: DrawText("Current: BLEND_ADDITIVE", (screenWidth/2) - 60, 370, 10, GRAY); break;
 | 
				
			||||||
                case BLEND_MULTIPLIED: DrawText("Current: BLEND_MULTIPLIED", (screenWidth / 2) - 60, 370, 10, GRAY); break;
 | 
					                case BLEND_MULTIPLIED: DrawText("Current: BLEND_MULTIPLIED", (screenWidth/2) - 60, 370, 10, GRAY); break;
 | 
				
			||||||
                case BLEND_ADD_COLORS: DrawText("Current: BLEND_ADD_COLORS", (screenWidth / 2) - 60, 370, 10, GRAY); break;
 | 
					                case BLEND_ADD_COLORS: DrawText("Current: BLEND_ADD_COLORS", (screenWidth/2) - 60, 370, 10, GRAY); break;
 | 
				
			||||||
                default: break;
 | 
					                default: break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,10 +64,10 @@ int main(void)
 | 
				
			|||||||
    Rectangle fudesumiRec = {0, 0, fudesumiImage.width, fudesumiImage.height};
 | 
					    Rectangle fudesumiRec = {0, 0, fudesumiImage.width, fudesumiImage.height};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Rectangle fudesumiPos = {50, 10, fudesumiImage.width*0.8f, fudesumiImage.height*0.8f};
 | 
					    Rectangle fudesumiPos = {50, 10, fudesumiImage.width*0.8f, fudesumiImage.height*0.8f};
 | 
				
			||||||
    Rectangle redPos = { 410, 10, fudesumiPos.width / 2, fudesumiPos.height / 2 };
 | 
					    Rectangle redPos = { 410, 10, fudesumiPos.width/2, fudesumiPos.height/2 };
 | 
				
			||||||
    Rectangle greenPos = { 600, 10, fudesumiPos.width / 2, fudesumiPos.height / 2 };
 | 
					    Rectangle greenPos = { 600, 10, fudesumiPos.width/2, fudesumiPos.height/2 };
 | 
				
			||||||
    Rectangle bluePos = { 410, 230, fudesumiPos.width / 2, fudesumiPos.height / 2 };
 | 
					    Rectangle bluePos = { 410, 230, fudesumiPos.width/2, fudesumiPos.height/2 };
 | 
				
			||||||
    Rectangle alphaPos = { 600, 230, fudesumiPos.width / 2, fudesumiPos.height / 2 };
 | 
					    Rectangle alphaPos = { 600, 230, fudesumiPos.width/2, fudesumiPos.height/2 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SetTargetFPS(60);               // Set our game to run at 60 frames-per-second
 | 
					    SetTargetFPS(60);               // Set our game to run at 60 frames-per-second
 | 
				
			||||||
    //--------------------------------------------------------------------------------------
 | 
					    //--------------------------------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,8 +18,8 @@ int main() {
 | 
				
			|||||||
    SetTargetFPS(60);
 | 
					    SetTargetFPS(60);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while (!WindowShouldClose()) {
 | 
					    while (!WindowShouldClose()) {
 | 
				
			||||||
        cam.position.x = sin(GetTime()) * 10.0f;
 | 
					        cam.position.x = sin(GetTime())*10.0f;
 | 
				
			||||||
        cam.position.z = cos(GetTime()) * 10.0f;
 | 
					        cam.position.z = cos(GetTime())*10.0f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        BeginDrawing();
 | 
					        BeginDrawing();
 | 
				
			||||||
            ClearBackground(RAYWHITE);
 | 
					            ClearBackground(RAYWHITE);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								src/external/rl_gputex.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								src/external/rl_gputex.h
									
									
									
									
										vendored
									
									
								
							@@ -288,7 +288,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
 | 
				
			|||||||
                if (header->ddspf.flags == 0x40)        // No alpha channel
 | 
					                if (header->ddspf.flags == 0x40)        // No alpha channel
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    int data_size = image_pixel_size*sizeof(unsigned short);
 | 
					                    int data_size = image_pixel_size*sizeof(unsigned short);
 | 
				
			||||||
                    if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
 | 
					                    if (header->mipmap_count > 1) data_size = data_size + data_size/3;
 | 
				
			||||||
                    image_data = RL_GPUTEX_MALLOC(data_size);
 | 
					                    image_data = RL_GPUTEX_MALLOC(data_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
					                    RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
				
			||||||
@@ -300,7 +300,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
 | 
				
			|||||||
                    if (header->ddspf.a_bit_mask == 0x8000)     // 1bit alpha
 | 
					                    if (header->ddspf.a_bit_mask == 0x8000)     // 1bit alpha
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        int data_size = image_pixel_size*sizeof(unsigned short);
 | 
					                        int data_size = image_pixel_size*sizeof(unsigned short);
 | 
				
			||||||
                        if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
 | 
					                        if (header->mipmap_count > 1) data_size = data_size + data_size/3;
 | 
				
			||||||
                        image_data = RL_GPUTEX_MALLOC(data_size);
 | 
					                        image_data = RL_GPUTEX_MALLOC(data_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
					                        RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
				
			||||||
@@ -320,7 +320,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
 | 
				
			|||||||
                    else if (header->ddspf.a_bit_mask == 0xf000)   // 4bit alpha
 | 
					                    else if (header->ddspf.a_bit_mask == 0xf000)   // 4bit alpha
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        int data_size = image_pixel_size*sizeof(unsigned short);
 | 
					                        int data_size = image_pixel_size*sizeof(unsigned short);
 | 
				
			||||||
                        if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
 | 
					                        if (header->mipmap_count > 1) data_size = data_size + data_size/3;
 | 
				
			||||||
                        image_data = RL_GPUTEX_MALLOC(data_size);
 | 
					                        image_data = RL_GPUTEX_MALLOC(data_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
					                        RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
				
			||||||
@@ -342,7 +342,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
 | 
				
			|||||||
            else if ((header->ddspf.flags == 0x40) && (header->ddspf.rgb_bit_count == 24))   // DDS_RGB, no compressed
 | 
					            else if ((header->ddspf.flags == 0x40) && (header->ddspf.rgb_bit_count == 24))   // DDS_RGB, no compressed
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                int data_size = image_pixel_size*3*sizeof(unsigned char);
 | 
					                int data_size = image_pixel_size*3*sizeof(unsigned char);
 | 
				
			||||||
                if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
 | 
					                if (header->mipmap_count > 1) data_size = data_size + data_size/3;
 | 
				
			||||||
                image_data = RL_GPUTEX_MALLOC(data_size);
 | 
					                image_data = RL_GPUTEX_MALLOC(data_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
					                RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
				
			||||||
@@ -352,7 +352,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
 | 
				
			|||||||
            else if ((header->ddspf.flags == 0x41) && (header->ddspf.rgb_bit_count == 32)) // DDS_RGBA, no compressed
 | 
					            else if ((header->ddspf.flags == 0x41) && (header->ddspf.rgb_bit_count == 32)) // DDS_RGBA, no compressed
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                int data_size = image_pixel_size*4*sizeof(unsigned char);
 | 
					                int data_size = image_pixel_size*4*sizeof(unsigned char);
 | 
				
			||||||
                if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
 | 
					                if (header->mipmap_count > 1) data_size = data_size + data_size/3;
 | 
				
			||||||
                image_data = RL_GPUTEX_MALLOC(data_size);
 | 
					                image_data = RL_GPUTEX_MALLOC(data_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
					                RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
 | 
				
			||||||
@@ -376,7 +376,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
 | 
				
			|||||||
                int data_size = 0;
 | 
					                int data_size = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // Calculate data size, including all mipmaps
 | 
					                // Calculate data size, including all mipmaps
 | 
				
			||||||
                if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size + header->pitch_or_linear_size / 3;
 | 
					                if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size + header->pitch_or_linear_size/3;
 | 
				
			||||||
                else data_size = header->pitch_or_linear_size;
 | 
					                else data_size = header->pitch_or_linear_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                image_data = RL_GPUTEX_MALLOC(data_size*sizeof(unsigned char));
 | 
					                image_data = RL_GPUTEX_MALLOC(data_size*sizeof(unsigned char));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1041,8 +1041,8 @@ void PollInputEvents(void)
 | 
				
			|||||||
                // if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
 | 
					                // if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
 | 
				
			||||||
                if (IsWindowState(FLAG_WINDOW_HIGHDPI))
 | 
					                if (IsWindowState(FLAG_WINDOW_HIGHDPI))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    CORE.Window.screen.width = (int)(platform.window->r.w / GetWindowScaleDPI().x);
 | 
					                    CORE.Window.screen.width = (int)(platform.window->r.w/GetWindowScaleDPI().x);
 | 
				
			||||||
                    CORE.Window.screen.height = (int)(platform.window->r.h / GetWindowScaleDPI().y);
 | 
					                    CORE.Window.screen.height = (int)(platform.window->r.h/GetWindowScaleDPI().y);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -1207,13 +1207,13 @@ void PollInputEvents(void)
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    case 0:
 | 
					                    case 0:
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_X] = event->axis[0].x / 100.0f;
 | 
					                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_X] = event->axis[0].x/100.0f;
 | 
				
			||||||
                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_Y] = event->axis[0].y / 100.0f;
 | 
					                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_Y] = event->axis[0].y/100.0f;
 | 
				
			||||||
                    } break;
 | 
					                    } break;
 | 
				
			||||||
                    case 1:
 | 
					                    case 1:
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_X] = event->axis[1].x / 100.0f;
 | 
					                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_X] = event->axis[1].x/100.0f;
 | 
				
			||||||
                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y / 100.0f;
 | 
					                        CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y/100.0f;
 | 
				
			||||||
                    } break;
 | 
					                    } break;
 | 
				
			||||||
                    case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER;
 | 
					                    case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER;
 | 
				
			||||||
                    case 3:
 | 
					                    case 3:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1485,8 +1485,8 @@ void PollInputEvents(void)
 | 
				
			|||||||
                        // if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
 | 
					                        // if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
 | 
				
			||||||
                        if (IsWindowState(FLAG_WINDOW_HIGHDPI))
 | 
					                        if (IsWindowState(FLAG_WINDOW_HIGHDPI))
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            CORE.Window.screen.width = (int)(width / GetWindowScaleDPI().x);
 | 
					                            CORE.Window.screen.width = (int)(width/GetWindowScaleDPI().x);
 | 
				
			||||||
                            CORE.Window.screen.height = (int)(height / GetWindowScaleDPI().y);
 | 
					                            CORE.Window.screen.height = (int)(height/GetWindowScaleDPI().y);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else
 | 
					                        else
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3722,7 +3722,7 @@ void GenMeshTangents(Mesh *mesh)
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Gram-Schmidt orthogonalization to make tangent orthogonal to normal
 | 
					        // Gram-Schmidt orthogonalization to make tangent orthogonal to normal
 | 
				
			||||||
        // T_prime = T - N * dot(N, T)
 | 
					        // T_prime = T - N*dot(N, T)
 | 
				
			||||||
        Vector3 orthogonalized = Vector3Subtract(tangent, Vector3Scale(normal, Vector3DotProduct(normal, tangent)));
 | 
					        Vector3 orthogonalized = Vector3Subtract(tangent, Vector3Scale(normal, Vector3DotProduct(normal, tangent)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Handle cases where orthogonalized vector is too small
 | 
					        // Handle cases where orthogonalized vector is too small
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user