| 52 | ~PathTest() {} |
| 53 | |
| 54 | GetImageDataFunction createImageFunction( |
| 55 | int w, int h, int s, vec3 color0, vec3 color1, string name) |
| 56 | { |
| 57 | _imageFunctionInvocations[name] = 0; |
| 58 | return [this, w, h, s, color0, color1, name]( |
| 59 | ImageData& dataOut, AllocateBufferFunction alloc) { |
| 60 | uint8_t* pPixelData = static_cast<uint8_t*>(alloc(w * h * 4)); |
| 61 | int idx = 0; |
| 62 | for (int i = 0; i < w; i++) |
| 63 | { |
| 64 | for (int j = 0; j < h; j++) |
| 65 | { |
| 66 | vec3 color = ((i / s) % 2 == (j / s) % 2) ? color0 : color1; |
| 67 | pPixelData[idx++] = static_cast<uint8_t>(color.x * 255.0f); |
| 68 | pPixelData[idx++] = static_cast<uint8_t>(color.y * 255.0f); |
| 69 | pPixelData[idx++] = static_cast<uint8_t>(color.z * 255.0f); |
| 70 | pPixelData[idx++] = 255; |
| 71 | } |
| 72 | } |
| 73 | dataOut.pPixelBuffer = pPixelData; |
| 74 | dataOut.bufferSize = w * h * 4; |
| 75 | dataOut.dimensions = { w, h }; |
| 76 | dataOut.format = Aurora::ImageFormat::Integer_RGBA; |
| 77 | _imageFunctionInvocations[name]++; |
| 78 | return true; |
| 79 | }; |
| 80 | } |
| 81 | |
| 82 | map<string, int> _imageFunctionInvocations; |
| 83 | unique_ptr<GeomData> _pGeometryDataP; |
nothing calls this directly
no outgoing calls
no test coverage detected