Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ce5690e
Added Assimp include path to OvEditor
Gopmyc Apr 8, 2026
979f4c3
Added model material and texture import pipeline
Gopmyc Apr 8, 2026
d7746b6
Fixed skinning fallback for selection rendering
Gopmyc Apr 8, 2026
cd26037
Synced regenerated model materials across scene instances
Gopmyc Apr 8, 2026
91b8604
Reverted outline skinning fallback change
Gopmyc Apr 8, 2026
c223140
Fixed skinning detection in picking render pass
Gopmyc Apr 8, 2026
6e3633f
Added Assimp include path to OvEditor
Gopmyc Apr 8, 2026
8ca3243
Added model material and texture import pipeline
Gopmyc Apr 8, 2026
a00a0ea
Synced regenerated model materials across scene instances
Gopmyc Apr 8, 2026
3501087
Fixed skinning detection in picking render pass
Gopmyc Apr 8, 2026
08b4595
Extended model loading with embedded asset extraction
Gopmyc Apr 9, 2026
27aea9e
Added embedded model resource resolution in managers
Gopmyc Apr 9, 2026
28ed40d
Moved model material import workflow out of editor
Gopmyc Apr 9, 2026
625484e
Fixed runtime fallback for embedded model materials
Gopmyc Apr 9, 2026
cdf5e2d
Added embedded asset path helpers
Gopmyc Apr 9, 2026
0a24a23
Preserved explicit default materials in embedded fallback
Gopmyc Apr 10, 2026
d50b8df
Merge branch '303' of https://github.com/Gopmyc/Overload into 303
Gopmyc Apr 10, 2026
917976e
Fixed Assimp embedded texture lookup for named references
Gopmyc Apr 10, 2026
65764c8
Improved embedded material runtime binding and fallback handling
Gopmyc Apr 10, 2026
5f5169f
Fixed material fallback assignment for models without embedded data
Gopmyc Apr 10, 2026
c791903
Restored model material generation entries in Asset Browser
Gopmyc Apr 10, 2026
2a09ed9
Merged origin/main into 303
Gopmyc Apr 10, 2026
46baa24
Fixed false parallax activation for embedded model materials
Gopmyc Apr 11, 2026
41a9f46
Merged origin/main into 303
Gopmyc Apr 14, 2026
17645ac
Refactored model metadata loading and helper scoping
Gopmyc Apr 14, 2026
3e4580f
Added explicit error feedback when scene loading fails
Gopmyc Apr 14, 2026
0654ec1
Replaced embedded model pointer accessors with OptRef
Gopmyc Apr 14, 2026
deff986
Decoupled embedded material setup from OvCore asset paths
Gopmyc Apr 14, 2026
7c9b784
Simplified embedded texture manager runtime paths
Gopmyc Apr 14, 2026
466981f
Merged origin/main into 303
Gopmyc Apr 14, 2026
7344dd0
Replaced shader definition pointer access with optional reference
Gopmyc Apr 14, 2026
f533105
Renamed ModelMetadata struct for naming consistency
Gopmyc Apr 14, 2026
6d21bc8
Removed scene load error popup and kept log-only failure
Gopmyc Apr 14, 2026
b10513b
Merged origin/main into 303
Gopmyc Apr 14, 2026
c37e3ff
Simplified texture metadata defaults and embedded context typing
Gopmyc Apr 14, 2026
6968d38
Moved embedded material filling logic into material renderer
Gopmyc Apr 14, 2026
6107108
Fixed material inspector refresh after embedded fallback reassignment
Gopmyc Apr 14, 2026
165a2ba
Replaced deserialization state flag with explicit model update flag
Gopmyc Apr 14, 2026
0afbf82
Refreshed embedded materials when model updates request overwrite
Gopmyc Apr 14, 2026
22b8563
Simplified Lua ModelRenderer SetModel binding
Gopmyc Apr 14, 2026
8698f45
Merged origin/main into 303
Gopmyc Apr 15, 2026
b97565b
Simplified CModelRenderer model change flow
Gopmyc Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ namespace OvCore::ECS::Components
*/
void UpdateMaterialList();

/**
* Fill material entries using the embedded materials of the current model
* @param p_overwriteExisting
* @param p_fallbackMaterial
*/
void FillWithEmbeddedMaterials(bool p_overwriteExisting, OvCore::Resources::Material* p_fallbackMaterial = nullptr);

/**
* Defines an element of the user matrix
* @param p_row
Expand Down Expand Up @@ -162,4 +169,4 @@ namespace OvCore::ECS::Components
{
static constexpr std::string_view Name = "class OvCore::ECS::Components::CMaterialRenderer";
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#pragma once

#include <optional>
#include <string>

#include "OvCore/Resources/Loaders/MaterialLoader.h"
#include "OvCore/ResourceManagement/AResourceManager.h"

Expand All @@ -17,6 +20,37 @@ namespace OvCore::ResourceManagement
class MaterialManager : public AResourceManager<OvCore::Resources::Material>
{
public:
struct StandardShaderDefinition
{
std::string shaderPath;
std::string albedoUniform = "u_Albedo";
std::string metallicUniform = "u_Metallic";
std::string roughnessUniform = "u_Roughness";
std::string emissiveColorUniform = "u_EmissiveColor";
std::string emissiveIntensityUniform = "u_EmissiveIntensity";
std::string normalMapUniform = "u_NormalMap";
std::string heightMapUniform = "u_HeightMap";
std::string albedoMapUniform = "u_AlbedoMap";
std::string metallicMapUniform = "u_MetallicMap";
std::string roughnessMapUniform = "u_RoughnessMap";
std::string ambientOcclusionMapUniform = "u_AmbientOcclusionMap";
std::string emissiveMapUniform = "u_EmissiveMap";
std::string opacityMapUniform = "u_MaskMap";
std::string normalMappingFeature = "NORMAL_MAPPING";
std::string parallaxMappingFeature = "PARALLAX_MAPPING";
};

/**
* Provide the shader definition used to create embedded materials
* @param p_definition
*/
void ProvideStandardShaderDefinition(StandardShaderDefinition p_definition);

/**
* Returns the current shader definition used for embedded materials
*/
const std::optional<StandardShaderDefinition>& GetStandardShaderDefinition() const;

/**
* Create the resource identified by the given path
* @param p_path
Expand All @@ -35,5 +69,8 @@ namespace OvCore::ResourceManagement
* @param p_path
*/
virtual void ReloadResource(OvCore::Resources::Material* p_resource, const std::filesystem::path& p_path) override;

private:
std::optional<StandardShaderDefinition> m_standardShaderDefinition;
};
}
}
73 changes: 73 additions & 0 deletions Sources/OvCore/src/OvCore/ECS/Components/CMaterialRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @licence: MIT
*/

#include <algorithm>
#include <format>
#include <tinyxml2.h>

Expand All @@ -13,8 +14,10 @@
#include <OvCore/Global/ServiceLocator.h>
#include <OvCore/Helpers/GUIDrawer.h>
#include <OvCore/ResourceManagement/MaterialManager.h>
#include <OvRendering/Resources/Parsers/EmbeddedAssetPath.h>

#include <OvUI/Widgets/Layout/Dummy.h>
#include <OvUI/Widgets/InputFields/AssetField.h>
#include <OvUI/Widgets/Texts/Text.h>
#include <OvUI/Widgets/Visual/Separator.h>

Expand Down Expand Up @@ -226,6 +229,76 @@ void OvCore::ECS::Components::CMaterialRenderer::UpdateMaterialList()
m_materialFields[i][1]->enabled = enabled;
static_cast<OvUI::Widgets::Texts::Text*>(m_materialFields[i][0])->content =
std::format("Material [{}]: <{}>", i, m_materialNames[i]);
static_cast<OvUI::Widgets::InputFields::AssetField*>(m_materialFields[i][1])->content =
m_materials[i] ? m_materials[i]->path : std::string{};
}
}
}

void OvCore::ECS::Components::CMaterialRenderer::FillWithEmbeddedMaterials(bool p_overwriteExisting, OvCore::Resources::Material* p_fallbackMaterial)
{
auto* modelRenderer = owner.GetComponent<CModelRenderer>();
if (!modelRenderer)
{
return;
}

const auto* model = modelRenderer->GetModel();
if (!model)
{
return;
}

auto& materialManager = Global::ServiceLocator::Get<ResourceManagement::MaterialManager>();

const uint8_t materialCount = static_cast<uint8_t>(std::min(
model->GetMaterialNames().size(),
static_cast<size_t>(kMaxMaterialCount)
));
const size_t embeddedMaterialCount = model->GetEmbeddedMaterials().size();

for (uint8_t i = 0; i < materialCount; ++i)
{
auto* currentMaterial = GetMaterialAtIndex(i);
const bool shouldOverride = p_overwriteExisting || !currentMaterial;
if (!shouldOverride)
{
continue;
}

if (i >= embeddedMaterialCount)
{
if (p_fallbackMaterial)
{
SetMaterialAtIndex(i, *p_fallbackMaterial);
}
else if (p_overwriteExisting)
{
RemoveMaterialAtIndex(i);
}
continue;
}

const auto embeddedMaterialPath = OvRendering::Resources::Parsers::MakeEmbeddedMaterialPath(model->path, i);
if (auto* embeddedMaterial = materialManager.GetResource(embeddedMaterialPath))
{
SetMaterialAtIndex(i, *embeddedMaterial);
}
else if (p_fallbackMaterial)
{
SetMaterialAtIndex(i, *p_fallbackMaterial);
}
else if (p_overwriteExisting)
{
RemoveMaterialAtIndex(i);
}
}

if (p_overwriteExisting)
{
for (uint8_t i = materialCount; i < kMaxMaterialCount; ++i)
{
RemoveMaterialAtIndex(i);
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions Sources/OvCore/src/OvCore/ECS/Components/CModelRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
#include <OvCore/ECS/Components/CModelRenderer.h>
#include <OvCore/ECS/Components/CMaterialRenderer.h>
#include <OvCore/ECS/Components/CSkinnedMeshRenderer.h>
#include <OvCore/Global/ServiceLocator.h>
#include <OvCore/ResourceManagement/ModelManager.h>
#include <OvCore/ResourceManagement/ShaderManager.h>
#include <OvCore/ResourceManagement/TextureManager.h>

#include <OvUI/Plugins/DDTarget.h>
#include <OvUI/Widgets/Drags/DragFloat.h>
Expand All @@ -23,10 +19,12 @@

OvCore::ECS::Components::CModelRenderer::CModelRenderer(ECS::Actor& p_owner) : AComponent(p_owner)
{
m_modelChangedEvent += [this]
m_modelChangedEvent += [this]()
{
if (auto materialRenderer = owner.GetComponent<CMaterialRenderer>())
{
materialRenderer->UpdateMaterialList();
}

if (auto skinnedMeshRenderer = owner.GetComponent<CSkinnedMeshRenderer>())
skinnedMeshRenderer->NotifyModelChanged();
Expand Down Expand Up @@ -87,6 +85,7 @@ void OvCore::ECS::Components::CModelRenderer::OnDeserialize(tinyxml2::XMLDocumen
OvRendering::Resources::Model* model = nullptr;
OvCore::Helpers::Serializer::DeserializeModel(p_doc, p_node, "model", model);
SetModel(model);

OvCore::Helpers::Serializer::DeserializeInt(p_doc, p_node, "frustum_behaviour", reinterpret_cast<int&>(m_frustumBehaviour));
OvCore::Helpers::Serializer::DeserializeVec3(p_doc, p_node, "custom_bounding_sphere_position", m_customBoundingSphere.position);
OvCore::Helpers::Serializer::DeserializeFloat(p_doc, p_node, "custom_bounding_sphere_radius", m_customBoundingSphere.radius);
Expand Down
Loading