Refactor removing extra space and add break line for { (#5533)

Co-authored-by: maiconpintoabreu <maicon@thinkpad02.exads.com>
This commit is contained in:
Maicon Santana
2026-02-05 14:10:55 +00:00
committed by GitHub
parent d4f636151b
commit f43e049444
18 changed files with 35 additions and 23 deletions

View File

@ -44,7 +44,7 @@ float GetCharacter(float n, vec2 p)
// Main shader logic
// -----------------------------------------------------------------------------
void main()
void main()
{
vec2 charPixelSize = vec2(fontSize, fontSize);
vec2 uvCellSize = charPixelSize/resolution;

View File

@ -63,7 +63,7 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
}
// SRC: https://iquilezles.org/articles/boxfunctions
vec2 iBox(in vec3 ro, in vec3 rd, in vec3 rad)
vec2 iBox(in vec3 ro, in vec3 rd, in vec3 rad)
{
vec3 m = 1.0/rd;
vec3 n = m*ro;

View File

@ -19,7 +19,8 @@ uniform float ampY;
uniform float speedX;
uniform float speedY;
void main() {
void main()
{
float pixelWidth = 1.0/size.x;
float pixelHeight = 1.0/size.y;
float aspect = pixelHeight/pixelWidth;

View File

@ -42,7 +42,7 @@ float GetCharacter(float n, vec2 p)
// Main shader logic
// -----------------------------------------------------------------------------
void main()
void main()
{
vec2 charPixelSize = vec2(fontSize, fontSize);
vec2 uvCellSize = charPixelSize / resolution;

View File

@ -61,7 +61,7 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
}
// SRC: https://iquilezles.org/articles/boxfunctions
vec2 iBox(in vec3 ro, in vec3 rd, in vec3 rad)
vec2 iBox(in vec3 ro, in vec3 rd, in vec3 rad)
{
vec3 m = 1.0/rd;
vec3 n = m*ro;

View File

@ -17,7 +17,8 @@ uniform float ampY;
uniform float speedX;
uniform float speedY;
void main() {
void main()
{
float pixelWidth = 1.0/size.x;
float pixelHeight = 1.0/size.y;
float aspect = pixelHeight/pixelWidth;

View File

@ -38,7 +38,7 @@ float GetCharacter(int n, vec2 p)
// Main shader logic
// -----------------------------------------------------------------------------
void main()
void main()
{
vec2 charPixelSize = vec2(fontSize, fontSize);
vec2 uvCellSize = charPixelSize/resolution;

View File

@ -23,7 +23,8 @@ uniform vec3 viewPosition;
const float QUADRATIC = 0.032;
const float LINEAR = 0.09;
void main() {
void main()
{
vec3 fragPosition = texture(gPosition, texCoord).rgb;
vec3 normal = texture(gNormal, texCoord).rgb;
vec3 albedo = texture(gAlbedoSpec, texCoord).rgb;

View File

@ -5,7 +5,8 @@ layout (location = 1) in vec2 vertexTexCoord;
out vec2 texCoord;
void main() {
void main()
{
gl_Position = vec4(vertexPosition, 1.0);
texCoord = vertexTexCoord;
}

View File

@ -10,7 +10,8 @@ in vec3 fragNormal;
uniform sampler2D diffuseTexture;
uniform sampler2D specularTexture;
void main() {
void main()
{
// store the fragment position vector in the first gbuffer texture
gPosition = fragPosition;
// also store the per-fragment normals into the gbuffer

View File

@ -59,7 +59,7 @@ float sdSixWayCutHollowSphere(vec3 p, float r, float h, float t)
}
// https://iquilezles.org/articles/boxfunctions
vec2 iBox(in vec3 ro, in vec3 rd, in vec3 rad)
vec2 iBox(in vec3 ro, in vec3 rd, in vec3 rad)
{
vec3 m = 1.0/rd;
vec3 n = m*ro;

View File

@ -22,7 +22,8 @@ uniform float ampY;
uniform float speedX;
uniform float speedY;
void main() {
void main()
{
float pixelWidth = 1.0/size.x;
float pixelHeight = 1.0/size.y;
float aspect = pixelHeight/pixelWidth;

View File

@ -139,14 +139,14 @@ int main(void)
Ball *ball = &balls[i];
// The ball is not grabbed
if (!ball->grabbed)
if (!ball->grabbed)
{
// Ball repositioning using the velocity
ball->pos.x += ball->vel.x * delta;
ball->pos.y += ball->vel.y * delta;
// Does the ball hit the screen right boundary?
if ((ball->pos.x + ball->radius) >= screenWidth)
if ((ball->pos.x + ball->radius) >= screenWidth)
{
ball->pos.x = screenWidth - ball->radius; // Ball repositioning
ball->vel.x = -ball->vel.x*ball->elasticity; // Elasticity makes the ball lose 10% of its velocity on hit
@ -159,12 +159,12 @@ int main(void)
}
// The same for y axis
if ((ball->pos.y + ball->radius) >= screenHeight)
if ((ball->pos.y + ball->radius) >= screenHeight)
{
ball->pos.y = screenHeight - ball->radius;
ball->vel.y = -ball->vel.y*ball->elasticity;
}
else if ((ball->pos.y - ball->radius) <= 0)
else if ((ball->pos.y - ball->radius) <= 0)
{
ball->pos.y = ball->radius;
ball->vel.y = -ball->vel.y*ball->elasticity;