| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package android.gameperformance; |
| 17 |
|
| 18 |
import java.util.ArrayList; |
| 19 |
import java.util.List; |
| 20 |
|
| 21 |
import android.annotation.NonNull; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public class TriangleCountOpenGLTest extends RenderPatchOpenGLTest { |
| 29 |
|
| 30 |
private final static int MAX_TRIANGLES_IN_PATCH = 32000; |
| 31 |
|
| 32 |
public TriangleCountOpenGLTest(@NonNull GamePerformanceActivity activity) { |
| 33 |
super(activity); |
| 34 |
} |
| 35 |
|
| 36 |
@Override |
| 37 |
public String getName() { |
| 38 |
return "triangle_count"; |
| 39 |
} |
| 40 |
|
| 41 |
@Override |
| 42 |
public String getUnitName() { |
| 43 |
return "ktriangles"; |
| 44 |
} |
| 45 |
|
| 46 |
@Override |
| 47 |
public double getUnitScale() { |
| 48 |
return 2.0; |
| 49 |
} |
| 50 |
|
| 51 |
@Override |
| 52 |
public void initUnits(double trianlgeCountD) { |
| 53 |
final int triangleCount = (int)Math.round(trianlgeCountD * 1000.0); |
| 54 |
final List<RenderPatchAnimation> renderPatches = new ArrayList<>(); |
| 55 |
final int patchCount = |
| 56 |
(triangleCount + MAX_TRIANGLES_IN_PATCH - 1) / MAX_TRIANGLES_IN_PATCH; |
| 57 |
final int patchTriangleCount = triangleCount / patchCount; |
| 58 |
for (int i = 0; i < patchCount; ++i) { |
| 59 |
final RenderPatch renderPatch = new RenderPatch(patchTriangleCount, |
| 60 |
0.5f , |
| 61 |
RenderPatch.TESSELLATION_TO_CENTER); |
| 62 |
renderPatches.add(new RenderPatchAnimation(renderPatch, getView().getRenderRatio())); |
| 63 |
} |
| 64 |
setRenderPatches(renderPatches); |
| 65 |
} |
| 66 |
} |