Remove Graphics module and fix compilation

This commit is contained in:
Jérôme Leclercq
2020-08-27 19:43:31 +02:00
parent bc92d030ed
commit 2a875c8bdc
283 changed files with 16 additions and 32474 deletions

View File

@@ -1,100 +0,0 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/Formats/MeshLoader.hpp>
#include <Nazara/Graphics/Material.hpp>
#include <Nazara/Graphics/Model.hpp>
#include <Nazara/Graphics/SkeletalModel.hpp>
#include <Nazara/Utility/MaterialData.hpp>
#include <Nazara/Utility/Mesh.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz
{
namespace
{
void LoadMaterials(Model* model, const ModelParameters& parameters)
{
unsigned int matCount = model->GetMaterialCount();
for (unsigned int i = 0; i < matCount; ++i)
{
const ParameterList& matData = model->GetMesh()->GetMaterialData(i);
String path;
if (matData.GetStringParameter(MaterialData::FilePath, &path))
{
std::filesystem::path filePath = path.ToStdString();
if (!std::filesystem::exists(filePath))
{
NazaraWarning("Shader name does not refer to an existing file, \".tga\" is used by default");
filePath.replace_extension(".tga");
}
if (MaterialRef material = Material::LoadFromFile(filePath, parameters.material))
model->SetMaterial(i, std::move(material));
else
NazaraWarning("Failed to load material from file " + String::Number(i));
}
else
{
MaterialRef material = Material::New();
material->BuildFromParameters(matData, parameters.material);
model->SetMaterial(i, std::move(material));
}
}
}
Ternary Check(Stream& stream, const ModelParameters& parameters)
{
NazaraUnused(stream);
bool skip;
if (parameters.custom.GetBooleanParameter("SkipNativeMeshLoader", &skip) && skip)
return Ternary_False;
return Ternary_Unknown;
}
ModelRef Load(Stream& stream, const ModelParameters& parameters)
{
NazaraUnused(parameters);
MeshRef mesh = Mesh::LoadFromStream(stream, parameters.mesh);
if (!mesh)
{
NazaraError("Failed to load model mesh");
return nullptr;
}
ModelRef model;
if (mesh->IsAnimable())
model = SkeletalModel::New();
else
model = Model::New();
model->SetMesh(mesh);
if (parameters.loadMaterials)
LoadMaterials(model, parameters);
return model;
}
}
namespace Loaders
{
void RegisterMesh()
{
ModelLoader::RegisterLoader(MeshLoader::IsExtensionSupported, Check, Load);
}
void UnregisterMesh()
{
ModelLoader::UnregisterLoader(MeshLoader::IsExtensionSupported, Check, Load);
}
}
}

View File

@@ -1,21 +0,0 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_LOADERS_MESH_HPP
#define NAZARA_LOADERS_MESH_HPP
#include <Nazara/Prerequisites.hpp>
namespace Nz
{
namespace Loaders
{
void RegisterMesh();
void UnregisterMesh();
}
}
#endif // NAZARA_LOADERS_MESH_HPP

View File

@@ -1,56 +0,0 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/Formats/TextureLoader.hpp>
#include <Nazara/Graphics/Material.hpp>
#include <Nazara/Renderer/Texture.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz
{
namespace
{
Ternary Check(Stream& stream, const MaterialParams& parameters)
{
NazaraUnused(stream);
bool skip;
if (parameters.custom.GetBooleanParameter("SkipNativeTextureLoader", &skip) && skip)
return Ternary_False;
return Ternary_Unknown;
}
MaterialRef Load(Stream& stream, const MaterialParams& parameters)
{
NazaraUnused(parameters);
TextureRef texture = Texture::LoadFromStream(stream);
if (!texture)
{
NazaraError("Failed to load diffuse map");
return nullptr;
}
MaterialRef material = Material::New();
material->SetDiffuseMap(texture);
material->SetShader(parameters.shaderName);
return material;
}
}
namespace Loaders
{
void RegisterTexture()
{
MaterialLoader::RegisterLoader(ImageLoader::IsExtensionSupported, Check, Load);
}
void UnregisterTexture()
{
MaterialLoader::UnregisterLoader(ImageLoader::IsExtensionSupported, Check, Load);
}
}
}

View File

@@ -1,21 +0,0 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_LOADERS_TEXTURE_HPP
#define NAZARA_LOADERS_TEXTURE_HPP
#include <Nazara/Prerequisites.hpp>
namespace Nz
{
namespace Loaders
{
void RegisterTexture();
void UnregisterTexture();
}
}
#endif // NAZARA_LOADERS_TEXTURE_HPP