Core/AppFilesystemComponent: Add support for default resource parameters
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/Graphics.hpp>
|
||||
#include <Nazara/Core/AppFilesystemComponent.hpp>
|
||||
#include <Nazara/Graphics/GuillotineTextureAtlas.hpp>
|
||||
#include <Nazara/Graphics/MaterialInstance.hpp>
|
||||
#include <Nazara/Graphics/MaterialPipeline.hpp>
|
||||
@@ -174,6 +175,14 @@ namespace Nz
|
||||
m_defaultTextures = DefaultTextures{};
|
||||
}
|
||||
|
||||
void Graphics::RegisterComponent(AppFilesystemComponent& component)
|
||||
{
|
||||
TextureParams defaultTexParams;
|
||||
defaultTexParams.renderDevice = m_renderDevice;
|
||||
|
||||
component.SetDefaultResourceParameters<Texture>(defaultTexParams);
|
||||
}
|
||||
|
||||
void Graphics::BuildBlitPipeline()
|
||||
{
|
||||
RenderPipelineLayoutInfo layoutInfo;
|
||||
|
||||
@@ -32,6 +32,16 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
void TextureParams::Merge(const TextureParams& params)
|
||||
{
|
||||
ImageParams::Merge(params);
|
||||
|
||||
if (!renderDevice)
|
||||
renderDevice = params.renderDevice;
|
||||
|
||||
usageFlags |= params.usageFlags;
|
||||
}
|
||||
|
||||
std::shared_ptr<Texture> Texture::CreateFromImage(const Image& image, const TextureParams& params)
|
||||
{
|
||||
NazaraAssert(params.IsValid(), "Invalid TextureParams");
|
||||
|
||||
@@ -39,6 +39,13 @@ namespace Nz
|
||||
return true; // Rien à vérifier
|
||||
}
|
||||
|
||||
void ImageParams::Merge(const ImageParams& params)
|
||||
{
|
||||
if (loadFormat == PixelFormat::Undefined)
|
||||
loadFormat = params.loadFormat;
|
||||
}
|
||||
|
||||
|
||||
Image::Image() :
|
||||
m_sharedImage(&emptyImage)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user