diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-14 17:45:31 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-14 17:45:31 +0100 |
commit | 66da4f83c1b5bb6f3ceda880820e01c2f8e23e43 (patch) | |
tree | a28addf0ca4533f2b0f7562e218bba6843432957 | |
parent | Load all assets in red dir with asset factory (diff) | |
download | ilt-66da4f83c1b5bb6f3ceda880820e01c2f8e23e43.tar.bz2 ilt-66da4f83c1b5bb6f3ceda880820e01c2f8e23e43.tar.xz ilt-66da4f83c1b5bb6f3ceda880820e01c2f8e23e43.zip |
Remove the old .obj load, assets and supporting stuff
-rw-r--r-- | Jamroot.jam | 1 | ||||
-rw-r--r-- | game/vehicles/railVehicleClass.cpp | 53 | ||||
-rw-r--r-- | game/vehicles/railVehicleClass.h | 9 | ||||
-rw-r--r-- | gfx/models/obj.h | 38 | ||||
-rw-r--r-- | gfx/models/obj.impl.cpp | 77 | ||||
-rw-r--r-- | gfx/models/obj.ll | 116 | ||||
-rw-r--r-- | res/brush47.mtl | 13 | ||||
-rw-r--r-- | res/brush47.obj | 260 | ||||
-rw-r--r-- | res/brush47.png | bin | 111263 -> 0 bytes | |||
-rw-r--r-- | test/Jamfile.jam | 1 | ||||
-rw-r--r-- | test/test-obj.cpp | 39 |
11 files changed, 0 insertions, 607 deletions
diff --git a/Jamroot.jam b/Jamroot.jam index 2275dd6..35b48ea 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -22,7 +22,6 @@ project : requirements <variant>profile:<lto>on <variant>coverage:<coverage>on <toolset>tidy:<enable>all - <toolset>tidy:<exclude>bin/link-static/gfx/models/obj.cpp <toolset>tidy:<exclude>bin/link-static/lib/jsonParse.cpp <toolset>tidy:<checkxx>boost-* <toolset>tidy:<checkxx>bugprone-* diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp index 4e9263c..b7a3b1e 100644 --- a/game/vehicles/railVehicleClass.cpp +++ b/game/vehicles/railVehicleClass.cpp @@ -2,7 +2,6 @@ #include "gfx/gl/sceneShader.h" #include "gfx/gl/shadowMapper.h" #include "gfx/models/mesh.h" -#include "gfx/models/obj.h" #include "gfx/models/texture.h" #include <algorithm> #include <array> @@ -22,25 +21,6 @@ #include <utility> #include <vector> -RailVehicleClass::RailVehicleClass(const std::string & name) : - RailVehicleClass {std::make_unique<ObjParser>(Resource::mapPath(name + ".obj")), - Texture::cachedTexture.get(Resource::mapPath(name + ".png"))} -{ -} - -RailVehicleClass::RailVehicleClass(std::unique_ptr<ObjParser> o, std::shared_ptr<Texture> t) : - texture {std::move(t)}, maxSpeed(95._mph) -{ - wheelBase = bogieOffset(*o); - length = objectLength(*o); - const auto m = o->createMeshes(); - bodyMesh = m.at("Body"); - bogies[0] = m.at("Bogie1"); - bogies[1] = m.at("Bogie2"); -} - -RailVehicleClass::RailVehicleClass() { } - bool RailVehicleClass::persist(Persistence::PersistenceStore & store) { @@ -80,36 +60,3 @@ RailVehicleClass::shadows( bogies[b]->Draw(); } } - -float -RailVehicleClass::bogieOffset(ObjParser & o) -{ - float wheelBase {0}; - // offset bogie positions so they can be set directly - for (auto & object : o.objects) { // bogie object index - if (!object.first.starts_with("Bogie")) { - continue; - } - std::set<std::pair<float, std::size_t>> vertexIds; - for (const auto & face : object.second) { - for (const auto & faceElement : face) { - vertexIds.emplace(o.vertices[faceElement.x - 1].y, faceElement.x - 1); - } - } - const auto offset = (vertexIds.begin()->first + vertexIds.rbegin()->first) / 2; - for (const auto & v : vertexIds) { - o.vertices[v.second].y -= offset; - } - wheelBase += std::abs(offset); - } - return wheelBase; -} - -float -RailVehicleClass::objectLength(ObjParser & o) -{ - const auto mme = std::minmax_element(o.vertices.begin(), o.vertices.end(), [](const auto & v1, const auto & v2) { - return v1.y < v2.y; - }); - return mme.second->y - mme.first->y; -} diff --git a/game/vehicles/railVehicleClass.h b/game/vehicles/railVehicleClass.h index 61ec4ec..1a52e2b 100644 --- a/game/vehicles/railVehicleClass.h +++ b/game/vehicles/railVehicleClass.h @@ -9,14 +9,10 @@ class SceneShader; class ShadowMapper; class Texture; -class ObjParser; class Location; class RailVehicleClass : public Asset { public: - explicit RailVehicleClass(const std::string & name); - RailVehicleClass(); - void render(const SceneShader &, const Location &, const std::array<Location, 2> &) const; void shadows(const ShadowMapper &, const Location &, const std::array<Location, 2> &) const; @@ -31,10 +27,5 @@ protected: friend Persistence::SelectionPtrBase<std::shared_ptr<RailVehicleClass>>; bool persist(Persistence::PersistenceStore & store) override; void postLoad() override; - -private: - RailVehicleClass(std::unique_ptr<ObjParser> obj, std::shared_ptr<Texture>); - static float bogieOffset(ObjParser & o); - static float objectLength(ObjParser & o); }; using RailVehicleClassPtr = std::shared_ptr<RailVehicleClass>; diff --git a/gfx/models/obj.h b/gfx/models/obj.h deleted file mode 100644 index e28f7de..0000000 --- a/gfx/models/obj.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#ifndef yyFlexLexer -# define yyFlexLexer objbaseFlexLexer -# include <FlexLexer.h> -#endif -#include <filesystem> -#include <fstream> -#include <glm/glm.hpp> -#include <map> -#include <memory> -#include <vector> - -class Mesh; -class Vertex; - -class ObjParser : yyFlexLexer { -public: - explicit ObjParser(const std::filesystem::path & fileName); - explicit ObjParser(std::unique_ptr<std::istream> in); - - int yylex() override; - - std::vector<glm::vec4> vertices; - std::vector<glm::vec3> texCoords; - std::vector<glm::vec3> normals; - using FaceElement = glm::vec<3, unsigned int>; - using Face = std::vector<FaceElement>; - using Faces = std::vector<Face>; - using Object = std::pair<std::string, Faces>; - std::vector<Object> objects; - glm::length_t axis {0}; - - using NamedMeshesData = std::map<std::string, std::pair<std::vector<Vertex>, std::vector<unsigned int>>>; - [[nodiscard]] NamedMeshesData createMeshData() const; - using NamedMeshes = std::map<std::string, std::shared_ptr<const Mesh>>; - [[nodiscard]] NamedMeshes createMeshes() const; -}; diff --git a/gfx/models/obj.impl.cpp b/gfx/models/obj.impl.cpp deleted file mode 100644 index 205abc8..0000000 --- a/gfx/models/obj.impl.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "obj.h" -#include <algorithm> -#include <cassert> -#include <filesystem> -#include <fstream> -#include <gfx/models/mesh.h> // IWYU pragma: keep -#include <gfx/models/vertex.hpp> -#include <glm/glm.hpp> -#include <iterator> -#include <map> -#include <memory> -#include <utility> -#include <vector> - -ObjParser::ObjParser(const std::filesystem::path & fileName) : ObjParser {std::make_unique<std::ifstream>(fileName)} { } - -ObjParser::ObjParser(std::unique_ptr<std::istream> in) : yyFlexLexer(in.get()) -{ - assert(in); - ObjParser::yylex(); - assert(in->good()); - constexpr const glm::mat4 obj2ilt { - -1, 0, 0, 0, // x - 0, 0, 1, 0, // y - 0, 1, 0, 0, // z - 0, 0, 0, 0, // w - }; - std::for_each(vertices.begin(), vertices.end(), [&obj2ilt](auto & v) { - v = v * obj2ilt; - }); - std::for_each(normals.begin(), normals.end(), [&obj2ilt](auto & v) { - v = glm::vec4 {v, 0} * obj2ilt; - }); -} - -ObjParser::NamedMeshes -ObjParser::createMeshes() const -{ - NamedMeshes out; - const auto data {createMeshData()}; - std::transform(data.begin(), data.end(), std::inserter(out, out.end()), [](auto && obj) { - return std::make_pair(obj.first, std::make_shared<Mesh>(obj.second.first, obj.second.second)); - }); - return out; -} - -ObjParser::NamedMeshesData -ObjParser::createMeshData() const -{ - NamedMeshesData out; - std::transform(objects.begin(), objects.end(), std::inserter(out, out.end()), [this](auto && obj) { - std::vector<Vertex> overtices; - std::vector<ObjParser::FaceElement> vertexOrder; - std::vector<unsigned int> indices; - for (const auto & face : obj.second) { - for (auto idx = 2U; idx < face.size(); idx += 1) { - auto f = [&](auto idx) { - const auto & fe {face[idx]}; - if (const auto existing = std::find(vertexOrder.begin(), vertexOrder.end(), fe); - existing != vertexOrder.end()) { - indices.push_back(static_cast<unsigned int>(std::distance(vertexOrder.begin(), existing))); - } - else { - indices.push_back(static_cast<unsigned int>(overtices.size())); - overtices.emplace_back(vertices[fe.x - 1], texCoords[fe.y - 1], -normals[fe.z - 1]); - vertexOrder.emplace_back(fe); - } - }; - f(0U); - f(idx); - f(idx - 1); - } - } - return std::make_pair(obj.first, std::make_pair(overtices, indices)); - }); - return out; -} diff --git a/gfx/models/obj.ll b/gfx/models/obj.ll deleted file mode 100644 index 84884fe..0000000 --- a/gfx/models/obj.ll +++ /dev/null @@ -1,116 +0,0 @@ -%option batch -%option c++ -%option noyywrap -%option 8bit -%option stack -%option yyclass="ObjParser" -%option prefix="objbase" - -%{ -#include <gfx/models/obj.h> -#include <glm/glm.hpp> -#include <memory> -#include <string> -#include <vector> -class objbaseFlexLexer; -%} - -comment #.* -float -?[0-9.]+ -index -?[0-9]+ -linestring [^\r\n]* -truthy (1|on) -falsey (0|off) - -%x FACE -%x MTLLIB -%x OBJECT -%x SMOOTH -%x USEMTL -%x VERTEX -%x NORMAL -%x TEXCOORD - -%% - -<INITIAL>{comment} { - // fprintf(stderr, "COMMENT %s\n", YYText()); -} -<INITIAL>"f " { - BEGIN(FACE); - objects.back().second.emplace_back(); - objects.back().second.back().emplace_back(); - axis = 0; -} -<INITIAL>"mtllib " { - BEGIN(MTLLIB); -} -<INITIAL>"o " { - BEGIN(OBJECT); -} -<INITIAL>"s " { - BEGIN(SMOOTH); -} -<INITIAL>"usemtl " { - BEGIN(USEMTL); -} -<INITIAL>"v " { - BEGIN(VERTEX); - vertices.emplace_back(0, 0, 0, 1); - axis = 0; -} -<INITIAL>"vn " { - BEGIN(NORMAL); - normals.emplace_back(0, 0, 0); - axis = 0; -} -<INITIAL>"vt " { - BEGIN(TEXCOORD); - texCoords.emplace_back(0, 1, 1); - axis = 0; -} -<USEMTL>{linestring} { - // fprintf(stderr, "USEMTL <%s>\n", YYText()); -} -<MTLLIB>{linestring} { - // fprintf(stderr, "MTLLIB <%s>\n", YYText()); -} -<OBJECT>{linestring} { - objects.emplace_back(YYText(), Faces{}); -} -<SMOOTH>{truthy} { - // fprintf(stderr, "Set smooth\n"); -} -<SMOOTH>{falsey} { - // fprintf(stderr, "Set flat\n"); -} -<VERTEX>{float} { - vertices.back()[axis++] = std::stof(YYText()); -} -<NORMAL>{float} { - normals.back()[axis++] = std::stof(YYText()); -} -<TEXCOORD>{float} { - texCoords.back()[axis++] = std::stof(YYText()); -} -<FACE>{index} { - objects.back().second.back().back()[axis] = std::stoi(YYText()); -} -<FACE>\/ { - axis++; -} -<FACE>[ \t] { - objects.back().second.back().emplace_back(); - axis = 0; -} - -<*>[ \t] { -} -<*>[\r\n\f] { - BEGIN(INITIAL); -} - -%% - -// Make iwyu think unistd.h is required -[[maybe_unused]]static auto x=getpid; diff --git a/res/brush47.mtl b/res/brush47.mtl deleted file mode 100644 index a4ba512..0000000 --- a/res/brush47.mtl +++ /dev/null @@ -1,13 +0,0 @@ -# Blender MTL File: 'brush47.blend' -# Material Count: 1 - -newmtl Brush47 -Ns 225.000000 -Ka 1.000000 1.000000 1.000000 -Kd 0.800000 0.800000 0.800000 -Ks 0.500000 0.500000 0.500000 -Ke 0.000000 0.000000 0.000000 -Ni 1.450000 -d 1.000000 -illum 2 -map_Kd brush47.png diff --git a/res/brush47.obj b/res/brush47.obj deleted file mode 100644 index 8fcb2b1..0000000 --- a/res/brush47.obj +++ /dev/null @@ -1,260 +0,0 @@ -# Blender v2.91.0 OBJ File: 'brush47.blend' -# www.blender.org -mtllib brush47.mtl -o Body -v -1.345000 1.200000 -9.690000 -v -1.345000 1.200000 9.690000 -v 1.345000 1.200000 -9.690000 -v 1.345000 1.200000 9.690000 -v -0.991447 3.900000 -8.536446 -v -1.345000 3.546447 -9.440000 -v -0.991447 3.900000 8.536446 -v -1.345000 3.546447 9.440000 -v 0.991447 3.900000 -8.536446 -v 1.345000 3.546447 -9.440000 -v 0.991447 3.900000 8.536446 -v 1.345000 3.546447 9.440000 -v -1.345000 2.723224 9.690000 -v 1.345000 2.723224 9.690000 -v 1.345000 2.723224 -9.690000 -v -1.345000 2.723224 -9.690000 -v 1.340000 0.500000 9.600000 -v -1.340000 0.500000 9.600000 -v -1.340000 1.200000 9.690000 -v -1.340000 0.500000 -9.600000 -v 1.340000 0.500000 -9.600000 -v -1.300000 0.200000 -2.250000 -v -1.300000 1.200000 -2.250000 -v -1.300000 0.200000 2.250000 -v -1.300000 1.200000 2.250000 -v 1.300000 0.200000 -2.250000 -v 1.300000 1.200000 -2.250000 -v 1.300000 0.200000 2.250000 -v 1.300000 1.200000 2.250000 -v 1.345000 1.200000 8.236500 -v 1.345000 1.200000 -8.236500 -v -1.345000 1.200000 -8.236500 -v -1.345000 1.200000 8.236500 -vt 0.025174 0.662500 -vt 0.025174 0.831250 -vt 0.037326 0.925000 -vt 0.957465 0.927083 -vt 0.971354 0.833333 -vt 0.971354 0.662500 -vt 0.900391 0.662500 -vt 0.096137 0.662500 -vt 0.025174 0.662500 -vt 0.025174 0.831250 -vt 0.037326 0.925000 -vt 0.957465 0.927083 -vt 0.971354 0.833333 -vt 0.971354 0.662500 -vt 0.900391 0.662500 -vt 0.096137 0.662500 -vt 0.605035 0.456250 -vt 0.605035 0.581250 -vt 0.359375 0.581250 -vt 0.359375 0.456250 -vt 0.605035 0.581250 -vt 0.605035 0.456250 -vt 0.359375 0.581250 -vt 0.359375 0.456250 -vt 0.026042 0.593750 -vt 0.971354 0.593750 -vt 0.026042 0.593750 -vt 0.971354 0.593750 -vt 0.088542 0.089583 -vt 0.088542 0.206250 -vt 0.918403 0.206250 -vt 0.918403 0.089583 -vt 0.926215 0.527083 -vt 0.926215 0.612500 -vt 0.834201 0.612500 -vt 0.834201 0.527083 -vt 0.083333 0.989583 -vt 0.913194 0.989583 -vt 0.037326 0.927083 -vt 0.152778 0.364583 -vt 0.197049 0.364583 -vt 0.204861 0.310417 -vt 0.144965 0.310417 -vt 0.083333 0.989583 -vt 0.913194 0.989583 -vt 0.037326 0.927083 -vt 0.152778 0.364583 -vt 0.197049 0.364583 -vt 0.204861 0.310417 -vt 0.144965 0.310417 -vt 0.834201 0.527083 -vt 0.834201 0.612500 -vt 0.927083 0.612500 -vt 0.927083 0.527083 -vt 0.114583 0.293750 -vt 0.114583 0.414583 -vt 0.010417 0.414583 -vt 0.010417 0.293750 -vt 0.010417 0.293750 -vt 0.010417 0.414583 -vt 0.114583 0.414583 -vt 0.114583 0.293750 -vt 0.043403 0.014583 -vt 0.002604 0.014583 -vt 0.002604 0.081250 -vt 0.043403 0.081250 -vt 0.043403 0.014583 -vt 0.002604 0.014583 -vt 0.002604 0.081250 -vt 0.043403 0.081250 -vn -1.0000 0.0000 0.0000 -vn 1.0000 0.0000 0.0000 -vn 0.0000 0.0000 -1.0000 -vn 0.0000 0.0000 1.0000 -vn -1.0000 0.0071 0.0000 -vn 1.0000 0.0071 -0.0000 -vn -0.3335 -0.9344 -0.1252 -vn 0.3335 -0.9344 -0.1252 -vn 0.3335 -0.9344 0.1252 -vn -0.3335 -0.9344 0.1252 -vn 0.6755 -0.1083 -0.7294 -vn 0.6276 -0.5509 -0.5500 -vn -0.6276 -0.5509 -0.5500 -vn -0.6755 -0.1083 -0.7294 -vn 0.6276 -0.5509 0.5500 -vn -0.6276 -0.5509 0.5500 -vn -0.6755 -0.1083 0.7294 -vn 0.6755 -0.1083 0.7294 -vn 0.8867 0.0030 -0.4622 -vn -0.6937 0.0482 -0.7186 -vn -0.6937 0.0482 0.7186 -vn 0.6937 0.0482 0.7186 -vn -0.6128 0.1051 -0.7832 -vn 0.6145 0.1049 -0.7819 -vn 0.0000 0.1275 -0.9918 -vn 0.6128 0.1051 0.7832 -vn -0.6128 0.1051 0.7832 -usemtl Brush47 -s off -f 4/1/1 14/2/1 12/3/1 10/4/1 15/5/1 3/6/1 31/7/1 30/8/1 -f 1/9/2 16/10/2 6/11/2 8/12/2 13/13/2 2/14/2 33/15/2 32/16/2 -f 22/17/2 23/18/2 25/19/2 24/20/2 -f 24/20/3 25/19/3 29/21/3 28/22/3 -f 28/22/1 29/21/1 27/23/1 26/24/1 -f 26/24/4 27/23/4 23/18/4 22/17/4 -f 4/1/5 30/8/5 17/25/5 -f 31/7/5 3/6/5 21/26/5 -f 1/9/6 32/16/6 20/27/6 -f 33/15/6 2/14/6 18/28/6 -s 1 -f 11/29/7 7/30/8 5/31/9 9/32/10 -f 13/33/11 8/34/12 12/35/13 14/36/14 -f 5/37/9 7/38/8 8/12/12 6/39/15 -f 7/40/8 11/41/7 12/42/13 8/43/12 -f 11/44/7 9/45/10 10/4/16 12/46/13 -f 9/47/10 5/48/9 6/49/15 10/50/16 -f 15/51/17 10/52/16 6/53/15 16/54/18 -f 2/55/19 13/56/11 14/57/14 4/58/20 -f 3/59/21 15/60/17 16/61/18 1/62/22 -f 17/63/23 18/64/24 19/65/25 4/66/20 -f 20/67/26 21/68/27 3/69/21 1/70/22 -o Bogie2 -v -0.717500 0.000000 -2.700000 -v -0.717500 0.000000 -9.300000 -v -0.717500 1.200000 -2.700000 -v 0.717500 1.200000 -2.700000 -v 0.717500 0.000000 -2.700000 -v 0.717500 0.000000 -9.300000 -v 1.017500 1.200000 -2.700000 -v 1.017500 0.000000 -2.700000 -v 1.017500 0.000000 -9.300000 -v -1.017500 0.000000 -9.300000 -v -1.017501 0.000000 -2.700000 -v -1.017501 1.200000 -2.700000 -v -0.717500 0.654015 -9.300000 -v -0.717500 1.200000 -8.236500 -v -0.717500 0.661560 -9.285304 -v 0.717500 1.200000 -8.236500 -v 0.717500 0.654015 -9.300000 -v 1.017500 1.200000 -8.236500 -v 1.017500 0.654015 -9.300000 -v -1.017500 0.654015 -9.300000 -v -1.017500 1.200000 -8.236500 -vt 0.342014 0.591667 -vt 0.342014 0.435417 -vt 0.006076 0.435417 -vt 0.006076 0.520575 -vt 0.006824 0.521557 -vt 0.060208 0.591667 -vt 0.006076 0.435417 -vt 0.342014 0.435417 -vt 0.342014 0.591667 -vt 0.060208 0.591667 -vt 0.006076 0.520575 -vt 0.217014 0.270833 -vt 0.552951 0.270833 -vt 0.552951 0.427083 -vt 0.271146 0.427083 -vt 0.217014 0.355992 -vt 0.552083 0.429167 -vt 0.552083 0.272917 -vt 0.216146 0.272917 -vt 0.216146 0.358075 -vt 0.270278 0.429167 -vn 1.0000 0.0000 -0.0000 -vn -1.0000 0.0000 0.0000 -usemtl Brush47 -s off -f 36/71/28 34/72/28 35/73/28 46/74/28 48/75/28 47/76/28 -f 39/77/29 38/78/29 37/79/29 49/80/29 50/81/29 -f 42/82/29 41/83/29 40/84/29 51/85/29 52/86/29 -f 45/87/28 44/88/28 43/89/28 53/90/28 54/91/28 -o Bogie1 -v 0.717500 0.000000 2.700000 -v 0.717500 1.200000 2.700000 -v 0.717500 0.000000 9.300000 -v -0.717500 0.000000 2.700000 -v -0.717500 1.200000 2.700000 -v -0.717500 0.000000 9.300000 -v 1.017500 0.000000 2.700001 -v 1.017500 1.200000 2.700001 -v 1.017500 0.000000 9.300000 -v -1.017500 0.000000 2.700000 -v -1.017500 1.200000 2.700000 -v -1.017500 0.000000 9.300000 -v 0.717500 0.654015 9.300000 -v 0.717500 1.200000 8.236500 -v 1.017500 0.654015 9.300000 -v 1.017500 1.200000 8.236500 -v -0.717500 1.200000 8.236500 -v -0.717500 0.661372 9.285670 -v -0.717500 0.654015 9.300000 -v -1.017500 1.200000 8.236500 -v -1.017500 0.654015 9.300000 -vt 0.342014 0.435417 -vt 0.006076 0.435417 -vt 0.006076 0.520575 -vt 0.060208 0.591667 -vt 0.342014 0.591667 -vt 0.006076 0.520575 -vt 0.006076 0.435417 -vt 0.342014 0.435417 -vt 0.342014 0.591667 -vt 0.060208 0.591667 -vt 0.006806 0.521533 -vt 0.552083 0.270833 -vt 0.216146 0.270833 -vt 0.216146 0.355992 -vt 0.270278 0.427083 -vt 0.552083 0.427083 -vt 0.215278 0.355992 -vt 0.215278 0.270833 -vt 0.552083 0.270833 -vt 0.552083 0.427083 -vt 0.269549 0.427083 -vn -1.0000 0.0000 -0.0000 -vn 1.0000 -0.0000 0.0000 -usemtl Brush47 -s off -f 55/92/30 57/93/30 67/94/30 68/95/30 56/96/30 -f 73/97/31 60/98/31 58/99/31 59/100/31 71/101/31 72/102/31 -f 61/103/30 63/104/30 69/105/30 70/106/30 62/107/30 -f 75/108/31 66/109/31 64/110/31 65/111/31 74/112/31 diff --git a/res/brush47.png b/res/brush47.png Binary files differdeleted file mode 100644 index 3d435d6..0000000 --- a/res/brush47.png +++ /dev/null diff --git a/test/Jamfile.jam b/test/Jamfile.jam index d91af1d..b0eed5e 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -44,7 +44,6 @@ project : requirements lib test : [ glob *.cpp : test-*.cpp perf-*.cpp ] ; run test-collection.cpp ; -run test-obj.cpp ; run test-maths.cpp ; run test-lib.cpp ; run test-geo.cpp ; diff --git a/test/test-obj.cpp b/test/test-obj.cpp deleted file mode 100644 index e6e725d..0000000 --- a/test/test-obj.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#define BOOST_TEST_MODULE test_obj - -#include <boost/test/unit_test.hpp> - -#include <gfx/models/obj.h> -#include <gfx/models/vertex.hpp> -#include <glm/glm.hpp> -#include <map> -#include <memory> -#include <utility> -#include <vector> - -BOOST_AUTO_TEST_CASE(objparse) -{ - const ObjParser op {RESDIR "/brush47.obj"}; - BOOST_CHECK_EQUAL(75, op.vertices.size()); - BOOST_CHECK_EQUAL(112, op.texCoords.size()); - BOOST_CHECK_EQUAL(31, op.normals.size()); - BOOST_CHECK_EQUAL(3, op.objects.size()); - const auto & object {op.objects.front()}; - BOOST_CHECK_EQUAL("Body", object.first); - BOOST_CHECK_EQUAL(21, object.second.size()); - BOOST_CHECK_EQUAL(8, object.second[0].size()); - BOOST_CHECK_EQUAL(8, object.second[1].size()); - BOOST_CHECK_EQUAL(4, object.second[12].size()); -} - -BOOST_AUTO_TEST_CASE(create_meshes) -{ - const ObjParser op {RESDIR "/brush47.obj"}; - const auto ms = op.createMeshData(); - BOOST_REQUIRE_EQUAL(3, ms.size()); - BOOST_REQUIRE_EQUAL("Body", ms.begin()->first); - const auto & o = ms.at("Body"); - BOOST_REQUIRE_EQUAL(88, o.first.size()); - const auto & v = o.first.front(); - BOOST_REQUIRE_CLOSE(-1.345, v.pos.x, 1); - BOOST_REQUIRE_EQUAL(138, o.second.size()); -} |