Merge branch 'master' into vulkan
Former-commit-id: e2aa8425da79e895900639e75c19e6155ae1681e [formerly e85202803b75ef6526f537bb1c8baab5a02c63db] Former-commit-id: 08e921b9afd2e004413b5777e9371593d42815ee
This commit is contained in:
@@ -84,7 +84,7 @@ namespace Nz
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!file.Open(OpenMode_WriteOnly))
|
||||
if (!file.Open(OpenMode_WriteOnly | OpenMode_Truncate))
|
||||
{
|
||||
NazaraError("Failed to save to file: unable to open \"" + filePath + "\" in write mode");
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file was automatically generated on 17 Nov 2015 at 13:20:45
|
||||
// This file was automatically generated on 12 Jul 2016 at 17:44:43
|
||||
|
||||
/*
|
||||
Nazara Engine - Graphics module
|
||||
@@ -47,6 +47,8 @@
|
||||
#include <Nazara/Graphics/DeferredRenderPass.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/DepthRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/DepthRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/Drawable.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/ForwardRenderQueue.hpp>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// This file was automatically generated on 17 Nov 2015 at 13:20:45
|
||||
// This file was automatically generated on 12 Jul 2016 at 17:44:43
|
||||
|
||||
/*
|
||||
Nazara Engine - Noise module
|
||||
|
||||
Copyright (C) 2015 Rémi "Overdrivr" Bèges (remi.beges@laposte.net)
|
||||
Copyright (C) 2016 Rémi "Overdrivr" Bèges (remi.beges@laposte.net)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -29,25 +29,16 @@
|
||||
#ifndef NAZARA_GLOBAL_NOISE_HPP
|
||||
#define NAZARA_GLOBAL_NOISE_HPP
|
||||
|
||||
#include <Nazara/Noise/Abstract2DNoise.hpp>
|
||||
#include <Nazara/Noise/Abstract3DNoise.hpp>
|
||||
#include <Nazara/Noise/Abstract4DNoise.hpp>
|
||||
#include <Nazara/Noise/ComplexNoiseBase.hpp>
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
#include <Nazara/Noise/FBM2D.hpp>
|
||||
#include <Nazara/Noise/FBM3D.hpp>
|
||||
#include <Nazara/Noise/FBM4D.hpp>
|
||||
#include <Nazara/Noise/HybridMultiFractal2D.hpp>
|
||||
#include <Nazara/Noise/HybridMultiFractal3D.hpp>
|
||||
#include <Nazara/Noise/HybridMultiFractal4D.hpp>
|
||||
#include <Nazara/Noise/MappedNoiseBase.hpp>
|
||||
#include <Nazara/Noise/Enums.hpp>
|
||||
#include <Nazara/Noise/FBM.hpp>
|
||||
#include <Nazara/Noise/HybridMultiFractal.hpp>
|
||||
#include <Nazara/Noise/MixerBase.hpp>
|
||||
#include <Nazara/Noise/Noise.hpp>
|
||||
#include <Nazara/Noise/NoiseBase.hpp>
|
||||
#include <Nazara/Noise/Perlin2D.hpp>
|
||||
#include <Nazara/Noise/Perlin3D.hpp>
|
||||
#include <Nazara/Noise/Perlin4D.hpp>
|
||||
#include <Nazara/Noise/Simplex2D.hpp>
|
||||
#include <Nazara/Noise/Simplex3D.hpp>
|
||||
#include <Nazara/Noise/Simplex4D.hpp>
|
||||
#include <Nazara/Noise/NoiseTools.hpp>
|
||||
#include <Nazara/Noise/Perlin.hpp>
|
||||
#include <Nazara/Noise/Simplex.hpp>
|
||||
#include <Nazara/Noise/Worley.hpp>
|
||||
|
||||
#endif // NAZARA_GLOBAL_NOISE_HPP
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file was automatically generated on 24 Jun 2015 at 13:55:50
|
||||
// This file was automatically generated on 12 Jul 2016 at 17:44:43
|
||||
|
||||
/*
|
||||
Nazara Engine - Utility module
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <Nazara/Utility/Joint.hpp>
|
||||
#include <Nazara/Utility/Joystick.hpp>
|
||||
#include <Nazara/Utility/Keyboard.hpp>
|
||||
#include <Nazara/Utility/MaterialData.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <Nazara/Utility/MeshData.hpp>
|
||||
#include <Nazara/Utility/Mouse.hpp>
|
||||
|
||||
@@ -19,6 +19,22 @@ namespace Nz
|
||||
class NAZARA_UTILITY_API MTLParser
|
||||
{
|
||||
public:
|
||||
struct Material;
|
||||
|
||||
MTLParser() = default;
|
||||
~MTLParser() = default;
|
||||
|
||||
inline Material* AddMaterial(const String& matName);
|
||||
|
||||
inline void Clear();
|
||||
|
||||
inline const Material* GetMaterial(const String& materialName) const;
|
||||
inline const std::unordered_map<String, Material>& GetMaterials() const;
|
||||
|
||||
bool Parse(Stream& stream);
|
||||
|
||||
bool Save(Stream& stream) const;
|
||||
|
||||
struct Material
|
||||
{
|
||||
Color ambient = Color::White;
|
||||
@@ -39,27 +55,26 @@ namespace Nz
|
||||
unsigned int illumModel = 0;
|
||||
};
|
||||
|
||||
MTLParser(Stream& stream$);
|
||||
~MTLParser();
|
||||
|
||||
const Material* GetMaterial(const String& materialName) const;
|
||||
const std::unordered_map<String, Material>& GetMaterials() const;
|
||||
|
||||
bool Parse();
|
||||
|
||||
private:
|
||||
bool Advance(bool required = true);
|
||||
void Error(const String& message);
|
||||
void Warning(const String& message);
|
||||
void UnrecognizedLine(bool error = false);
|
||||
template<typename T> void Emit(const T& text) const;
|
||||
inline void EmitLine() const;
|
||||
template<typename T> void EmitLine(const T& line) const;
|
||||
inline void Error(const String& message);
|
||||
inline void Flush() const;
|
||||
inline void Warning(const String& message);
|
||||
inline void UnrecognizedLine(bool error = false);
|
||||
|
||||
std::unordered_map<String, Material> m_materials;
|
||||
Stream& m_stream;
|
||||
mutable Stream* m_currentStream;
|
||||
String m_currentLine;
|
||||
mutable StringStream m_outputStream;
|
||||
bool m_keepLastLine;
|
||||
unsigned int m_lineCount;
|
||||
unsigned int m_streamFlags;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/Formats/MTLParser.inl>
|
||||
|
||||
#endif // NAZARA_FORMATS_MTLPARSER_HPP
|
||||
|
||||
83
include/Nazara/Utility/Formats/MTLParser.inl
Normal file
83
include/Nazara/Utility/Formats/MTLParser.inl
Normal file
@@ -0,0 +1,83 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/Formats/MTLParser.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline MTLParser::Material* MTLParser::AddMaterial(const String& matName)
|
||||
{
|
||||
return &m_materials[matName];
|
||||
}
|
||||
|
||||
inline void MTLParser::Clear()
|
||||
{
|
||||
m_materials.clear();
|
||||
}
|
||||
|
||||
inline const MTLParser::Material* MTLParser::GetMaterial(const String& materialName) const
|
||||
{
|
||||
auto it = m_materials.find(materialName);
|
||||
if (it != m_materials.end())
|
||||
return &it->second;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline const std::unordered_map<String, MTLParser::Material>& MTLParser::GetMaterials() const
|
||||
{
|
||||
return m_materials;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void MTLParser::Emit(const T& text) const
|
||||
{
|
||||
m_outputStream << text;
|
||||
if (m_outputStream.GetBufferSize() > 1024 * 1024)
|
||||
Flush();
|
||||
}
|
||||
|
||||
inline void MTLParser::EmitLine() const
|
||||
{
|
||||
Emit('\n');
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void MTLParser::EmitLine(const T& line) const
|
||||
{
|
||||
Emit(line);
|
||||
Emit('\n');
|
||||
}
|
||||
|
||||
inline void MTLParser::Error(const String& message)
|
||||
{
|
||||
NazaraError(message + " at line #" + String::Number(m_lineCount));
|
||||
}
|
||||
|
||||
inline void MTLParser::Flush() const
|
||||
{
|
||||
m_currentStream->Write(m_outputStream);
|
||||
m_outputStream.Clear();
|
||||
}
|
||||
|
||||
inline void MTLParser::Warning(const String& message)
|
||||
{
|
||||
NazaraWarning(message + " at line #" + String::Number(m_lineCount));
|
||||
}
|
||||
|
||||
inline void MTLParser::UnrecognizedLine(bool error)
|
||||
{
|
||||
String message = "Unrecognized \"" + m_currentLine + '"';
|
||||
|
||||
if (error)
|
||||
Error(message);
|
||||
else
|
||||
Warning(message);
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
#include "MTLParser.hpp"
|
||||
@@ -52,6 +52,7 @@ namespace Nz
|
||||
|
||||
inline String* SetMaterialCount(std::size_t materialCount);
|
||||
inline Mesh* SetMeshCount(std::size_t meshCount);
|
||||
inline void SetMtlLib(const String& mtlLib);
|
||||
inline Vector3f* SetNormalCount(std::size_t normalCount);
|
||||
inline Vector4f* SetPositionCount(std::size_t positionCount);
|
||||
inline Vector3f* SetTexCoordCount(std::size_t texCoordCount);
|
||||
|
||||
@@ -109,6 +109,11 @@ namespace Nz
|
||||
return m_meshes.data();
|
||||
}
|
||||
|
||||
inline void OBJParser::SetMtlLib(const String& mtlLib)
|
||||
{
|
||||
m_mtlLib = mtlLib;
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::SetNormalCount(std::size_t normalCount)
|
||||
{
|
||||
m_normals.resize(normalCount);
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <memory>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
template<typename... Args>
|
||||
ImageRef Image::New(Args&&... args)
|
||||
{
|
||||
std::unique_ptr<Image> object(new Image(std::forward<Args>(args)...));
|
||||
object->SetPersistent(false);
|
||||
|
||||
return object.release();
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
@@ -71,6 +71,7 @@ namespace Nz
|
||||
friend MeshLibrary;
|
||||
friend MeshLoader;
|
||||
friend MeshManager;
|
||||
friend MeshSaver;
|
||||
friend class Utility;
|
||||
|
||||
public:
|
||||
@@ -126,6 +127,9 @@ namespace Nz
|
||||
void RemoveSubMesh(const String& identifier);
|
||||
void RemoveSubMesh(unsigned int index);
|
||||
|
||||
bool SaveToFile(const String& filePath, const MeshParams& params = MeshParams());
|
||||
bool SaveToStream(Stream& stream, const String& format, const MeshParams& params = MeshParams());
|
||||
|
||||
void SetAnimation(const String& animationPath);
|
||||
void SetMaterialCount(unsigned int matCount);
|
||||
void SetMaterialData(unsigned int matIndex, ParameterList data);
|
||||
|
||||
Reference in New Issue
Block a user