mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 16:09:19 +02:00
pch migration to modules [wip]
This commit is contained in:
66
global_include/interfaces/IMaterial.cppm
Normal file
66
global_include/interfaces/IMaterial.cppm
Normal file
@@ -0,0 +1,66 @@
|
||||
module;
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include "global_include/interfaces/ITexture_macros.h"
|
||||
|
||||
export module eu07.global_include.interfaces.imaterial;
|
||||
import eu07.glm;
|
||||
import eu07.global_include.interfaces.itexture;
|
||||
|
||||
export {
|
||||
|
||||
|
||||
|
||||
struct IMaterial
|
||||
{
|
||||
virtual void finalize(bool Loadnow) = 0;
|
||||
virtual bool update() = 0;
|
||||
virtual float get_or_guess_opacity() const = 0;
|
||||
virtual bool is_translucent() const = 0;
|
||||
virtual glm::vec2 GetSize() const = 0;
|
||||
virtual std::string GetName() const = 0;
|
||||
virtual std::optional<float> GetSelfillum() const = 0;
|
||||
virtual int GetShadowRank() const = 0;
|
||||
virtual texture_handle GetTexture(int slot) const = 0;
|
||||
static IMaterial *null_material()
|
||||
{
|
||||
static struct NullMaterial : public IMaterial
|
||||
{
|
||||
virtual void finalize(bool Loadnow) override {}
|
||||
virtual bool update() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual float get_or_guess_opacity() const override
|
||||
{
|
||||
return 1.f;
|
||||
}
|
||||
virtual bool is_translucent() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual glm::vec2 GetSize() const override
|
||||
{
|
||||
return {-1.f, -1.f};
|
||||
}
|
||||
virtual std::string GetName() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
virtual std::optional<float> GetSelfillum() const override
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
virtual int GetShadowRank() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual texture_handle GetTexture(int slot) const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} null_material{};
|
||||
return &null_material;
|
||||
}
|
||||
};
|
||||
} // export
|
||||
Reference in New Issue
Block a user