mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-14 02:22:34 +00:00
REVIEWED: examples: Replace TABS and Remove trailing spaces
This commit is contained in:
@@ -87,15 +87,15 @@ int main(void)
|
||||
DrawTexture(fudesumi, 500, -30, WHITE);
|
||||
DrawTextureV(raysan, circlePos, WHITE);
|
||||
EndTextureMode();
|
||||
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginShaderMode(shader);
|
||||
// Draw the scene texture (that we rendered earlier) to the screen
|
||||
// The shader will process every pixel of this texture
|
||||
DrawTextureRec(target.texture,
|
||||
(Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height },
|
||||
DrawTextureRec(target.texture,
|
||||
(Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height },
|
||||
(Vector2){ 0, 0 }, WHITE);
|
||||
EndShaderMode();
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ int main(void)
|
||||
SetShaderValue(shader, emissiveColorLoc, &carEmissiveColor, SHADER_UNIFORM_VEC4);
|
||||
float emissiveIntensity = 0.01f;
|
||||
SetShaderValue(shader, emissiveIntensityLoc, &emissiveIntensity, SHADER_UNIFORM_FLOAT);
|
||||
|
||||
|
||||
// Set old car metallic and roughness values
|
||||
SetShaderValue(shader, metallicValueLoc, &car.materials[0].maps[MATERIAL_MAP_METALNESS].value, SHADER_UNIFORM_FLOAT);
|
||||
SetShaderValue(shader, roughnessValueLoc, &car.materials[0].maps[MATERIAL_MAP_ROUGHNESS].value, SHADER_UNIFORM_FLOAT);
|
||||
@@ -252,7 +252,7 @@ int main(void)
|
||||
// Draw spheres to show the lights positions
|
||||
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||
{
|
||||
Color lightColor = (Color){
|
||||
Color lightColor = (Color){
|
||||
(unsigned char)(lights[i].color[0]*255),
|
||||
(unsigned char)(lights[i].color[1] * 255),
|
||||
(unsigned char)(lights[i].color[2] * 255),
|
||||
|
||||
@@ -124,7 +124,7 @@ int main(void)
|
||||
);
|
||||
BeginBlendMode(BLEND_ALPHA);
|
||||
EndTextureMode();
|
||||
|
||||
|
||||
// NOTE: To enable trilinear filtering we need mipmaps available for texture
|
||||
GenTextureMipmaps(&lightmap.texture);
|
||||
SetTextureFilter(lightmap.texture, TEXTURE_FILTER_TRILINEAR);
|
||||
@@ -143,7 +143,7 @@ int main(void)
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
@@ -155,7 +155,7 @@ int main(void)
|
||||
(Vector2){ 0.0, 0.0 }, 0.0, WHITE);
|
||||
|
||||
DrawText(TextFormat("LIGHTMAP: %ix%i pixels", MAP_SIZE, MAP_SIZE), GetRenderWidth() - 130, 20 + MAP_SIZE*8, 10, GREEN);
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
|
||||
@@ -45,7 +45,7 @@ int main(void)
|
||||
// Shadows are a HUGE topic, and this example shows an extremely simple implementation of the shadowmapping algorithm,
|
||||
// which is the industry standard for shadows. This algorithm can be extended in a ridiculous number of ways to improve
|
||||
// realism and also adapt it for different scenes. This is pretty much the simplest possible implementation
|
||||
|
||||
|
||||
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shadowmap rendering");
|
||||
|
||||
@@ -59,7 +59,7 @@ int main(void)
|
||||
Shader shadowShader = LoadShader(TextFormat("resources/shaders/glsl%i/shadowmap.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/shadowmap.fs", GLSL_VERSION));
|
||||
shadowShader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shadowShader, "viewPos");
|
||||
|
||||
|
||||
Vector3 lightDir = Vector3Normalize((Vector3){ 0.35f, -1.0f, -0.35f });
|
||||
Color lightColor = WHITE;
|
||||
Vector4 lightColorNormalized = ColorNormalize(lightColor);
|
||||
@@ -83,7 +83,7 @@ int main(void)
|
||||
ModelAnimation *robotAnimations = LoadModelAnimations("resources/models/robot.glb", &animCount);
|
||||
|
||||
RenderTexture2D shadowMap = LoadShadowmapRenderTexture(SHADOWMAP_RESOLUTION, SHADOWMAP_RESOLUTION);
|
||||
|
||||
|
||||
// For the shadowmapping algorithm, we will be rendering everything from the light's point of view
|
||||
Camera3D lightCamera = { 0 };
|
||||
lightCamera.position = Vector3Scale(lightDir, -15.0f);
|
||||
@@ -91,9 +91,9 @@ int main(void)
|
||||
lightCamera.projection = CAMERA_ORTHOGRAPHIC; // Use an orthographic projection for directional lights
|
||||
lightCamera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||
lightCamera.fovy = 20.0f;
|
||||
|
||||
|
||||
int frameCounter = 0;
|
||||
|
||||
|
||||
// Store the light matrices
|
||||
Matrix lightView = { 0 };
|
||||
Matrix lightProj = { 0 };
|
||||
@@ -136,7 +136,7 @@ int main(void)
|
||||
{
|
||||
if (lightDir.z > -0.6f) lightDir.z -= cameraSpeed*60.0f*deltaTime;
|
||||
}
|
||||
|
||||
|
||||
lightDir = Vector3Normalize(lightDir);
|
||||
lightCamera.position = Vector3Scale(lightDir, -15.0f);
|
||||
SetShaderValue(shadowShader, lightDirLoc, &lightDir, SHADER_UNIFORM_VEC3);
|
||||
@@ -151,13 +151,13 @@ int main(void)
|
||||
// to determine whether a given point is "visible" to the light
|
||||
BeginTextureMode(shadowMap);
|
||||
ClearBackground(WHITE);
|
||||
|
||||
|
||||
BeginMode3D(lightCamera);
|
||||
lightView = rlGetMatrixModelview();
|
||||
lightProj = rlGetMatrixProjection();
|
||||
DrawScene(cube, robot);
|
||||
EndMode3D();
|
||||
|
||||
|
||||
EndTextureMode();
|
||||
lightViewProj = MatrixMultiply(lightView, lightProj);
|
||||
|
||||
@@ -167,7 +167,7 @@ int main(void)
|
||||
|
||||
SetShaderValueMatrix(shadowShader, lightVPLoc, lightViewProj);
|
||||
rlEnableShader(shadowShader.id);
|
||||
|
||||
|
||||
rlActiveTextureSlot(textureActiveSlot);
|
||||
rlEnableTexture(shadowMap.depth.id);
|
||||
rlSetUniform(shadowMapLoc, &textureActiveSlot, SHADER_UNIFORM_INT, 1);
|
||||
@@ -178,7 +178,7 @@ int main(void)
|
||||
|
||||
DrawText("Use the arrow keys to rotate the light!", 10, 10, 30, RED);
|
||||
DrawText("Shadows in raylib using the shadowmapping algorithm!", screenWidth - 280, screenHeight - 20, 10, GRAY);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
|
||||
if (IsKeyPressed(KEY_F)) TakeScreenshot("shaders_shadowmap.png");
|
||||
@@ -200,7 +200,7 @@ int main(void)
|
||||
}
|
||||
|
||||
// Load render texture for shadowmap projection
|
||||
// NOTE: Load framebuffer with only a texture depth attachment,
|
||||
// NOTE: Load framebuffer with only a texture depth attachment,
|
||||
// no color attachment required for shadowmap
|
||||
static RenderTexture2D LoadShadowmapRenderTexture(int width, int height)
|
||||
{
|
||||
|
||||
@@ -239,7 +239,7 @@ int main(void)
|
||||
static void ResetStar(Star *star)
|
||||
{
|
||||
star->position = (Vector2){ GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||
|
||||
|
||||
star->speed.x = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||
star->speed.y = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||
|
||||
@@ -247,7 +247,7 @@ static void ResetStar(Star *star)
|
||||
{
|
||||
star->speed.x = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||
star->speed.y = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
star->position = Vector2Add(star->position, Vector2Multiply(star->speed, (Vector2){ 8.0f, 8.0f }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user