|
|
|
@ -347,8 +347,8 @@ void FlatGLTest::renderTeardown() { |
|
|
|
void FlatGLTest::renderDefaults2D() { |
|
|
|
void FlatGLTest::renderDefaults2D() { |
|
|
|
GL::Mesh circle = MeshTools::compile(Primitives::circle2DSolid(32)); |
|
|
|
GL::Mesh circle = MeshTools::compile(Primitives::circle2DSolid(32)); |
|
|
|
|
|
|
|
|
|
|
|
Flat2D shader; |
|
|
|
Flat2D{} |
|
|
|
circle.draw(shader); |
|
|
|
.draw(circle); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -367,8 +367,8 @@ void FlatGLTest::renderDefaults2D() { |
|
|
|
void FlatGLTest::renderDefaults3D() { |
|
|
|
void FlatGLTest::renderDefaults3D() { |
|
|
|
GL::Mesh sphere = MeshTools::compile(Primitives::uvSphereSolid(16, 32)); |
|
|
|
GL::Mesh sphere = MeshTools::compile(Primitives::uvSphereSolid(16, 32)); |
|
|
|
|
|
|
|
|
|
|
|
Flat3D shader; |
|
|
|
Flat3D{} |
|
|
|
sphere.draw(shader); |
|
|
|
.draw(sphere); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -387,11 +387,10 @@ void FlatGLTest::renderDefaults3D() { |
|
|
|
void FlatGLTest::renderColored2D() { |
|
|
|
void FlatGLTest::renderColored2D() { |
|
|
|
GL::Mesh circle = MeshTools::compile(Primitives::circle2DSolid(32)); |
|
|
|
GL::Mesh circle = MeshTools::compile(Primitives::circle2DSolid(32)); |
|
|
|
|
|
|
|
|
|
|
|
Flat2D shader; |
|
|
|
Flat2D{} |
|
|
|
shader.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})); |
|
|
|
.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
|
|
|
|
.draw(circle); |
|
|
|
circle.draw(shader); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -415,15 +414,14 @@ void FlatGLTest::renderColored2D() { |
|
|
|
void FlatGLTest::renderColored3D() { |
|
|
|
void FlatGLTest::renderColored3D() { |
|
|
|
GL::Mesh sphere = MeshTools::compile(Primitives::uvSphereSolid(16, 32)); |
|
|
|
GL::Mesh sphere = MeshTools::compile(Primitives::uvSphereSolid(16, 32)); |
|
|
|
|
|
|
|
|
|
|
|
Flat3D shader; |
|
|
|
Flat3D{} |
|
|
|
shader.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setTransformationProjectionMatrix( |
|
|
|
.setTransformationProjectionMatrix( |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationX(15.0_degf)); |
|
|
|
Matrix4::rotationX(15.0_degf)) |
|
|
|
|
|
|
|
.draw(sphere); |
|
|
|
sphere.draw(shader); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -473,10 +471,10 @@ void FlatGLTest::renderSinglePixelTextured2D() { |
|
|
|
.setStorage(1, TextureFormatRGBA, Vector2i{1}) |
|
|
|
.setStorage(1, TextureFormatRGBA, Vector2i{1}) |
|
|
|
.setSubImage(0, {}, diffuseImage); |
|
|
|
.setSubImage(0, {}, diffuseImage); |
|
|
|
|
|
|
|
|
|
|
|
Flat2D shader{Flat3D::Flag::Textured}; |
|
|
|
Flat2D{Flat3D::Flag::Textured} |
|
|
|
shader.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
.bindTexture(texture); |
|
|
|
.bindTexture(texture) |
|
|
|
circle.draw(shader); |
|
|
|
.draw(circle); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -511,14 +509,14 @@ void FlatGLTest::renderSinglePixelTextured3D() { |
|
|
|
.setStorage(1, TextureFormatRGBA, Vector2i{1}) |
|
|
|
.setStorage(1, TextureFormatRGBA, Vector2i{1}) |
|
|
|
.setSubImage(0, {}, diffuseImage); |
|
|
|
.setSubImage(0, {}, diffuseImage); |
|
|
|
|
|
|
|
|
|
|
|
Flat3D shader{Flat3D::Flag::Textured}; |
|
|
|
Flat3D{Flat3D::Flag::Textured} |
|
|
|
shader.setTransformationProjectionMatrix( |
|
|
|
.setTransformationProjectionMatrix( |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationX(15.0_degf)) |
|
|
|
Matrix4::rotationX(15.0_degf)) |
|
|
|
.bindTexture(texture); |
|
|
|
.bindTexture(texture) |
|
|
|
sphere.draw(shader); |
|
|
|
.draw(sphere); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -560,13 +558,13 @@ void FlatGLTest::renderTextured2D() { |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
|
|
|
|
|
|
|
|
Flat2D shader{Flat2D::Flag::Textured}; |
|
|
|
Flat2D{Flat2D::Flag::Textured} |
|
|
|
shader.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
/* Colorized. Case without a color (where it should be white) is tested
|
|
|
|
/* Colorized. Case without a color (where it should be white) is tested
|
|
|
|
in renderSinglePixelTextured() */ |
|
|
|
in renderSinglePixelTextured() */ |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.bindTexture(texture); |
|
|
|
.bindTexture(texture) |
|
|
|
circle.draw(shader); |
|
|
|
.draw(circle); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -604,8 +602,8 @@ void FlatGLTest::renderTextured3D() { |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
|
|
|
|
|
|
|
|
Flat3D shader{Flat3D::Flag::Textured}; |
|
|
|
Flat3D{Flat3D::Flag::Textured} |
|
|
|
shader.setTransformationProjectionMatrix( |
|
|
|
.setTransformationProjectionMatrix( |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
@ -613,8 +611,8 @@ void FlatGLTest::renderTextured3D() { |
|
|
|
/* Colorized. Case without a color (where it should be white) is tested
|
|
|
|
/* Colorized. Case without a color (where it should be white) is tested
|
|
|
|
in renderSinglePixelTextured() */ |
|
|
|
in renderSinglePixelTextured() */ |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.bindTexture(texture); |
|
|
|
.bindTexture(texture) |
|
|
|
sphere.draw(shader); |
|
|
|
.draw(sphere); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -664,11 +662,11 @@ template<class T> void FlatGLTest::renderVertexColor2D() { |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
|
|
|
|
|
|
|
|
Flat2D shader{Flat2D::Flag::Textured|Flat2D::Flag::VertexColor}; |
|
|
|
Flat2D{Flat2D::Flag::Textured|Flat2D::Flag::VertexColor} |
|
|
|
shader.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.bindTexture(texture); |
|
|
|
.bindTexture(texture) |
|
|
|
circle.draw(shader); |
|
|
|
.draw(circle); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -718,15 +716,15 @@ template<class T> void FlatGLTest::renderVertexColor3D() { |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setStorage(1, TextureFormatRGB, image->size()) |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
.setSubImage(0, {}, *image); |
|
|
|
|
|
|
|
|
|
|
|
Flat3D shader{Flat3D::Flag::Textured|Flat3D::Flag::VertexColor}; |
|
|
|
Flat3D{Flat3D::Flag::Textured|Flat3D::Flag::VertexColor} |
|
|
|
shader.setTransformationProjectionMatrix( |
|
|
|
.setTransformationProjectionMatrix( |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationX(15.0_degf)) |
|
|
|
Matrix4::rotationX(15.0_degf)) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.bindTexture(texture); |
|
|
|
.bindTexture(texture) |
|
|
|
sphere.draw(shader); |
|
|
|
.draw(sphere); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -791,7 +789,7 @@ void FlatGLTest::renderAlpha2D() { |
|
|
|
if(data.flags & Flat3D::Flag::AlphaMask) |
|
|
|
if(data.flags & Flat3D::Flag::AlphaMask) |
|
|
|
shader.setAlphaMask(data.threshold); |
|
|
|
shader.setAlphaMask(data.threshold); |
|
|
|
|
|
|
|
|
|
|
|
circle.draw(shader); |
|
|
|
shader.draw(circle); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -848,9 +846,9 @@ void FlatGLTest::renderAlpha3D() { |
|
|
|
|
|
|
|
|
|
|
|
/* For proper Z order draw back faces first and then front faces */ |
|
|
|
/* For proper Z order draw back faces first and then front faces */ |
|
|
|
GL::Renderer::setFaceCullingMode(GL::Renderer::PolygonFacing::Front); |
|
|
|
GL::Renderer::setFaceCullingMode(GL::Renderer::PolygonFacing::Front); |
|
|
|
sphere.draw(shader); |
|
|
|
shader.draw(sphere); |
|
|
|
GL::Renderer::setFaceCullingMode(GL::Renderer::PolygonFacing::Back); |
|
|
|
GL::Renderer::setFaceCullingMode(GL::Renderer::PolygonFacing::Back); |
|
|
|
sphere.draw(shader); |
|
|
|
shader.draw(sphere); |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -904,12 +902,11 @@ void FlatGLTest::renderObjectId2D() { |
|
|
|
|
|
|
|
|
|
|
|
GL::Mesh circle = MeshTools::compile(Primitives::circle2DSolid(32)); |
|
|
|
GL::Mesh circle = MeshTools::compile(Primitives::circle2DSolid(32)); |
|
|
|
|
|
|
|
|
|
|
|
Flat2D shader{Flat3D::Flag::ObjectId}; |
|
|
|
Flat2D{Flat3D::Flag::ObjectId} |
|
|
|
shader.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
.setTransformationProjectionMatrix(Matrix3::projection({2.1f, 2.1f})) |
|
|
|
.setObjectId(47523); |
|
|
|
.setObjectId(47523) |
|
|
|
|
|
|
|
.draw(circle); |
|
|
|
circle.draw(shader); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
@ -949,16 +946,15 @@ void FlatGLTest::renderObjectId3D() { |
|
|
|
|
|
|
|
|
|
|
|
GL::Mesh sphere = MeshTools::compile(Primitives::uvSphereSolid(16, 32)); |
|
|
|
GL::Mesh sphere = MeshTools::compile(Primitives::uvSphereSolid(16, 32)); |
|
|
|
|
|
|
|
|
|
|
|
Flat3D shader{Flat3D::Flag::ObjectId}; |
|
|
|
Flat3D{Flat3D::Flag::ObjectId} |
|
|
|
shader.setColor(0x9999ff_rgbf) |
|
|
|
.setColor(0x9999ff_rgbf) |
|
|
|
.setTransformationProjectionMatrix( |
|
|
|
.setTransformationProjectionMatrix( |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::perspectiveProjection(60.0_degf, 1.0f, 0.1f, 10.0f)* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::translation(Vector3::zAxis(-2.15f))* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationY(-15.0_degf)* |
|
|
|
Matrix4::rotationX(15.0_degf)) |
|
|
|
Matrix4::rotationX(15.0_degf)) |
|
|
|
.setObjectId(48526); |
|
|
|
.setObjectId(48526) |
|
|
|
|
|
|
|
.draw(sphere); |
|
|
|
sphere.draw(shader); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
|
|
|