Skip to content

Commit

Permalink
Mesh interface improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Epixu committed Mar 17, 2024
1 parent bb82266 commit 6ff9b82
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 28 deletions.
3 changes: 1 addition & 2 deletions include/Langulus/Asset.inl
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ namespace Langulus::A
/// Get a data list from the contents
/// @tparam T - the trait to search for
/// @return a pointer to the data list, or nullptr if none exists
template<CT::Trait T>
LANGULUS(INLINED)
template<CT::Trait T> LANGULUS(INLINED)
const Asset::DataList* Asset::GetDataList() const noexcept {
return GetDataList(MetaTraitOf<T>());
}
Expand Down
12 changes: 7 additions & 5 deletions include/Langulus/Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ namespace Langulus::A
template<CT::Topology, CT::Topology...>
NOD() bool CheckTopology() const;
NOD() DMeta GetTopology() const noexcept;
void SetTopology(DMeta) noexcept;

NOD() Math::MapMode GetTextureMapper() const noexcept;
void SetTextureMapper(Math::MapMode) noexcept;

NOD() const MeshView& GetView() const noexcept;
NOD() MeshView& GetView() noexcept;
NOD() MeshView const& GetView() const noexcept;
NOD() MeshView& GetView() noexcept;

NOD() virtual Ref<Mesh> GetLOD(const Math::LOD&) const = 0;

Expand All @@ -75,21 +77,21 @@ namespace Langulus::A
//
NOD() bool MadeOfPoints() const noexcept;
NOD() Count GetPointCount() const;
template<CT::Trait T>
template<CT::Trait>
NOD() Any GetPointTrait(Offset) const;

//
NOD() bool MadeOfLines() const noexcept;
NOD() Count GetLineCount() const;
NOD() Math::Vec2u GetLineIndices(Offset) const;
template<CT::Trait T>
template<CT::Trait>
NOD() Any GetLineTrait(Offset) const;

//
NOD() bool MadeOfTriangles() const noexcept;
NOD() Count GetTriangleCount() const;
NOD() Math::Vec3u GetTriangleIndices(Offset) const;
template<CT::Trait T>
template<CT::Trait>
NOD() Any GetTriangleTrait(Offset) const;
};

Expand Down
58 changes: 37 additions & 21 deletions include/Langulus/Mesh.inl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ namespace Langulus::A
return mView.mTopology;
}

/// Set the topology of the geometry
/// @attention will reset all contents
LANGULUS(INLINED)
void Mesh::SetTopology(DMeta t) noexcept {
mView.mTopology = t;
mDataListMap.Reset();
}

/// Check if topology matches one of the specified types
/// @tparam T1, TN - types to check
/// @return true if T matches one of the topology types
Expand All @@ -90,6 +98,35 @@ namespace Langulus::A
return mView.mTopology == MetaDataOf<T1>()
or ((mView.mTopology == MetaDataOf<TN>()) or ...);
}

/// Get texture mapping mode
/// @return the texturing mode
LANGULUS(INLINED)
Math::MapMode Mesh::GetTextureMapper() const noexcept {
return mView.mTextureMapping;
}

/// Set texture mapping mode
/// @attention will reset texture coordinates
LANGULUS(INLINED)
void Mesh::SetTextureMapper(Math::MapMode m) noexcept {
mView.mTextureMapping = m;
mDataListMap.RemoveKey(MetaTraitOf<Traits::Sampler>());
}

/// Get the geometry view (const)
/// @return the geometry view
LANGULUS(INLINED)
const MeshView& Mesh::GetView() const noexcept {
return mView;
}

/// Get the geometry view
/// @return the geometry view
LANGULUS(INLINED)
MeshView& Mesh::GetView() noexcept {
return mView;
}

/// Helper that indirects in case there is an index buffer
/// @param indices - index buffer
Expand Down Expand Up @@ -403,25 +440,4 @@ namespace Langulus::A
return result;
}

/// Get texture mapping mode
/// @return the texturing mode
LANGULUS(INLINED)
Math::MapMode Mesh::GetTextureMapper() const noexcept {
return mView.mTextureMapping;
}

/// Get the geometry view (const)
/// @return the geometry view
LANGULUS(INLINED)
const MeshView& Mesh::GetView() const noexcept {
return mView;
}

/// Get the geometry view
/// @return the geometry view
LANGULUS(INLINED)
MeshView& Mesh::GetView() noexcept {
return mView;
}

} // namespace Langulus::A

0 comments on commit 6ff9b82

Please sign in to comment.