From 68a9f8291b83425f46fe9877bfc966e524d1f6a4 Mon Sep 17 00:00:00 2001 From: Philip Trettner <Philip.Trettner@rwth-aachen.de> Date: Wed, 16 Oct 2019 07:28:36 +0200 Subject: [PATCH] fixed removal of mandatory glm dep --- extern/glow | 2 +- extern/glow-extras | 2 +- extern/polymesh | 2 +- extern/typed-geometry | 2 +- samples/basic/lighting/LightingSample.cc | 8 +-- .../post-processing/PostProcessingSample.cc | 4 +- .../post-processing/PostProcessingSample.hh | 6 +- samples/basic/shadow/ShadowSample.cc | 4 +- samples/demo/flowanim/FlowAnimSample.cc | 2 + .../wip/geometry-grass/GeometryGrassSample.cc | 35 ++++++----- .../wip/geometry-grass/GeometryGrassSample.hh | 4 +- samples/wip/path-tracer/PathTracerSample.hh | 4 +- .../RenderingPipelineSample.cc | 48 +++++++-------- .../RenderingPipelineSample.hh | 8 +-- samples/wip/voxels/Voxels.cc | 6 +- tests/glow/geometry/Cube.cc | 6 +- tests/glow/geometry/Quad.cc | 8 +-- tests/glow/std140.cc | 61 ++++++------------- 18 files changed, 95 insertions(+), 117 deletions(-) diff --git a/extern/glow b/extern/glow index 513580f..ba50935 160000 --- a/extern/glow +++ b/extern/glow @@ -1 +1 @@ -Subproject commit 513580fb0d0ed40517a048ce0580bb844f3a76a3 +Subproject commit ba5093539d8be988da4ab15834f875d6bbcfc347 diff --git a/extern/glow-extras b/extern/glow-extras index c79194a..eeae4d0 160000 --- a/extern/glow-extras +++ b/extern/glow-extras @@ -1 +1 @@ -Subproject commit c79194a72351899b5c54da20c0838fece62670bf +Subproject commit eeae4d08494b9ac58765bd33097a8610a0ecff32 diff --git a/extern/polymesh b/extern/polymesh index a50e12b..5ee0b30 160000 --- a/extern/polymesh +++ b/extern/polymesh @@ -1 +1 @@ -Subproject commit a50e12bfb73f7cf764d954200cc770261e52fb70 +Subproject commit 5ee0b30d132202fecefb7f777f2287fdf1daa13b diff --git a/extern/typed-geometry b/extern/typed-geometry index f273740..5667d30 160000 --- a/extern/typed-geometry +++ b/extern/typed-geometry @@ -1 +1 @@ -Subproject commit f2737400016d652e77048e54885e466ce769cb6c +Subproject commit 5667d301be090fe5e175714cc6497c096f9189b5 diff --git a/samples/basic/lighting/LightingSample.cc b/samples/basic/lighting/LightingSample.cc index 1593ef9..f3a3627 100644 --- a/samples/basic/lighting/LightingSample.cc +++ b/samples/basic/lighting/LightingSample.cc @@ -32,10 +32,10 @@ void LightingSample::init() mShaderBG = Program::createFromFile(util::pathOf(__FILE__) + "/bg"); mSphere = geometry::UVSphere<>().generate(); mPlane = geometry::Quad<geometry::CubeVertex>().generate([](float u, float v) { - return geometry::CubeVertex{glm::vec3((u * 2 - 1) * 10000, 0, (v * 2 - 1) * 10000), // - glm::vec3(0, 1, 0), // - glm::vec3(1, 0, 0), // - glm::vec2(u, v)}; + return geometry::CubeVertex{tg::pos3((u * 2 - 1) * 10000, 0, (v * 2 - 1) * 10000), // + tg::vec3(0, 1, 0), // + tg::vec3(1, 0, 0), // + tg::pos2(u, v)}; }); mQuad = geometry::Quad<>().generate(); diff --git a/samples/basic/post-processing/PostProcessingSample.cc b/samples/basic/post-processing/PostProcessingSample.cc index 98850d7..7dad836 100644 --- a/samples/basic/post-processing/PostProcessingSample.cc +++ b/samples/basic/post-processing/PostProcessingSample.cc @@ -99,7 +99,7 @@ void PostProcessingSample::ppSwap() void PostProcessingSample::init() { - setUseDefaultCameraHandlingLeft(false); + // setUseDefaultCameraHandlingLeft(false); setGui(GlfwApp::Gui::AntTweakBar); GlfwApp::init(); // call to base! @@ -325,6 +325,8 @@ void PostProcessingSample::render(float elapsedSeconds) void PostProcessingSample::onResize(int w, int h) { + GlfwApp::onResize(w, h); + for (auto const& tex : {mTexColor, // mTexNormal, // mTexVelocity, // diff --git a/samples/basic/post-processing/PostProcessingSample.hh b/samples/basic/post-processing/PostProcessingSample.hh index d564933..387ed07 100644 --- a/samples/basic/post-processing/PostProcessingSample.hh +++ b/samples/basic/post-processing/PostProcessingSample.hh @@ -106,9 +106,9 @@ private: // post-processing float mElapsedSeconds; float mMotionBlurLength = 30.0f; - - glm::mat4 mPrevView; - glm::mat4 mPrevProj; + + tg::mat4 mPrevView; + tg::mat4 mPrevProj; void copyTo(glow::SharedTextureRectangle const& from, glow::SharedFramebuffer const& to) const; diff --git a/samples/basic/shadow/ShadowSample.cc b/samples/basic/shadow/ShadowSample.cc index e5c974b..e102e62 100644 --- a/samples/basic/shadow/ShadowSample.cc +++ b/samples/basic/shadow/ShadowSample.cc @@ -108,8 +108,8 @@ void ShadowSample::render(float elapsedSeconds) glm::mat4 modelMatrix = glm::rotate(float(mRuntime), glm::vec3(0, 1, 0)); // Get the projection and view matrices from the GlowApp-Camera - glm::mat4 proj = getCamera()->getProjectionMatrix(); - glm::mat4 view = getCamera()->getViewMatrix(); + tg::mat4 proj = getCamera()->getProjectionMatrix(); + tg::mat4 view = getCamera()->getViewMatrix(); // Compute shadow matrices glm::mat4 shadowProjMatrix = glm::perspective(glm::pi<float>() / 5.0f, 1.0f, 1.0f, 100.0f); diff --git a/samples/demo/flowanim/FlowAnimSample.cc b/samples/demo/flowanim/FlowAnimSample.cc index 85283e5..16ea82e 100644 --- a/samples/demo/flowanim/FlowAnimSample.cc +++ b/samples/demo/flowanim/FlowAnimSample.cc @@ -134,6 +134,8 @@ void FlowAnimSample::render(float elapsedSeconds) void FlowAnimSample::onResize(int w, int h) { + GlfwApp::onResize(w, h); + mResultA->bind().resize(w, h); mResultB->bind().resize(w, h); diff --git a/samples/wip/geometry-grass/GeometryGrassSample.cc b/samples/wip/geometry-grass/GeometryGrassSample.cc index 96a2014..78c9d3a 100644 --- a/samples/wip/geometry-grass/GeometryGrassSample.cc +++ b/samples/wip/geometry-grass/GeometryGrassSample.cc @@ -4,8 +4,7 @@ #include <numeric> #include <random> -#include <glm/ext.hpp> -#include <glm/glm.hpp> +#include <typed-geometry/tg.hh> #include <imgui/imgui.h> @@ -76,7 +75,7 @@ public: } // Get a noise value, for 2D images z can have any value - float noise(glm::vec3 const& vec) const + float noise(tg::pos3 const& vec) const { // Find the unit cube that contains the point auto X = static_cast<unsigned>(floor(vec.x)) & 255; @@ -126,9 +125,9 @@ private: struct GrassBladeVertex { - glm::vec3 pos; - glm::vec3 normal; - glm::vec3 tangent; + tg::pos3 pos; + tg::vec3 normal; + tg::vec3 tangent; static std::vector<ArrayBufferAttribute> attributes() { @@ -165,8 +164,8 @@ private: glm::vec2 mPosMax = glm::vec2(std::numeric_limits<float>().min()); ///< World space max position of the grass field, Y omitted std::vector<GrassBladeVertex> mBlades; ///< Vertices of the point cloud - glm::ivec2 mTexSize; ///< Size of the texture - glm::uvec2 mComputeRange; ///< Amount of workgroups covered by the texture + tg::isize2 mTexSize; ///< Size of the texture + tg::isize2 mComputeRange; ///< Amount of workgroups covered by the texture private: void updateTextureSize(float texelSize) @@ -174,7 +173,7 @@ private: auto const fieldSizeX = mPosMax.x - mPosMin.x; auto const fieldSizeZ = mPosMax.y - mPosMin.y; mTexSize = {static_cast<int>(glm::ceil(fieldSizeX / texelSize)), static_cast<int>(glm::ceil(fieldSizeZ / texelSize))}; - mComputeRange = {INT_DIV_CEIL(mTexSize.x, WORK_GROUP_SIZE), INT_DIV_CEIL(mTexSize.y, WORK_GROUP_SIZE)}; + mComputeRange = {INT_DIV_CEIL(mTexSize.width, WORK_GROUP_SIZE), INT_DIV_CEIL(mTexSize.height, WORK_GROUP_SIZE)}; } void fill(glm::vec2 const& start, glm::vec2 const& end, float worldHeight, bool performCheck) @@ -190,8 +189,8 @@ private: auto const randomFloatB = (static_cast<float>(rand()) / static_cast<float>(RAND_MAX)) * 2.f - 1.f; auto const worldPos - = glm::vec3(start.x, worldHeight, start.y) - + glm::vec3(x * bladeDistance + bladeDistanceVariation * randomFloatA, 0, z * bladeDistance + bladeDistanceVariation * randomFloatB); + = tg::pos3(start.x, worldHeight, start.y) + + tg::vec3(x * bladeDistance + bladeDistanceVariation * randomFloatA, 0, z * bladeDistance + bladeDistanceVariation * randomFloatB); if (performCheck) { @@ -207,7 +206,7 @@ private: continue; } - auto const randomTangent = glm::rotateY(glow::transform::Right(), mNoise.noise(worldPos * 3.f) * glm::pi<float>() * 2.f); + auto const randomTangent = tg::rotate_y(glow::transform::Right(), mNoise.noise(worldPos * 3.f) * 360_deg); mBlades.emplace_back(GrassBladeVertex{worldPos, glow::transform::Up(), randomTangent}); } @@ -250,7 +249,7 @@ public: { updateTextureSize(texelSize); - glow::info() << "Generated texture of size " << mTexSize.x << "x" << mTexSize.y; + glow::info() << "Generated texture of size " << mTexSize.width << "x" << mTexSize.height; auto res = Texture2D::createStorageImmutable(mTexSize, GL_RGBA8, 1); res->bind().setWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE); res->setMipmapsGenerated(true); @@ -297,7 +296,7 @@ void GeometryGrassSample::init() mTexTrampleComputeRange = grassField.getComputeRange(); mGrassUBOData.setWorldBounds(grassField.getPosMin(), grassField.getPosMax()); - mGrassUBOData.inverseTrampleTexSize = 1.f / glm::vec2(mTextureTrample->getSize()); + mGrassUBOData.inverseTrampleTexSize = 1.f / tg::vec2(mTextureTrample->getSize()); } // Create UBO + SSBO @@ -341,13 +340,13 @@ void GeometryGrassSample::init() shader.compute(mTexTrampleComputeRange); } - getCamera()->setLookAt(glm::vec3(0, 2, -1), glm::vec3(3, 0, 3)); + getCamera()->setLookAt(tg::pos3(0, 2, -1), tg::pos3(3, 0, 3)); mGpuTimer.init(); } void GeometryGrassSample::render(float dt) { - mMowerPosition += glm::vec2(dt * 0.5f); + mMowerPosition += tg::vec2(dt * 0.5f); GlfwApp::render(dt); } @@ -363,10 +362,10 @@ void GeometryGrassSample::onGui() ImGui::Separator(); ImGui::Text("Grass drawing: %.4fms", static_cast<double>(mGrassTime)); ImGui::Separator(); - ImGui::InputFloat2("Mower Position", glm::value_ptr(mMowerPosition)); + ImGui::InputFloat2("Mower Position", tg::data_ptr(mMowerPosition)); if (ImGui::Button("Reset Mower")) { - mMowerPosition = glm::vec2(-0.05f); + mMowerPosition = tg::pos2(-0.05f); } ImGui::SameLine(); if (ImGui::Button("Refresh grass")) diff --git a/samples/wip/geometry-grass/GeometryGrassSample.hh b/samples/wip/geometry-grass/GeometryGrassSample.hh index b6926d1..707f5c0 100644 --- a/samples/wip/geometry-grass/GeometryGrassSample.hh +++ b/samples/wip/geometry-grass/GeometryGrassSample.hh @@ -73,12 +73,12 @@ private: glow::SharedTexture2D mTextureNoise; glow::SharedTexture2D mTextureTrample; - glm::uvec2 mTexTrampleComputeRange; + tg::isize2 mTexTrampleComputeRange; glow::timing::GpuTimer mGpuTimer; float mGrassTime = 0.f; - glm::vec2 mMowerPosition = glm::vec2(-0.05f); + tg::pos2 mMowerPosition = tg::pos2(-0.05f); struct { diff --git a/samples/wip/path-tracer/PathTracerSample.hh b/samples/wip/path-tracer/PathTracerSample.hh index 6135f90..7a7f8d3 100644 --- a/samples/wip/path-tracer/PathTracerSample.hh +++ b/samples/wip/path-tracer/PathTracerSample.hh @@ -1,7 +1,5 @@ #pragma once -#include <glm/ext.hpp> - #include <glow/fwd.hh> #include <glow-extras/glfw/GlfwApp.hh> @@ -26,7 +24,7 @@ private: int mWidth, mHeight; int lastBounces = -1; - glm::mat4 mLastViewProj; + tg::mat4 mLastViewProj; void resetTracer(); protected: diff --git a/samples/wip/rendering-pipeline/RenderingPipelineSample.cc b/samples/wip/rendering-pipeline/RenderingPipelineSample.cc index 09a73bc..5474f22 100644 --- a/samples/wip/rendering-pipeline/RenderingPipelineSample.cc +++ b/samples/wip/rendering-pipeline/RenderingPipelineSample.cc @@ -4,7 +4,7 @@ #include <memory> #include <vector> -#include <glm/ext.hpp> +#include <typed-geometry/tg.hh> #include <imgui/imgui.h> @@ -63,7 +63,7 @@ void RenderingPipelineSample::onGui() if (ImGui::Button("Reset Camera")) { - getCamera()->setLookAt(glm::vec3(sampleMaxX - 4, 5, sampleMaxZ + 10), glm::vec3(sampleMaxX / 2, -3, sampleMaxZ / 2)); + getCamera()->setLookAt(tg::pos3(sampleMaxX - 4, 5, sampleMaxZ + 10), tg::pos3(sampleMaxX / 2, -3, sampleMaxZ / 2)); } if (ImGui::Button("Toggle Fullscreen")) @@ -116,28 +116,28 @@ void RenderingPipelineSample::onGatherLights(glow::pipeline::LightCallback& lc) static constexpr auto intensity = 1.5f; static constexpr auto roughIntensity = 4.f; - static const auto backLeftC = colors::color::from_hex("CEF19E").to_rgb(); - static const auto frontLeftC = colors::color::from_hex("836890").to_rgb(); - static const auto centerC = colors::color::from_hex("0DFF9F").to_rgb(); - static const auto backRightC = colors::color::from_hex("068587").to_rgb(); - static const auto frontRightC = colors::color::from_hex("ED553B").to_rgb(); - static const auto movingC = colors::color::from_hex("ED553B").to_rgb(); - - lc.addLight(glm::vec3(1, defY, 1), backLeftC * intensity, size, radius); - lc.addLight(glm::vec3(1, defY, sampleMaxZ - 1), frontLeftC * intensity, size, radius); - lc.addLight(glm::vec3(sampleMaxX - 1, defY, 1), backRightC * roughIntensity, size, radius); - lc.addLight(glm::vec3(sampleMaxX / 2, defY + 2, sampleMaxZ / 2), centerC * roughIntensity, size, radius); - lc.addLight(glm::vec3(sampleMaxX - 1, defY, sampleMaxZ - 1), frontRightC * roughIntensity, size, radius); + static const auto backLeftC = tg::color3(colors::color::from_hex("CEF19E").to_rgb()); + static const auto frontLeftC = tg::color3(colors::color::from_hex("836890").to_rgb()); + static const auto centerC = tg::color3(colors::color::from_hex("0DFF9F").to_rgb()); + static const auto backRightC = tg::color3(colors::color::from_hex("068587").to_rgb()); + static const auto frontRightC = tg::color3(colors::color::from_hex("ED553B").to_rgb()); + static const auto movingC = tg::color3(colors::color::from_hex("ED553B").to_rgb()); + + lc.addLight(tg::pos3(1, defY, 1), backLeftC * intensity, size, radius); + lc.addLight(tg::pos3(1, defY, sampleMaxZ - 1), frontLeftC * intensity, size, radius); + lc.addLight(tg::pos3(sampleMaxX - 1, defY, 1), backRightC * roughIntensity, size, radius); + lc.addLight(tg::pos3(sampleMaxX / 2, defY + 2, sampleMaxZ / 2), centerC * roughIntensity, size, radius); + lc.addLight(tg::pos3(sampleMaxX - 1, defY, sampleMaxZ - 1), frontRightC * roughIntensity, size, radius); // Moving Light const auto timeVaryingX = (sampleMaxX / 2) + std::sin(getCurrentTime()) * (sampleMaxX / 2); const auto timeVaryingZ = (sampleMaxZ / 2) + std::cos(getCurrentTime()) * (sampleMaxZ / 2); - lc.addLight(glm::vec3(timeVaryingX, defY, timeVaryingZ), movingC * intensity, size, 4.f); + lc.addLight(tg::pos3(timeVaryingX, defY, timeVaryingZ), movingC * intensity, size, 4.f); // Long Tube lights static constexpr auto tubeLightY = -7; - lc.addLight(glm::vec3(1, tubeLightY, sampleMaxZ - 1), glm::vec3(sampleMaxX - 1, tubeLightY, 1), frontLeftC, .25f, radius); - lc.addLight(glm::vec3(1, tubeLightY, 1), glm::vec3(sampleMaxX - 1, tubeLightY, sampleMaxZ - 1), backRightC, .25f, radius); + lc.addLight(tg::pos3(1, tubeLightY, sampleMaxZ - 1), tg::pos3(sampleMaxX - 1, tubeLightY, 1), frontLeftC, .25f, radius); + lc.addLight(tg::pos3(1, tubeLightY, 1), tg::pos3(sampleMaxX - 1, tubeLightY, sampleMaxZ - 1), backRightC, .25f, radius); } void RenderingPipelineSample::onRenderTransparentPass(glow::pipeline::RenderContext const& info) @@ -173,12 +173,12 @@ void RenderingPipelineSample::initMeshes() for (float metallic : sampleMetallicDist) { mMeshEntries.emplace_back(MeshEntry{ - mMeshSample, glm::translate(glm::vec3(roughnessCount * sampleRoughnessPosOffset, 0, metallicCount * sampleMetallicPosOffset)), - glm::vec3(1, .9f, 1), roughness, metallic}); + mMeshSample, tg::translation(tg::vec3(roughnessCount * sampleRoughnessPosOffset, 0, metallicCount * sampleMetallicPosOffset)), + tg::color3(1, .9f, 1), roughness, metallic}); mTransparentMeshEntries.emplace_back( - TransparentMeshEntry{glm::translate(glm::vec3(roughnessCount * sampleRoughnessPosOffset, -4, metallicCount * sampleMetallicPosOffset)), - glm::vec3(.6f, .6f, 1), roughness, metallic, std::max(roughness, 0.1f)}); + TransparentMeshEntry{tg::translation(tg::vec3(roughnessCount * sampleRoughnessPosOffset, -4, metallicCount * sampleMetallicPosOffset)), + tg::color3(.6f, .6f, 1), roughness, metallic, std::max(roughness, 0.1f)}); ++metallicCount; } @@ -187,8 +187,8 @@ void RenderingPipelineSample::initMeshes() // Floor mMeshEntries.emplace_back(MeshEntry{glow::geometry::Cube<>().generate(), - glm::translate(glm::vec3(sampleMaxX / 2, -8, sampleMaxZ / 2)) * glm::scale(glm::vec3(sampleMaxX, .25f, sampleMaxZ)), - glm::vec3(.75), .45f, .95f}); + tg::translation(tg::vec3(sampleMaxX / 2, -8, sampleMaxZ / 2)) * tg::scaling(tg::size3(sampleMaxX, .25f, sampleMaxZ)), + tg::color3(.75), .45f, .95f}); } void RenderingPipelineSample::drawOpaqueGeometry(UsedProgram& shader, const CameraData& camData, bool zPreOnly) @@ -239,7 +239,7 @@ void RenderingPipelineSample::init() getPipelineScene()->contrast = 1.3f; getCamera()->setFarPlane(2000); getCamera()->setNearPlane(0.01f); - getCamera()->setLookAt(glm::vec3(sampleMaxX - 4, 5, sampleMaxZ + 10), glm::vec3(sampleMaxX / 2, -3, sampleMaxZ / 2)); + getCamera()->setLookAt(tg::pos3(sampleMaxX - 4, 5, sampleMaxZ + 10), tg::pos3(sampleMaxX / 2, -3, sampleMaxZ / 2)); } // -- Asset loading -- diff --git a/samples/wip/rendering-pipeline/RenderingPipelineSample.hh b/samples/wip/rendering-pipeline/RenderingPipelineSample.hh index f6064c6..3702c37 100644 --- a/samples/wip/rendering-pipeline/RenderingPipelineSample.hh +++ b/samples/wip/rendering-pipeline/RenderingPipelineSample.hh @@ -19,16 +19,16 @@ private: struct MeshEntry { glow::SharedVertexArray mesh; - glm::mat4 model; - glm::vec3 albedo; + tg::mat4 model; + tg::color3 albedo; float roughness; float metallic; }; struct TransparentMeshEntry { - glm::mat4 model; - glm::vec3 albedo; + tg::mat4 model; + tg::color3 albedo; float roughness; float metallic; float alpha; diff --git a/samples/wip/voxels/Voxels.cc b/samples/wip/voxels/Voxels.cc index 73dd8a7..07fde5b 100644 --- a/samples/wip/voxels/Voxels.cc +++ b/samples/wip/voxels/Voxels.cc @@ -485,9 +485,9 @@ glow::SharedVertexArray Voxels::buildMesh(glow::SharedShaderStorageBuffer const& } GpuVoxel voxel; - voxel.normal = n; - voxel.colors = colors; - voxel.lights = lights; + voxel.normal = tg::vec3(n); + voxel.colors = tg::mat4(colors); + voxel.lights = tg::mat4(lights); voxels.push_back(voxel); indices.push_back(bi + 1); diff --git a/tests/glow/geometry/Cube.cc b/tests/glow/geometry/Cube.cc index 2a25378..dcdd2b9 100644 --- a/tests/glow/geometry/Cube.cc +++ b/tests/glow/geometry/Cube.cc @@ -18,11 +18,11 @@ TEST_CASE("ExtrasGeometry, Cube") }; } - glm::vec3 pos; - glm::vec3 normal; + tg::pos3 pos; + tg::vec3 normal; MyCubeVertex() = default; - MyCubeVertex(glm::vec3 p, glm::vec3 n, glm::vec3, glm::vec2) : pos(p), normal(n) {} + MyCubeVertex(tg::pos3 p, tg::vec3 n, tg::vec3, tg::pos2) : pos(p), normal(n) {} }; auto cube0 = geometry::Cube<>().generate(); diff --git a/tests/glow/geometry/Quad.cc b/tests/glow/geometry/Quad.cc index c364285..db09712 100644 --- a/tests/glow/geometry/Quad.cc +++ b/tests/glow/geometry/Quad.cc @@ -8,7 +8,7 @@ using namespace glow; -static glm::vec2 MakeQuad(float u, float v) { return {u + 1, v + 1}; } +static tg::pos2 MakeQuad(float u, float v) { return {u + 1, v + 1}; } TEST_CASE("ExtrasGeometry, Quad") { @@ -44,14 +44,14 @@ TEST_CASE("ExtrasGeometry, Quad") float s = 1.2345f; auto make_quad = [&](float u, float v) -> ComplexQuadVertex { return {v + s, u + s}; }; - std::function<glm::vec2(float, float)> make_quad2 = [](float u, float v) -> glm::vec2 { return {v, u}; }; + std::function<tg::pos2(float, float)> make_quad2 = [](float u, float v) -> tg::pos2 { return {v, u}; }; auto quad0 = geometry::Quad<>().generate(); - auto quad1 = geometry::Quad<glm::vec2>().generate(); + auto quad1 = geometry::Quad<tg::pos2>().generate(); auto quad2 = geometry::Quad<QuadVertex>({{&QuadVertex::u, "u"}, {&QuadVertex::v, "v"}}).generate(); auto quad3 = geometry::Quad<CustomCtorQuadVertex>({{&CustomCtorQuadVertex::pos, "aPosition"}}).generate(); auto quad4 = geometry::Quad<ComplexQuadVertex>().generate(); - auto quad5 = geometry::Quad<>().generate([](float u, float v) { return glm::vec2{v, u}; }); + auto quad5 = geometry::Quad<>().generate([](float u, float v) { return tg::pos2{v, u}; }); auto quad6 = geometry::Quad<ComplexQuadVertex>().generate(make_quad); auto quad7 = geometry::Quad<>().generate(make_quad2); auto quad8 = geometry::Quad<>().generate(MakeQuad); diff --git a/tests/glow/std140.cc b/tests/glow/std140.cc index 5dcdfd1..a18c504 100644 --- a/tests/glow/std140.cc +++ b/tests/glow/std140.cc @@ -2,17 +2,17 @@ #include <glow/std140.hh> #if !GLOW_COMPILER_MSVC -typedef glm::vec4 std140vec4b __attribute__((__aligned__(4 * 4))); -typedef glm::vec4 std140vec4c __attribute__((__aligned__(4 * 4))); -typedef glm::vec3 std140vec3c __attribute__((__aligned__(4 * 4))); +typedef tg::vec4 std140vec4b __attribute__((__aligned__(4 * 4))); +typedef tg::vec4 std140vec4c __attribute__((__aligned__(4 * 4))); +typedef tg::vec3 std140vec3c __attribute__((__aligned__(4 * 4))); #endif #include <glow/objects/Program.hh> #include <glow/objects/Shader.hh> #include <glow/objects/UniformBuffer.hh> #if !GLOW_COMPILER_MSVC -typedef glm::vec4 std140vec4d __attribute__((__aligned__(4 * 4))); -typedef glm::vec3 std140vec3b __attribute__((__aligned__(4 * 4))); +typedef tg::vec4 std140vec4d __attribute__((__aligned__(4 * 4))); +typedef tg::vec3 std140vec3b __attribute__((__aligned__(4 * 4))); #endif using namespace glow; @@ -36,10 +36,6 @@ struct MyBuffer std140ivec3 iv3; std140ivec4 iv4; - std140bvec2 bv2; - std140bvec3 bv3; - std140bvec4 bv4; - std140dvec2 dv2; std140dvec3 dv3; std140dvec4 dv4; @@ -49,32 +45,20 @@ struct MyBuffer std140uvec4 uv4; // matrices - std140mat2 m2; - std140mat3 m3; std140mat4 m4; - std140mat2x2 m2x2; - std140mat2x3 m2x3; std140mat2x4 m2x4; - std140mat3x2 m3x2; - std140mat3x3 m3x3; std140mat3x4 m3x4; - std140mat4x2 m4x2; - std140mat4x3 m4x3; std140mat4x4 m4x4; std140dmat2 dm2; - std140dmat3 dm3; std140dmat4 dm4; std140dmat2x2 dm2x2; - std140dmat2x3 dm2x3; std140dmat2x4 dm2x4; std140dmat3x2 dm3x2; - std140dmat3x3 dm3x3; std140dmat3x4 dm3x4; std140dmat4x2 dm4x2; - std140dmat4x3 dm4x3; std140dmat4x4 dm4x4; }; } @@ -99,39 +83,32 @@ TEST_CASE("Std140, Access") b.l = l + 1; CHECK(b.l == 2.f); - glm::vec2 v2 = b.v2; + tg::vec2 v2 = b.v2; b.v2 = v2; - glm::vec3 v3 = b.v3; + tg::vec3 v3 = b.v3; b.v3 = v3; - glm::vec4 v4 = b.v4; + tg::vec4 v4 = b.v4; b.v4 = v4; - glm::ivec2 iv2 = b.iv2; + tg::ivec2 iv2 = b.iv2; b.iv2 = iv2; - glm::ivec3 iv3 = b.iv3; + tg::ivec3 iv3 = b.iv3; b.iv3 = iv3; - glm::ivec4 iv4 = b.iv4; + tg::ivec4 iv4 = b.iv4; b.iv4 = iv4; - glm::dvec2 dv2 = b.dv2; + tg::dvec2 dv2 = b.dv2; b.dv2 = dv2; - glm::dvec3 dv3 = b.dv3; + tg::dvec3 dv3 = b.dv3; b.dv3 = dv3; - glm::dvec4 dv4 = b.dv4; + tg::dvec4 dv4 = b.dv4; b.dv4 = dv4; - glm::bvec2 bv2 = b.bv2; - b.bv2 = bv2; - glm::bvec3 bv3 = b.bv3; - b.bv3 = bv3; - glm::bvec4 bv4 = b.bv4; - b.bv4 = bv4; - - glm::uvec2 uv2 = b.uv2; + tg::uvec2 uv2 = b.uv2; b.uv2 = uv2; - glm::uvec3 uv3 = b.uv3; + tg::uvec3 uv3 = b.uv3; b.uv3 = uv3; - glm::uvec4 uv4 = b.uv4; + tg::uvec4 uv4 = b.uv4; b.uv4 = uv4; } @@ -384,7 +361,7 @@ TEST_CASE("Std140, UB3") { std140vec3 a; std140ivec3 b; - std140bvec3 c; + std140vec3 c; std140dvec3 d; std140uvec3 e; }; @@ -399,7 +376,7 @@ TEST_CASE("Std140, UB3") {&TestUB3::e, "e"}, }); auto shader = Shader::createFromSource(GL_VERTEX_SHADER, "layout(std140) uniform Buffer { " - "vec3 a; ivec3 b; bvec3 c; dvec3 d; uvec3 e;" + "vec3 a; ivec3 b; vec3 c; dvec3 d; uvec3 e;" "};" "out float x; void main() { x = a.x + b.x + float(c.x) + float(d.x) + e.x; }"); auto prog = Program::create(shader); -- GitLab