Skip to content

Commit

Permalink
Use different triangle vertex order permutations, cutting down overhe…
Browse files Browse the repository at this point in the history
…ad on the array manipulation logic
  • Loading branch information
FalsePattern committed Jan 19, 2022
1 parent 4a1fe28 commit 4961a2a
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,15 @@ private void hackVertex(CallbackInfo ci) {
}
//Current vertex layout: ABCD
if (alternativeTriangulation) {
//Target vertex layout: BCDBDA
System.arraycopy(rawBuffer, rawBufferIndex - 32, rawBuffer, rawBufferIndex + 8, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 8, rawBuffer, rawBufferIndex, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 24, rawBuffer, rawBufferIndex - 8, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 24, rawBuffer, rawBufferIndex - 32, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 16, rawBuffer, rawBufferIndex - 24, 8);
System.arraycopy(rawBuffer, rawBufferIndex, rawBuffer, rawBufferIndex - 16, 8);
//Target vertex layout: ABD DBC
System.arraycopy(rawBuffer, rawBufferIndex - 16, rawBuffer, rawBufferIndex + 8, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 24, rawBuffer, rawBufferIndex, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 8, rawBuffer, rawBufferIndex - 16, 8);
alternativeTriangulation = false;
} else {
//Target vertex layout: ABCACD
System.arraycopy(rawBuffer, rawBufferIndex - 8, rawBuffer, rawBufferIndex + 8, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 16, rawBuffer, rawBufferIndex, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 32, rawBuffer, rawBufferIndex - 8, 8);
//Target vertex layout: ABC DAC
System.arraycopy(rawBuffer, rawBufferIndex - 32, rawBuffer, rawBufferIndex, 8);
System.arraycopy(rawBuffer, rawBufferIndex - 16, rawBuffer, rawBufferIndex + 8, 8);
}
vertexCount += 2;
rawBufferIndex += 16;
Expand Down

0 comments on commit 4961a2a

Please sign in to comment.