Browse Source

Shaders: change icospheres to uvspheres in MeshVisualizer tests.

The icosphere doesn't have texture coordinates, which we'll need for
testing textured object ID.
pull/547/head
Vladimír Vondruš 4 years ago
parent
commit
0a6c8e660b
  1. 44
      src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp
  2. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/instancedobjectid3D.tga
  3. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-instancedobjectid3D.tga
  4. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-vertexid3D.tga
  5. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-wireframe-nogeo3D.tga
  6. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-wireframe-tbn3D.tga
  7. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-wireframe3D.tga
  8. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/objectid3D.tga
  9. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/primitiveid3D.tga
  10. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/vertexid3D.tga
  11. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/wireframe-instancedobjectid3D.tga
  12. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/wireframe-nogeo-instancedobjectid3D.tga
  13. BIN
      src/Magnum/Shaders/Test/MeshVisualizerTestFiles/wireframe-vertexid3D.tga

44
src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp

@ -3166,16 +3166,16 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderObjectV
#endif #endif
#endif #endif
Trade::MeshData icosphereData = Primitives::icosphereSolid(1); Trade::MeshData sphereData = Primitives::uvSphereSolid(4, 8);
/* Add the instanced Object ID data even if visualizing just uniform object /* Add the instanced Object ID data even if visualizing just uniform object
ID, to test the attribute isn't accidentally accessed always */ ID, to test the attribute isn't accidentally accessed always */
if(data.flags3D & MeshVisualizerGL3D::Flag::ObjectId) { if(data.flags3D & MeshVisualizerGL3D::Flag::ObjectId) {
Containers::Array<UnsignedInt> ids{80}; Containers::Array<UnsignedInt> ids{sphereData.indexCount()/3};
/* Each four faces share the same ID */ /* Each two faces share the same ID */
for(std::size_t i = 0; i != ids.size(); ++i) ids[i] = i/4; for(std::size_t i = 0; i != ids.size(); ++i) ids[i] = i/2;
icosphereData = MeshTools::combineFaceAttributes( sphereData = MeshTools::combineFaceAttributes(
icosphereData, { sphereData, {
Trade::MeshAttributeData{Trade::MeshAttribute::ObjectId, Trade::MeshAttributeData{Trade::MeshAttribute::ObjectId,
Containers::arrayView(ids)} Containers::arrayView(ids)}
}); });
@ -3185,9 +3185,9 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderObjectV
shader is disabled */ shader is disabled */
if(data.flags3D >= MeshVisualizerGL3D::Flag::PrimitiveIdFromVertexId || if(data.flags3D >= MeshVisualizerGL3D::Flag::PrimitiveIdFromVertexId ||
data.flags3D & MeshVisualizerGL3D::Flag::NoGeometryShader) data.flags3D & MeshVisualizerGL3D::Flag::NoGeometryShader)
icosphereData = MeshTools::duplicate(icosphereData); sphereData = MeshTools::duplicate(sphereData);
GL::Mesh icosphere = MeshTools::compile(icosphereData); GL::Mesh sphere = MeshTools::compile(sphereData);
MeshVisualizerGL3D shader{data.flags3D|flag}; MeshVisualizerGL3D shader{data.flags3D|flag};
shader shader
@ -3210,19 +3210,18 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderObjectV
/* For object ID we set a base ID to verify the uniform and instanced /* For object ID we set a base ID to verify the uniform and instanced
ID get summed. */ ID get summed. */
if(data.flags3D & MeshVisualizerGL3D::Flag::ObjectId) if(data.flags3D & MeshVisualizerGL3D::Flag::ObjectId)
shader.setObjectId(20); shader.setObjectId(sphere.count()/6);
/* For vertex ID we don't want any repeat/wraparound as that causes /* For vertex ID we don't want any repeat/wraparound as that causes
disruptions in the gradient and test failures. There's 42 vertices disruptions in the gradient and test failures */
also. */
if(data.flags3D & MeshVisualizerGL3D::Flag::VertexId) if(data.flags3D & MeshVisualizerGL3D::Flag::VertexId)
shader.setColorMapTransformation(1.0f, -1.0f/42.0f); shader.setColorMapTransformation(1.0f, -1.0f/sphereData.vertexCount());
/* For object/primitive ID there's no gradient so a wraparound is okay. /* For object/primitive ID there's no gradient so a wraparound is okay.
For the object ID this should cover the second half of the colormap For the object ID this should cover the second half of the colormap
(due to the uniform object ID), in reverse order; for primitive ID (due to the uniform object ID), in reverse order; for primitive ID
the whole colormap due to the repeat wrapping */ the whole colormap due to the repeat wrapping */
else else
shader.setColorMapTransformation(0.5f, -1.0f/40.0f); shader.setColorMapTransformation(0.5f, -1.0f/(sphere.count()/3));
shader.draw(icosphere); shader.draw(sphere);
} else if(flag == MeshVisualizerGL3D::Flag::UniformBuffers) { } else if(flag == MeshVisualizerGL3D::Flag::UniformBuffers) {
/* See above for comments */ /* See above for comments */
GL::Buffer projectionUniform{GL::Buffer::TargetHint::Uniform, { GL::Buffer projectionUniform{GL::Buffer::TargetHint::Uniform, {
@ -3239,23 +3238,23 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderObjectV
}}; }};
GL::Buffer drawUniform{GL::Buffer::TargetHint::Uniform, { GL::Buffer drawUniform{GL::Buffer::TargetHint::Uniform, {
MeshVisualizerDrawUniform3D{} MeshVisualizerDrawUniform3D{}
.setObjectId(20) .setObjectId(sphere.count()/6)
}}; }};
MeshVisualizerMaterialUniform materialUniformData[1]; MeshVisualizerMaterialUniform materialUniformData[1];
materialUniformData->setColor(0xffff00_rgbf); materialUniformData->setColor(0xffff00_rgbf);
if(data.flags3D & MeshVisualizerGL3D::Flag::Wireframe) if(data.flags3D & MeshVisualizerGL3D::Flag::Wireframe)
materialUniformData->setWireframeColor(0xffffff_rgbf); materialUniformData->setWireframeColor(0xffffff_rgbf);
if(data.flags3D & MeshVisualizerGL3D::Flag::VertexId) if(data.flags3D & MeshVisualizerGL3D::Flag::VertexId)
materialUniformData->setColorMapTransformation(1.0f, -1.0f/42.0f); materialUniformData->setColorMapTransformation(1.0f, -1.0f/sphereData.vertexCount());
else else
materialUniformData->setColorMapTransformation(0.5f, -1.0f/40.0f); materialUniformData->setColorMapTransformation(0.5f, -1.0f/(sphere.count()/3));
GL::Buffer materialUniform{materialUniformData}; GL::Buffer materialUniform{materialUniformData};
shader shader
.bindProjectionBuffer(projectionUniform) .bindProjectionBuffer(projectionUniform)
.bindTransformationBuffer(transformationUniform) .bindTransformationBuffer(transformationUniform)
.bindDrawBuffer(drawUniform) .bindDrawBuffer(drawUniform)
.bindMaterialBuffer(materialUniform) .bindMaterialBuffer(materialUniform)
.draw(icosphere); .draw(sphere);
} else CORRADE_INTERNAL_ASSERT_UNREACHABLE(); } else CORRADE_INTERNAL_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -4132,12 +4131,9 @@ void MeshVisualizerGLTest::renderMulti3D() {
CORRADE_SKIP("UBOs with dynamically indexed arrays are a crashy dumpster fire on SwiftShader, can't test."); CORRADE_SKIP("UBOs with dynamically indexed arrays are a crashy dumpster fire on SwiftShader, can't test.");
#endif #endif
Trade::MeshData sphereData = MeshTools::interleave(Primitives::icosphereSolid(0), { /* We don't visualize tangents for the sphere, but concatenate() will
/* The icosphere doesn't have tangents and we don't use them, but ignore the tangents of others if the first mesh doesn't have them */
concatenate() will ignore the tangents of others if the first mesh Trade::MeshData sphereData = Primitives::uvSphereSolid(2, 4, Primitives::UVSphereFlag::Tangents);
doesn't have them, so add a bogus data at least */
Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, VertexFormat::Vector4, nullptr}
});
/* Plane is a strip, make it indexed first */ /* Plane is a strip, make it indexed first */
Trade::MeshData planeData = MeshTools::generateIndices(Primitives::planeSolid(Primitives::PlaneFlag::Tangents)); Trade::MeshData planeData = MeshTools::generateIndices(Primitives::planeSolid(Primitives::PlaneFlag::Tangents));
Trade::MeshData coneData = Primitives::coneSolid(1, 8, 1.0f, Primitives::ConeFlag::Tangents); Trade::MeshData coneData = Primitives::coneSolid(1, 8, 1.0f, Primitives::ConeFlag::Tangents);

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/instancedobjectid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-instancedobjectid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-vertexid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-wireframe-nogeo3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-wireframe-tbn3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/multidraw-wireframe3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/objectid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/primitiveid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/vertexid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/wireframe-instancedobjectid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/wireframe-nogeo-instancedobjectid3D.tga

Binary file not shown.

BIN
src/Magnum/Shaders/Test/MeshVisualizerTestFiles/wireframe-vertexid3D.tga

Binary file not shown.
Loading…
Cancel
Save