Skip to content

Commit

Permalink
Image and Pin improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Epixu committed Apr 9, 2024
1 parent 965fdb9 commit 9191a20
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/Langulus/Asset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace Langulus::A

void Detach();

virtual bool Generate(TMeta, Offset = 0) = 0;
virtual bool Generate(TMeta, Offset = 0) { return true; }

template<CT::TraitBased = Langulus::Trait>
void Commit(auto&&) const;
Expand Down
9 changes: 5 additions & 4 deletions include/Langulus/Image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once
#include "Asset.hpp"
#include <Math/Color.hpp>
#include <Math/Scale.hpp>

LANGULUS_DEFINE_TRAIT(Image, "Image unit");
LANGULUS_EXCEPTION(Image);
Expand Down Expand Up @@ -38,6 +39,7 @@ namespace Langulus
NOD() Size GetBytesize() const noexcept;
NOD() uint32_t GetChannelCount() const noexcept;
NOD() Hash GetHash() const noexcept;
NOD() Math::Scale3 GetScale() const noexcept;
};

} // namespace Langulus
Expand All @@ -54,11 +56,10 @@ namespace Langulus::A

public:
LANGULUS_BASES(Asset);
Image()
: Resolvable {this} {}
Image() : Resolvable {this} {}

NOD() virtual Ref<Image> GetLOD(const Math::LOD&) const = 0;
NOD() virtual void* GetGPUHandle() const noexcept = 0;
NOD() virtual Ref<Image> GetLOD(const Math::LOD&) const { return {}; }
NOD() virtual void* GetGPUHandle() const noexcept { return nullptr; }

NOD() DMeta GetFormat() const noexcept;
NOD() ImageView const& GetView() const noexcept;
Expand Down
7 changes: 7 additions & 0 deletions include/Langulus/Image.inl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ namespace Langulus
);
}

/// Get the scale of the image, represented by real numbers
/// @return the scale
LANGULUS(INLINED)
Math::Scale3 ImageView::GetScale() const noexcept {
return {mWidth, mHeight, mDepth};
}

} // namespace Langulus

namespace Langulus::A
Expand Down
2 changes: 2 additions & 0 deletions source/Pin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ namespace Langulus::Entity
///
NOD() bool IsLocked() const noexcept;

operator T const& () const noexcept { return mValue; }

T const& operator * () const noexcept;
T const* operator -> () const noexcept;
T* operator -> () noexcept;
Expand Down

0 comments on commit 9191a20

Please sign in to comment.