| 59 | |
| 60 | |
| 61 | static void renderDispatch(const std::vector<Primitive*>& primitives, |
| 62 | Algorithm algorithm, |
| 63 | DepthComplexityAlgorithm depthComplexityAlgorithm) |
| 64 | { |
| 65 | if (primitives.empty()) { |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | bool hasIntersected = false; |
| 70 | for (std::vector<Primitive*>::const_iterator itr = primitives.begin(); itr != primitives.end(); ++itr) { |
| 71 | Operation operation = (*itr)->getOperation(); |
| 72 | if (operation == Intersection) { |
| 73 | hasIntersected = true; |
| 74 | break; |
| 75 | } |
| 76 | } |
| 77 | if (!hasIntersected) { |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | if (algorithm == Automatic) { |
| 82 | algorithm = chooseAlgorithm(primitives); |
| 83 | depthComplexityAlgorithm = chooseDepthComplexityAlgorithm(primitives); |
| 84 | } |
| 85 | |
| 86 | if (depthComplexityAlgorithm == OcclusionQuery && !haveHardwareOcclusionQueries()) { |
| 87 | // hardware support is missing. issue a warning? |
| 88 | depthComplexityAlgorithm = DepthComplexitySampling; |
| 89 | } |
| 90 | |
| 91 | if (algorithm != Automatic) { |
| 92 | switch (algorithm) { |
| 93 | case Goldfeather: |
| 94 | renderGoldfeather(primitives, depthComplexityAlgorithm); |
| 95 | break; |
| 96 | |
| 97 | case SCS: |
| 98 | renderSCS(primitives, depthComplexityAlgorithm); |
| 99 | break; |
| 100 | |
| 101 | default: |
| 102 | break; |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | void render(const std::vector<Primitive*>& primitives) |
| 108 | { |
no test coverage detected