mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-02 06:44:45 +00:00
Modify IndexConverter class to functor.
This commit is contained in:
parent
d8ccc1c2b5
commit
15a11d58c9
@ -873,7 +873,7 @@ void DrawEngineCommon::SubmitSpline(const void *control_points, const void *indi
|
||||
|
||||
u16 index_lower_bound = 0;
|
||||
u16 index_upper_bound = count_u * count_v - 1;
|
||||
IndexConverter idxConv(vertType, indices);
|
||||
IndexConverter ConvertIndex(vertType, indices);
|
||||
if (indices)
|
||||
GetIndexBounds(indices, count_u * count_v, vertType, &index_lower_bound, &index_upper_bound);
|
||||
|
||||
@ -897,7 +897,7 @@ void DrawEngineCommon::SubmitSpline(const void *control_points, const void *indi
|
||||
// Make an array of pointers to the control points, to get rid of indices.
|
||||
const SimpleVertex **points = (const SimpleVertex **)managedBuf.Allocate(sizeof(SimpleVertex *) * count_u * count_v);
|
||||
for (int idx = 0; idx < count_u * count_v; idx++)
|
||||
points[idx] = simplified_control_points + (indices ? idxConv.convert(idx) : idx);
|
||||
points[idx] = simplified_control_points + (indices ? ConvertIndex(idx) : idx);
|
||||
|
||||
int count = 0;
|
||||
u8 *dest = splineBuffer;
|
||||
@ -960,7 +960,7 @@ void DrawEngineCommon::SubmitBezier(const void *control_points, const void *indi
|
||||
|
||||
u16 index_lower_bound = 0;
|
||||
u16 index_upper_bound = count_u * count_v - 1;
|
||||
IndexConverter idxConv(vertType, indices);
|
||||
IndexConverter ConvertIndex(vertType, indices);
|
||||
if (indices)
|
||||
GetIndexBounds(indices, count_u*count_v, vertType, &index_lower_bound, &index_upper_bound);
|
||||
|
||||
@ -989,7 +989,7 @@ void DrawEngineCommon::SubmitBezier(const void *control_points, const void *indi
|
||||
// Make an array of pointers to the control points, to get rid of indices.
|
||||
const SimpleVertex **points = (const SimpleVertex **)managedBuf.Allocate(sizeof(SimpleVertex *) * count_u * count_v);
|
||||
for (int idx = 0; idx < count_u * count_v; idx++)
|
||||
points[idx] = simplified_control_points + (indices ? idxConv.convert(idx) : idx);
|
||||
points[idx] = simplified_control_points + (indices ? ConvertIndex(idx) : idx);
|
||||
|
||||
int count = 0;
|
||||
u8 *dest = splineBuffer;
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
: indices(indices), indexType(vertType & GE_VTYPE_IDX_MASK) {
|
||||
}
|
||||
|
||||
inline u32 convert(u32 index) const {
|
||||
u32 operator() (u32 index) const {
|
||||
switch (indexType) {
|
||||
case GE_VTYPE_IDX_8BIT:
|
||||
return indices8[index];
|
||||
|
@ -280,7 +280,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
|
||||
|
||||
u16 index_lower_bound = 0;
|
||||
u16 index_upper_bound = vertex_count - 1;
|
||||
IndexConverter idxConv(vertex_type, indices);
|
||||
IndexConverter ConvertIndex(vertex_type, indices);
|
||||
|
||||
if (indices)
|
||||
GetIndexBounds(indices, vertex_count, vertex_type, &index_lower_bound, &index_upper_bound);
|
||||
@ -321,7 +321,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
|
||||
{
|
||||
for (int vtx = 0; vtx < vertex_count; ++vtx) {
|
||||
if (indices) {
|
||||
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
|
||||
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
|
||||
} else {
|
||||
vreader.Goto(vtx);
|
||||
}
|
||||
@ -380,7 +380,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
|
||||
int skip_count = data_index == 0 ? 1 : 0;
|
||||
for (int vtx = 0; vtx < vertex_count; ++vtx) {
|
||||
if (indices) {
|
||||
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
|
||||
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
|
||||
} else {
|
||||
vreader.Goto(vtx);
|
||||
}
|
||||
@ -410,7 +410,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
|
||||
|
||||
for (int vtx = 0; vtx < vertex_count; ++vtx) {
|
||||
if (indices) {
|
||||
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
|
||||
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
|
||||
} else {
|
||||
vreader.Goto(vtx);
|
||||
}
|
||||
@ -452,7 +452,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
|
||||
// Only read the central vertex if we're not continuing.
|
||||
if (data_index == 0) {
|
||||
if (indices) {
|
||||
vreader.Goto(idxConv.convert(0) - index_lower_bound);
|
||||
vreader.Goto(ConvertIndex(0) - index_lower_bound);
|
||||
} else {
|
||||
vreader.Goto(0);
|
||||
}
|
||||
@ -463,7 +463,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
|
||||
|
||||
for (int vtx = start_vtx; vtx < vertex_count; ++vtx) {
|
||||
if (indices) {
|
||||
vreader.Goto(idxConv.convert(vtx) - index_lower_bound);
|
||||
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
|
||||
} else {
|
||||
vreader.Goto(vtx);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user