From 0c873fb1c3d1abe2bf1bf59e6512f54ffc9e9dcd Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 22 Sep 2013 10:50:33 +0200 Subject: [PATCH] Spline/Bezier: Fix UV generation issue. --- GPU/GLES/Spline.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/GPU/GLES/Spline.cpp b/GPU/GLES/Spline.cpp index cf7585707e..cb0061b0bd 100644 --- a/GPU/GLES/Spline.cpp +++ b/GPU/GLES/Spline.cpp @@ -223,7 +223,7 @@ Vec3f Bernstein3D(const Vec3f p0, const Vec3f p1, const Vec3f p2, const Vec3f p3 } -void TesselatePatch(u8 *&dest, int &count, const HWSplinePatch &patch, u32 vertType) { +void TesselatePatch(u8 *&dest, int &count, const HWSplinePatch &patch, u32 origVertType) { if (true) { // TODO: Should do actual patch subdivision instead of just drawing the control points! const int tile_min_u = (patch.type & START_OPEN_U) ? 0 : 1; @@ -246,7 +246,7 @@ void TesselatePatch(u8 *&dest, int &count, const HWSplinePatch &patch, u32 vertT SimpleVertex v3 = *patch.points[point_index+5]; // Generate UV. TODO: Do this even if UV specified in control points? - if ((vertType & GE_VTYPE_TC_MASK) == 0) { + if ((origVertType & GE_VTYPE_TC_MASK) == 0) { float u = u_base + tile_u * third; float v = v_base + tile_v * third; v0.uv[0] = u; @@ -346,6 +346,7 @@ void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int SimpleVertex *simplified_control_points = (SimpleVertex *)(decoded + 65536 * 12); u8 *temp_buffer = decoded + 65536 * 24; + u32 origVertType = vertType; vertType = NormalizeVertices((u8 *)simplified_control_points, temp_buffer, (u8 *)control_points, index_lower_bound, index_upper_bound, vertType); VertexDecoder *vdecoder = GetVertexDecoder(vertType); @@ -387,7 +388,7 @@ void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int for (int patch_idx = 0; patch_idx < num_patches_u*num_patches_v; ++patch_idx) { HWSplinePatch& patch = patches[patch_idx]; - TesselatePatch(dest, count, patch, vertType); + TesselatePatch(dest, count, patch, origVertType); } delete[] patches; @@ -417,6 +418,7 @@ void TransformDrawEngine::SubmitBezier(void* control_points, void* indices, int SimpleVertex *simplified_control_points = (SimpleVertex *)(decoded + 65536 * 12); u8 *temp_buffer = decoded + 65536 * 24; + u32 origVertType = vertType; vertType = NormalizeVertices((u8 *)simplified_control_points, temp_buffer, (u8 *)control_points, index_lower_bound, index_upper_bound, vertType); VertexDecoder *vdecoder = GetVertexDecoder(vertType); @@ -454,7 +456,7 @@ void TransformDrawEngine::SubmitBezier(void* control_points, void* indices, int for (int patch_idx = 0; patch_idx < num_patches_u*num_patches_v; ++patch_idx) { HWSplinePatch& patch = patches[patch_idx]; - TesselatePatch(dest, count, patch, vertType); + TesselatePatch(dest, count, patch, origVertType); } delete[] patches;