gpu: move priority_map and count_prio_offset to priority_renderer
This commit is contained in:
@@ -78,90 +78,3 @@ bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, i
|
||||
|
||||
return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0;
|
||||
}
|
||||
|
||||
// Calculate adjusted priority for a face with a given priority, distance, and
|
||||
// model global min10 and face distance averages. This allows positioning faces
|
||||
// with priorities 10/11 into the correct 'slots' resulting in 18 possible
|
||||
// adjusted priorities
|
||||
int priority_map(int p, int distance, int _min10, int avg1, int avg2, int avg3) {
|
||||
// (10, 11) 0 1 2 (10, 11) 3 4 (10, 11) 5 6 7 8 9 (10, 11)
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
switch (p) {
|
||||
case 0: return 2;
|
||||
case 1: return 3;
|
||||
case 2: return 4;
|
||||
case 3: return 7;
|
||||
case 4: return 8;
|
||||
case 5: return 11;
|
||||
case 6: return 12;
|
||||
case 7: return 13;
|
||||
case 8: return 14;
|
||||
case 9: return 15;
|
||||
case 10:
|
||||
if (distance > avg1) {
|
||||
return 0;
|
||||
} else if (distance > avg2) {
|
||||
return 5;
|
||||
} else if (distance > avg3) {
|
||||
return 9;
|
||||
} else {
|
||||
return 16;
|
||||
}
|
||||
case 11:
|
||||
if (distance > avg1 && _min10 > avg1) {
|
||||
return 1;
|
||||
} else if (distance > avg2 && (_min10 > avg1 || _min10 > avg2)) {
|
||||
return 6;
|
||||
} else if (distance > avg3 && (_min10 > avg1 || _min10 > avg2 || _min10 > avg3)) {
|
||||
return 10;
|
||||
} else {
|
||||
return 17;
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the number of faces with a lower adjusted priority than
|
||||
// the given adjusted priority
|
||||
int count_prio_offset(int priority) {
|
||||
int total = 0;
|
||||
switch (priority) {
|
||||
case 17:
|
||||
total += totalMappedNum[16];
|
||||
case 16:
|
||||
total += totalMappedNum[15];
|
||||
case 15:
|
||||
total += totalMappedNum[14];
|
||||
case 14:
|
||||
total += totalMappedNum[13];
|
||||
case 13:
|
||||
total += totalMappedNum[12];
|
||||
case 12:
|
||||
total += totalMappedNum[11];
|
||||
case 11:
|
||||
total += totalMappedNum[10];
|
||||
case 10:
|
||||
total += totalMappedNum[9];
|
||||
case 9:
|
||||
total += totalMappedNum[8];
|
||||
case 8:
|
||||
total += totalMappedNum[7];
|
||||
case 7:
|
||||
total += totalMappedNum[6];
|
||||
case 6:
|
||||
total += totalMappedNum[5];
|
||||
case 5:
|
||||
total += totalMappedNum[4];
|
||||
case 4:
|
||||
total += totalMappedNum[3];
|
||||
case 3:
|
||||
total += totalMappedNum[2];
|
||||
case 2:
|
||||
total += totalMappedNum[1];
|
||||
case 1:
|
||||
total += totalMappedNum[0];
|
||||
case 0:
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,93 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Calculate adjusted priority for a face with a given priority, distance, and
|
||||
// model global min10 and face distance averages. This allows positioning faces
|
||||
// with priorities 10/11 into the correct 'slots' resulting in 18 possible
|
||||
// adjusted priorities
|
||||
int priority_map(int p, int distance, int _min10, int avg1, int avg2, int avg3) {
|
||||
// (10, 11) 0 1 2 (10, 11) 3 4 (10, 11) 5 6 7 8 9 (10, 11)
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
switch (p) {
|
||||
case 0: return 2;
|
||||
case 1: return 3;
|
||||
case 2: return 4;
|
||||
case 3: return 7;
|
||||
case 4: return 8;
|
||||
case 5: return 11;
|
||||
case 6: return 12;
|
||||
case 7: return 13;
|
||||
case 8: return 14;
|
||||
case 9: return 15;
|
||||
case 10:
|
||||
if (distance > avg1) {
|
||||
return 0;
|
||||
} else if (distance > avg2) {
|
||||
return 5;
|
||||
} else if (distance > avg3) {
|
||||
return 9;
|
||||
} else {
|
||||
return 16;
|
||||
}
|
||||
case 11:
|
||||
if (distance > avg1 && _min10 > avg1) {
|
||||
return 1;
|
||||
} else if (distance > avg2 && (_min10 > avg1 || _min10 > avg2)) {
|
||||
return 6;
|
||||
} else if (distance > avg3 && (_min10 > avg1 || _min10 > avg2 || _min10 > avg3)) {
|
||||
return 10;
|
||||
} else {
|
||||
return 17;
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the number of faces with a lower adjusted priority than
|
||||
// the given adjusted priority
|
||||
int count_prio_offset(int priority) {
|
||||
int total = 0;
|
||||
switch (priority) {
|
||||
case 17:
|
||||
total += totalMappedNum[16];
|
||||
case 16:
|
||||
total += totalMappedNum[15];
|
||||
case 15:
|
||||
total += totalMappedNum[14];
|
||||
case 14:
|
||||
total += totalMappedNum[13];
|
||||
case 13:
|
||||
total += totalMappedNum[12];
|
||||
case 12:
|
||||
total += totalMappedNum[11];
|
||||
case 11:
|
||||
total += totalMappedNum[10];
|
||||
case 10:
|
||||
total += totalMappedNum[9];
|
||||
case 9:
|
||||
total += totalMappedNum[8];
|
||||
case 8:
|
||||
total += totalMappedNum[7];
|
||||
case 7:
|
||||
total += totalMappedNum[6];
|
||||
case 6:
|
||||
total += totalMappedNum[5];
|
||||
case 5:
|
||||
total += totalMappedNum[4];
|
||||
case 4:
|
||||
total += totalMappedNum[3];
|
||||
case 3:
|
||||
total += totalMappedNum[2];
|
||||
case 2:
|
||||
total += totalMappedNum[1];
|
||||
case 1:
|
||||
total += totalMappedNum[0];
|
||||
case 0:
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
void get_face(uint localId, modelinfo minfo, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom,
|
||||
out int prio, out int dis, out ivec4 o1, out ivec4 o2, out ivec4 o3) {
|
||||
int offset = minfo.offset;
|
||||
|
||||
Reference in New Issue
Block a user