summaryrefslogtreecommitdiff
path: root/assetFactory
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-09 01:57:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-09 01:57:27 +0000
commitd771fbda2c171cfbc36cc0eb3122c1a02ffbb081 (patch)
tree69d2879e41da2b79264b6c3b8500b5d18383ae85 /assetFactory
parentWIP typedefing all the things - sources (diff)
downloadilt-d771fbda2c171cfbc36cc0eb3122c1a02ffbb081.tar.bz2
ilt-d771fbda2c171cfbc36cc0eb3122c1a02ffbb081.tar.xz
ilt-d771fbda2c171cfbc36cc0eb3122c1a02ffbb081.zip
WIP typedefing just about everything else
Diffstat (limited to 'assetFactory')
-rw-r--r--assetFactory/assetFactory.h5
-rw-r--r--assetFactory/modelFactoryMesh.h9
-rw-r--r--assetFactory/style.cpp14
-rw-r--r--assetFactory/style.h6
4 files changed, 16 insertions, 18 deletions
diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h
index e449ce2..787f0a4 100644
--- a/assetFactory/assetFactory.h
+++ b/assetFactory/assetFactory.h
@@ -15,10 +15,9 @@ public:
using Assets = std::map<std::string, Asset::Ptr, std::less<>>;
using AssImps = std::map<std::string, AssImp::Ptr, std::less<>>;
using TextureFragments = std::map<std::string, TextureFragment::Ptr, std::less<>>;
- using Colour = glm::vec3;
- using ColourAlpha = glm::vec4;
+ using Colour = RGB;
+ using ColourAlpha = RGBA;
using Colours = std::map<std::string, Colour, std::less<>>;
- using TextureFragmentCoords = std::array<glm::vec2, 4>;
AssetFactory();
[[nodiscard]] static std::shared_ptr<AssetFactory> loadXML(const std::filesystem::path &);
diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h
index 32e7ab5..480bf7f 100644
--- a/assetFactory/modelFactoryMesh.h
+++ b/assetFactory/modelFactoryMesh.h
@@ -1,5 +1,6 @@
#pragma once
+#include "config/types.h"
#include "modelFactoryMesh_fwd.h"
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/Mesh/Traits.hh>
@@ -38,10 +39,10 @@ struct ModelFactoryTraits : public OpenMesh::DefaultTraits {
EdgeAttributes(OpenMesh::Attributes::Status);
VertexAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
HalfedgeAttributes(OpenMesh::Attributes::TexCoord2D);
- using Point = glm::vec3;
- using Normal = glm::vec3;
- using Color = glm::vec4;
- using TexCoord2D = glm::vec2;
+ using Point = Position3D;
+ using Normal = Normal3D;
+ using Color = RGBA;
+ using TexCoord2D = TextureRelCoord;
};
struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT<ModelFactoryTraits> {
diff --git a/assetFactory/style.cpp b/assetFactory/style.cpp
index 81a5441..265becb 100644
--- a/assetFactory/style.cpp
+++ b/assetFactory/style.cpp
@@ -33,10 +33,10 @@ Style::applyStyle(
const auto material = mf->getMaterialIndex(texture);
mesh.property(mesh.materialFaceProperty, face) = material;
static constexpr std::array<ModelFactoryTraits::TexCoord2D, 4> coords {{
- {0.f, 0.f},
- {1.f, 0.f},
- {1.f, 1.f},
- {0.f, 1.f},
+ {0.F, 0.F},
+ {1.F, 0.F},
+ {1.F, 1.F},
+ {0.F, 1.F},
}};
auto coord = coords.begin();
// Wild assumption that face is a quad and the texture should apply linearly
@@ -58,9 +58,9 @@ Style::getColour(const StyleStack & parents)
bool
Style::persist(Persistence::PersistenceStore & store)
{
- struct ColourParser : public Persistence::SelectionV<ColourAlpha> {
- using Persistence::SelectionV<ColourAlpha>::SelectionV;
- using Persistence::SelectionV<ColourAlpha>::setValue;
+ struct ColourParser : public Persistence::SelectionV<RGBA> {
+ using Persistence::SelectionV<RGBA>::SelectionV;
+ using Persistence::SelectionV<RGBA>::setValue;
void
setValue(std::string && str) override
diff --git a/assetFactory/style.h b/assetFactory/style.h
index d931f98..2a437aa 100644
--- a/assetFactory/style.h
+++ b/assetFactory/style.h
@@ -10,9 +10,7 @@
class Style {
public:
using StyleStack = std::vector<const Style *>;
- using Colour = glm::vec3;
- using ColourAlpha = glm::vec4;
- using EffectiveColour = std::optional<std::reference_wrapper<const ColourAlpha>>;
+ using EffectiveColour = std::optional<std::reference_wrapper<const RGBA>>;
void applyStyle(ModelFactoryMesh &, const StyleStack & parents, const Shape::CreatedFaces &) const;
void applyStyle(ModelFactoryMesh &, const StyleStack & parents, const ModelFactoryMesh::FaceHandle &) const;
@@ -30,7 +28,7 @@ public:
static EffectiveColour getColour(const StyleStack & parents);
- ColourAlpha colour {};
+ RGBA colour {};
std::optional<bool> smooth;
std::string texture;
std::string textureRotation; // Multiples of 90deg, no int/enum support