Import material textures with mesh assets
This commit is contained in:
@@ -68,6 +68,7 @@ public:
|
||||
Core::int32 GetInt(const Containers::String& name) const;
|
||||
bool GetBool(const Containers::String& name) const;
|
||||
ResourceHandle<Texture> GetTexture(const Containers::String& name) const;
|
||||
Core::uint32 GetTextureBindingCount() const { return static_cast<Core::uint32>(m_textureBindings.Size()); }
|
||||
|
||||
const Containers::Array<Core::uint8>& GetConstantBufferData() const { return m_constantBufferData; }
|
||||
void UpdateConstantBuffer();
|
||||
@@ -77,6 +78,8 @@ public:
|
||||
void ClearAllProperties();
|
||||
|
||||
private:
|
||||
void UpdateMemorySize();
|
||||
|
||||
ResourceHandle<class Shader> m_shader;
|
||||
Containers::HashMap<Containers::String, MaterialProperty> m_properties;
|
||||
Containers::Array<Core::uint8> m_constantBufferData;
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
class Material;
|
||||
class Texture;
|
||||
|
||||
enum class VertexAttribute : Core::uint32 {
|
||||
Position = 1 << 0, Normal = 1 << 1, Tangent = 1 << 2,
|
||||
Color = 1 << 3, UV0 = 1 << 4, UV1 = 1 << 5,
|
||||
@@ -77,7 +80,12 @@ public:
|
||||
const Math::Bounds& GetBounds() const { return m_bounds; }
|
||||
|
||||
void AddSection(const MeshSection& section);
|
||||
void AddMaterial(Material* material);
|
||||
void AddTexture(Texture* texture);
|
||||
const Containers::Array<MeshSection>& GetSections() const { return m_sections; }
|
||||
const Containers::Array<Material*>& GetMaterials() const { return m_materials; }
|
||||
const Containers::Array<Texture*>& GetTextures() const { return m_textures; }
|
||||
Material* GetMaterial(Core::uint32 index) const;
|
||||
|
||||
private:
|
||||
void UpdateMemorySize();
|
||||
@@ -92,6 +100,8 @@ private:
|
||||
Containers::Array<Core::uint8> m_vertexData;
|
||||
Containers::Array<Core::uint8> m_indexData;
|
||||
Containers::Array<MeshSection> m_sections;
|
||||
Containers::Array<Material*> m_materials;
|
||||
Containers::Array<Texture*> m_textures;
|
||||
Math::Bounds m_bounds;
|
||||
};
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
float GetThreshold() const { return m_threshold; }
|
||||
|
||||
private:
|
||||
MeshImportFlags m_importFlags = MeshImportFlags::None;
|
||||
MeshImportFlags m_importFlags = MeshImportFlags::ImportMaterials;
|
||||
float m_scale = 1.0f;
|
||||
Math::Vector3 m_offset = Math::Vector3::Zero();
|
||||
bool m_axisConversion = true;
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
Containers::Array<Containers::String> GetSupportedExtensions() const override;
|
||||
bool CanLoad(const Containers::String& path) const override;
|
||||
LoadResult Load(const Containers::String& path, const ImportSettings* settings = nullptr) override;
|
||||
LoadResult LoadFromMemory(const Containers::String& path, const void* data, size_t dataSize) const;
|
||||
ImportSettings* GetDefaultSettings() const override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user