Skip to content

Commit b39ce97

Browse files
CanReaderclaude
andcommitted
Remove redundant comments and section dividers
Strip banner headers, section dividers, and obvious inline comments from headers, source files, and shaders across the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a492011 commit b39ce97

27 files changed

Lines changed: 0 additions & 514 deletions

Engine/assets/shaders/default_shader.frag

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,27 @@ void main() {
8686
vec3 lightColor = uLightColor.rgb;
8787
float lightIntensity = uLightColor.a;
8888

89-
// ---- Ambient ----
9089
vec3 ambientColor = uAmbient.rgb * uAmbient.a;
9190
// Subtle hemisphere: ground bounce slightly warmer/darker than sky
9291
vec3 groundColor = ambientColor * vec3(0.7, 0.65, 0.6);
9392
float hemisphere = N.y * 0.5 + 0.5;
9493
vec3 ambient = mix(groundColor, ambientColor, hemisphere);
9594

96-
// ---- Diffuse (Lambert) ----
9795
float NdotL = dot(N, -lightDir);
9896
float diffuseTerm = max(NdotL, 0.0);
9997
vec3 diffuse = lightColor * lightIntensity * diffuseTerm;
10098

101-
// ---- Specular (Blinn-Phong) ----
10299
vec3 halfDir = normalize(-lightDir + viewDir);
103100
float shininess = 32.0;
104101
float normFactor = (shininess + 8.0) / 25.1327;
105102
float spec = normFactor * pow(max(dot(N, halfDir), 0.0), shininess);
106103
vec3 specular = lightColor * spec * 0.5 * max(NdotL, 0.0);
107104

108-
// ---- Shadow ----
109105
float shadow = CalcShadow(fragShadowCoord);
110106

111-
// ---- Compose ----
112107
vec3 lit = baseColor.rgb * (ambient + shadow * diffuse)
113108
+ shadow * specular;
114109

115-
// ---- Tone mapping (Reinhard) ----
116110
lit = lit / (lit + vec3(1.0));
117111

118112
outColor = vec4(lit, baseColor.a);

Engine/assets/shaders/default_shader.hlsl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ struct VS_OUTPUT
2323
float2 TexCoord : TEXCOORD4;
2424
};
2525

26-
// --- Constant Buffers ---
27-
2826
cbuffer TransformCB : register(b0) {
2927
row_major float4x4 WVP;
3028
row_major float4x4 World;
@@ -87,8 +85,6 @@ cbuffer LightCB : register(b2) {
8785
LightData Lights[16];
8886
};
8987

90-
// --- Textures & Samplers ---
91-
9288
Texture2D diffuseTexture : register(t0);
9389
Texture2D normalTexture : register(t1);
9490
Texture2D specularTexture : register(t2);
@@ -99,9 +95,6 @@ Texture2D emissiveTexture : register(t6);
9995

10096
SamplerState mainSampler : register(s0);
10197

102-
// ============================================================
103-
// Vertex Shader
104-
// ============================================================
10598
VS_OUTPUT VS_Main(VS_INPUT input)
10699
{
107100
VS_OUTPUT output;
@@ -125,10 +118,6 @@ VS_OUTPUT VS_Main(VS_INPUT input)
125118
return output;
126119
}
127120

128-
// ============================================================
129-
// PBR Helper Functions
130-
// ============================================================
131-
132121
static const float PI = 3.14159265359;
133122

134123
// GGX/Trowbridge-Reitz normal distribution
@@ -179,25 +168,19 @@ float AttenuateUE4(float distance, float range) {
179168
return (falloff * falloff) / (distance * distance + 1.0);
180169
}
181170

182-
// ============================================================
183-
// Pixel Shader
184-
// ============================================================
185171
float4 PS_Main(VS_OUTPUT input) : SV_Target
186172
{
187173
// Apply UV tiling and offset
188174
float2 uv = input.TexCoord * matTiling + matOffset;
189175

190-
// --- Base Color ---
191176
float4 baseColor = matDiffuseColor * input.Color;
192177
if (HasDiffuseMap)
193178
baseColor *= diffuseTexture.Sample(mainSampler, uv);
194179

195-
// --- Alpha Cutoff ---
196180
float alpha = baseColor.a * matOpacity;
197181
if (matAlphaCutoff > 0.0 && alpha < matAlphaCutoff)
198182
discard;
199183

200-
// --- Normal ---
201184
float3 N = normalize(input.WorldNorm);
202185
if (HasNormalMap) {
203186
float3 tangentNormal =
@@ -211,7 +194,6 @@ float4 PS_Main(VS_OUTPUT input) : SV_Target
211194
N = normalize(mul(tangentNormal, TBN));
212195
}
213196

214-
// --- Material Properties ---
215197
float roughness = matRoughness;
216198
if (HasRoughnessMap)
217199
roughness *= roughnessTexture.Sample(mainSampler, uv).r;
@@ -225,15 +207,13 @@ float4 PS_Main(VS_OUTPUT input) : SV_Target
225207
if (HasAOMap)
226208
ao *= aoTexture.Sample(mainSampler, uv).r;
227209

228-
// --- PBR Setup ---
229210
float3 albedo = baseColor.rgb;
230211
float3 V = normalize(CameraPos - input.WorldPos);
231212

232213
// Reflectance at normal incidence (F0)
233214
float3 F0 = float3(0.04, 0.04, 0.04);
234215
F0 = lerp(F0, albedo, metallic);
235216

236-
// --- Accumulate Light Contributions ---
237217
float3 Lo = float3(0.0, 0.0, 0.0);
238218

239219
for (uint i = 0; i < NumActiveLights; i++) {
@@ -304,16 +284,13 @@ float4 PS_Main(VS_OUTPUT input) : SV_Target
304284
}
305285
}
306286

307-
// --- Ambient ---
308287
float3 ambient = AmbientColor * AmbientIntensity
309288
* albedo * ao;
310289

311-
// --- Emissive ---
312290
float3 emissive = matEmissiveColor * matEmissiveIntensity;
313291
if (HasEmissiveMap)
314292
emissive *= emissiveTexture.Sample(mainSampler, uv).rgb;
315293

316-
// --- Final Composition ---
317294
float3 finalColor = ambient + Lo + emissive;
318295

319296
return float4(finalColor, alpha);

Engine/assets/shaders/default_shader_dx12.hlsl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ cbuffer TransformCB : register(b0) {
3434
Texture2D diffuseTexture : register(t0);
3535
SamplerState mainSampler : register(s0);
3636

37-
// ============================================================
38-
// Vertex Shader
39-
// ============================================================
4037
VS_OUTPUT VS_Main(VS_INPUT input)
4138
{
4239
VS_OUTPUT output;
@@ -59,12 +56,8 @@ VS_OUTPUT VS_Main(VS_INPUT input)
5956
return output;
6057
}
6158

62-
// ============================================================
63-
// Pixel Shader
64-
// ============================================================
6559
float4 PS_Main(VS_OUTPUT input) : SV_Target
6660
{
67-
// Sample texture
6861
float4 texColor = diffuseTexture.Sample(mainSampler,
6962
input.TexCoord);
7063
float4 baseColor = texColor * input.Color;

Engine/assets/shaders/default_shader_gl.frag

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ layout(binding = 4) uniform sampler2D metallicTexture;
8181
layout(binding = 5) uniform sampler2D aoTexture;
8282
layout(binding = 6) uniform sampler2D emissiveTexture;
8383

84-
// ============================================================
85-
// PBR Helper Functions
86-
// ============================================================
87-
8884
const float PI = 3.14159265359;
8985

9086
float DistributionGGX(vec3 N, vec3 H, float roughness) {
@@ -133,17 +129,14 @@ void main() {
133129
// Apply UV tiling and offset
134130
vec2 uv = fragUV * matTiling + matOffset;
135131

136-
// --- Base Color ---
137132
vec4 baseColor = matDiffuseColor * fragColor;
138133
if (HasDiffuseMap != 0u)
139134
baseColor *= texture(diffuseTexture, uv);
140135

141-
// --- Alpha Cutoff ---
142136
float alpha = baseColor.a * matOpacity;
143137
if (matAlphaCutoff > 0.0 && alpha < matAlphaCutoff)
144138
discard;
145139

146-
// --- Normal ---
147140
vec3 N = normalize(fragWorldNorm);
148141
if (HasNormalMap != 0u) {
149142
vec3 tangentNormal =
@@ -157,7 +150,6 @@ void main() {
157150
N = normalize(TBN * tangentNormal);
158151
}
159152

160-
// --- Material Properties ---
161153
float roughness = matRoughness;
162154
if (HasRoughnessMap != 0u)
163155
roughness *= texture(roughnessTexture, uv).r;
@@ -171,14 +163,12 @@ void main() {
171163
if (HasAOMap != 0u)
172164
ao *= texture(aoTexture, uv).r;
173165

174-
// --- PBR Setup ---
175166
vec3 albedo = baseColor.rgb;
176167
vec3 V = normalize(CameraPos - fragWorldPos);
177168

178169
vec3 F0 = vec3(0.04);
179170
F0 = mix(F0, albedo, metallic);
180171

181-
// --- Accumulate Light Contributions ---
182172
vec3 Lo = vec3(0.0);
183173

184174
for (uint i = 0u; i < NumActiveLights; i++) {
@@ -242,16 +232,13 @@ void main() {
242232
}
243233
}
244234

245-
// --- Ambient ---
246235
vec3 ambient = AmbientColor * AmbientIntensity
247236
* albedo * ao;
248237

249-
// --- Emissive ---
250238
vec3 emissive = matEmissiveColor * matEmissiveIntensity;
251239
if (HasEmissiveMap != 0u)
252240
emissive *= texture(emissiveTexture, uv).rgb;
253241

254-
// --- Final Composition ---
255242
vec3 finalColor = ambient + Lo + emissive;
256243

257244
outColor = vec4(finalColor, alpha);

Engine/assets/shaders/default_shader_gl.vert

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#version 450 core
22

3-
// ============================================================
4-
// DXCraft Basic Material Shader - OpenGL Vertex Shader
5-
// ============================================================
6-
73
layout(location = 0) in vec3 inPosition;
84
layout(location = 1) in vec3 inNormal;
95
layout(location = 2) in vec4 inTangent;

Engine/assets/shaders/skinned_shader.frag

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,27 @@ void main() {
8686
vec3 lightColor = uLightColor.rgb;
8787
float lightIntensity = uLightColor.a;
8888

89-
// ---- Ambient ----
9089
vec3 ambientColor = uAmbient.rgb * uAmbient.a;
9190
// Subtle hemisphere: ground bounce slightly warmer/darker than sky
9291
vec3 groundColor = ambientColor * vec3(0.7, 0.65, 0.6);
9392
float hemisphere = N.y * 0.5 + 0.5;
9493
vec3 ambient = mix(groundColor, ambientColor, hemisphere);
9594

96-
// ---- Diffuse (Lambert) ----
9795
float NdotL = dot(N, -lightDir);
9896
float diffuseTerm = max(NdotL, 0.0);
9997
vec3 diffuse = lightColor * lightIntensity * diffuseTerm;
10098

101-
// ---- Specular (Blinn-Phong) ----
10299
vec3 halfDir = normalize(-lightDir + viewDir);
103100
float shininess = 32.0;
104101
float normFactor = (shininess + 8.0) / 25.1327;
105102
float spec = normFactor * pow(max(dot(N, halfDir), 0.0), shininess);
106103
vec3 specular = lightColor * spec * 0.5 * max(NdotL, 0.0);
107104

108-
// ---- Shadow ----
109105
float shadow = CalcShadow(fragShadowCoord);
110106

111-
// ---- Compose ----
112107
vec3 lit = baseColor.rgb * (ambient + shadow * diffuse)
113108
+ shadow * specular;
114109

115-
// ---- Tone mapping (Reinhard) ----
116110
lit = lit / (lit + vec3(1.0));
117111

118112
outColor = vec4(lit, baseColor.a);

Engine/assets/shaders/skinned_shader.hlsl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ struct VS_OUTPUT
2525
float2 TexCoord : TEXCOORD4;
2626
};
2727

28-
// --- Constant Buffers ---
29-
3028
cbuffer TransformCB : register(b0) {
3129
row_major float4x4 WVP;
3230
row_major float4x4 World;
@@ -95,8 +93,6 @@ cbuffer BoneMatrices : register(b3) {
9593
row_major float4x4 boneMatrices[MAX_BONES];
9694
};
9795

98-
// --- Textures & Samplers ---
99-
10096
Texture2D diffuseTexture : register(t0);
10197
Texture2D normalTexture : register(t1);
10298
Texture2D specularTexture : register(t2);
@@ -107,9 +103,6 @@ Texture2D emissiveTexture : register(t6);
107103

108104
SamplerState mainSampler : register(s0);
109105

110-
// ============================================================
111-
// Vertex Shader
112-
// ============================================================
113106
VS_OUTPUT VS_Main(VS_INPUT input)
114107
{
115108
VS_OUTPUT output;
@@ -153,10 +146,6 @@ VS_OUTPUT VS_Main(VS_INPUT input)
153146
return output;
154147
}
155148

156-
// ============================================================
157-
// PBR Helper Functions
158-
// ============================================================
159-
160149
static const float PI = 3.14159265359;
161150

162151
// GGX/Trowbridge-Reitz normal distribution
@@ -207,25 +196,19 @@ float AttenuateUE4(float distance, float range) {
207196
return (falloff * falloff) / (distance * distance + 1.0);
208197
}
209198

210-
// ============================================================
211-
// Pixel Shader
212-
// ============================================================
213199
float4 PS_Main(VS_OUTPUT input) : SV_Target
214200
{
215201
// Apply UV tiling and offset
216202
float2 uv = input.TexCoord * matTiling + matOffset;
217203

218-
// --- Base Color ---
219204
float4 baseColor = matDiffuseColor * input.Color;
220205
if (HasDiffuseMap)
221206
baseColor *= diffuseTexture.Sample(mainSampler, uv);
222207

223-
// --- Alpha Cutoff ---
224208
float alpha = baseColor.a * matOpacity;
225209
if (matAlphaCutoff > 0.0 && alpha < matAlphaCutoff)
226210
discard;
227211

228-
// --- Normal ---
229212
float3 N = normalize(input.WorldNorm);
230213
if (HasNormalMap) {
231214
float3 tangentNormal =
@@ -239,7 +222,6 @@ float4 PS_Main(VS_OUTPUT input) : SV_Target
239222
N = normalize(mul(tangentNormal, TBN));
240223
}
241224

242-
// --- Material Properties ---
243225
float roughness = matRoughness;
244226
if (HasRoughnessMap)
245227
roughness *= roughnessTexture.Sample(mainSampler, uv).r;
@@ -253,15 +235,13 @@ float4 PS_Main(VS_OUTPUT input) : SV_Target
253235
if (HasAOMap)
254236
ao *= aoTexture.Sample(mainSampler, uv).r;
255237

256-
// --- PBR Setup ---
257238
float3 albedo = baseColor.rgb;
258239
float3 V = normalize(CameraPos - input.WorldPos);
259240

260241
// Reflectance at normal incidence (F0)
261242
float3 F0 = float3(0.04, 0.04, 0.04);
262243
F0 = lerp(F0, albedo, metallic);
263244

264-
// --- Accumulate Light Contributions ---
265245
float3 Lo = float3(0.0, 0.0, 0.0);
266246

267247
for (uint i = 0; i < NumActiveLights; i++) {
@@ -332,16 +312,13 @@ float4 PS_Main(VS_OUTPUT input) : SV_Target
332312
}
333313
}
334314

335-
// --- Ambient ---
336315
float3 ambient = AmbientColor * AmbientIntensity
337316
* albedo * ao;
338317

339-
// --- Emissive ---
340318
float3 emissive = matEmissiveColor * matEmissiveIntensity;
341319
if (HasEmissiveMap)
342320
emissive *= emissiveTexture.Sample(mainSampler, uv).rgb;
343321

344-
// --- Final Composition ---
345322
float3 finalColor = ambient + Lo + emissive;
346323

347324
return float4(finalColor, alpha);

0 commit comments

Comments
 (0)