Fixed some PR derps

This commit is contained in:
2025-04-03 00:48:13 +02:00
parent d1835dfe3a
commit 6c1a0854c7
2 changed files with 6 additions and 6 deletions

View File

@@ -128,7 +128,7 @@ namespace SplashEdit.RuntimeCode
Vector3 wv = transform.TransformPoint(vertices[index]); Vector3 wv = transform.TransformPoint(vertices[index]);
// Transform the normals to world space. // Transform the normals to world space.
Vector3 wn = transform.TransformDirection(smoothNormals[index]).normalized; Vector3 wn = transform.TransformDirection(smoothNormals[index]).normalized;
// Compute lighting for each vertex (this can be a custom function). // Compute lighting for each vertex.
Color c = PSXLightingBaker.ComputeLighting(wv, wn); Color c = PSXLightingBaker.ComputeLighting(wv, wn);
// Convert vertex to PSX format, including fixed-point conversion and shading. // Convert vertex to PSX format, including fixed-point conversion and shading.
return ConvertToPSXVertex(v, GTEScaling, normals[index], uv[index], psxTexture?.Width, psxTexture?.Height, c); return ConvertToPSXVertex(v, GTEScaling, normals[index], uv[index], psxTexture?.Width, psxTexture?.Height, c);
@@ -148,7 +148,7 @@ namespace SplashEdit.RuntimeCode
} }
// Add the constructed triangle to the mesh. // Add the constructed triangle to the mesh.
psxMesh.Triangles.Add(new Tri { v0 = convertData(vid0), v1 = convertData(vid0), v2 = convertData(vid0), Texture = psxTexture }); psxMesh.Triangles.Add(new Tri { v0 = convertData(vid0), v1 = convertData(vid1), v2 = convertData(vid2), Texture = psxTexture });
} }
} }
@@ -187,9 +187,9 @@ namespace SplashEdit.RuntimeCode
v = (byte)Mathf.Clamp((1.0f - uv.y) * (height - 1), 0, 255), v = (byte)Mathf.Clamp((1.0f - uv.y) * (height - 1), 0, 255),
// Apply lighting to the colors. // Apply lighting to the colors.
r = Utils.Clamp0255(color.r), r = Utils.ColorUnityToPSX(color.r),
g = Utils.Clamp0255(color.g), g = Utils.ColorUnityToPSX(color.g),
b = Utils.Clamp0255(color.b), b = Utils.ColorUnityToPSX(color.b),
}; };
return psxVertex; return psxVertex;

View File

@@ -332,7 +332,7 @@ namespace SplashEdit.RuntimeCode
} }
public static byte Clamp0255(float v) => (byte)(Mathf.Clamp(v, 0, 255)); public static byte ColorUnityToPSX(float v) => (byte)(Mathf.Clamp(v*255, 0, 255));
} }
} }