diff --git a/include/igeometryrenderer.h b/include/igeometryrenderer.h index c57b71c5ff..c11ec65471 100644 --- a/include/igeometryrenderer.h +++ b/include/igeometryrenderer.h @@ -4,7 +4,7 @@ #include #include #include "igeometrystore.h" -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" #include "math/Matrix4.h" #include "math/AABB.h" @@ -39,7 +39,7 @@ class IGeometryRenderer // Returns the handle which can be used to update or deallocate the data later // The indexType determines the primitive GLenum that is chosen to render this surface virtual Slot addGeometry(GeometryType indexType, - const std::vector& vertices, + const std::vector& vertices, const std::vector& indices) = 0; // Releases a previously allocated slot. This invalidates the handle. @@ -47,7 +47,7 @@ class IGeometryRenderer // Updates the vertex data. The size of the vertex and index array must be the same // as the one passed to addGeometry. To change the size the data needs to be removed and re-added. - virtual void updateGeometry(Slot slot, const std::vector& vertices, + virtual void updateGeometry(Slot slot, const std::vector& vertices, const std::vector& indices) = 0; // Submits the geometry of a single slot to GL diff --git a/include/igeometrystore.h b/include/igeometrystore.h index a22b8a5516..c173ff7a2e 100644 --- a/include/igeometrystore.h +++ b/include/igeometrystore.h @@ -3,7 +3,7 @@ #include #include #include "math/AABB.h" -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" namespace render { @@ -42,7 +42,7 @@ class IGeometryStore * index arrays must not be larger than what has been allocated earlier, * but they're allowed to be smaller. */ - virtual void updateData(Slot slot, const std::vector& vertices, + virtual void updateData(Slot slot, const std::vector& vertices, const std::vector& indices) = 0; /** @@ -50,7 +50,7 @@ class IGeometryStore * from vertexOffset/indexOffset respectively. The affected range must not be out of bounds * of the allocated slot. */ - virtual void updateSubData(Slot slot, std::size_t vertexOffset, const std::vector& vertices, + virtual void updateSubData(Slot slot, std::size_t vertexOffset, const std::vector& vertices, std::size_t indexOffset, const std::vector& indices) = 0; /** @@ -63,7 +63,7 @@ class IGeometryStore // The render parameters suitable for rendering surfaces using gl(Multi)DrawElements struct RenderParameters { - ArbitraryMeshVertex* bufferStart; // start of buffer (to pass to gl*Pointer) + MeshVertex* bufferStart; // start of buffer (to pass to gl*Pointer) unsigned int* firstIndex; // first index location of the given geometry std::size_t indexCount; // index count of the given geometry std::size_t firstVertex; // offset to the first vertex of this surface diff --git a/include/imodelsurface.h b/include/imodelsurface.h index eac953c4e1..3e5d02b5d2 100644 --- a/include/imodelsurface.h +++ b/include/imodelsurface.h @@ -1,7 +1,7 @@ #pragma once // Math/Vertex classes -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" namespace model { @@ -9,9 +9,9 @@ namespace model // A Polygon (Triangle) which is part of a model surface struct ModelPolygon { - ArbitraryMeshVertex a; - ArbitraryMeshVertex b; - ArbitraryMeshVertex c; + MeshVertex a; + MeshVertex b; + MeshVertex c; }; // Abstract definition of a model surface @@ -25,7 +25,7 @@ class IModelSurface virtual int getNumTriangles() const = 0; // Get a specific vertex of this surface - virtual const ArbitraryMeshVertex& getVertex(int vertexNum) const = 0; + virtual const MeshVertex& getVertex(int vertexNum) const = 0; /** * greebo: Returns a specific polygon from this model surface. @@ -61,7 +61,7 @@ class IIndexedModelSurface : { public: // Const access to the vertices used in this surface. - virtual const std::vector& getVertexArray() const = 0; + virtual const std::vector& getVertexArray() const = 0; // Const access to the index array connecting the vertices. virtual const std::vector& getIndexArray() const = 0; diff --git a/include/irender.h b/include/irender.h index 38326467fe..8df1e80669 100644 --- a/include/irender.h +++ b/include/irender.h @@ -13,7 +13,7 @@ #include "math/Vector4.h" #include "render/Colour4.h" #include "math/AABB.h" -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" #include "ishaderlayer.h" #include diff --git a/include/irenderable.h b/include/irenderable.h index ac3b3c7f52..77271d56e8 100644 --- a/include/irenderable.h +++ b/include/irenderable.h @@ -3,7 +3,7 @@ #include #include "math/Vector3.h" -class ArbitraryMeshVertex; +class MeshVertex; class Shader; typedef std::shared_ptr ShaderPtr; diff --git a/include/isurfacerenderer.h b/include/isurfacerenderer.h index f51c290d93..f2d4282e8b 100644 --- a/include/isurfacerenderer.h +++ b/include/isurfacerenderer.h @@ -6,7 +6,7 @@ #include #include #include -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" #include "math/Matrix4.h" namespace render @@ -27,7 +27,7 @@ class IRenderableSurface : virtual ~IRenderableSurface() {} // Returns the vertex array of this surface - virtual const std::vector& getVertices() = 0; + virtual const std::vector& getVertices() = 0; // Returns the indices to render the triangle primitives virtual const std::vector& getIndices() = 0; diff --git a/include/iwindingrenderer.h b/include/iwindingrenderer.h index d9862974a5..13ca9b9438 100644 --- a/include/iwindingrenderer.h +++ b/include/iwindingrenderer.h @@ -3,7 +3,7 @@ #include #include #include -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" class IRenderEntity; @@ -33,14 +33,14 @@ class IWindingRenderer // The winding will be associated to the given render entity (causing it to be grouped internally // by the render entities when the surfaces are processed in lit render views). // Returns the handle which can be used to update or deallocate the data later - virtual Slot addWinding(const std::vector& vertices, IRenderEntity* entity) = 0; + virtual Slot addWinding(const std::vector& vertices, IRenderEntity* entity) = 0; // Releases a previously allocated winding slot. This invalidates the handle. virtual void removeWinding(Slot slot) = 0; // Updates the winding data. An IRenderEntity change is not supported through updateWinding(), in case the // winding has to be associated to a different entity, call removeWinding() first. - virtual void updateWinding(Slot slot, const std::vector& vertices) = 0; + virtual void updateWinding(Slot slot, const std::vector& vertices) = 0; // Mode used to specify how to render a single winding enum class RenderMode diff --git a/libs/render.h b/libs/render.h index 2ecec77804..34a8eafb0c 100644 --- a/libs/render.h +++ b/libs/render.h @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /// \file /// \brief High-level constructs for efficient OpenGL rendering. -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" #include "render/Vertex3f.h" #include "render/TexCoord2f.h" #include "render/VertexCb.h" @@ -291,9 +291,9 @@ struct RemappingTraits }; template<> -struct RemappingTraits +struct RemappingTraits { - static Vertex3f& getVertex(ArbitraryMeshVertex& container) { return container.vertex; } + static Vertex3f& getVertex(MeshVertex& container) { return container.vertex; } }; class RemapXYZ diff --git a/libs/render/ArbitraryMeshVertex.h b/libs/render/MeshVertex.h similarity index 69% rename from libs/render/ArbitraryMeshVertex.h rename to libs/render/MeshVertex.h index 1e6271db0a..e51da85ec0 100644 --- a/libs/render/ArbitraryMeshVertex.h +++ b/libs/render/MeshVertex.h @@ -11,7 +11,7 @@ /** * Data structure representing a mesh vertex. */ -class ArbitraryMeshVertex +class MeshVertex { public: TexCoord2f texcoord; @@ -24,24 +24,24 @@ class ArbitraryMeshVertex Vector4 colour; /// Default constructor. - ArbitraryMeshVertex() + MeshVertex() : tangent(0, 0, 0), bitangent(0, 0, 0), colour(1.0, 1.0, 1.0, 1.0) {} /// Initialising constructor, leaves colour at 1,1,1,1 and tangent vectors at 0,0,0 - ArbitraryMeshVertex(const Vertex3f& v, const Normal3f& n, const TexCoord2f& t) : - ArbitraryMeshVertex(v, n, t, { 1.0, 1.0, 1.0, 1.0 }) + MeshVertex(const Vertex3f& v, const Normal3f& n, const TexCoord2f& t) : + MeshVertex(v, n, t, { 1.0, 1.0, 1.0, 1.0 }) {} /// Initialising constructor, leaves tangent vectors at 0,0,0 - ArbitraryMeshVertex(const Vertex3f& v, const Normal3f& n, const TexCoord2f& t, const Vector4& c) : - ArbitraryMeshVertex(v, n, t, c, { 0, 0, 0 }, { 0, 0, 0 }) + MeshVertex(const Vertex3f& v, const Normal3f& n, const TexCoord2f& t, const Vector4& c) : + MeshVertex(v, n, t, c, { 0, 0, 0 }, { 0, 0, 0 }) {} // Initialises all attributes of this vertex - ArbitraryMeshVertex(const Vertex3f& vertex_, const Normal3f& normal_, + MeshVertex(const Vertex3f& vertex_, const Normal3f& normal_, const TexCoord2f& texcoord_, const Vector4& colour_, const Normal3f& tangent_, const Normal3f& bitangent_) : texcoord(texcoord_), @@ -59,9 +59,9 @@ class ArbitraryMeshVertex } }; -/// Less-than comparison for ArbitraryMeshVertex -inline bool operator<(const ArbitraryMeshVertex& first, - const ArbitraryMeshVertex& other) +/// Less-than comparison for MeshVertex +inline bool operator<(const MeshVertex& first, + const MeshVertex& other) { if (first.texcoord != other.texcoord) { @@ -81,18 +81,18 @@ inline bool operator<(const ArbitraryMeshVertex& first, return false; } -/// Equality comparison for ArbitraryMeshVertex -inline bool operator==(const ArbitraryMeshVertex& first, - const ArbitraryMeshVertex& other) +/// Equality comparison for MeshVertex +inline bool operator==(const MeshVertex& first, + const MeshVertex& other) { return first.texcoord == other.texcoord && first.normal == other.normal && first.vertex == other.vertex; } -/// Inequality comparison for ArbitraryMeshVertex -inline bool operator!=(const ArbitraryMeshVertex& first, - const ArbitraryMeshVertex& other) +/// Inequality comparison for MeshVertex +inline bool operator!=(const MeshVertex& first, + const MeshVertex& other) { return !(first == other); } @@ -100,14 +100,14 @@ inline bool operator!=(const ArbitraryMeshVertex& first, namespace render { -/// VertexTraits specialisation for ArbitraryMeshVertex -template<> class VertexTraits +/// VertexTraits specialisation for MeshVertex +template<> class VertexTraits { public: static const void* VERTEX_OFFSET() { return reinterpret_cast( - offsetof(ArbitraryMeshVertex, vertex) + offsetof(MeshVertex, vertex) ); } @@ -115,7 +115,7 @@ template<> class VertexTraits static const void* NORMAL_OFFSET() { return reinterpret_cast( - offsetof(ArbitraryMeshVertex, normal) + offsetof(MeshVertex, normal) ); } @@ -123,7 +123,7 @@ template<> class VertexTraits static const void* TEXCOORD_OFFSET() { return reinterpret_cast( - offsetof(ArbitraryMeshVertex, texcoord) + offsetof(MeshVertex, texcoord) ); } @@ -131,13 +131,13 @@ template<> class VertexTraits static const void* TANGENT_OFFSET() { return reinterpret_cast( - offsetof(ArbitraryMeshVertex, tangent) + offsetof(MeshVertex, tangent) ); } static const void* BITANGENT_OFFSET() { return reinterpret_cast( - offsetof(ArbitraryMeshVertex, bitangent) + offsetof(MeshVertex, bitangent) ); } }; @@ -145,11 +145,11 @@ template<> class VertexTraits } /** - * String output for ArbitraryMeshVertex. + * String output for MeshVertex. */ -inline std::ostream& operator<< (std::ostream& os, const ArbitraryMeshVertex& v) +inline std::ostream& operator<< (std::ostream& os, const MeshVertex& v) { - os << "ArbitraryMeshVertex { " + os << "MeshVertex { " << " vertex = " << v.vertex << ", normal = " << v.normal << ", texcoord = " << v.texcoord << ", colour = " << v.colour << " }"; @@ -158,8 +158,8 @@ inline std::ostream& operator<< (std::ostream& os, const ArbitraryMeshVertex& v) } /// \brief Calculates the tangent vectors for a triangle \p a, \p b, \p c and stores the tangent in \p s and the bitangent in \p t. -inline void ArbitraryMeshTriangle_calcTangents(const ArbitraryMeshVertex& a, - const ArbitraryMeshVertex& b, const ArbitraryMeshVertex& c, +inline void MeshTriangle_calcTangents(const MeshVertex& a, + const MeshVertex& b, const MeshVertex& c, Vector3& s, Vector3& t) { s = Vector3(0, 0, 0); @@ -215,11 +215,11 @@ inline void ArbitraryMeshTriangle_calcTangents(const ArbitraryMeshVertex& a, } } -inline void ArbitraryMeshTriangle_sumTangents(ArbitraryMeshVertex& a, ArbitraryMeshVertex& b, ArbitraryMeshVertex& c) +inline void MeshTriangle_sumTangents(MeshVertex& a, MeshVertex& b, MeshVertex& c) { Vector3 s, t; - ArbitraryMeshTriangle_calcTangents(a, b, c, s, t); + MeshTriangle_calcTangents(a, b, c, s, t); a.tangent += s; b.tangent += s; diff --git a/libs/render/RenderableBoundingBoxes.h b/libs/render/RenderableBoundingBoxes.h index cafdbe0b08..ddefd983d4 100644 --- a/libs/render/RenderableBoundingBoxes.h +++ b/libs/render/RenderableBoundingBoxes.h @@ -41,7 +41,7 @@ class RenderableBoundingBoxes : _needsUpdate = false; - std::vector vertices; + std::vector vertices; std::vector indices; static auto WireframeBoxIndices = render::detail::generateWireframeBoxIndices(); diff --git a/libs/render/RenderableBox.h b/libs/render/RenderableBox.h index c630b2bf58..d4d67ea7cf 100644 --- a/libs/render/RenderableBox.h +++ b/libs/render/RenderableBox.h @@ -10,65 +10,65 @@ namespace render namespace detail { -inline std::vector getFillBoxVertices(const Vector3& min, const Vector3& max, const Vector4& colour) +inline std::vector getFillBoxVertices(const Vector3& min, const Vector3& max, const Vector4& colour) { // Load the 6 times 4 = 24 corner points, each with the correct face normal return { // Bottom quad - ArbitraryMeshVertex({ min[0], max[1], min[2] }, {0,0,-1}, {0,1}, colour), - ArbitraryMeshVertex({ max[0], max[1], min[2] }, {0,0,-1}, {1,1}, colour), - ArbitraryMeshVertex({ max[0], min[1], min[2] }, {0,0,-1}, {1,0}, colour), - ArbitraryMeshVertex({ min[0], min[1], min[2] }, {0,0,-1}, {0,0}, colour), + MeshVertex({ min[0], max[1], min[2] }, {0,0,-1}, {0,1}, colour), + MeshVertex({ max[0], max[1], min[2] }, {0,0,-1}, {1,1}, colour), + MeshVertex({ max[0], min[1], min[2] }, {0,0,-1}, {1,0}, colour), + MeshVertex({ min[0], min[1], min[2] }, {0,0,-1}, {0,0}, colour), // Top quad - ArbitraryMeshVertex({ min[0], min[1], max[2] }, {0,0,+1}, {0,1}, colour), - ArbitraryMeshVertex({ max[0], min[1], max[2] }, {0,0,+1}, {1,1}, colour), - ArbitraryMeshVertex({ max[0], max[1], max[2] }, {0,0,+1}, {1,0}, colour), - ArbitraryMeshVertex({ min[0], max[1], max[2] }, {0,0,+1}, {0,0}, colour), + MeshVertex({ min[0], min[1], max[2] }, {0,0,+1}, {0,1}, colour), + MeshVertex({ max[0], min[1], max[2] }, {0,0,+1}, {1,1}, colour), + MeshVertex({ max[0], max[1], max[2] }, {0,0,+1}, {1,0}, colour), + MeshVertex({ min[0], max[1], max[2] }, {0,0,+1}, {0,0}, colour), // Front quad - ArbitraryMeshVertex({ min[0], min[1], min[2] }, {0,-1,0}, {0,1}, colour), - ArbitraryMeshVertex({ max[0], min[1], min[2] }, {0,-1,0}, {1,1}, colour), - ArbitraryMeshVertex({ max[0], min[1], max[2] }, {0,-1,0}, {1,0}, colour), - ArbitraryMeshVertex({ min[0], min[1], max[2] }, {0,-1,0}, {0,0}, colour), + MeshVertex({ min[0], min[1], min[2] }, {0,-1,0}, {0,1}, colour), + MeshVertex({ max[0], min[1], min[2] }, {0,-1,0}, {1,1}, colour), + MeshVertex({ max[0], min[1], max[2] }, {0,-1,0}, {1,0}, colour), + MeshVertex({ min[0], min[1], max[2] }, {0,-1,0}, {0,0}, colour), // Back quad - ArbitraryMeshVertex({ min[0], max[1], min[2] }, {0,+1,0}, {1,1}, colour), - ArbitraryMeshVertex({ min[0], max[1], max[2] }, {0,+1,0}, {1,0}, colour), - ArbitraryMeshVertex({ max[0], max[1], max[2] }, {0,+1,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], max[1], min[2] }, {0,+1,0}, {0,1}, colour), + MeshVertex({ min[0], max[1], min[2] }, {0,+1,0}, {1,1}, colour), + MeshVertex({ min[0], max[1], max[2] }, {0,+1,0}, {1,0}, colour), + MeshVertex({ max[0], max[1], max[2] }, {0,+1,0}, {0,0}, colour), + MeshVertex({ max[0], max[1], min[2] }, {0,+1,0}, {0,1}, colour), // Right quad - ArbitraryMeshVertex({ max[0], max[1], min[2] }, {+1,0,0}, {1,1}, colour), - ArbitraryMeshVertex({ max[0], max[1], max[2] }, {+1,0,0}, {1,0}, colour), - ArbitraryMeshVertex({ max[0], min[1], max[2] }, {+1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], min[1], min[2] }, {+1,0,0}, {0,1}, colour), + MeshVertex({ max[0], max[1], min[2] }, {+1,0,0}, {1,1}, colour), + MeshVertex({ max[0], max[1], max[2] }, {+1,0,0}, {1,0}, colour), + MeshVertex({ max[0], min[1], max[2] }, {+1,0,0}, {0,0}, colour), + MeshVertex({ max[0], min[1], min[2] }, {+1,0,0}, {0,1}, colour), // Left quad - ArbitraryMeshVertex({ min[0], max[1], min[2] }, {-1,0,0}, {0,1}, colour), - ArbitraryMeshVertex({ min[0], min[1], min[2] }, {-1,0,0}, {1,1}, colour), - ArbitraryMeshVertex({ min[0], min[1], max[2] }, {-1,0,0}, {1,0}, colour), - ArbitraryMeshVertex({ min[0], max[1], max[2] }, {-1,0,0}, {0,0}, colour), + MeshVertex({ min[0], max[1], min[2] }, {-1,0,0}, {0,1}, colour), + MeshVertex({ min[0], min[1], min[2] }, {-1,0,0}, {1,1}, colour), + MeshVertex({ min[0], min[1], max[2] }, {-1,0,0}, {1,0}, colour), + MeshVertex({ min[0], max[1], max[2] }, {-1,0,0}, {0,0}, colour), }; } -inline std::vector getWireframeBoxVertices(const Vector3& min, const Vector3& max, const Vector4& colour) +inline std::vector getWireframeBoxVertices(const Vector3& min, const Vector3& max, const Vector4& colour) { // Load the 8 corner points return { // Bottom quad - ArbitraryMeshVertex({ min[0], min[1], min[2] }, {0,0,1}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], min[1], min[2] }, {0,0,1}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], max[1], min[2] }, {0,0,1}, {0,0}, colour), - ArbitraryMeshVertex({ min[0], max[1], min[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ min[0], min[1], min[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ max[0], min[1], min[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ max[0], max[1], min[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ min[0], max[1], min[2] }, {0,0,1}, {0,0}, colour), // Top quad - ArbitraryMeshVertex({ min[0], min[1], max[2] }, {0,0,1}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], min[1], max[2] }, {0,0,1}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], max[1], max[2] }, {0,0,1}, {0,0}, colour), - ArbitraryMeshVertex({ min[0], max[1], max[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ min[0], min[1], max[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ max[0], min[1], max[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ max[0], max[1], max[2] }, {0,0,1}, {0,0}, colour), + MeshVertex({ min[0], max[1], max[2] }, {0,0,1}, {0,0}, colour), }; } @@ -207,7 +207,7 @@ class RenderableBoxSurface final : const AABB& _bounds; const Matrix4& _orientation; - std::vector _vertices; + std::vector _vertices; std::vector _indices; public: @@ -230,7 +230,7 @@ class RenderableBoxSurface final : return !_indices.empty(); } - const std::vector& getVertices() override + const std::vector& getVertices() override { return _vertices; } diff --git a/libs/render/RenderableGeometry.h b/libs/render/RenderableGeometry.h index 12d27e71ff..48536b3769 100644 --- a/libs/render/RenderableGeometry.h +++ b/libs/render/RenderableGeometry.h @@ -223,7 +223,7 @@ class RenderableGeometry : // This method is supposed to be called from within updateGeometry() // to ensure that the _shader reference is already up to date. void updateGeometry(GeometryType type, - const std::vector& vertices, + const std::vector& vertices, const std::vector& indices) { // Size changes require removal of the geometry before update diff --git a/libs/render/RenderablePivot.h b/libs/render/RenderablePivot.h index 77f1415ad3..8b32987ab2 100644 --- a/libs/render/RenderablePivot.h +++ b/libs/render/RenderablePivot.h @@ -38,16 +38,16 @@ class RenderablePivot : static const Vector4 ColourY{ 0, 255, 0, 255 }; static const Vector4 ColourZ{ 0, 0, 255, 255 }; - std::vector vertices; + std::vector vertices; - vertices.push_back(ArbitraryMeshVertex(_pivot, { 0, 0, 0 }, { 0, 0 }, ColourX)); - vertices.push_back(ArbitraryMeshVertex(_pivot + Vector3(16, 0, 0), { 0, 0, 0 }, { 0, 0 }, ColourX)); + vertices.push_back(MeshVertex(_pivot, { 0, 0, 0 }, { 0, 0 }, ColourX)); + vertices.push_back(MeshVertex(_pivot + Vector3(16, 0, 0), { 0, 0, 0 }, { 0, 0 }, ColourX)); - vertices.push_back(ArbitraryMeshVertex(_pivot, { 0, 0, 0 }, { 0, 0 }, ColourY)); - vertices.push_back(ArbitraryMeshVertex(_pivot + Vector3(0, 16, 0), { 0, 0, 0 }, { 0, 0 }, ColourY)); + vertices.push_back(MeshVertex(_pivot, { 0, 0, 0 }, { 0, 0 }, ColourY)); + vertices.push_back(MeshVertex(_pivot + Vector3(0, 16, 0), { 0, 0, 0 }, { 0, 0 }, ColourY)); - vertices.push_back(ArbitraryMeshVertex(_pivot, { 0, 0, 0 }, { 0, 0 }, ColourZ)); - vertices.push_back(ArbitraryMeshVertex(_pivot + Vector3(0, 0, 16), { 0, 0, 0 }, { 0, 0 }, ColourZ)); + vertices.push_back(MeshVertex(_pivot, { 0, 0, 0 }, { 0, 0 }, ColourZ)); + vertices.push_back(MeshVertex(_pivot + Vector3(0, 0, 16), { 0, 0, 0 }, { 0, 0 }, ColourZ)); static std::vector Indices = { diff --git a/libs/render/RenderableVertexArray.h b/libs/render/RenderableVertexArray.h index ba628a9f63..6b8d55a421 100644 --- a/libs/render/RenderableVertexArray.h +++ b/libs/render/RenderableVertexArray.h @@ -81,11 +81,11 @@ class RenderableVertexArray : _needsUpdate = false; - std::vector vertices; + std::vector vertices; for (const auto& vertex : _vertices) { - vertices.push_back(ArbitraryMeshVertex(vertex, { 0,0,0 }, { 0,0 }, _colour)); + vertices.push_back(MeshVertex(vertex, { 0,0,0 }, { 0,0 }, _colour)); } std::vector indices; diff --git a/libs/render/VertexHashing.h b/libs/render/VertexHashing.h index 327ac24ab3..ed002a0452 100644 --- a/libs/render/VertexHashing.h +++ b/libs/render/VertexHashing.h @@ -1,7 +1,7 @@ #pragma once #include "math/Vector3.h" -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" #include "math/Hash.h" /** @@ -17,9 +17,9 @@ * * The hash functors below aim to reproduce this behaviour without fully re-implementing * those custom containers in the engine code, designed to be used in a std::unordered_map -* with ArbitraryMeshVertex used as Key type. +* with MeshVertex used as Key type. * -* The ArbitraryMeshVertex hash functions is deliberately coarse and will produce lots of +* The MeshVertex hash functions is deliberately coarse and will produce lots of * collisions for vertices in a certain vicinity, only provide a fast way of looking up * duplicates in meshes with many verts. Each "colliding" vertex will then be compared * in-depth by the std::equal_to<> specialisation, where the epsilon-comparison is performed. @@ -47,25 +47,25 @@ struct std::hash } }; -// Hash specialisation such that ArbitraryMeshVertex can be used as key type in std::unordered_map<> +// Hash specialisation such that MeshVertex can be used as key type in std::unordered_map<> // Only the 3D coordinates (the vertex member) will be considered for hash calculation, // to intentionally produce hash collisions for vectors that are within a certain VertexEpsilon. template<> -struct std::hash +struct std::hash { - size_t operator()(const ArbitraryMeshVertex& v) const + size_t operator()(const MeshVertex& v) const { // We just hash the vertex return std::hash()(v.vertex); } }; -// Assumes equality of two ArbitraryMeshVertices if all of (vertex, normal, texcoord, colour) +// Assumes equality of two MeshVertices if all of (vertex, normal, texcoord, colour) // are equal within defined epsilons (VertexEpsilon, NormalEpsilon, TexCoordEpsilon) template<> -struct std::equal_to +struct std::equal_to { - bool operator()(const ArbitraryMeshVertex& a, const ArbitraryMeshVertex& b) const + bool operator()(const MeshVertex& a, const MeshVertex& b) const { return math::isNear(a.vertex, b.vertex, render::VertexEpsilon) && a.normal.dot(b.normal) > (1.0 - render::NormalEpsilon) && diff --git a/plugins/script/interfaces/ModelInterface.cpp b/plugins/script/interfaces/ModelInterface.cpp index 5756e3e07a..217762a3c7 100644 --- a/plugins/script/interfaces/ModelInterface.cpp +++ b/plugins/script/interfaces/ModelInterface.cpp @@ -17,7 +17,7 @@ int ScriptModelSurface::getNumTriangles() const return _surface.getNumTriangles(); } -const ArbitraryMeshVertex& ScriptModelSurface::getVertex(int vertexIndex) const +const MeshVertex& ScriptModelSurface::getVertex(int vertexIndex) const { return _surface.getVertex(vertexIndex); } @@ -143,14 +143,17 @@ ScriptModelNode ScriptModelNode::getModel(const ScriptSceneNode& node) { void ModelInterface::registerInterface(py::module& scope, py::dict& globals) { - py::class_ vertex(scope, "ArbitraryMeshVertex"); - - vertex.def_readwrite("texcoord", &ArbitraryMeshVertex::texcoord); - vertex.def_readwrite("normal", &ArbitraryMeshVertex::normal); - vertex.def_readwrite("vertex", &ArbitraryMeshVertex::vertex); - vertex.def_readwrite("tangent", &ArbitraryMeshVertex::tangent); - vertex.def_readwrite("bitangent", &ArbitraryMeshVertex::bitangent); - vertex.def_readwrite("colour", &ArbitraryMeshVertex::colour); + py::class_ vertex(scope, "MeshVertex"); + + vertex.def_readwrite("texcoord", &MeshVertex::texcoord); + vertex.def_readwrite("normal", &MeshVertex::normal); + vertex.def_readwrite("vertex", &MeshVertex::vertex); + vertex.def_readwrite("tangent", &MeshVertex::tangent); + vertex.def_readwrite("bitangent", &MeshVertex::bitangent); + vertex.def_readwrite("colour", &MeshVertex::colour); + + // Register the old name as alias to MeshVertex + scope.add_object("ArbitraryMeshVertex", vertex); py::class_ poly(scope, "ModelPolygon"); diff --git a/plugins/script/interfaces/ModelInterface.h b/plugins/script/interfaces/ModelInterface.h index 727b2bfb78..fdc21d943b 100644 --- a/plugins/script/interfaces/ModelInterface.h +++ b/plugins/script/interfaces/ModelInterface.h @@ -6,7 +6,7 @@ #include "imodel.h" #include "SceneGraphInterface.h" -class ArbitraryMeshVertex; +class MeshVertex; namespace model { struct ModelPolygon; } namespace script @@ -23,7 +23,7 @@ class ScriptModelSurface int getNumVertices() const; int getNumTriangles() const; - const ArbitraryMeshVertex& getVertex(int vertexIndex) const; + const MeshVertex& getVertex(int vertexIndex) const; model::ModelPolygon getPolygon(int polygonIndex) const; std::string getDefaultMaterial() const; std::string getActiveMaterial() const; diff --git a/radiantcore/brush/RenderableBrushVertices.cpp b/radiantcore/brush/RenderableBrushVertices.cpp index 0ab23d624e..31d775e302 100644 --- a/radiantcore/brush/RenderableBrushVertices.cpp +++ b/radiantcore/brush/RenderableBrushVertices.cpp @@ -10,7 +10,7 @@ namespace detail { inline void addColouredVertices(const std::vector& sourceVertices, const Vector4& colour, - std::vector& vertices, std::vector& indices) + std::vector& vertices, std::vector& indices) { auto indexOffset = static_cast(vertices.size()); @@ -18,7 +18,7 @@ inline void addColouredVertices(const std::vector& sourceVertices, cons { const auto& vertex = sourceVertices[i]; - vertices.push_back(ArbitraryMeshVertex(vertex, { 0,0,0 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex(vertex, { 0,0,0 }, { 0,0 }, colour)); indices.push_back(indexOffset + i); } } @@ -34,7 +34,7 @@ void RenderableBrushVertices::updateGeometry() // Get the vertices for our given mode const auto& brushVertices = _brush.getVertices(_mode); - std::vector vertices; + std::vector vertices; std::vector indices; auto totalSize = brushVertices.size() + _selectedVertices.size(); diff --git a/radiantcore/brush/RenderableWinding.h b/radiantcore/brush/RenderableWinding.h index b314c7f13d..d4cdfaf111 100644 --- a/radiantcore/brush/RenderableWinding.h +++ b/radiantcore/brush/RenderableWinding.h @@ -52,7 +52,7 @@ class RenderableWinding : return; } - std::vector vertices; + std::vector vertices; vertices.reserve(numPoints); // Use the colour defined by the entity as vertex colour @@ -60,7 +60,7 @@ class RenderableWinding : for (const auto& vertex : _winding) { - vertices.emplace_back(ArbitraryMeshVertex(vertex.vertex, vertex.normal, + vertices.emplace_back(MeshVertex(vertex.vertex, vertex.normal, vertex.texcoord, entityColour, vertex.tangent, vertex.bitangent)); } diff --git a/radiantcore/entity/RenderableArrow.cpp b/radiantcore/entity/RenderableArrow.cpp index cd22614d4c..d12a25961f 100644 --- a/radiantcore/entity/RenderableArrow.cpp +++ b/radiantcore/entity/RenderableArrow.cpp @@ -35,14 +35,14 @@ void RenderableArrow::updateGeometry() Vector3 tip3(endpoint + direction * (-8.0) + left * (-4.0)); Vector3 tip4(tip3 + left * 8.0); - std::vector vertices + std::vector vertices { - ArbitraryMeshVertex(origin, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(endpoint, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(tip1, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(tip2, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(tip3, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(tip4, {1,0,0}, {0,0}, colour), + MeshVertex(origin, {1,0,0}, {0,0}, colour), + MeshVertex(endpoint, {1,0,0}, {0,0}, colour), + MeshVertex(tip1, {1,0,0}, {0,0}, colour), + MeshVertex(tip2, {1,0,0}, {0,0}, colour), + MeshVertex(tip3, {1,0,0}, {0,0}, colour), + MeshVertex(tip4, {1,0,0}, {0,0}, colour), }; // Indices are always the same, therefore constant diff --git a/radiantcore/entity/curve/RenderableCurve.h b/radiantcore/entity/curve/RenderableCurve.h index 5e2e80c021..2e1ba1f66f 100644 --- a/radiantcore/entity/curve/RenderableCurve.h +++ b/radiantcore/entity/curve/RenderableCurve.h @@ -41,7 +41,7 @@ class RenderableCurve : return; } - std::vector vertices; + std::vector vertices; std::vector indices; vertices.reserve(m_vertices.size()); @@ -53,7 +53,7 @@ class RenderableCurve : for (const auto& v : m_vertices) { - vertices.push_back(ArbitraryMeshVertex(v.vertex, { 0,0,1 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex(v.vertex, { 0,0,1 }, { 0,0 }, colour)); indices.push_back(index); indices.push_back(++index); }; diff --git a/radiantcore/entity/curve/RenderableCurveVertices.h b/radiantcore/entity/curve/RenderableCurveVertices.h index 650de7c9f8..ad54618b38 100644 --- a/radiantcore/entity/curve/RenderableCurveVertices.h +++ b/radiantcore/entity/curve/RenderableCurveVertices.h @@ -40,7 +40,7 @@ class RenderableCurveVertices : return; } - std::vector vertices; + std::vector vertices; std::vector indices; static const Vector4 SelectedColour(0, 0, 0, 1); @@ -50,7 +50,7 @@ class RenderableCurveVertices : _instance.forEachControlPoint([&](const Vector3& position, bool isSelected) { - vertices.push_back(ArbitraryMeshVertex(position, { 0, 0, 0 }, { 0, 0 }, + vertices.push_back(MeshVertex(position, { 0, 0, 0 }, { 0, 0 }, isSelected ? SelectedColour : DeselectedColour)); indices.push_back(static_cast(i++)); }); diff --git a/radiantcore/entity/doom3group/RenderableVertex.h b/radiantcore/entity/doom3group/RenderableVertex.h index a598559384..8d5152399b 100644 --- a/radiantcore/entity/doom3group/RenderableVertex.h +++ b/radiantcore/entity/doom3group/RenderableVertex.h @@ -35,14 +35,14 @@ class RenderableVertex : _needsUpdate = false; - std::vector vertices; + std::vector vertices; static std::vector Indices = { 0 }; auto colour = entity::EntitySettings::InstancePtr()->getLightVertexColour( _instance.isSelected() ? LightEditVertexType::Selected : LightEditVertexType::Deselected ); - vertices.push_back(ArbitraryMeshVertex(_localToWorld * _instance.getVertex(), { 0,0,0 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex(_localToWorld * _instance.getVertex(), { 0,0,0 }, { 0,0 }, colour)); RenderableGeometry::updateGeometry(render::GeometryType::Points, vertices, Indices); } diff --git a/radiantcore/entity/light/Renderables.cpp b/radiantcore/entity/light/Renderables.cpp index 437f8bfc67..f917a53d14 100644 --- a/radiantcore/entity/light/Renderables.cpp +++ b/radiantcore/entity/light/Renderables.cpp @@ -9,7 +9,7 @@ namespace entity namespace { -inline void applyTransform(std::vector& vertices, const Matrix4& transform) +inline void applyTransform(std::vector& vertices, const Matrix4& transform) { for (auto& vertex : vertices) { @@ -37,14 +37,14 @@ void RenderableLightOctagon::updateGeometry() auto colour = _light.getEntityColour(); // top, bottom, tleft, tright, bright, bleft - std::vector vertices + std::vector vertices { - ArbitraryMeshVertex({ mid[0], mid[1], max[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ mid[0], mid[1], min[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ min[0], max[1], mid[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], max[1], mid[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], min[1], mid[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ min[0], min[1], mid[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ mid[0], mid[1], max[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ mid[0], mid[1], min[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ min[0], max[1], mid[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ max[0], max[1], mid[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ max[0], min[1], mid[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ min[0], min[1], mid[2] }, {1,0,0}, {0,0}, colour), }; // Orient the points using the transform @@ -95,17 +95,17 @@ void RenderableLightVolume::updatePointLightVolume() auto colour = _light.getEntityColour(); // Load the 8 corner points - std::vector vertices + std::vector vertices { - ArbitraryMeshVertex({ min[0], min[1], min[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], min[1], min[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], max[1], min[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ min[0], max[1], min[2] }, {1,0,0}, {0,0}, colour), - - ArbitraryMeshVertex({ min[0], min[1], max[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], min[1], max[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ max[0], max[1], max[2] }, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex({ min[0], max[1], max[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ min[0], min[1], min[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ max[0], min[1], min[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ max[0], max[1], min[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ min[0], max[1], min[2] }, {1,0,0}, {0,0}, colour), + + MeshVertex({ min[0], min[1], max[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ max[0], min[1], max[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ max[0], max[1], max[2] }, {1,0,0}, {0,0}, colour), + MeshVertex({ min[0], max[1], max[2] }, {1,0,0}, {0,0}, colour), }; // Orient the points using the transform @@ -159,16 +159,16 @@ void RenderableLightVolume::updateProjectedLightVolume() auto frontUpperRight = frustum.getCornerPoint(Frustum::FRONT, Frustum::TOP_RIGHT); auto frontLowerRight = frustum.getCornerPoint(Frustum::FRONT, Frustum::BOTTOM_RIGHT); - std::vector vertices + std::vector vertices { - ArbitraryMeshVertex(frontUpperLeft, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(frontLowerLeft, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(frontLowerRight, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(frontUpperRight, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backUpperLeft, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backLowerLeft, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backLowerRight, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backUpperRight, {1,0,0}, {0,0}, colour), + MeshVertex(frontUpperLeft, {1,0,0}, {0,0}, colour), + MeshVertex(frontLowerLeft, {1,0,0}, {0,0}, colour), + MeshVertex(frontLowerRight, {1,0,0}, {0,0}, colour), + MeshVertex(frontUpperRight, {1,0,0}, {0,0}, colour), + MeshVertex(backUpperLeft, {1,0,0}, {0,0}, colour), + MeshVertex(backLowerLeft, {1,0,0}, {0,0}, colour), + MeshVertex(backLowerRight, {1,0,0}, {0,0}, colour), + MeshVertex(backUpperRight, {1,0,0}, {0,0}, colour), }; // Orient the points using the transform @@ -199,13 +199,13 @@ void RenderableLightVolume::updateProjectedLightVolume() // no light_start, just use the top vertex (doesn't need to be mirrored) auto top = Plane3::intersect(frustum.left, frustum.right, frustum.top); - std::vector vertices + std::vector vertices { - ArbitraryMeshVertex(top, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backUpperLeft, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backLowerLeft, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backLowerRight, {1,0,0}, {0,0}, colour), - ArbitraryMeshVertex(backUpperRight, {1,0,0}, {0,0}, colour), + MeshVertex(top, {1,0,0}, {0,0}, colour), + MeshVertex(backUpperLeft, {1,0,0}, {0,0}, colour), + MeshVertex(backLowerLeft, {1,0,0}, {0,0}, colour), + MeshVertex(backLowerRight, {1,0,0}, {0,0}, colour), + MeshVertex(backUpperRight, {1,0,0}, {0,0}, colour), }; // Orient the points using the transform @@ -230,11 +230,11 @@ void RenderableLightVolume::updateProjectedLightVolume() namespace detail { -inline void addVertex(std::vector& vertices, std::vector& indices, +inline void addVertex(std::vector& vertices, std::vector& indices, const Vector3& vertex, const Vector4& colour) { indices.push_back(static_cast(vertices.size())); - vertices.push_back(ArbitraryMeshVertex(vertex, { 0,0,0 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex(vertex, { 0,0,0 }, { 0,0 }, colour)); } } @@ -245,7 +245,7 @@ void RenderableLightVertices::updateGeometry() _needsUpdate = false; - std::vector vertices; + std::vector vertices; std::vector indices; vertices.reserve(LightVertexInstanceSet::NumVertices); diff --git a/radiantcore/entity/speaker/SpeakerRenderables.cpp b/radiantcore/entity/speaker/SpeakerRenderables.cpp index 47d3524f2e..ae5692589b 100644 --- a/radiantcore/entity/speaker/SpeakerRenderables.cpp +++ b/radiantcore/entity/speaker/SpeakerRenderables.cpp @@ -38,7 +38,7 @@ void RenderableSpeakerRadiiWireframe::updateGeometry() // Generate the three circles in axis-aligned planes constexpr std::size_t NumSegments = 2; - std::vector vertices; + std::vector vertices; // Allocate space for 6 circles, one per radius, each radius has NumSegments * 8 vertices constexpr std::size_t NumVerticesPerCircle = NumSegments << 3; @@ -147,7 +147,7 @@ inline std::vector generateSphereIndices() } -void RenderableSpeakerRadiiFill::generateSphereVertices(std::vector& vertices, double radius) +void RenderableSpeakerRadiiFill::generateSphereVertices(std::vector& vertices, double radius) { auto colour = _entity.getEntityColour(); @@ -166,13 +166,13 @@ void RenderableSpeakerRadiiFill::generateSphereVertices(std::vector vertices; + std::vector vertices; // Make space for two spheres vertices.reserve(NumVerticesPerSphere << 1); diff --git a/radiantcore/entity/speaker/SpeakerRenderables.h b/radiantcore/entity/speaker/SpeakerRenderables.h index c0bcc9fbca..437fe6b10f 100644 --- a/radiantcore/entity/speaker/SpeakerRenderables.h +++ b/radiantcore/entity/speaker/SpeakerRenderables.h @@ -69,7 +69,7 @@ class RenderableSpeakerRadiiFill : void updateGeometry() override; private: - void generateSphereVertices(std::vector& vertices, double radius); + void generateSphereVertices(std::vector& vertices, double radius); }; } // namespace diff --git a/radiantcore/entity/target/RenderableTargetLines.h b/radiantcore/entity/target/RenderableTargetLines.h index 8ffb5ccfcb..dd7d1bef6b 100644 --- a/radiantcore/entity/target/RenderableTargetLines.h +++ b/radiantcore/entity/target/RenderableTargetLines.h @@ -61,7 +61,7 @@ class RenderableTargetLines : // an update on the renderable geometry every time we're asked to // Collect vertex and index data - std::vector vertices; + std::vector vertices; std::vector indices; auto maxTargets = _targetKeys.getNumTargets(); @@ -87,7 +87,7 @@ class RenderableTargetLines : // Adds points to the vector, defining a line from start to end, with arrow indicators // in the XY plane (located at the midpoint between start/end). void addTargetLine(const Vector3& startPosition, const Vector3& endPosition, - std::vector& vertices, std::vector& indices) + std::vector& vertices, std::vector& indices) { // Take the mid-point Vector3 mid((startPosition + endPosition) * 0.5f); @@ -126,15 +126,15 @@ class RenderableTargetLines : auto indexOffset = static_cast(vertices.size()); // The line from this to the other entity - vertices.push_back(ArbitraryMeshVertex(startPosition, { 1,0,0 }, { 0, 0 }, colour)); - vertices.push_back(ArbitraryMeshVertex(endPosition, { 1,0,0 }, { 0, 0 }, colour)); + vertices.push_back(MeshVertex(startPosition, { 1,0,0 }, { 0, 0 }, colour)); + vertices.push_back(MeshVertex(endPosition, { 1,0,0 }, { 0, 0 }, colour)); // The "arrow indicators" in the xy plane - vertices.push_back(ArbitraryMeshVertex(mid, { 1,0,0 }, { 0, 0 }, colour)); - vertices.push_back(ArbitraryMeshVertex(xyPoint1, { 1,0,0 }, { 0, 0 }, colour)); + vertices.push_back(MeshVertex(mid, { 1,0,0 }, { 0, 0 }, colour)); + vertices.push_back(MeshVertex(xyPoint1, { 1,0,0 }, { 0, 0 }, colour)); - vertices.push_back(ArbitraryMeshVertex(mid, { 1,0,0 }, { 0, 0 }, colour)); - vertices.push_back(ArbitraryMeshVertex(xyPoint2, { 1,0,0 }, { 0, 0 }, colour)); + vertices.push_back(MeshVertex(mid, { 1,0,0 }, { 0, 0 }, colour)); + vertices.push_back(MeshVertex(xyPoint2, { 1,0,0 }, { 0, 0 }, colour)); indices.push_back(indexOffset + 0); indices.push_back(indexOffset + 1); diff --git a/radiantcore/map/RenderablePointFile.h b/radiantcore/map/RenderablePointFile.h index 0f889051db..965744a4e7 100644 --- a/radiantcore/map/RenderablePointFile.h +++ b/radiantcore/map/RenderablePointFile.h @@ -35,14 +35,14 @@ class RenderablePointFile : protected: void updateGeometry() override { - std::vector vertices; + std::vector vertices; std::vector indices; if (_points.size() < 2) return; for (unsigned int i = 0; i < _points.size(); ++i) { - vertices.push_back(ArbitraryMeshVertex(_points[i].vertex, { 0, 0, 0 }, { 0, 0 }, detail::toVector4(_points[i].colour))); + vertices.push_back(MeshVertex(_points[i].vertex, { 0, 0, 0 }, { 0, 0 }, detail::toVector4(_points[i].colour))); if (i > 0) { diff --git a/radiantcore/model/RenderableModelSurface.h b/radiantcore/model/RenderableModelSurface.h index 497a5806bc..b56f77875a 100644 --- a/radiantcore/model/RenderableModelSurface.h +++ b/radiantcore/model/RenderableModelSurface.h @@ -38,7 +38,7 @@ class RenderableModelSurface final : return !_surface.getIndexArray().empty(); } - const std::vector& getVertices() override + const std::vector& getVertices() override { return _surface.getVertexArray(); } diff --git a/radiantcore/model/StaticModelSurface.cpp b/radiantcore/model/StaticModelSurface.cpp index 82be3374af..b841002ca6 100644 --- a/radiantcore/model/StaticModelSurface.cpp +++ b/radiantcore/model/StaticModelSurface.cpp @@ -13,7 +13,7 @@ namespace model { -StaticModelSurface::StaticModelSurface(std::vector&& vertices, std::vector&& indices) : +StaticModelSurface::StaticModelSurface(std::vector&& vertices, std::vector&& indices) : _vertices(vertices), _indices(indices) { @@ -46,7 +46,7 @@ void StaticModelSurface::calculateTangents() auto& c = _vertices[*(i + 2)]; // Call the tangent calculation function - ArbitraryMeshTriangle_sumTangents(a, b, c); + MeshTriangle_sumTangents(a, b, c); } // Normalise all of the tangent and bitangent vectors @@ -68,7 +68,7 @@ void StaticModelSurface::testSelect(Selector& selector, SelectionTest& test, SelectionIntersection result; test.TestTriangles( - VertexPointer(&_vertices[0].vertex, sizeof(ArbitraryMeshVertex)), + VertexPointer(&_vertices[0].vertex, sizeof(MeshVertex)), IndexPointer(&_indices[0], IndexPointer::index_type(_indices.size())), result @@ -91,7 +91,7 @@ int StaticModelSurface::getNumTriangles() const return static_cast(_indices.size() / 3); // 3 indices per triangle } -const ArbitraryMeshVertex& StaticModelSurface::getVertex(int vertexIndex) const +const MeshVertex& StaticModelSurface::getVertex(int vertexIndex) const { assert(vertexIndex >= 0 && vertexIndex < static_cast(_vertices.size())); return _vertices[vertexIndex]; @@ -114,7 +114,7 @@ ModelPolygon StaticModelSurface::getPolygon(int polygonIndex) const return poly; } -const std::vector& StaticModelSurface::getVertexArray() const +const std::vector& StaticModelSurface::getVertexArray() const { return _vertices; } @@ -159,9 +159,9 @@ bool StaticModelSurface::getIntersection(const Ray& ray, Vector3& intersection, i += 3) { // Get the vertices for this triangle - const ArbitraryMeshVertex& p1 = _vertices[*(i)]; - const ArbitraryMeshVertex& p2 = _vertices[*(i+1)]; - const ArbitraryMeshVertex& p3 = _vertices[*(i+2)]; + const MeshVertex& p1 = _vertices[*(i)]; + const MeshVertex& p2 = _vertices[*(i+1)]; + const MeshVertex& p3 = _vertices[*(i+2)]; if (ray.intersectTriangle(localToWorld.transformPoint(p1.vertex), localToWorld.transformPoint(p2.vertex), localToWorld.transformPoint(p3.vertex), triIntersection)) diff --git a/radiantcore/model/StaticModelSurface.h b/radiantcore/model/StaticModelSurface.h index 1e49b1e58b..6377b443ba 100644 --- a/radiantcore/model/StaticModelSurface.h +++ b/radiantcore/model/StaticModelSurface.h @@ -34,9 +34,9 @@ class StaticModelSurface final : // Name of the material with skin remaps applied std::string _activeMaterial; - // Vector of ArbitraryMeshVertex structures, containing the coordinates, + // Vector of MeshVertex structures, containing the coordinates, // normals, tangents and texture coordinates of the component vertices - typedef std::vector VertexVector; + typedef std::vector VertexVector; VertexVector _vertices; // Vector of render indices, representing the groups of vertices to be @@ -53,7 +53,7 @@ class StaticModelSurface final : public: // Move-construct this static model surface from the given vertex- and index array - StaticModelSurface(std::vector&& vertices, std::vector&& indices); + StaticModelSurface(std::vector&& vertices, std::vector&& indices); // Copy-constructor. All vertices and indices will be copied from 'other'. StaticModelSurface(const StaticModelSurface& other); @@ -74,10 +74,10 @@ class StaticModelSurface final : int getNumVertices() const override; int getNumTriangles() const override; - const ArbitraryMeshVertex& getVertex(int vertexIndex) const override; + const MeshVertex& getVertex(int vertexIndex) const override; ModelPolygon getPolygon(int polygonIndex) const override; - const std::vector& getVertexArray() const override; + const std::vector& getVertexArray() const override; const std::vector& getIndexArray() const override; const std::string& getDefaultMaterial() const override; diff --git a/radiantcore/model/export/Lwo2Exporter.cpp b/radiantcore/model/export/Lwo2Exporter.cpp index b172b584d0..ad6f623eef 100644 --- a/radiantcore/model/export/Lwo2Exporter.cpp +++ b/radiantcore/model/export/Lwo2Exporter.cpp @@ -172,7 +172,7 @@ void Lwo2Exporter::exportToStream(std::ostream& stream) for (std::size_t v = 0; v < surface.vertices.size(); ++v) { - const ArbitraryMeshVertex& vertex = surface.vertices[v]; + const MeshVertex& vertex = surface.vertices[v]; std::size_t vertNum = vertexIdxStart + v; // "The LightWave coordinate system is left-handed, with +X to the right or east, +Y upward, and +Z forward or north." diff --git a/radiantcore/model/export/ModelExporter.cpp b/radiantcore/model/export/ModelExporter.cpp index 8593ff32be..329139028d 100644 --- a/radiantcore/model/export/ModelExporter.cpp +++ b/radiantcore/model/export/ModelExporter.cpp @@ -21,10 +21,10 @@ namespace model namespace { -// Adapter methods to convert brush vertices to ArbitraryMeshVertex type -ArbitraryMeshVertex convertWindingVertex(const WindingVertex& in) +// Adapter methods to convert brush vertices to MeshVertex type +MeshVertex convertWindingVertex(const WindingVertex& in) { - ArbitraryMeshVertex out; + MeshVertex out; out.vertex = in.vertex; out.normal = in.normal; diff --git a/radiantcore/model/export/ModelExporterBase.h b/radiantcore/model/export/ModelExporterBase.h index 1a446179fa..4f83a7aac5 100644 --- a/radiantcore/model/export/ModelExporterBase.h +++ b/radiantcore/model/export/ModelExporterBase.h @@ -27,7 +27,7 @@ class ModelExporterBase : std::string materialName; // The vertices of this surface - std::vector vertices; + std::vector vertices; // The indices connecting the vertices to triangles IndexBuffer indices; diff --git a/radiantcore/model/export/PatchSurface.cpp b/radiantcore/model/export/PatchSurface.cpp index 0093aa9019..3b54986a7c 100644 --- a/radiantcore/model/export/PatchSurface.cpp +++ b/radiantcore/model/export/PatchSurface.cpp @@ -7,11 +7,11 @@ namespace model namespace { - // Adapter method to convert patch vertices to ArbitraryMeshVertex type - inline ArbitraryMeshVertex convertPatchVertex(const VertexNT& in) + // Adapter method to convert patch vertices to MeshVertex type + inline MeshVertex convertPatchVertex(const VertexNT& in) { // Colour will be set to 1,1,1 by the constructor - return ArbitraryMeshVertex(in.vertex, in.normal, in.texcoord); + return MeshVertex(in.vertex, in.normal, in.texcoord); } } @@ -64,7 +64,7 @@ int PatchSurface::getNumTriangles() const return static_cast(_indices.size() / 3); // 3 indices per triangle } -const ArbitraryMeshVertex& PatchSurface::getVertex(int vertexNum) const +const MeshVertex& PatchSurface::getVertex(int vertexNum) const { return _vertices[vertexNum]; } @@ -92,7 +92,7 @@ const std::string& PatchSurface::getActiveMaterial() const return _materialName; } -const std::vector& PatchSurface::getVertexArray() const +const std::vector& PatchSurface::getVertexArray() const { return _vertices; } diff --git a/radiantcore/model/export/PatchSurface.h b/radiantcore/model/export/PatchSurface.h index 418a446541..58797336bb 100644 --- a/radiantcore/model/export/PatchSurface.h +++ b/radiantcore/model/export/PatchSurface.h @@ -16,7 +16,7 @@ class PatchSurface : public IIndexedModelSurface { private: - std::vector _vertices; + std::vector _vertices; std::vector _indices; std::string _materialName; AABB _bounds; @@ -27,13 +27,13 @@ class PatchSurface : int getNumVertices() const override; int getNumTriangles() const override; - const ArbitraryMeshVertex& getVertex(int vertexNum) const override; + const MeshVertex& getVertex(int vertexNum) const override; ModelPolygon getPolygon(int polygonIndex) const override; const std::string& getDefaultMaterial() const override; const std::string& getActiveMaterial() const override; - const std::vector& getVertexArray() const override; + const std::vector& getVertexArray() const override; const std::vector& getIndexArray() const override; const AABB& getSurfaceBounds() const override; diff --git a/radiantcore/model/export/WavefrontExporter.cpp b/radiantcore/model/export/WavefrontExporter.cpp index b0bdce0807..f89dec0b92 100644 --- a/radiantcore/model/export/WavefrontExporter.cpp +++ b/radiantcore/model/export/WavefrontExporter.cpp @@ -78,7 +78,7 @@ void WavefrontExporter::writeObjFile(std::ostream& stream, const std::string& mt std::stringstream texCoordBuf; std::stringstream polyBuf; - for (const ArbitraryMeshVertex& meshVertex : surface.vertices) + for (const MeshVertex& meshVertex : surface.vertices) { // Write coordinates into the export buffers const Vector3& vert = meshVertex.vertex; diff --git a/radiantcore/model/import/AseModel.cpp b/radiantcore/model/import/AseModel.cpp index 41c0467bcc..ef5df44845 100644 --- a/radiantcore/model/import/AseModel.cpp +++ b/radiantcore/model/import/AseModel.cpp @@ -95,7 +95,7 @@ void AseModel::finishSurface(Mesh& mesh, std::size_t materialIndex, const Matrix double materialCos = cos(material.uvAngle); // Hash table to provide quick (and coarse) lookup of vertices with similar XYZ coords - std::unordered_map vertexIndices; + std::unordered_map vertexIndices; for (const auto& face : mesh.faces) { @@ -122,7 +122,7 @@ void AseModel::finishSurface(Mesh& mesh, std::size_t materialIndex, const Matrix const auto& colour = !mesh.colours.empty() ? mesh.colours[face.colourIndices[j]] : White; - ArbitraryMeshVertex meshVertex( + MeshVertex meshVertex( vertex, nodeMatrix.transformDirection(normal).getNormalised(), TexCoord2f(u * materialCos + v * materialSin, u * -materialSin + v * materialCos), diff --git a/radiantcore/model/import/AseModel.h b/radiantcore/model/import/AseModel.h index 106b0180d2..0b78703764 100644 --- a/radiantcore/model/import/AseModel.h +++ b/radiantcore/model/import/AseModel.h @@ -41,7 +41,7 @@ class AseModel { std::string material; - std::vector vertices; + std::vector vertices; std::vector indices; }; diff --git a/radiantcore/model/import/FbxModelLoader.cpp b/radiantcore/model/import/FbxModelLoader.cpp index c5a8939746..90b122c137 100644 --- a/radiantcore/model/import/FbxModelLoader.cpp +++ b/radiantcore/model/import/FbxModelLoader.cpp @@ -22,14 +22,14 @@ FbxModelLoader::FbxModelLoader() : namespace { -inline ArbitraryMeshVertex ConstructMeshVertex(const ofbx::Geometry& geometry, int index) +inline MeshVertex ConstructMeshVertex(const ofbx::Geometry& geometry, int index) { auto vertices = geometry.getVertices(); auto normals = geometry.getNormals(); auto uvs = geometry.getUVs(); auto colours = geometry.getColors(); - return ArbitraryMeshVertex( + return MeshVertex( Vertex3f(vertices[index].x, vertices[index].y, vertices[index].z), normals != nullptr ? Normal3f(normals[index].x, normals[index].y, normals[index].z) : Normal3f(1, 0, 0), uvs != nullptr ? TexCoord2f(uvs[index].x, 1.0 - uvs[index].y) : TexCoord2f(0, 0), // invert v diff --git a/radiantcore/model/import/FbxSurface.h b/radiantcore/model/import/FbxSurface.h index 88a6c28bce..a057eb0515 100644 --- a/radiantcore/model/import/FbxSurface.h +++ b/radiantcore/model/import/FbxSurface.h @@ -4,7 +4,7 @@ #include #include -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" #include "render/VertexHashing.h" namespace model @@ -14,14 +14,14 @@ class FbxSurface { private: std::vector indices; - std::vector vertices; + std::vector vertices; std::string material; // Hash index to share vertices with the same set of attributes - std::unordered_map vertexIndices; + std::unordered_map vertexIndices; public: - std::vector& getVertexArray() + std::vector& getVertexArray() { return vertices; } @@ -41,7 +41,7 @@ class FbxSurface material = newMaterial; } - void addVertex(const ArbitraryMeshVertex& vertex) + void addVertex(const MeshVertex& vertex) { // Try to look up an existing vertex or add a new index auto emplaceResult = vertexIndices.try_emplace(vertex, vertices.size()); diff --git a/radiantcore/model/md5/MD5Surface.cpp b/radiantcore/model/md5/MD5Surface.cpp index 4e6651a4ad..21196b7906 100644 --- a/radiantcore/model/md5/MD5Surface.cpp +++ b/radiantcore/model/md5/MD5Surface.cpp @@ -8,9 +8,9 @@ namespace md5 { -inline VertexPointer vertexpointer_arbitrarymeshvertex(const ArbitraryMeshVertex* array) +inline VertexPointer vertexpointer_Meshvertex(const MeshVertex* array) { - return VertexPointer(&array->vertex, sizeof(ArbitraryMeshVertex)); + return VertexPointer(&array->vertex, sizeof(MeshVertex)); } // Constructor @@ -43,7 +43,7 @@ void MD5Surface::updateGeometry() auto& b = _vertices[*(i + 1)]; auto& c = _vertices[*(i + 2)]; - ArbitraryMeshTriangle_sumTangents(a, b, c); + MeshTriangle_sumTangents(a, b, c); } for (auto& vertex : _vertices) @@ -61,7 +61,7 @@ void MD5Surface::testSelect(Selector& selector, SelectionIntersection best; test.TestTriangles( - vertexpointer_arbitrarymeshvertex(_vertices.data()), + vertexpointer_Meshvertex(_vertices.data()), IndexPointer(_indices.data(), IndexPointer::index_type(_indices.size())), best ); @@ -131,7 +131,7 @@ int MD5Surface::getNumTriangles() const return static_cast(_indices.size() / 3); } -const ArbitraryMeshVertex& MD5Surface::getVertex(int vertexIndex) const +const MeshVertex& MD5Surface::getVertex(int vertexIndex) const { assert(vertexIndex >= 0 && vertexIndex < static_cast(_vertices.size())); return _vertices[vertexIndex]; @@ -150,7 +150,7 @@ model::ModelPolygon MD5Surface::getPolygon(int polygonIndex) const return poly; } -const std::vector& MD5Surface::getVertexArray() const +const std::vector& MD5Surface::getVertexArray() const { return _vertices; } diff --git a/radiantcore/model/md5/MD5Surface.h b/radiantcore/model/md5/MD5Surface.h index 3d11f2841f..b8504db180 100644 --- a/radiantcore/model/md5/MD5Surface.h +++ b/radiantcore/model/md5/MD5Surface.h @@ -22,7 +22,7 @@ class MD5Surface final : public model::IIndexedModelSurface { public: - typedef std::vector Vertices; + typedef std::vector Vertices; typedef IndexBuffer Indices; private: @@ -77,10 +77,10 @@ class MD5Surface final : int getNumVertices() const override; int getNumTriangles() const override; - const ArbitraryMeshVertex& getVertex(int vertexIndex) const override; + const MeshVertex& getVertex(int vertexIndex) const override; model::ModelPolygon getPolygon(int polygonIndex) const override; - const std::vector& getVertexArray() const override; + const std::vector& getVertexArray() const override; const std::vector& getIndexArray() const override; const std::string& getDefaultMaterial() const override; diff --git a/radiantcore/model/md5/RenderableMD5Skeleton.h b/radiantcore/model/md5/RenderableMD5Skeleton.h index ac4fea7bc6..73c08c4e06 100644 --- a/radiantcore/model/md5/RenderableMD5Skeleton.h +++ b/radiantcore/model/md5/RenderableMD5Skeleton.h @@ -41,7 +41,7 @@ class RenderableMD5Skeleton : return; } - std::vector vertices; + std::vector vertices; std::vector indices; auto numJoints = _skeleton.size(); @@ -114,7 +114,7 @@ class RenderableMD5Skeleton : } private: - ArbitraryMeshVertex toVertex(const Vector3& vertex, const Vector4& colour = { 1, 1, 1, 1 }) + MeshVertex toVertex(const Vector3& vertex, const Vector4& colour = { 1, 1, 1, 1 }) { return { vertex, {0, 0, 0}, {1, 0}, colour }; } diff --git a/radiantcore/model/picomodel/PicoModelLoader.cpp b/radiantcore/model/picomodel/PicoModelLoader.cpp index 5a8ce54656..49df528047 100644 --- a/radiantcore/model/picomodel/PicoModelLoader.cpp +++ b/radiantcore/model/picomodel/PicoModelLoader.cpp @@ -220,7 +220,7 @@ StaticModelSurfacePtr PicoModelLoader::CreateSurface(picoSurface_t* picoSurface, { // Allocate the vectors that will be moved to the surface at end of scope - std::vector vertices(numVertices); + std::vector vertices(numVertices); std::vector indices(numIndices); // Stream in the vertex data from the raw struct, expanding the local AABB diff --git a/radiantcore/particles/RenderableParticleBunch.cpp b/radiantcore/particles/RenderableParticleBunch.cpp index 5db82413bf..50b1a078b9 100644 --- a/radiantcore/particles/RenderableParticleBunch.cpp +++ b/radiantcore/particles/RenderableParticleBunch.cpp @@ -151,7 +151,7 @@ void RenderableParticleBunch::update(std::size_t time) } } -void RenderableParticleBunch::addVertexData(std::vector& vertices, +void RenderableParticleBunch::addVertexData(std::vector& vertices, std::vector& indices, const Matrix4& localToWorld) { if (_quads.empty()) return; @@ -166,7 +166,7 @@ void RenderableParticleBunch::addVertexData(std::vector& ve { auto worldVertex = localToWorld * quad.verts[i].vertex; - vertices.push_back(ArbitraryMeshVertex( + vertices.push_back(MeshVertex( worldVertex, quad.verts[i].normal, quad.verts[i].texcoord, diff --git a/radiantcore/particles/RenderableParticleBunch.h b/radiantcore/particles/RenderableParticleBunch.h index 1f840753f7..becec9ea05 100644 --- a/radiantcore/particles/RenderableParticleBunch.h +++ b/radiantcore/particles/RenderableParticleBunch.h @@ -74,7 +74,7 @@ class RenderableParticleBunch void update(std::size_t time); // Add the renderable geometry to the given arrays - void addVertexData(std::vector& vertices, + void addVertexData(std::vector& vertices, std::vector& indices, const Matrix4& localToWorld); const AABB& getBounds(); diff --git a/radiantcore/particles/RenderableParticleStage.cpp b/radiantcore/particles/RenderableParticleStage.cpp index 715a551f9a..4918dd4719 100644 --- a/radiantcore/particles/RenderableParticleStage.cpp +++ b/radiantcore/particles/RenderableParticleStage.cpp @@ -77,7 +77,7 @@ void RenderableParticleStage::submitGeometry(const ShaderPtr& shader, const Matr void RenderableParticleStage::updateGeometry() { - std::vector vertices; + std::vector vertices; std::vector indices; auto numQuads = (_bunches[0] ? _bunches[0]->getNumQuads() : 0) + diff --git a/radiantcore/patch/Patch.cpp b/radiantcore/patch/Patch.cpp index f65fed0073..1265cbcc2f 100644 --- a/radiantcore/patch/Patch.cpp +++ b/radiantcore/patch/Patch.cpp @@ -22,8 +22,8 @@ // ====== Helper Functions ================================================================== -inline VertexPointer vertexpointer_arbitrarymeshvertex(const ArbitraryMeshVertex* array) { - return VertexPointer(&array->vertex, sizeof(ArbitraryMeshVertex)); +inline VertexPointer vertexpointer_Meshvertex(const MeshVertex* array) { + return VertexPointer(&array->vertex, sizeof(MeshVertex)); } inline const Colour4b colour_for_index(std::size_t i, std::size_t width) @@ -199,7 +199,7 @@ void Patch::testSelect(Selector& selector, SelectionTest& test) IndexPointer::index_type* pIndex = &_mesh.indices.front(); for (std::size_t s=0; s<_mesh.numStrips; s++) { - test.TestQuadStrip(vertexpointer_arbitrarymeshvertex(&_mesh.vertices.front()), IndexPointer(pIndex, _mesh.lenStrips), best); + test.TestQuadStrip(vertexpointer_Meshvertex(&_mesh.vertices.front()), IndexPointer(pIndex, _mesh.lenStrips), best); pIndex += _mesh.lenStrips; } @@ -1740,7 +1740,7 @@ PatchMesh Patch::getTesselatedPatchMesh() const mesh.width = _mesh.width; mesh.height = _mesh.height; - for (std::vector::const_iterator i = _mesh.vertices.begin(); + for (std::vector::const_iterator i = _mesh.vertices.begin(); i != _mesh.vertices.end(); ++i) { VertexNT v; diff --git a/radiantcore/patch/PatchRenderables.cpp b/radiantcore/patch/PatchRenderables.cpp index a1f8ef13e1..a7ad6e8432 100644 --- a/radiantcore/patch/PatchRenderables.cpp +++ b/radiantcore/patch/PatchRenderables.cpp @@ -27,7 +27,7 @@ void RenderablePatchControlPoints::updateGeometry() _needsUpdate = false; // Generate the new point vector - std::vector vertices; + std::vector vertices; std::vector indices; vertices.reserve(_controlPoints.size()); @@ -40,7 +40,7 @@ void RenderablePatchControlPoints::updateGeometry() { const auto& ctrl = _controlPoints[i]; - vertices.push_back(ArbitraryMeshVertex(ctrl.control.vertex, { 0, 0, 0 }, { 0, 0 }, + vertices.push_back(MeshVertex(ctrl.control.vertex, { 0, 0, 0 }, { 0, 0 }, ctrl.isSelected() ? SelectedColour : detail::getControlPointVertexColour(i, width))); indices.push_back(static_cast(i)); } diff --git a/radiantcore/patch/PatchRenderables.h b/radiantcore/patch/PatchRenderables.h index d8287cdae7..80749b8ab3 100644 --- a/radiantcore/patch/PatchRenderables.h +++ b/radiantcore/patch/PatchRenderables.h @@ -134,15 +134,15 @@ class RenderablePatchTesselation : _whiteVertexColour ? getColouredVertices() : _tess.vertices, indices); } - std::vector getColouredVertices() + std::vector getColouredVertices() { - std::vector vertices; + std::vector vertices; vertices.reserve(_tess.vertices.size()); for (const auto& vertex : _tess.vertices) { // Copy vertex data, but set the colour to 1,1,1,1 - vertices.push_back(ArbitraryMeshVertex(vertex.vertex, vertex.normal, + vertices.push_back(MeshVertex(vertex.vertex, vertex.normal, vertex.texcoord, { 1, 1, 1, 1 }, vertex.tangent, vertex.bitangent)); } @@ -182,12 +182,12 @@ class RenderablePatchLattice : auto height = _patch.getHeight(); assert(width * height == _controlPoints.size()); - std::vector vertices; + std::vector vertices; vertices.reserve(_controlPoints.size()); for (const auto& ctrl : _controlPoints) { - vertices.push_back(ArbitraryMeshVertex(ctrl.control.vertex, { 0, 0, 1 }, ctrl.control.texcoord, { 1, 0.5, 0, 1 })); + vertices.push_back(MeshVertex(ctrl.control.vertex, { 0, 0, 1 }, ctrl.control.texcoord, { 1, 0.5, 0, 1 })); } // Generate the index array diff --git a/radiantcore/patch/PatchTesselation.cpp b/radiantcore/patch/PatchTesselation.cpp index 9e21a5d91a..d790124b22 100644 --- a/radiantcore/patch/PatchTesselation.cpp +++ b/radiantcore/patch/PatchTesselation.cpp @@ -197,7 +197,7 @@ void PatchTesselation::generateNormals() } } -void PatchTesselation::sampleSinglePatchPoint(const ArbitraryMeshVertex ctrl[3][3], float u, float v, ArbitraryMeshVertex& out) const +void PatchTesselation::sampleSinglePatchPoint(const MeshVertex ctrl[3][3], float u, float v, MeshVertex& out) const { double vCtrl[3][8]; @@ -260,10 +260,10 @@ void PatchTesselation::sampleSinglePatchPoint(const ArbitraryMeshVertex ctrl[3][ } } -void PatchTesselation::sampleSinglePatch(const ArbitraryMeshVertex ctrl[3][3], +void PatchTesselation::sampleSinglePatch(const MeshVertex ctrl[3][3], std::size_t baseCol, std::size_t baseRow, std::size_t w, std::size_t horzSub, std::size_t vertSub, - std::vector& outVerts) const + std::vector& outVerts) const { horzSub++; vertSub++; @@ -285,10 +285,10 @@ void PatchTesselation::subdivideMeshFixed(std::size_t subdivX, std::size_t subdi std::size_t outWidth = ((width - 1) / 2 * subdivX) + 1; std::size_t outHeight = ((height - 1) / 2 * subdivY) + 1; - std::vector dv(outWidth * outHeight); + std::vector dv(outWidth * outHeight); std::size_t baseCol = 0; - ArbitraryMeshVertex sample[3][3]; + MeshVertex sample[3][3]; for (std::size_t i = 0; i + 2 < width; i += 2) { @@ -375,7 +375,7 @@ void PatchTesselation::resizeExpandedMesh(std::size_t newHeight, std::size_t new _maxWidth = newWidth; } -void PatchTesselation::lerpVert(const ArbitraryMeshVertex& a, const ArbitraryMeshVertex& b, ArbitraryMeshVertex&out) +void PatchTesselation::lerpVert(const MeshVertex& a, const MeshVertex& b, MeshVertex&out) { out.vertex = math::midPoint(a.vertex, b.vertex); out.normal = math::midPoint(a.normal, b.normal); @@ -384,7 +384,7 @@ void PatchTesselation::lerpVert(const ArbitraryMeshVertex& a, const ArbitraryMes void PatchTesselation::putOnCurve() { - ArbitraryMeshVertex prev, next; + MeshVertex prev, next; // put all the approximating points on the curve for (std::size_t i = 0; i < width; i++) @@ -500,7 +500,7 @@ void PatchTesselation::subdivideMesh() static const float DEFAULT_CURVE_MAX_LENGTH = -1.0f; Vector3 prevxyz, nextxyz, midxyz; - ArbitraryMeshVertex prev, next, mid; + MeshVertex prev, next, mid; static float maxHorizontalErrorSqr = DEFAULT_CURVE_MAX_ERROR * DEFAULT_CURVE_MAX_ERROR; static float maxVerticalErrorSqr = DEFAULT_CURVE_MAX_ERROR * DEFAULT_CURVE_MAX_ERROR; @@ -654,7 +654,7 @@ struct FaceTangents namespace { -void calculateFaceTangent(FaceTangents& ft, const ArbitraryMeshVertex& a, const ArbitraryMeshVertex& b, const ArbitraryMeshVertex& c) +void calculateFaceTangent(FaceTangents& ft, const MeshVertex& a, const MeshVertex& b, const MeshVertex& c) { double d0[5], d1[5]; @@ -759,7 +759,7 @@ void PatchTesselation::deriveTangents() for (std::size_t j = 0; j < 3; j++) { - ArbitraryMeshVertex& vert = vertices[strip_indices[i + j]]; + MeshVertex& vert = vertices[strip_indices[i + j]]; vert.tangent += ft1.tangents[0]; vert.bitangent += ft1.tangents[1]; @@ -770,7 +770,7 @@ void PatchTesselation::deriveTangents() for (std::size_t j = 0; j < 3; j++) { - ArbitraryMeshVertex& vert = vertices[strip_indices[i + j + 1]]; + MeshVertex& vert = vertices[strip_indices[i + j + 1]]; vert.tangent += ft2.tangents[0]; vert.bitangent += ft2.tangents[1]; @@ -782,7 +782,7 @@ void PatchTesselation::deriveTangents() // and normalize. The tangent vectors will not necessarily // be orthogonal to each other, but they will be orthogonal // to the surface normal. - for (ArbitraryMeshVertex& vert : vertices) + for (MeshVertex& vert : vertices) { auto d = vert.tangent.dot(vert.normal); vert.tangent = vert.tangent - vert.normal * d; @@ -872,7 +872,7 @@ void PatchTesselation::generate(std::size_t patchWidth, std::size_t patchHeight, // Final update: assign colours and normalise normals auto colour = renderEntity ? renderEntity->getEntityColour() : Vector4(1, 1, 1, 1); - for (ArbitraryMeshVertex& vertex : vertices) + for (MeshVertex& vertex : vertices) { // normalize all the lerped normals if (vertex.normal.getLengthSquared() > 0) diff --git a/radiantcore/patch/PatchTesselation.h b/radiantcore/patch/PatchTesselation.h index dbd7eae82f..74a3420ad0 100644 --- a/radiantcore/patch/PatchTesselation.h +++ b/radiantcore/patch/PatchTesselation.h @@ -10,7 +10,7 @@ class PatchTesselation { public: // The vertex data, each vertex equipped with texcoord and ntb vectors - std::vector vertices; + std::vector vertices; // The indices, arranged in the way it's expected by GL_QUAD_STRIPS // The number of indices is (lenStrips*numStrips), which is the same as (width*height) @@ -60,13 +60,13 @@ class PatchTesselation void putOnCurve(); void removeLinearColumnsRows(); - static void lerpVert(const ArbitraryMeshVertex& a, const ArbitraryMeshVertex& b, ArbitraryMeshVertex&out); + static void lerpVert(const MeshVertex& a, const MeshVertex& b, MeshVertex&out); static Vector3 projectPointOntoVector(const Vector3& point, const Vector3& vStart, const Vector3& vEnd); - void sampleSinglePatch(const ArbitraryMeshVertex ctrl[3][3], std::size_t baseCol, std::size_t baseRow, + void sampleSinglePatch(const MeshVertex ctrl[3][3], std::size_t baseCol, std::size_t baseRow, std::size_t width, std::size_t horzSub, std::size_t vertSub, - std::vector& outVerts) const; - void sampleSinglePatchPoint(const ArbitraryMeshVertex ctrl[3][3], float u, float v, ArbitraryMeshVertex& out) const; + std::vector& outVerts) const; + void sampleSinglePatchPoint(const MeshVertex ctrl[3][3], float u, float v, MeshVertex& out) const; void deriveTangents(); void deriveFaceTangents(std::vector& faceTangents); }; diff --git a/radiantcore/rendersystem/backend/GeometryRenderer.h b/radiantcore/rendersystem/backend/GeometryRenderer.h index db4ed27da7..8e346a9b25 100644 --- a/radiantcore/rendersystem/backend/GeometryRenderer.h +++ b/radiantcore/rendersystem/backend/GeometryRenderer.h @@ -70,7 +70,7 @@ class GeometryRenderer : return true; } - Slot addGeometry(GeometryType indexType, const std::vector& vertices, + Slot addGeometry(GeometryType indexType, const std::vector& vertices, const std::vector& indices) override { auto groupIndex = GetGroupIndexForIndexType(indexType); @@ -110,7 +110,7 @@ class GeometryRenderer : } } - void updateGeometry(Slot slot, const std::vector& vertices, + void updateGeometry(Slot slot, const std::vector& vertices, const std::vector& indices) override { auto& slotInfo = _slots.at(slot); diff --git a/radiantcore/rendersystem/backend/GeometryStore.h b/radiantcore/rendersystem/backend/GeometryStore.h index 868af2103f..689e3855ca 100644 --- a/radiantcore/rendersystem/backend/GeometryStore.h +++ b/radiantcore/rendersystem/backend/GeometryStore.h @@ -24,7 +24,7 @@ class GeometryStore : // Represents the storage for a single frame struct FrameBuffer { - ContinuousBuffer vertices; + ContinuousBuffer vertices; ContinuousBuffer indices; GLsync syncObject; @@ -110,7 +110,7 @@ class GeometryStore : return slot; } - void updateData(Slot slot, const std::vector& vertices, + void updateData(Slot slot, const std::vector& vertices, const std::vector& indices) override { assert(!vertices.empty()); @@ -125,7 +125,7 @@ class GeometryStore : }); } - void updateSubData(Slot slot, std::size_t vertexOffset, const std::vector& vertices, + void updateSubData(Slot slot, std::size_t vertexOffset, const std::vector& vertices, std::size_t indexOffset, const std::vector& indices) override { assert(!vertices.empty()); diff --git a/radiantcore/rendersystem/backend/ObjectRenderer.cpp b/radiantcore/rendersystem/backend/ObjectRenderer.cpp index 8ea14adb00..e999fe7d98 100644 --- a/radiantcore/rendersystem/backend/ObjectRenderer.cpp +++ b/radiantcore/rendersystem/backend/ObjectRenderer.cpp @@ -3,7 +3,7 @@ #include "igl.h" #include "math/Matrix4.h" #include "igeometrystore.h" -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" namespace render { @@ -34,18 +34,18 @@ namespace { // Prepare a glDraw call by setting the glVertex(Attrib)Pointers to the given starting vertex -inline void setupAttributePointers(ArbitraryMeshVertex* startVertex) +inline void setupAttributePointers(MeshVertex* startVertex) { - glVertexPointer(3, GL_DOUBLE, sizeof(ArbitraryMeshVertex), &startVertex->vertex); - glColorPointer(4, GL_DOUBLE, sizeof(ArbitraryMeshVertex), &startVertex->colour); - glTexCoordPointer(2, GL_DOUBLE, sizeof(ArbitraryMeshVertex), &startVertex->texcoord); - glNormalPointer(GL_DOUBLE, sizeof(ArbitraryMeshVertex), &startVertex->normal); - - glVertexAttribPointer(GLProgramAttribute::Position, 3, GL_DOUBLE, 0, sizeof(ArbitraryMeshVertex), &startVertex->vertex); - glVertexAttribPointer(GLProgramAttribute::Normal, 3, GL_DOUBLE, 0, sizeof(ArbitraryMeshVertex), &startVertex->normal); - glVertexAttribPointer(GLProgramAttribute::TexCoord, 2, GL_DOUBLE, 0, sizeof(ArbitraryMeshVertex), &startVertex->texcoord); - glVertexAttribPointer(GLProgramAttribute::Tangent, 3, GL_DOUBLE, 0, sizeof(ArbitraryMeshVertex), &startVertex->tangent); - glVertexAttribPointer(GLProgramAttribute::Bitangent, 3, GL_DOUBLE, 0, sizeof(ArbitraryMeshVertex), &startVertex->bitangent); + glVertexPointer(3, GL_DOUBLE, sizeof(MeshVertex), &startVertex->vertex); + glColorPointer(4, GL_DOUBLE, sizeof(MeshVertex), &startVertex->colour); + glTexCoordPointer(2, GL_DOUBLE, sizeof(MeshVertex), &startVertex->texcoord); + glNormalPointer(GL_DOUBLE, sizeof(MeshVertex), &startVertex->normal); + + glVertexAttribPointer(GLProgramAttribute::Position, 3, GL_DOUBLE, 0, sizeof(MeshVertex), &startVertex->vertex); + glVertexAttribPointer(GLProgramAttribute::Normal, 3, GL_DOUBLE, 0, sizeof(MeshVertex), &startVertex->normal); + glVertexAttribPointer(GLProgramAttribute::TexCoord, 2, GL_DOUBLE, 0, sizeof(MeshVertex), &startVertex->texcoord); + glVertexAttribPointer(GLProgramAttribute::Tangent, 3, GL_DOUBLE, 0, sizeof(MeshVertex), &startVertex->tangent); + glVertexAttribPointer(GLProgramAttribute::Bitangent, 3, GL_DOUBLE, 0, sizeof(MeshVertex), &startVertex->bitangent); } } @@ -75,7 +75,7 @@ void ObjectRenderer::SubmitGeometry(const std::set& slots, firstIndices.reserve(surfaceCount); firstVertices.reserve(surfaceCount); - ArbitraryMeshVertex* bufferStart = nullptr; + MeshVertex* bufferStart = nullptr; for (const auto slot : slots) { diff --git a/radiantcore/rendersystem/backend/OpenGLShader.cpp b/radiantcore/rendersystem/backend/OpenGLShader.cpp index b08b5f4dd2..6b319e05a2 100644 --- a/radiantcore/rendersystem/backend/OpenGLShader.cpp +++ b/radiantcore/rendersystem/backend/OpenGLShader.cpp @@ -136,7 +136,7 @@ bool OpenGLShader::hasSurfaces() const } IGeometryRenderer::Slot OpenGLShader::addGeometry(GeometryType indexType, - const std::vector& vertices, const std::vector& indices) + const std::vector& vertices, const std::vector& indices) { return _geometryRenderer.addGeometry(indexType, vertices, indices); } @@ -146,7 +146,7 @@ void OpenGLShader::removeGeometry(IGeometryRenderer::Slot slot) _geometryRenderer.removeGeometry(slot); } -void OpenGLShader::updateGeometry(IGeometryRenderer::Slot slot, const std::vector& vertices, +void OpenGLShader::updateGeometry(IGeometryRenderer::Slot slot, const std::vector& vertices, const std::vector& indices) { _geometryRenderer.updateGeometry(slot, vertices, indices); @@ -192,7 +192,7 @@ IGeometryStore::Slot OpenGLShader::getSurfaceStorageLocation(ISurfaceRenderer::S return _surfaceRenderer.getSurfaceStorageLocation(slot); } -IWindingRenderer::Slot OpenGLShader::addWinding(const std::vector& vertices, IRenderEntity* entity) +IWindingRenderer::Slot OpenGLShader::addWinding(const std::vector& vertices, IRenderEntity* entity) { return _windingRenderer->addWinding(vertices, entity); } @@ -202,7 +202,7 @@ void OpenGLShader::removeWinding(IWindingRenderer::Slot slot) _windingRenderer->removeWinding(slot); } -void OpenGLShader::updateWinding(IWindingRenderer::Slot slot, const std::vector& vertices) +void OpenGLShader::updateWinding(IWindingRenderer::Slot slot, const std::vector& vertices) { _windingRenderer->updateWinding(slot, vertices); } diff --git a/radiantcore/rendersystem/backend/OpenGLShader.h b/radiantcore/rendersystem/backend/OpenGLShader.h index f740921347..b939e7df51 100644 --- a/radiantcore/rendersystem/backend/OpenGLShader.h +++ b/radiantcore/rendersystem/backend/OpenGLShader.h @@ -106,9 +106,9 @@ class OpenGLShader : void drawSurfaces(const VolumeTest& view); IGeometryRenderer::Slot addGeometry(GeometryType indexType, - const std::vector& vertices, const std::vector& indices) override; + const std::vector& vertices, const std::vector& indices) override; void removeGeometry(IGeometryRenderer::Slot slot) override; - void updateGeometry(IGeometryRenderer::Slot slot, const std::vector& vertices, + void updateGeometry(IGeometryRenderer::Slot slot, const std::vector& vertices, const std::vector& indices) override; void renderGeometry(IGeometryRenderer::Slot slot) override; AABB getGeometryBounds(IGeometryRenderer::Slot slot) override; @@ -120,9 +120,9 @@ class OpenGLShader : void renderSurface(ISurfaceRenderer::Slot slot) override; IGeometryStore::Slot getSurfaceStorageLocation(ISurfaceRenderer::Slot slot) override; - IWindingRenderer::Slot addWinding(const std::vector& vertices, IRenderEntity* entity) override; + IWindingRenderer::Slot addWinding(const std::vector& vertices, IRenderEntity* entity) override; void removeWinding(IWindingRenderer::Slot slot) override; - void updateWinding(IWindingRenderer::Slot slot, const std::vector& vertices) override; + void updateWinding(IWindingRenderer::Slot slot, const std::vector& vertices) override; bool hasWindings() const; void renderWinding(IWindingRenderer::RenderMode mode, IWindingRenderer::Slot slot) override; diff --git a/radiantcore/rendersystem/backend/WindingRenderer.h b/radiantcore/rendersystem/backend/WindingRenderer.h index 774541bdb6..473f2c5ff8 100644 --- a/radiantcore/rendersystem/backend/WindingRenderer.h +++ b/radiantcore/rendersystem/backend/WindingRenderer.h @@ -58,7 +58,7 @@ class WindingRenderer final : public IBackendWindingRenderer { private: - using VertexBuffer = CompactWindingVertexBuffer; + using VertexBuffer = CompactWindingVertexBuffer; static constexpr typename VertexBuffer::Slot InvalidVertexBufferSlot = std::numeric_limits::max(); static constexpr IGeometryStore::Slot InvalidStorageHandle = std::numeric_limits::max(); @@ -181,7 +181,7 @@ class WindingRenderer final : _boundsNeedUpdate = true; _surfaceNeedsRebuild = false; - std::vector vertices; + std::vector vertices; vertices.reserve(_slotIndices.size() * 6); // reserve 6 vertices per winding std::vector indices; @@ -336,7 +336,7 @@ class WindingRenderer final : return _windingCount == 0; } - Slot addWinding(const std::vector& vertices, IRenderEntity* entity) override + Slot addWinding(const std::vector& vertices, IRenderEntity* entity) override { auto windingSize = vertices.size(); @@ -415,7 +415,7 @@ class WindingRenderer final : --_windingCount; } - void updateWinding(Slot slot, const std::vector& vertices) override + void updateWinding(Slot slot, const std::vector& vertices) override { assert(slot < _slots.size()); auto& slotMapping = _slots[slot]; @@ -471,9 +471,9 @@ class WindingRenderer final : glDisableClientState(GL_COLOR_ARRAY); - glVertexPointer(3, GL_DOUBLE, sizeof(ArbitraryMeshVertex), &vertices.front().vertex); - glTexCoordPointer(2, GL_DOUBLE, sizeof(ArbitraryMeshVertex), &vertices.front().texcoord); - glNormalPointer(GL_DOUBLE, sizeof(ArbitraryMeshVertex), &vertices.front().normal); + glVertexPointer(3, GL_DOUBLE, sizeof(MeshVertex), &vertices.front().vertex); + glTexCoordPointer(2, GL_DOUBLE, sizeof(MeshVertex), &vertices.front().texcoord); + glNormalPointer(GL_DOUBLE, sizeof(MeshVertex), &vertices.front().normal); if (mode == IWindingRenderer::RenderMode::Triangles) { @@ -544,7 +544,7 @@ class WindingRenderer final : // Copy the modified range to the store // We need to set up a local copy here, this could be optimised // if the GeometryStore accepted iterator ranges - std::vector vertexSubData; + std::vector vertexSubData; auto firstVertex = bucket.modifiedSlotRange.first * bucket.buffer.getWindingSize(); auto highestVertex = (bucket.modifiedSlotRange.second + 1) * bucket.buffer.getWindingSize(); diff --git a/radiantcore/selection/manipulators/Renderables.h b/radiantcore/selection/manipulators/Renderables.h index fb36a062b4..ec26c12c67 100644 --- a/radiantcore/selection/manipulators/Renderables.h +++ b/radiantcore/selection/manipulators/Renderables.h @@ -43,7 +43,7 @@ class RenderableCornerPoints : _needsUpdate = false; - std::vector vertices; + std::vector vertices; std::vector indices; // 8 vertices per box @@ -74,15 +74,15 @@ class RenderableCornerPoints : namespace detail { -inline void generateQuad(std::vector& vertices, std::vector& indices, +inline void generateQuad(std::vector& vertices, std::vector& indices, double size, const Vector4& colour) { unsigned int indexOffset = static_cast(vertices.size()); - vertices.push_back(ArbitraryMeshVertex({ -size, size, 0 }, { 0,0,0 }, { 0,0 }, colour)); - vertices.push_back(ArbitraryMeshVertex({ size, size, 0 }, { 0,0,0 }, { 0,0 }, colour)); - vertices.push_back(ArbitraryMeshVertex({ size, -size, 0 }, { 0,0,0 }, { 0,0 }, colour)); - vertices.push_back(ArbitraryMeshVertex({ -size, -size, 0 }, { 0,0,0 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex({ -size, size, 0 }, { 0,0,0 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex({ size, size, 0 }, { 0,0,0 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex({ size, -size, 0 }, { 0,0,0 }, { 0,0 }, colour)); + vertices.push_back(MeshVertex({ -size, -size, 0 }, { 0,0,0 }, { 0,0 }, colour)); indices.push_back(indexOffset + 0); indices.push_back(indexOffset + 1); @@ -148,14 +148,14 @@ class RenderableLineStrip : _needsUpdate = false; - std::vector vertices; + std::vector vertices; std::vector indices; unsigned int index = 0; for (const auto& vertex : _rawPoints) { - vertices.push_back(ArbitraryMeshVertex(_localToWorld * vertex, { 0,0,0 }, { 0,0 }, _colour)); + vertices.push_back(MeshVertex(_localToWorld * vertex, { 0,0,0 }, { 0,0 }, _colour)); if (index > 0) { @@ -270,7 +270,7 @@ class RenderableArrowHead : _needsUpdate = false; - std::vector vertices; + std::vector vertices; std::vector indices; auto direction = _offset.getNormalised(); @@ -284,7 +284,7 @@ class RenderableArrowHead : for (const auto& vertex : _rawPoints) { - vertices.push_back(ArbitraryMeshVertex(_localToWorld * vertex, _screenAxis, { 0,0 }, _colour)); + vertices.push_back(MeshVertex(_localToWorld * vertex, _screenAxis, { 0,0 }, _colour)); indices.push_back(index++); } @@ -326,10 +326,10 @@ class RenderablePoint : _needsUpdate = false; - std::vector vertices; + std::vector vertices; std::vector indices; - vertices.push_back(ArbitraryMeshVertex(_localToWorld * _point, { 0,0,0 }, { 0,0 }, _colour)); + vertices.push_back(MeshVertex(_localToWorld * _point, { 0,0,0 }, { 0,0 }, _colour)); indices.push_back(0); RenderableGeometry::updateGeometry(render::GeometryType::Points, vertices, indices); diff --git a/test/ModelExport.cpp b/test/ModelExport.cpp index 27d08de48c..c4bd2d87ed 100644 --- a/test/ModelExport.cpp +++ b/test/ModelExport.cpp @@ -89,7 +89,7 @@ TEST_F(ModelExportTest, ExportFolderNotExisting) EXPECT_TRUE(fs::exists(outputPath)) << "Exporter didn't create the file " << outputPath; } -inline bool surfaceHasVertex(const model::IModelSurface& surface, const std::function& functor) +inline bool surfaceHasVertex(const model::IModelSurface& surface, const std::function& functor) { for (int i = 0; i < surface.getNumVertices(); ++i) { @@ -160,15 +160,15 @@ inline void checkVertexColoursOfExportedModel(const model::IModelExporterPtr& ex EXPECT_EQ(surface.getNumVertices(), 3); // The three colours we exported need to be present in the mesh - EXPECT_TRUE(surfaceHasVertex(surface, [&](const ArbitraryMeshVertex& vertex) + EXPECT_TRUE(surfaceHasVertex(surface, [&](const MeshVertex& vertex) { return math::isNear(vertex.colour, VertexColour1, 0.01); })); - EXPECT_TRUE(surfaceHasVertex(surface, [&](const ArbitraryMeshVertex& vertex) + EXPECT_TRUE(surfaceHasVertex(surface, [&](const MeshVertex& vertex) { return math::isNear(vertex.colour, VertexColour2, 0.01); })); - EXPECT_TRUE(surfaceHasVertex(surface, [&](const ArbitraryMeshVertex& vertex) + EXPECT_TRUE(surfaceHasVertex(surface, [&](const MeshVertex& vertex) { return math::isNear(vertex.colour, VertexColour3, 0.01); })); @@ -193,9 +193,9 @@ TEST_F(ModelExportTest, LwoVertexColoursAddedByPolygon) polys.emplace_back(model::ModelPolygon { - ArbitraryMeshVertex(Vertex3f(1,0,0), Normal3f(1,0,0), TexCoord2f(1,0), VertexColour1), - ArbitraryMeshVertex(Vertex3f(0,1,0), Normal3f(1,0,0), TexCoord2f(0,0), VertexColour2), - ArbitraryMeshVertex(Vertex3f(1,1,0), Normal3f(1,0,0), TexCoord2f(1,0), VertexColour3) + MeshVertex(Vertex3f(1,0,0), Normal3f(1,0,0), TexCoord2f(1,0), VertexColour1), + MeshVertex(Vertex3f(0,1,0), Normal3f(1,0,0), TexCoord2f(0,0), VertexColour2), + MeshVertex(Vertex3f(1,1,0), Normal3f(1,0,0), TexCoord2f(1,0), VertexColour3) }); exporter->addPolygons(CustomMaterialName, polys, Matrix4::getIdentity()); @@ -207,7 +207,7 @@ class TestModelSurface : public model::IIndexedModelSurface { public: - std::vector vertices; + std::vector vertices; std::vector indices; int getNumVertices() const override @@ -220,7 +220,7 @@ class TestModelSurface : return static_cast(indices.size() / 3); } - const ArbitraryMeshVertex& getVertex(int vertexNum) const override + const MeshVertex& getVertex(int vertexNum) const override { return vertices[vertexNum]; } @@ -245,7 +245,7 @@ class TestModelSurface : return getDefaultMaterial(); } - const std::vector& getVertexArray() const override + const std::vector& getVertexArray() const override { return vertices; } diff --git a/test/Models.cpp b/test/Models.cpp index 5fc8666e89..173a16e66d 100644 --- a/test/Models.cpp +++ b/test/Models.cpp @@ -228,7 +228,7 @@ TEST_F(AseImportTest, UVAngleKeyword) } bool surfaceHasVertexWith(const model::IModelSurface& surface, - const std::function& predicate) + const std::function& predicate) { bool found = false; @@ -246,7 +246,7 @@ bool surfaceHasVertexWith(const model::IModelSurface& surface, void expectVertexWithNormal(const model::IModelSurface& surface, const Vertex3f& vertex, const Normal3f& normal) { - EXPECT_TRUE(surfaceHasVertexWith(surface, [&](const ArbitraryMeshVertex& v)->bool + EXPECT_TRUE(surfaceHasVertexWith(surface, [&](const MeshVertex& v)->bool { return math::isNear(v.vertex, vertex, render::VertexEpsilon) && v.normal.dot(normal) > 1.0 - render::NormalEpsilon; })) << "Could not find a vertex with xyz = " << vertex << " and normal " << normal; @@ -285,7 +285,7 @@ TEST_F(AseImportTest, VertexNormals) void expectVertexWithColour(const model::IModelSurface& surface, const Vertex3f& vertex, const Vector4& colour) { - EXPECT_TRUE(surfaceHasVertexWith(surface, [&](const ArbitraryMeshVertex& v)->bool + EXPECT_TRUE(surfaceHasVertexWith(surface, [&](const MeshVertex& v)->bool { return math::isNear(v.vertex, vertex, render::VertexEpsilon) && math::isNear(v.colour, colour, render::VertexEpsilon); })) << "Could not find a vertex with xyz = " << vertex << " and colour " << colour; @@ -337,27 +337,27 @@ TEST_F(AseImportTest, VertexNormalTransformation) TEST_F(AseImportTest, VertexHashFunction) { // Construct two mesh vertices which should be considered equal - ArbitraryMeshVertex vertex1(Vertex3f(-0.0218, -0.7449, 2.2385), Normal3f(-0.8698, 0, -0.493405), + MeshVertex vertex1(Vertex3f(-0.0218, -0.7449, 2.2385), Normal3f(-0.8698, 0, -0.493405), TexCoord2f(0.9808, 0.8198), Vector3(1, 1, 1)); - ArbitraryMeshVertex vertex2(Vertex3f(-0.0218, -0.7434, 2.2385), Normal3f(-0.872, 0, -0.489505), + MeshVertex vertex2(Vertex3f(-0.0218, -0.7434, 2.2385), Normal3f(-0.872, 0, -0.489505), TexCoord2f(0.9808, 0.8198), Vector3(1, 1, 1)); // Construct a that is differing in the normal part - ArbitraryMeshVertex vertex3(Vertex3f(-0.0218, -0.7434, 2.2385), Normal3f(-1, 0, 0), + MeshVertex vertex3(Vertex3f(-0.0218, -0.7434, 2.2385), Normal3f(-1, 0, 0), TexCoord2f(0.9808, 0.8198), Vector3(1, 1, 1)); // Check the hash behaviour - std::hash hasher; + std::hash hasher; EXPECT_EQ(hasher(vertex1), hasher(vertex2)); EXPECT_EQ(hasher(vertex1), hasher(vertex3)); - std::equal_to equalityComparer; + std::equal_to equalityComparer; EXPECT_TRUE(equalityComparer(vertex1, vertex2)); EXPECT_FALSE(equalityComparer(vertex1, vertex3)); // With the included hash specialisations from render/VertexHashing.h, the two vertices should be considered equal - std::unordered_set set; + std::unordered_set set; // Insert the first vertex EXPECT_TRUE(set.insert(vertex1).second); diff --git a/test/WindingRendering.cpp b/test/WindingRendering.cpp index ce073ce261..3f191c1f95 100644 --- a/test/WindingRendering.cpp +++ b/test/WindingRendering.cpp @@ -1,5 +1,5 @@ #include "gtest/gtest.h" -#include "render/ArbitraryMeshVertex.h" +#include "render/MeshVertex.h" #include "render/CompactWindingVertexBuffer.h" namespace test @@ -8,22 +8,22 @@ namespace test constexpr int SmallestWindingSize = 3; constexpr int LargestWindingSize = 12; -using VertexBuffer = render::CompactWindingVertexBuffer; +using VertexBuffer = render::CompactWindingVertexBuffer; -inline ArbitraryMeshVertex createNthVertexOfWinding(int n, int id, std::size_t size) +inline MeshVertex createNthVertexOfWinding(int n, int id, std::size_t size) { auto offset = static_cast(n + size * id); - return ArbitraryMeshVertex( + return MeshVertex( { offset + 0.0, offset + 0.5, offset + 0.3 }, { 0, 0, offset + 0.0 }, { offset + 0.0, -offset + 0.0 } ); } -inline std::vector createWinding(int id, std::size_t size) +inline std::vector createWinding(int id, std::size_t size) { - std::vector winding; + std::vector winding; for (int i = 0; i < size; ++i) { @@ -282,7 +282,7 @@ TEST(CompactWindingVertexBuffer, RemoveMultipleWindings) TEST(CompactWindingVertexBuffer, TriangleIndexerSize3) // Winding size == 3 { - render::CompactWindingVertexBuffer buffer(3); + render::CompactWindingVertexBuffer buffer(3); EXPECT_EQ(buffer.getNumIndicesPerWinding(), 3); @@ -299,7 +299,7 @@ TEST(CompactWindingVertexBuffer, TriangleIndexerSize3) // Winding size == 3 TEST(CompactWindingVertexBuffer, TriangleIndexerSize4) // Winding size == 4 { - render::CompactWindingVertexBuffer buffer(4); + render::CompactWindingVertexBuffer buffer(4); EXPECT_EQ(buffer.getNumIndicesPerWinding(), 6); @@ -320,7 +320,7 @@ TEST(CompactWindingVertexBuffer, TriangleIndexerSize4) // Winding size == 4 TEST(CompactWindingVertexBuffer, TriangleIndexerSize5) // Winding size == 5 { - render::CompactWindingVertexBuffer buffer(5); + render::CompactWindingVertexBuffer buffer(5); EXPECT_EQ(buffer.getNumIndicesPerWinding(), 9); @@ -345,7 +345,7 @@ TEST(CompactWindingVertexBuffer, TriangleIndexerSize5) // Winding size == 5 TEST(CompactWindingVertexBuffer, LineIndexerSize3) // Winding size == 3 { - render::CompactWindingVertexBuffer buffer(3); + render::CompactWindingVertexBuffer buffer(3); EXPECT_EQ(buffer.getNumIndicesPerWinding(), 6); @@ -367,7 +367,7 @@ TEST(CompactWindingVertexBuffer, LineIndexerSize3) // Winding size == 3 TEST(CompactWindingVertexBuffer, LineIndexerSize4) // Winding size == 4 { - render::CompactWindingVertexBuffer buffer(4); + render::CompactWindingVertexBuffer buffer(4); EXPECT_EQ(buffer.getNumIndicesPerWinding(), 8); @@ -392,7 +392,7 @@ TEST(CompactWindingVertexBuffer, LineIndexerSize4) // Winding size == 4 TEST(CompactWindingVertexBuffer, LineIndexerSize5) // Winding size == 5 { - render::CompactWindingVertexBuffer buffer(5); + render::CompactWindingVertexBuffer buffer(5); EXPECT_EQ(buffer.getNumIndicesPerWinding(), 10); @@ -420,7 +420,7 @@ TEST(CompactWindingVertexBuffer, LineIndexerSize5) // Winding size == 5 TEST(CompactWindingVertexBuffer, PolygonIndexerSize5) // Winding size == 5 { - render::CompactWindingVertexBuffer buffer(5); + render::CompactWindingVertexBuffer buffer(5); EXPECT_EQ(buffer.getNumIndicesPerWinding(), 5); diff --git a/tools/msvc/libs.vcxproj b/tools/msvc/libs.vcxproj index d1ec04e184..52bc80f8e0 100644 --- a/tools/msvc/libs.vcxproj +++ b/tools/msvc/libs.vcxproj @@ -207,7 +207,6 @@ - @@ -215,6 +214,7 @@ + diff --git a/tools/msvc/libs.vcxproj.filters b/tools/msvc/libs.vcxproj.filters index a70bf34e84..6a00b29f3b 100644 --- a/tools/msvc/libs.vcxproj.filters +++ b/tools/msvc/libs.vcxproj.filters @@ -90,9 +90,6 @@ render - - render - render @@ -371,6 +368,9 @@ parser + + render +