(drawGeometry, lightingModes)
| 168 | }; |
| 169 | const checkNormals = () => myp5.normalMaterial(); |
| 170 | function assertGeometryRendersMatch(drawGeometry, lightingModes) { |
| 171 | myp5.createCanvas(50, 50, myp5.WEBGL); |
| 172 | myp5.pixelDensity(1); |
| 173 | myp5.setAttributes({ antialias: false }); |
| 174 | |
| 175 | for (const applyLights of lightingModes) { |
| 176 | // Regular mode |
| 177 | myp5.background(255); |
| 178 | myp5.fill(255); |
| 179 | myp5.push(); |
| 180 | applyLights(); |
| 181 | drawGeometry(); |
| 182 | myp5.pop(); |
| 183 | myp5.resetShader(); |
| 184 | const regularImage = myp5._renderer.canvas.toDataURL(); |
| 185 | |
| 186 | // Geometry mode |
| 187 | myp5.fill(255); |
| 188 | const geom = myp5.buildGeometry(drawGeometry); |
| 189 | myp5.background(255); |
| 190 | myp5.push(); |
| 191 | applyLights(); |
| 192 | myp5.model(geom); |
| 193 | myp5.pop(); |
| 194 | myp5.resetShader(); |
| 195 | const geometryImage = myp5._renderer.canvas.toDataURL(); |
| 196 | |
| 197 | assert.equal(regularImage, geometryImage); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | test('Transforms are applied to models', function() { |
| 202 | assertGeometryRendersMatch(function() { |
no test coverage detected