mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-19 17:29:06 +02:00
Try to fix scaling of generated UV texcoords on splines.
This commit is contained in:
1 parent
bd8cb4b02d
commit
4cba4efbba
6 files changed
+40
-10
No files matched your search
@@ -1005,6 +1005,7 @@ add_library(GPU OBJECT
|
||||
GPU/Common/IndexGenerator.h
|
||||
GPU/Common/TextureDecoder.cpp
|
||||
GPU/Common/TextureDecoder.h
|
||||
GPU/Common/SplineCommon.h
|
||||
GPU/GLES/GLES_GPU.cpp
|
||||
GPU/GLES/GLES_GPU.h
|
||||
GPU/GLES/FragmentShaderGenerator.cpp
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2013- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "GPU/Math3D.h"
|
||||
|
||||
// PSP compatible format so we can use the end of the pipeline in beziers etc
|
||||
struct SimpleVertex {
|
||||
float uv[2];
|
||||
u8 color[4];
|
||||
Vec3f nrm;
|
||||
Vec3f pos;
|
||||
};
|
||||
+6
-2
@@ -19,6 +19,7 @@
|
||||
#include "Core/Config.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "GPU/Math3D.h"
|
||||
#include "GPU/Common/SplineCommon.h"
|
||||
|
||||
// Here's how to evaluate them fast:
|
||||
// http://and-what-happened.blogspot.se/2012/07/evaluating-b-splines-aka-basis-splines.html
|
||||
@@ -418,6 +419,9 @@ void TesselateSplinePatch(u8 *&dest, int &count, const SplinePatch &spatch, u32
|
||||
// First compute all the vertices and put them in an array
|
||||
SimpleVertex *vertices = new SimpleVertex[(patch_div_s + 1) * (patch_div_t + 1)];
|
||||
|
||||
float tu_width = 1.0f + (spatch.count_u - 4) * 1.0f/3.0f;
|
||||
float tv_height = 1.0f + (spatch.count_v - 4) * 1.0f/3.0f;
|
||||
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
for (int tile_v = 0; tile_v < patch_div_t + 1; tile_v++) {
|
||||
float v = ((float)tile_v * (float)(m - 2) / (float)(patch_div_t + 0.00001f)); // epsilon to prevent division by 0 in spline_s
|
||||
@@ -441,8 +445,8 @@ void TesselateSplinePatch(u8 *&dest, int &count, const SplinePatch &spatch, u32
|
||||
vert->uv[0] = 0.0f;
|
||||
vert->uv[1] = 0.0f;
|
||||
} else {
|
||||
vert->uv[0] = ((float)tile_u / (float)patch_div_s);
|
||||
vert->uv[1] = ((float)tile_v / (float)patch_div_t);
|
||||
vert->uv[0] = tu_width * ((float)tile_u / (float)patch_div_s);
|
||||
vert->uv[1] = tv_height * ((float)tile_v / (float)patch_div_t);
|
||||
}
|
||||
|
||||
// Collect influences from surrounding control points.
|
||||
|
||||
@@ -90,14 +90,6 @@ public:
|
||||
u16 drawsUntilNextFullHash;
|
||||
};
|
||||
|
||||
// PSP compatible format so we can use the end of the pipeline in beziers etc
|
||||
struct SimpleVertex {
|
||||
float uv[2];
|
||||
u8 color[4];
|
||||
Vec3f nrm;
|
||||
Vec3f pos;
|
||||
};
|
||||
|
||||
// Handles transform, lighting and drawing.
|
||||
class TransformDrawEngine : public GfxResourceHolder {
|
||||
public:
|
||||
|
||||
@@ -157,6 +157,7 @@
|
||||
<ClInclude Include="..\ext\xbrz\xbrz.h" />
|
||||
<ClInclude Include="Common\GPUDebugInterface.h" />
|
||||
<ClInclude Include="Common\IndexGenerator.h" />
|
||||
<ClInclude Include="Common\SplineCommon.h" />
|
||||
<ClInclude Include="Common\VertexDecoderCommon.h" />
|
||||
<ClInclude Include="Directx9\GPU_DX9.h" />
|
||||
<ClInclude Include="Directx9\helper\dx_state.h" />
|
||||
|
||||
@@ -144,6 +144,9 @@
|
||||
<ClInclude Include="Common\GPUDebugInterface.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\SplineCommon.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Math3D.cpp">
|
||||
|
||||
Reference in new issue
Block a user