Merge remote-tracking branch 'upstream/master'
Conflicts: include/Nazara/Noise/NoiseMachine.hpp src/Nazara/Noise/ComplexNoiseBase.cpp src/Nazara/Noise/NoiseMachine.cpp Former-commit-id: 54af2e19e336cfacee63cabe785d7b05fa392b53
This commit is contained in:
commit
a72d388c05
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
@ -1,10 +1,21 @@
|
||||||
# Codeblocks
|
# Codeblocks
|
||||||
*.cbp
|
*.cbp
|
||||||
|
*.cbTemp
|
||||||
*.cscope_file_list
|
*.cscope_file_list
|
||||||
*.depend
|
*.depend
|
||||||
*.layout
|
*.layout
|
||||||
*.workspace
|
*.workspace
|
||||||
|
|
||||||
|
# CodeLite
|
||||||
|
*.project
|
||||||
|
|
||||||
|
# Nazara build
|
||||||
|
|
||||||
|
examples/bin
|
||||||
|
lib/libNazara*.a
|
||||||
|
lib/Nazara*.dll
|
||||||
|
lib/Nazara*.so
|
||||||
|
|
||||||
# Compiled Object files
|
# Compiled Object files
|
||||||
*.slo
|
*.slo
|
||||||
*.lo
|
*.lo
|
||||||
|
|
@ -16,22 +27,10 @@
|
||||||
# Compiled Static libraries
|
# Compiled Static libraries
|
||||||
*.lai
|
*.lai
|
||||||
*.la
|
*.la
|
||||||
*.a
|
|
||||||
|
|
||||||
# Object files
|
# Object files
|
||||||
*.o
|
*.o
|
||||||
|
|
||||||
# Libraries
|
|
||||||
*.lib
|
|
||||||
|
|
||||||
# Shared objects (inc. Windows DLLs)
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Executables
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
|
|
||||||
# Windows image file caches
|
# Windows image file caches
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
|
@ -50,7 +49,6 @@ $RECYCLE.BIN/
|
||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
|
|
||||||
[Dd]ebug*/
|
[Dd]ebug*/
|
||||||
[Rr]elease/
|
[Rr]elease/
|
||||||
|
|
||||||
|
|
@ -123,7 +121,6 @@ publish
|
||||||
*.Publish.xml
|
*.Publish.xml
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
[Bb]in
|
|
||||||
[Oo]bj
|
[Oo]bj
|
||||||
sql
|
sql
|
||||||
TestResults
|
TestResults
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
project "NazaraModuleName"
|
if (not _OPTIONS["one-library"]) then
|
||||||
|
project "NazaraModuleName"
|
||||||
|
end
|
||||||
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
|
|
@ -14,18 +16,19 @@ else
|
||||||
excludes { "../src/Nazara/ModuleName/Win32/*.hpp", "../src/Nazara/ModuleName/Win32/*.cpp" }
|
excludes { "../src/Nazara/ModuleName/Win32/*.hpp", "../src/Nazara/ModuleName/Win32/*.cpp" }
|
||||||
end
|
end
|
||||||
|
|
||||||
configuration "DebugStatic"
|
if (_OPTIONS["one-library"]) then
|
||||||
links "NazaraCored-s"
|
excludes "../src/Nazara/ModuleName/Debug/Leaks.cpp"
|
||||||
targetname "NazaraModuleNamed"
|
else
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
|
||||||
configuration "ReleaseStatic"
|
configuration "ReleaseStatic"
|
||||||
links "NazaraCore-s"
|
links "NazaraCore-s"
|
||||||
targetname "NazaraModuleName"
|
|
||||||
|
|
||||||
configuration "DebugDLL"
|
configuration "DebugDLL"
|
||||||
links "NazaraCored"
|
links "NazaraCore-d"
|
||||||
targetname "NazaraModuleNamed"
|
|
||||||
|
|
||||||
configuration "ReleaseDLL"
|
configuration "ReleaseDLL"
|
||||||
links "NazaraCore"
|
links "NazaraCore"
|
||||||
targetname "NazaraModuleName"
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 AUTHORS
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine
|
Nazara Engine - Module name
|
||||||
|
|
||||||
Copyright (C) 2012 AUTHORS (EMAIL)
|
Copyright (C) 2012 AUTHORS (EMAIL)
|
||||||
|
|
||||||
|
|
@ -27,12 +27,12 @@
|
||||||
#ifndef NAZARA_CONFIG_MODULENAME_HPP
|
#ifndef NAZARA_CONFIG_MODULENAME_HPP
|
||||||
#define NAZARA_CONFIG_MODULENAME_HPP
|
#define NAZARA_CONFIG_MODULENAME_HPP
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||||
#define NAZARA_MODULENAME_MEMORYLEAKTRACKER 0
|
#define NAZARA_MODULENAME_MEMORYLEAKTRACKER 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_MODULENAME_SAFE 1
|
#define NAZARA_MODULENAME_SAFE 1
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 AUTHORS
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/ModuleName/Config.hpp>
|
#include <Nazara/ModuleName/Config.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 AUTHORS
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_MODULENAME_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
#if NAZARA_MODULENAME_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 AUTHORS
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -8,20 +8,22 @@
|
||||||
#define NAZARA_MODULENAME_HPP
|
#define NAZARA_MODULENAME_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequesites.hpp>
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Core/Initializer.hpp>
|
||||||
|
|
||||||
class NAZARA_API NzModuleName
|
class NAZARA_API NzModuleName
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NzModuleName();
|
NzModuleName() = delete;
|
||||||
~NzModuleName();
|
~NzModuleName() = delete;
|
||||||
|
|
||||||
bool Initialize();
|
static bool Initialize();
|
||||||
void Uninitialize();
|
|
||||||
|
|
||||||
static bool IsInitialized();
|
static bool IsInitialized();
|
||||||
|
|
||||||
|
static void Uninitialize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool s_initialized;
|
static unsigned int s_moduleReferenceCouter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NAZARA_MODULENAME_HPP
|
#endif // NAZARA_MODULENAME_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 AUTHORS
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/ModuleName/ClassName.hpp>
|
#include <Nazara/ModuleName/ClassName.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 AUTHORS
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/ModuleName/Config.hpp>
|
#include <Nazara/ModuleName/Config.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,57 +1,49 @@
|
||||||
// Copyright (C) 2012 AUTHORS
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/ModuleName/ModuleName.hpp>
|
#include <Nazara/ModuleName/ModuleName.hpp>
|
||||||
|
#include <Nazara/Core/Core.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
|
#include <Nazara/Core/Log.hpp>
|
||||||
#include <Nazara/ModuleName/Config.hpp>
|
#include <Nazara/ModuleName/Config.hpp>
|
||||||
#include <Nazara/ModuleName/Debug.hpp>
|
#include <Nazara/ModuleName/Debug.hpp>
|
||||||
|
|
||||||
NzModuleName::NzModuleName()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NzModuleName::~NzModuleName()
|
|
||||||
{
|
|
||||||
if (s_initialized)
|
|
||||||
Uninitialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NzModuleName::Initialize()
|
bool NzModuleName::Initialize()
|
||||||
{
|
{
|
||||||
#if NAZARA_MODULENAME_SAFE
|
if (s_moduleReferenceCouter++ != 0)
|
||||||
if (s_initialized)
|
return true; // Déjà initialisé
|
||||||
|
|
||||||
|
// Initialisation des dépendances
|
||||||
|
if (!NzCore::Initialize())
|
||||||
{
|
{
|
||||||
NazaraError("ModuleName already initialized");
|
NazaraError("Failed to initialize core module");
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Initialisation du module
|
// Initialisation du module
|
||||||
|
|
||||||
s_initialized = true;
|
NazaraNotice("Initialized: ModuleName module");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NzModuleName::Uninitialize()
|
|
||||||
{
|
|
||||||
#if NAZARA_MODULENAME_SAFE
|
|
||||||
if (!s_initialized)
|
|
||||||
{
|
|
||||||
NazaraError("ModuleName not initialized");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Libération du module
|
|
||||||
|
|
||||||
s_initialized = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NzModuleName::IsInitialized()
|
bool NzModuleName::IsInitialized()
|
||||||
{
|
{
|
||||||
return s_initialized;
|
return s_moduleReferenceCouter != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NzModuleName::s_initialized = false;
|
void NzModuleName::Uninitialize()
|
||||||
|
{
|
||||||
|
if (--s_moduleReferenceCouter != 0)
|
||||||
|
return; // Encore utilisé
|
||||||
|
|
||||||
|
// Libération du module
|
||||||
|
|
||||||
|
NazaraNotice("Uninitialized: ModuleName module");
|
||||||
|
|
||||||
|
// Libération des dépendances
|
||||||
|
NzCore::Uninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int NzModuleName::s_moduleReferenceCouter = 0;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
premake4 --with-examples codeblocks
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
premake4 --with-examples codelite
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
premake4 codelite
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
premake4 --with-examples vs2010
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
premake4 generateheaders
|
||||||
|
pause
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
function examples()
|
||||||
|
dofile("../examples/build/common.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
newaction
|
||||||
|
{
|
||||||
|
trigger = "examples",
|
||||||
|
description = "Generate examples",
|
||||||
|
execute = examples
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
function generateHeaders()
|
||||||
|
local modules = os.matchdirs("../include/Nazara/*")
|
||||||
|
for k, modulePath in pairs(modules) do
|
||||||
|
local moduleName = modulePath:match(".*/(.*)")
|
||||||
|
print(moduleName)
|
||||||
|
|
||||||
|
local config, err = io.open(modulePath .. "/Config.hpp", "r")
|
||||||
|
local head = ""
|
||||||
|
if (not config) then
|
||||||
|
error("Failed to read config file: " .. err)
|
||||||
|
end
|
||||||
|
|
||||||
|
for line in config:lines() do
|
||||||
|
head = head .. line .. "\n"
|
||||||
|
if (line == "#pragma once") then -- On s'arrête au #pragma once, qu'on inclut quand même
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
config:close()
|
||||||
|
|
||||||
|
local header, err = io.open(modulePath .. ".hpp", "w+")
|
||||||
|
if (not header) then
|
||||||
|
error("Failed to create header file: " .. err)
|
||||||
|
end
|
||||||
|
|
||||||
|
header:write("// This file was automatically generated by Nazara\n\n")
|
||||||
|
header:write(head .. "\n")
|
||||||
|
|
||||||
|
local files = os.matchfiles(modulePath .. "/*.hpp")
|
||||||
|
local count = 0
|
||||||
|
for k, filePath in pairs(files) do
|
||||||
|
local include, fileName = filePath:match(".*(Nazara/.*/(.*))")
|
||||||
|
if (fileName ~= "Debug.hpp" and
|
||||||
|
fileName ~= "DebugOff.hpp" and
|
||||||
|
fileName ~= "ThreadSafety.hpp" and
|
||||||
|
fileName ~= "ThreadSafetyOff.hpp") then
|
||||||
|
header:write("#include <" .. include .. ">\n")
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
print(string.format("-# of includes: %d", count))
|
||||||
|
|
||||||
|
header:close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newaction
|
||||||
|
{
|
||||||
|
trigger = "generateheaders",
|
||||||
|
description = "Generate a global header for each module",
|
||||||
|
execute = generateHeaders
|
||||||
|
}
|
||||||
|
|
@ -1,20 +1,31 @@
|
||||||
-- Configuration générale
|
-- Configuration générale
|
||||||
configurations
|
configurations
|
||||||
{
|
{
|
||||||
"DebugStatic",
|
-- "DebugStatic",
|
||||||
"ReleaseStatic",
|
-- "ReleaseStatic",
|
||||||
"DebugDLL",
|
"DebugDLL",
|
||||||
"ReleaseDLL"
|
"ReleaseDLL"
|
||||||
}
|
}
|
||||||
|
|
||||||
defines "NAZARA_BUILD"
|
defines "NAZARA_BUILD"
|
||||||
language "C++"
|
language "C++"
|
||||||
|
location(_ACTION)
|
||||||
|
|
||||||
includedirs
|
includedirs
|
||||||
{
|
{
|
||||||
"../include",
|
"../include",
|
||||||
"../src/"
|
"../src/",
|
||||||
|
"../extlibs/include"
|
||||||
}
|
}
|
||||||
|
|
||||||
libdirs "../lib"
|
libdirs "../lib"
|
||||||
|
|
||||||
|
if (_OPTIONS["x64"]) then
|
||||||
|
libdirs "../extlibs/lib/x64"
|
||||||
|
end
|
||||||
|
|
||||||
|
libdirs "../extlibs/lib/x86"
|
||||||
|
|
||||||
targetdir "../lib"
|
targetdir "../lib"
|
||||||
|
|
||||||
configuration "Debug*"
|
configuration "Debug*"
|
||||||
|
|
@ -22,17 +33,25 @@ configuration "Debug*"
|
||||||
flags "Symbols"
|
flags "Symbols"
|
||||||
|
|
||||||
configuration "Release*"
|
configuration "Release*"
|
||||||
flags { "Optimize", "OptimizeSpeed" }
|
flags { "EnableSSE2", "Optimize", "OptimizeSpeed", "NoFramePointer", "NoRTTI" }
|
||||||
|
|
||||||
configuration "*Static"
|
configuration "*Static"
|
||||||
defines "NAZARA_STATIC"
|
defines "NAZARA_STATIC"
|
||||||
kind "StaticLib"
|
kind "StaticLib"
|
||||||
targetsuffix "-s"
|
|
||||||
|
|
||||||
configuration "*DLL"
|
configuration "*DLL"
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
|
|
||||||
configuration "gmake"
|
configuration "DebugStatic"
|
||||||
|
targetsuffix "-s-d"
|
||||||
|
|
||||||
|
configuration "ReleaseStatic"
|
||||||
|
targetsuffix "-s"
|
||||||
|
|
||||||
|
configuration "DebugDLL"
|
||||||
|
targetsuffix "-d"
|
||||||
|
|
||||||
|
configuration "codeblocks or codelite or gmake or xcode3*"
|
||||||
buildoptions "-std=c++11"
|
buildoptions "-std=c++11"
|
||||||
|
|
||||||
configuration { "linux or bsd or macosx", "gmake" }
|
configuration { "linux or bsd or macosx", "gmake" }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
-- Configuration générale
|
||||||
|
configurations
|
||||||
|
{
|
||||||
|
-- "DebugStatic",
|
||||||
|
-- "ReleaseStatic",
|
||||||
|
"DebugDLL",
|
||||||
|
"ReleaseDLL"
|
||||||
|
}
|
||||||
|
|
||||||
|
language "C++"
|
||||||
|
location("../examples/build/" .. _ACTION)
|
||||||
|
|
||||||
|
debugdir "../examples/bin"
|
||||||
|
|
||||||
|
includedirs "../include"
|
||||||
|
|
||||||
|
libdirs "../lib"
|
||||||
|
|
||||||
|
if (_OPTIONS["x64"]) then
|
||||||
|
libdirs "../extlibs/lib/x64"
|
||||||
|
end
|
||||||
|
|
||||||
|
libdirs "../extlibs/lib/x86"
|
||||||
|
|
||||||
|
targetdir "../examples/bin"
|
||||||
|
|
||||||
|
configuration "Debug*"
|
||||||
|
defines "NAZARA_DEBUG"
|
||||||
|
flags "Symbols"
|
||||||
|
|
||||||
|
configuration "Release*"
|
||||||
|
flags { "EnableSSE2", "Optimize", "OptimizeSpeed", "NoFramePointer", "NoRTTI" }
|
||||||
|
|
||||||
|
configuration "*Static"
|
||||||
|
defines "NAZARA_STATIC"
|
||||||
|
|
||||||
|
configuration "codeblocks or codelite or gmake or xcode3*"
|
||||||
|
buildoptions "-std=c++11"
|
||||||
|
|
@ -1,31 +1,36 @@
|
||||||
project "NazaraAudio"
|
if (not _OPTIONS["united"]) then
|
||||||
|
project "NazaraAudio"
|
||||||
|
end
|
||||||
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
"../include/Nazara/Audio/**.hpp",
|
"../include/Nazara/Audio/**.hpp",
|
||||||
"../include/Nazara/Audio/**.inl",
|
"../include/Nazara/Audio/**.inl",
|
||||||
"../src/Nazara/Audio/**.hpp",
|
"../src/Nazara/Audio/**.hpp",
|
||||||
"../src/Nazara/Audio/**.cpp"
|
"../src/Nazara/Audio/**.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (os.is("windows")) then
|
if (os.is("windows")) then
|
||||||
excludes { "../src/Nazara/Audio/Posix/*.hpp", "../src/Nazara/Audio/Posix/*.cpp" }
|
excludes { "../src/Nazara/Audio/Posix/*.hpp", "../src/Nazara/Audio/Posix/*.cpp" }
|
||||||
|
links "OpenAL32"
|
||||||
|
links "sndfile-1"
|
||||||
else
|
else
|
||||||
excludes { "../src/Nazara/Audio/Win32/*.hpp", "../src/Nazara/Audio/Win32/*.cpp" }
|
excludes { "../src/Nazara/Audio/Win32/*.hpp", "../src/Nazara/Audio/Win32/*.cpp" }
|
||||||
|
-- Link posix ?
|
||||||
end
|
end
|
||||||
|
|
||||||
configuration "DebugStatic"
|
if (_OPTIONS["united"]) then
|
||||||
links "NazaraCored-s"
|
excludes "../src/Nazara/Audio/Debug/Leaks.cpp"
|
||||||
targetname "NazaraAudiod"
|
else
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
|
||||||
configuration "ReleaseStatic"
|
configuration "ReleaseStatic"
|
||||||
links "NazaraCore-s"
|
links "NazaraCore-s"
|
||||||
targetname "NazaraAudio"
|
|
||||||
|
|
||||||
configuration "DebugDLL"
|
configuration "DebugDLL"
|
||||||
links "NazaraCored"
|
links "NazaraCore-d"
|
||||||
targetname "NazaraAudiod"
|
|
||||||
|
|
||||||
configuration "ReleaseDLL"
|
configuration "ReleaseDLL"
|
||||||
links "NazaraCore"
|
links "NazaraCore"
|
||||||
targetname "NazaraAudio"
|
end
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
project "NazaraCore"
|
if (not _OPTIONS["united"]) then
|
||||||
|
project "NazaraCore"
|
||||||
|
end
|
||||||
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
"../include/Nazara/Prerequesites.hpp",
|
"../include/Nazara/Prerequesites.hpp",
|
||||||
"../include/Nazara/Core/**.hpp",
|
"../include/Nazara/Core/**.hpp",
|
||||||
"../include/Nazara/Core/**.inl",
|
"../include/Nazara/Core/**.inl",
|
||||||
|
"../include/Nazara/Math/**.hpp",
|
||||||
|
"../include/Nazara/Math/**.inl",
|
||||||
"../src/Nazara/Core/**.hpp",
|
"../src/Nazara/Core/**.hpp",
|
||||||
"../src/Nazara/Core/**.cpp"
|
"../src/Nazara/Core/**.cpp"
|
||||||
}
|
}
|
||||||
|
|
@ -14,9 +18,3 @@ if (os.is("windows")) then
|
||||||
else
|
else
|
||||||
excludes { "../src/Nazara/Core/Win32/**.hpp", "../src/Nazara/Core/Win32/**.cpp" }
|
excludes { "../src/Nazara/Core/Win32/**.hpp", "../src/Nazara/Core/Win32/**.cpp" }
|
||||||
end
|
end
|
||||||
|
|
||||||
configuration "Debug*"
|
|
||||||
targetname "NazaraCored"
|
|
||||||
|
|
||||||
configuration "Release*"
|
|
||||||
targetname "NazaraCore"
|
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
project "NazaraNetwork"
|
|
||||||
|
|
||||||
if (os.is("windows")) then
|
|
||||||
links "ws2_32"
|
|
||||||
end
|
|
||||||
|
|
||||||
files
|
|
||||||
{
|
|
||||||
"../include/Nazara/Network/**.hpp",
|
|
||||||
"../include/Nazara/Network/**.inl",
|
|
||||||
"../src/Nazara/Network/**.hpp",
|
|
||||||
"../src/Nazara/Network/**.cpp"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (os.is("windows")) then
|
|
||||||
excludes { "../src/Nazara/Network/Posix/*.hpp", "../src/Nazara/Network/Posix/*.cpp" }
|
|
||||||
else
|
|
||||||
excludes { "../src/Nazara/Network/Win32/*.hpp", "../src/Nazara/Network/Win32/*.cpp" }
|
|
||||||
end
|
|
||||||
|
|
||||||
configuration "DebugStatic"
|
|
||||||
links "NazaraCored-s"
|
|
||||||
targetname "NazaraNetworkd"
|
|
||||||
|
|
||||||
configuration "ReleaseStatic"
|
|
||||||
links "NazaraCore-s"
|
|
||||||
targetname "NazaraNetwork"
|
|
||||||
|
|
||||||
configuration "DebugDLL"
|
|
||||||
links "NazaraCored"
|
|
||||||
targetname "NazaraNetworkd"
|
|
||||||
|
|
||||||
configuration "ReleaseDLL"
|
|
||||||
links "NazaraCore"
|
|
||||||
targetname "NazaraNetwork"
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
project "NazaraNoise"
|
if (not _OPTIONS["united"]) then
|
||||||
|
project "NazaraNoise"
|
||||||
|
end
|
||||||
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
"../include/Nazara/Noise/**.hpp",
|
"../include/Nazara/Noise/**.hpp",
|
||||||
"../include/Nazara/Noise/**.inl",
|
"../include/Nazara/Noise/**.inl",
|
||||||
"../src/Nazara/Noise/**.hpp",
|
"../src/Nazara/Noise/**.hpp",
|
||||||
"../src/Nazara/Noise/**.cpp"
|
"../src/Nazara/Noise/**.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (os.is("windows")) then
|
if (os.is("windows")) then
|
||||||
|
|
@ -14,18 +16,18 @@ else
|
||||||
excludes { "../src/Nazara/Noise/Win32/*.hpp", "../src/Nazara/Noise/Win32/*.cpp" }
|
excludes { "../src/Nazara/Noise/Win32/*.hpp", "../src/Nazara/Noise/Win32/*.cpp" }
|
||||||
end
|
end
|
||||||
|
|
||||||
configuration "DebugStatic"
|
if (_OPTIONS["united"]) then
|
||||||
links "NazaraCored-s"
|
excludes "../src/Nazara/Noise/Debug/Leaks.cpp"
|
||||||
targetname "NazaraNoised"
|
else
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
|
||||||
configuration "ReleaseStatic"
|
configuration "ReleaseStatic"
|
||||||
links "NazaraCore-s"
|
links "NazaraCore-s"
|
||||||
targetname "NazaraNoise"
|
|
||||||
|
|
||||||
configuration "DebugDLL"
|
configuration "DebugDLL"
|
||||||
links "NazaraCored"
|
links "NazaraCore-d"
|
||||||
targetname "NazaraNoised"
|
|
||||||
|
|
||||||
configuration "ReleaseDLL"
|
configuration "ReleaseDLL"
|
||||||
links "NazaraCore"
|
links "NazaraCore"
|
||||||
targetname "NazaraNoise"
|
end
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
project "NazaraRenderer"
|
if (not _OPTIONS["united"]) then
|
||||||
|
project "NazaraRenderer"
|
||||||
|
end
|
||||||
|
|
||||||
|
defines "NAZARA_RENDERER_OPENGL"
|
||||||
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
|
|
@ -17,22 +21,22 @@ else
|
||||||
excludes { "../src/Nazara/Renderer/Win32/*.hpp", "../src/Nazara/Renderer/Win32/*.cpp" }
|
excludes { "../src/Nazara/Renderer/Win32/*.hpp", "../src/Nazara/Renderer/Win32/*.cpp" }
|
||||||
end
|
end
|
||||||
|
|
||||||
configuration "DebugStatic"
|
if (_OPTIONS["united"]) then
|
||||||
links "NazaraCored-s"
|
excludes "../src/Nazara/Renderer/Debug/Leaks.cpp"
|
||||||
links "NazaraUtilityd-s"
|
else
|
||||||
targetname "NazaraRendererd"
|
configuration "DebugStatic"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
links "NazaraUtility-s-d"
|
||||||
|
|
||||||
configuration "ReleaseStatic"
|
configuration "ReleaseStatic"
|
||||||
links "NazaraCore-s"
|
links "NazaraCore-s"
|
||||||
links "NazaraUtility-s"
|
links "NazaraUtility-s"
|
||||||
targetname "NazaraRenderer"
|
|
||||||
|
|
||||||
configuration "DebugDLL"
|
configuration "DebugDLL"
|
||||||
links "NazaraCored"
|
links "NazaraCore-d"
|
||||||
links "NazaraUtilityd"
|
links "NazaraUtility-d"
|
||||||
targetname "NazaraRendererd"
|
|
||||||
|
|
||||||
configuration "ReleaseDLL"
|
configuration "ReleaseDLL"
|
||||||
links "NazaraCore"
|
links "NazaraCore"
|
||||||
links "NazaraUtility"
|
links "NazaraUtility"
|
||||||
targetname "NazaraRenderer"
|
end
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
project "NazaraUtility"
|
if (not _OPTIONS["united"]) then
|
||||||
|
project "NazaraUtility"
|
||||||
|
end
|
||||||
|
|
||||||
defines "STBI_NO_STDIO"
|
defines "STBI_NO_STDIO"
|
||||||
|
|
||||||
|
|
@ -18,18 +20,18 @@ else
|
||||||
excludes { "../src/Nazara/Utility/Win32/*.hpp", "../src/Nazara/Utility/Win32/*.cpp" }
|
excludes { "../src/Nazara/Utility/Win32/*.hpp", "../src/Nazara/Utility/Win32/*.cpp" }
|
||||||
end
|
end
|
||||||
|
|
||||||
configuration "DebugStatic"
|
if (_OPTIONS["united"]) then
|
||||||
links "NazaraCored-s"
|
excludes "../src/Nazara/Utility/Debug/Leaks.cpp"
|
||||||
targetname "NazaraUtilityd"
|
else
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
|
||||||
configuration "ReleaseStatic"
|
configuration "ReleaseStatic"
|
||||||
links "NazaraCore-s"
|
links "NazaraCore-s"
|
||||||
targetname "NazaraUtility"
|
|
||||||
|
|
||||||
configuration "DebugDLL"
|
configuration "DebugDLL"
|
||||||
links "NazaraCored"
|
links "NazaraCore-d"
|
||||||
targetname "NazaraUtilityd"
|
|
||||||
|
|
||||||
configuration "ReleaseDLL"
|
configuration "ReleaseDLL"
|
||||||
links "NazaraCore"
|
links "NazaraCore"
|
||||||
targetname "NazaraUtility"
|
end
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
kind "ConsoleApp"
|
||||||
|
|
||||||
|
files "main.cpp"
|
||||||
|
|
||||||
|
if (_OPTIONS["one-library"]) then
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraEngine-s-d"
|
||||||
|
|
||||||
|
configuration "ReleaseStatic"
|
||||||
|
links "NazaraEngine-s"
|
||||||
|
|
||||||
|
configuration "DebugDLL"
|
||||||
|
links "NazaraEngine-d"
|
||||||
|
|
||||||
|
configuration "ReleaseDLL"
|
||||||
|
links "NazaraEngine"
|
||||||
|
else
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraRenderer-s-d"
|
||||||
|
links "NazaraUtility-s-d"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
|
||||||
|
configuration "ReleaseStatic"
|
||||||
|
links "NazaraRenderer-s"
|
||||||
|
links "NazaraUtility-s"
|
||||||
|
links "NazaraCore-s"
|
||||||
|
|
||||||
|
configuration "DebugDLL"
|
||||||
|
links "NazaraRenderer-d"
|
||||||
|
links "NazaraUtility-d"
|
||||||
|
links "NazaraCore-d"
|
||||||
|
|
||||||
|
configuration "ReleaseDLL"
|
||||||
|
links "NazaraRenderer"
|
||||||
|
links "NazaraUtility"
|
||||||
|
links "NazaraCore"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,667 @@
|
||||||
|
#include <Nazara/Core/Clock.hpp>
|
||||||
|
#include <Nazara/Math/Quaternion.hpp>
|
||||||
|
#include <Nazara/Math/Vector3.hpp>
|
||||||
|
#include <Nazara/Renderer/ContextParameters.hpp>
|
||||||
|
#include <Nazara/Renderer/Renderer.hpp>
|
||||||
|
#include <Nazara/Renderer/RenderWindow.hpp>
|
||||||
|
#include <Nazara/Renderer/Shader.hpp>
|
||||||
|
#include <Nazara/Renderer/Texture.hpp>
|
||||||
|
#include <Nazara/Utility/Image.hpp>
|
||||||
|
#include <Nazara/Utility/Mesh.hpp>
|
||||||
|
#include <Nazara/Utility/StaticMesh.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
// Une structure pour contenir nos informations (Cette structure est très simpliste)
|
||||||
|
struct Model
|
||||||
|
{
|
||||||
|
NzMatrix4f matrix; // Les transformations subies par le modèle
|
||||||
|
NzMesh mesh; // Le mesh
|
||||||
|
NzTexture texture; // Sa texture
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AnimatedModel : public Model
|
||||||
|
{
|
||||||
|
// Quelques variables pour l'animation
|
||||||
|
const NzSequence* currentSequence = nullptr; // La séquence en cours
|
||||||
|
float interpolation = 0.f; // La valeur de l'interpolation ([0..1], si dépasse 1, on passe à la frame suivante)
|
||||||
|
unsigned int currentFrame = 0; // La première frame
|
||||||
|
unsigned int nextFrame; // La seconde frame, l'animation est interpollée entre ces deux-là
|
||||||
|
};
|
||||||
|
|
||||||
|
void AnimateModel(AnimatedModel& moedel, float elapsed);
|
||||||
|
bool CreateCheckerTexture(NzTexture* texture);
|
||||||
|
bool CreateFloorMesh(NzMesh* mesh);
|
||||||
|
void DrawModel(const Model& model);
|
||||||
|
void SetSequence(AnimatedModel& model, const NzString& name);
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Tout d'abord on affiche les instructions
|
||||||
|
std::cout << "Controls: ZQSD" << std::endl;
|
||||||
|
std::cout << "Escape to quit" << std::endl;
|
||||||
|
std::cout << "Left click to capture/free the mouse" << std::endl;
|
||||||
|
std::cout << "Right click to control Dr. Freak" << std::endl;
|
||||||
|
|
||||||
|
// Cette ligne active le mode de compatibilité d'OpenGL lors de l'initialisation de Nazara (Nécessaire pour le shader)
|
||||||
|
NzContextParameters::defaultCompatibilityProfile = true;
|
||||||
|
|
||||||
|
// Maintenant nous initialisons le Renderer (Qui initialisera le noyau ainsi que le module utilitaire)
|
||||||
|
// Cette étape est obligatoire pour beaucoup de fonctionnalités (Notamment le chargement de ressources et le rendu)
|
||||||
|
NzInitializer<NzRenderer> renderer;
|
||||||
|
if (!renderer)
|
||||||
|
{
|
||||||
|
// Ça n'a pas fonctionné, le pourquoi se trouve dans le fichier NazaraLog.log
|
||||||
|
std::cout << "Failed to initialize Nazara, see NazaraLog.log for further informations" << std::endl;
|
||||||
|
std::getchar(); // On laise le temps de voir l'erreur
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Maintenant nous pouvons utiliser le moteur comme bon nous semble, tout d'abord nous allons charger les ressources
|
||||||
|
|
||||||
|
// Charger une ressource se fait actuellement manuellement, mais un ResourceManager est à venir
|
||||||
|
// Vous initialisez une ressource, et la chargez via sa méthode LoadFrom[File|Memory|Stream]
|
||||||
|
// Note: il est possible de donner des instructions au loader (qui va charger le fichier en ressource) via les ResourceParameters
|
||||||
|
NzMeshParams parameters;
|
||||||
|
|
||||||
|
// Le loader doit-il automatiquement charger les animations ?
|
||||||
|
// Attention, ce paramètre possède une signification différente selon le type d'animation du mesh.
|
||||||
|
// -Pour les animations keyframe (image-clé), c'est la seule et unique façon de charger les animations, étant donné
|
||||||
|
// qu'elles sont fourniees avec le mesh.
|
||||||
|
// -Pour les animations squelettiques, le loader ne fera que charger automatiquement l'animation associée au mesh s'il le peut
|
||||||
|
// Dans les deux cas, les paramètres d'animations (parameters.animation) seront utilisés
|
||||||
|
parameters.loadAnimations = true; // Vaut true par défaut
|
||||||
|
|
||||||
|
// Pour qu'un mesh puisse être rendu, il doit être stocké du côté de la carte graphique (Hardware), mais il est parfois utile de
|
||||||
|
// le stocker côté RAM, par exemple pour le moteur physique. En sachant qu'il est facile de changer le stockage d'un buffer.
|
||||||
|
parameters.storage = nzBufferStorage_Hardware; // Vaut nzBufferStorage_Hardware par défaut
|
||||||
|
|
||||||
|
AnimatedModel drfreak;
|
||||||
|
if (!drfreak.mesh.LoadFromFile("resources/drfreak.md2", parameters)) // On charge notre bon vieux docteur avec les paramètres de chargement.
|
||||||
|
{
|
||||||
|
// Le chargement n'a pas fonctionné, le modèle est peut-être corrompu/non-supporté, ou alors n'existe pas.
|
||||||
|
std::cout << "Failed to load mesh" << std::endl;
|
||||||
|
std::getchar(); // On laise le temps de voir l'erreur
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!drfreak.mesh.HasAnimation()) // Le mesh possède-t-il des animations ?
|
||||||
|
{
|
||||||
|
// Cette démo n'a aucun intérêt sans animations
|
||||||
|
std::cout << "Mesh has no animation" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSequence(drfreak, "stand");
|
||||||
|
|
||||||
|
// Il est possible que le mesh possède un ou plusieurs skin, nous utiliserons cette information pour charger une texture
|
||||||
|
if (drfreak.mesh.HasSkin())
|
||||||
|
{
|
||||||
|
// Contrairement aux autres ressources, la texture n'est pas critique
|
||||||
|
if (drfreak.texture.LoadFromFile("resources/" + drfreak.mesh.GetSkin()))
|
||||||
|
drfreak.texture.SetFilterMode(nzTextureFilter_Bilinear); // Appliquons-lui un filtrage bilinéaire
|
||||||
|
else
|
||||||
|
std::cout << "Failed to load texture" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!drfreak.texture.IsValid()) // Les méthodes Resource::IsValid indiquent si la ressource a été correctement créée
|
||||||
|
{
|
||||||
|
std::cout << "Creating checker texture for mesh" << std::endl;
|
||||||
|
|
||||||
|
if (!CreateCheckerTexture(&drfreak.texture))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to create mesh texture" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nous créons maintenant notre sol
|
||||||
|
Model floor;
|
||||||
|
if (!CreateFloorMesh(&floor.mesh))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to create floor" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CreateCheckerTexture(&floor.texture))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to create floor texture" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Le sol ne subit aucune transformation
|
||||||
|
floor.matrix.MakeIdentity();
|
||||||
|
|
||||||
|
// Pour effectuer un rendu, il faut que la carte graphique sache comment le faire.
|
||||||
|
// Les shaders sont de petits programmes qui donnent des instructions à la carte graphique lors de son pipeline.
|
||||||
|
// Ils sont aujourd'hui indispensables pour un rendu 3D, mais sont très utiles pour divers effets !
|
||||||
|
// Il existe plusieurs langages de shaders, GLSL pour OpenGL, HLSL pour Direct3D et Cg qui peut être utilisé pour les deux.
|
||||||
|
// Le Renderer de Nazara utilise OpenGL, par conséquent nous utiliserons le GLSL
|
||||||
|
// La méthode NzShader::IsLanguageSupported permet de savoir si un langage est supporté.
|
||||||
|
NzShader shader;
|
||||||
|
if (!shader.Create(nzShaderLanguage_GLSL))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to load shader" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Une fois le shader créé, nous devons lui spécifier les codes sources de nos shaders
|
||||||
|
// Pour notre exemple nous prendrons un shader très simple
|
||||||
|
// Un shader doit obligatoirement posséder au moins deux codes, un pour le fragment shader et un pour le vertex shader
|
||||||
|
|
||||||
|
// Le fragment shader traite la couleur de nos pixels
|
||||||
|
if (!shader.LoadFromFile(nzShaderType_Fragment, "shaders/basic.frag"))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to load fragment shader from file" << std::endl;
|
||||||
|
// À la différence des autres ressources, le shader possède un log qui peut indiquer les erreurs en cas d'échec
|
||||||
|
std::cout << "Log: " << shader.GetLog() << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Le vertex shader (Transformation des vertices de l'espace 3D vers l'espace écran)
|
||||||
|
if (!shader.LoadFromFile(nzShaderType_Vertex, "shaders/basic.vert"))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to load vertex shader from file" << std::endl;
|
||||||
|
std::cout << "Log: " << shader.GetLog() << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Une fois les codes sources de notre shader chargé, nous pouvons le compiler, afin de le rendre utilisable
|
||||||
|
if (!shader.Compile())
|
||||||
|
{
|
||||||
|
std::cout << "Failed to compile shader" << std::endl;
|
||||||
|
std::cout << "Log: " << shader.GetLog() << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nos ressources sont chargées, et c'est bien beau, mais il nous faudrait une fenêtre pour afficher tout ça
|
||||||
|
// Window représente une fenêtre singulière, pour y effectuer un rendu il nous faut une RenderWindow
|
||||||
|
// Tout d'abord, sa taille, disons celle du bureau divisé par deux
|
||||||
|
|
||||||
|
// Un VideoMode est une structure contenant une longueur (width), une largeur (height) et le nombre de bits par pixels (bitsPerPixel)
|
||||||
|
NzVideoMode mode = NzVideoMode::GetDesktopMode(); // Nous récupérons le mode actuellement utilisé par le bureau
|
||||||
|
|
||||||
|
// Nous divisons sa longueur et sa largeur par deux
|
||||||
|
mode.width /= 2;
|
||||||
|
mode.height /= 2;
|
||||||
|
|
||||||
|
// Maintenant le titre, rien de plus simple...
|
||||||
|
NzString windowTitle = "Nazara Demo - AnimatedMesh";
|
||||||
|
|
||||||
|
// Nous pouvons créer notre fenêtre ! (Via le constructeur directement ou par la méthode Create)
|
||||||
|
NzRenderWindow window;
|
||||||
|
|
||||||
|
// Le premier argument définit la taille de rendu de la fenêtre (Si elle possède une bordure elle sera légèrement plus grande).
|
||||||
|
// Le deuxième argument est le titre de la fenêtre lors de sa création, vous pouvez le modifier à tout moment via window.SetTitle.
|
||||||
|
// Le troisième argument représente la décoration de la fenêtre, sa bordure, ses boutons.
|
||||||
|
// Attention que cela permet à la fenêtre de changer sa taille et qu'il faudra donc traiter l'évènement.
|
||||||
|
// Par défaut le troisième argument vaut nzWindowStyle_Default (Bordure + Bouton de fermeture + Redimensionnement)
|
||||||
|
if (!window.Create(mode, windowTitle, nzWindowStyle_Default))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to create window" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notre belle fenêtre est créée, nous pouvons la configurer
|
||||||
|
|
||||||
|
// On cache le curseur
|
||||||
|
window.SetCursor(nzWindowCursor_None);
|
||||||
|
|
||||||
|
// Nous limitons les FPS à 100
|
||||||
|
window.SetFramerateLimit(100);
|
||||||
|
|
||||||
|
// La matrice de projection définit la transformation du vertice 3D à un point 2D
|
||||||
|
NzRenderer::SetMatrix(nzMatrixType_Projection, NzMatrix4f::Perspective(NzDegrees(70.f), static_cast<float>(window.GetWidth())/window.GetHeight(), 1.f, 1000.f));
|
||||||
|
|
||||||
|
// Notre fenêtre est créée, cependant il faut s'occuper d'elle, pour le rendu et les évènements
|
||||||
|
NzClock secondClock, updateClock; // Des horloges pour gérer le temps
|
||||||
|
unsigned int fps = 0; // Compteur de FPS
|
||||||
|
|
||||||
|
// Quelques variables pour notre improvisation de physique
|
||||||
|
float groundPos = drfreak.mesh.GetAABB().GetMinimum().y; // Les coordonnées locales du "bas" du modèle
|
||||||
|
NzVector3f modelPos(0.f, -groundPos, -50.f);
|
||||||
|
NzVector3f modelVel(0.f, 0.f, 0.f);
|
||||||
|
NzQuaternionf modelOrient(NzQuaternionf::Identity());
|
||||||
|
NzEulerAnglesf modelRot(0.f, 0.f, 0.f);
|
||||||
|
float modelSpeed = 150.f;
|
||||||
|
|
||||||
|
// Nous initialisons la matrice
|
||||||
|
drfreak.matrix = NzMatrix4f::Rotate(modelOrient) * NzMatrix4f::Translate(modelPos);
|
||||||
|
|
||||||
|
// Notre caméra
|
||||||
|
NzVector3f camPos(0.f, 25.f, -20.f);
|
||||||
|
NzQuaternionf camOrient(NzQuaternionf::Identity());
|
||||||
|
NzEulerAnglesf camRot(0.f, 0.f, 0.f); // Les angles d'eulers sont bien plus facile à utiliser
|
||||||
|
NzMatrix4f camMatrix = NzMatrix4f::Translate(camPos);
|
||||||
|
float camSpeed = 100.f;
|
||||||
|
float sensitivity = 0.8f;
|
||||||
|
|
||||||
|
// Quelques variables
|
||||||
|
bool camMode = true;
|
||||||
|
bool paused = false;
|
||||||
|
bool thirdPerson = false;
|
||||||
|
bool windowOpen = true;
|
||||||
|
|
||||||
|
// On peut commencer la boucle du programme
|
||||||
|
while (windowOpen)
|
||||||
|
{
|
||||||
|
// Ici nous gérons les évènements
|
||||||
|
NzEvent event;
|
||||||
|
while (window.PollEvent(&event)) // Avons-nous un évènement dans la file ?
|
||||||
|
{
|
||||||
|
// Nous avons un évènement !
|
||||||
|
|
||||||
|
switch (event.type) // De quel type est cet évènement ?
|
||||||
|
{
|
||||||
|
case nzEventType_Quit: // L'utilisateur/L'OS nous a demandé de terminer notre exécution
|
||||||
|
windowOpen = false; // Nous terminons alors la boucle
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nzEventType_MouseMoved: // La souris a bougé
|
||||||
|
{
|
||||||
|
// Si nous ne sommes pas en mode free-fly, on ne traite pas l'évènement
|
||||||
|
if (!camMode || thirdPerson)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// On modifie l'angle de la caméra grâce au déplacement relatif de la souris
|
||||||
|
camRot.yaw = NzNormalizeAngle(camRot.yaw - event.mouseMove.deltaX*sensitivity);
|
||||||
|
|
||||||
|
// Pour éviter les loopings mais surtout les problèmes de calculation de la matrice de vue, on restreint les angles
|
||||||
|
camRot.pitch = NzClamp(camRot.pitch - event.mouseMove.deltaY*sensitivity, -89.f, 89.f);
|
||||||
|
|
||||||
|
// La matrice vue représente les transformations effectuées par la caméra
|
||||||
|
// On recalcule la matrice de la caméra et on l'envoie au renderer
|
||||||
|
camOrient = camRot; // Conversion des angles d'euler en quaternion
|
||||||
|
NzRenderer::SetMatrix(nzMatrixType_View, NzMatrix4f::LookAt(camPos, camPos + camOrient * NzVector3f::Forward()));
|
||||||
|
|
||||||
|
// Pour éviter que le curseur ne sorte de l'écran, nous le renvoyons au centre de la fenêtre
|
||||||
|
NzMouse::SetPosition(window.GetWidth()/2, window.GetHeight()/2, window);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case nzEventType_MouseButtonPressed: // L'utilisateur (ou son chat) vient de cliquer sur la souris
|
||||||
|
if (event.mouseButton.button == NzMouse::Left) // Est-ce le clic gauche ?
|
||||||
|
{
|
||||||
|
// L'utilisateur vient d'appuyer sur le bouton left de la souris
|
||||||
|
// Nous allons inverser le mode caméra et montrer/cacher le curseur en conséquence
|
||||||
|
if (camMode)
|
||||||
|
{
|
||||||
|
camMode = false;
|
||||||
|
window.SetCursor(nzWindowCursor_Default);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
camMode = true;
|
||||||
|
window.SetCursor(nzWindowCursor_None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (event.mouseButton.button == NzMouse::Right) // Est-ce le clic droit ?
|
||||||
|
{
|
||||||
|
if (thirdPerson)
|
||||||
|
{
|
||||||
|
// On arrête le mouvement
|
||||||
|
SetSequence(drfreak, "stand");
|
||||||
|
|
||||||
|
// Afin de synchroniser le quaternion avec les angles d'euler
|
||||||
|
camRot = camOrient.ToEulerAngles();
|
||||||
|
thirdPerson = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
thirdPerson = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nzEventType_Resized: // L'utilisateur a changé la taille de la fenêtre, le coquin !
|
||||||
|
NzRenderer::SetViewport(NzRectui(0, 0, event.size.width, event.size.height)); // Adaptons l'affichage
|
||||||
|
|
||||||
|
// Il nous faut aussi mettre à jour notre matrice de projection
|
||||||
|
NzRenderer::SetMatrix(nzMatrixType_Projection, NzMatrix4f::Perspective(NzDegrees(70.f), static_cast<float>(event.size.width)/event.size.height, 1.f, 1000.f));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nzEventType_KeyPressed: // Une touche du clavier vient d'être enfoncée
|
||||||
|
if (thirdPerson &&
|
||||||
|
(event.key.code == NzKeyboard::Z || // Est-ce la touche Z ?
|
||||||
|
event.key.code == NzKeyboard::S || // Ou bien la touche S ?
|
||||||
|
event.key.code == NzKeyboard::Q || // Ou encore la touche Q ?
|
||||||
|
event.key.code == NzKeyboard::D)) // Et pourquoi pas la touche D ?
|
||||||
|
{
|
||||||
|
// Si une touche concernant le déplacement est appuyée
|
||||||
|
SetSequence(drfreak, "run"); // On anime le personnage pour qu'il ait une animation de déplacement
|
||||||
|
}
|
||||||
|
else if (event.key.code == NzKeyboard::Escape)
|
||||||
|
windowOpen = false;
|
||||||
|
else if (event.key.code == NzKeyboard::P)
|
||||||
|
paused = !paused;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nzEventType_KeyReleased: // Une touche du clavier vient d'être relachée
|
||||||
|
if (thirdPerson &&
|
||||||
|
!NzKeyboard::IsKeyPressed(NzKeyboard::Z) && // Est-ce que la touche Z est enfoncée en ce moment ?
|
||||||
|
!NzKeyboard::IsKeyPressed(NzKeyboard::S) && // Ou bien la touche S ?
|
||||||
|
!NzKeyboard::IsKeyPressed(NzKeyboard::Q) && // Etc..
|
||||||
|
!NzKeyboard::IsKeyPressed(NzKeyboard::D)) // Etc..
|
||||||
|
{
|
||||||
|
// Si plus aucune touche de déplacement n'est enfoncée
|
||||||
|
SetSequence(drfreak, "stand");
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // Les autres évènements, on s'en fiche
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mise à jour de la partie logique
|
||||||
|
if (updateClock.GetMilliseconds() >= 1000/60) // 60 fois par seconde
|
||||||
|
{
|
||||||
|
float elapsedTime = updateClock.GetSeconds(); // Le temps depuis la dernière mise à jour
|
||||||
|
|
||||||
|
// Déplacement de la caméra
|
||||||
|
static const NzVector3f forward(NzVector3f::Forward());
|
||||||
|
static const NzVector3f left(NzVector3f::Left());
|
||||||
|
static const NzVector3f up(NzVector3f::Up());
|
||||||
|
|
||||||
|
// Notre rotation sous forme de quaternion nous permet de tourner un vecteur
|
||||||
|
// Par exemple ici, quaternion * forward nous permet de récupérer le vecteur de la direction "avant"
|
||||||
|
|
||||||
|
if (thirdPerson)
|
||||||
|
{
|
||||||
|
// Nous déplaçons le personnage en fonction des touches pressées
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::Z))
|
||||||
|
modelPos += modelOrient * forward * modelSpeed * elapsedTime;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::S))
|
||||||
|
modelPos -= modelOrient * forward * modelSpeed * elapsedTime;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::Q))
|
||||||
|
modelRot.yaw += camSpeed * elapsedTime;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::D))
|
||||||
|
modelRot.yaw -= camSpeed * elapsedTime;
|
||||||
|
|
||||||
|
modelOrient = modelRot;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Sinon, c'est la caméra qui se déplace (en fonction des mêmes touches)
|
||||||
|
|
||||||
|
// Un boost en maintenant le shift gauche
|
||||||
|
float speed = (NzKeyboard::IsKeyPressed(NzKeyboard::Key::LShift)) ? camSpeed*5 : camSpeed;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::Z))
|
||||||
|
camPos += camOrient * forward * speed * elapsedTime;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::S))
|
||||||
|
camPos -= camOrient * forward * speed * elapsedTime;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::Q))
|
||||||
|
camPos += camOrient * left * speed * elapsedTime;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::D))
|
||||||
|
camPos -= camOrient * left * speed * elapsedTime;
|
||||||
|
|
||||||
|
// En revanche, ici la hauteur est toujours la même, peu importe notre orientation
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::Space))
|
||||||
|
camPos += up * speed * elapsedTime;
|
||||||
|
|
||||||
|
if (NzKeyboard::IsKeyPressed(NzKeyboard::LControl))
|
||||||
|
camPos -= up * speed * elapsedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Oui les quaternions et les matrices sont calculés même si la caméra ne bouge pas
|
||||||
|
// C'est une limitation de mon implémentation, qui ne sera pas présente une fois les NzSceneNode intégrés
|
||||||
|
if (thirdPerson)
|
||||||
|
{
|
||||||
|
static NzQuaternionf rotDown(NzEulerAnglesf(-15.f, 0.f, 0.f)); // Une rotation pour regarder vers le bas
|
||||||
|
camOrient = modelOrient * rotDown;
|
||||||
|
|
||||||
|
camPos = modelPos + camOrient * NzVector3f(0.f, 25.f, 60.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
NzRenderer::SetMatrix(nzMatrixType_View, NzMatrix4f::LookAt(camPos, camPos + camOrient * NzVector3f::Forward()));
|
||||||
|
|
||||||
|
// Mise à jour de la matrice du personnage
|
||||||
|
drfreak.matrix = NzMatrix4f::Rotate(modelOrient) * NzMatrix4f::Translate(modelPos);
|
||||||
|
|
||||||
|
// Animation
|
||||||
|
if (!paused)
|
||||||
|
AnimateModel(drfreak, elapsedTime);
|
||||||
|
|
||||||
|
updateClock.Restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
// On active le shader et paramètrons le rendu
|
||||||
|
NzRenderer::SetShader(&shader);
|
||||||
|
|
||||||
|
// Notre scène 3D requiert un test de profondeur
|
||||||
|
NzRenderer::Enable(nzRendererParameter_DepthTest, true);
|
||||||
|
|
||||||
|
// Nous voulons avoir un fond bien gris
|
||||||
|
NzRenderer::SetClearColor(128, 128, 128);
|
||||||
|
|
||||||
|
// Et nous effaçons les buffers de couleur et de profondeur
|
||||||
|
NzRenderer::Clear(nzRendererClear_Color | nzRendererClear_Depth);
|
||||||
|
|
||||||
|
// Affichage des meshs
|
||||||
|
DrawModel(floor);
|
||||||
|
|
||||||
|
// Notre Dr. Freak possède des normales, nous pouvons alors éliminer les faces qu'on ne voit pas
|
||||||
|
NzRenderer::Enable(nzRendererParameter_FaceCulling, true);
|
||||||
|
|
||||||
|
DrawModel(drfreak);
|
||||||
|
|
||||||
|
NzRenderer::Enable(nzRendererParameter_FaceCulling, false);
|
||||||
|
|
||||||
|
// Nous mettons à jour l'écran
|
||||||
|
window.Display();
|
||||||
|
|
||||||
|
fps++;
|
||||||
|
|
||||||
|
// Toutes les secondes
|
||||||
|
if (secondClock.GetMilliseconds() >= 1000)
|
||||||
|
{
|
||||||
|
window.SetTitle(windowTitle + " (FPS: " + NzString::Number(fps) + ')');
|
||||||
|
fps = 0;
|
||||||
|
secondClock.Restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimateModel(AnimatedModel& model, float elapsed)
|
||||||
|
{
|
||||||
|
model.interpolation += model.currentSequence->framePerSecond * elapsed;
|
||||||
|
while (model.interpolation > 1.f)
|
||||||
|
{
|
||||||
|
model.interpolation -= 1.f;
|
||||||
|
|
||||||
|
model.currentFrame = model.nextFrame;
|
||||||
|
if (++model.nextFrame > model.currentSequence->lastFrame)
|
||||||
|
model.nextFrame = model.currentSequence->firstFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
model.mesh.Animate(model.currentFrame, model.nextFrame, (NzKeyboard::IsKeyPressed(NzKeyboard::A)) ? 0.f : model.interpolation);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CreateCheckerTexture(NzTexture* texture)
|
||||||
|
{
|
||||||
|
NzImage image;
|
||||||
|
// Nous crééons une image 2D, au format RGBA8 de dimensions 128*128 (8 blocs de 16 pixels de côté)
|
||||||
|
if (!image.Create(nzImageType_2D, nzPixelFormat_RGBA8, 8*16, 8*16))
|
||||||
|
{
|
||||||
|
// Ne devrait pas arriver (La création d'une image ne peut échouer que si l'un des argument est incorrect)
|
||||||
|
std::cout << "Failed to create image, this means a bug has been found in Nazara" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pour modifier les pixels, nous pouvons accéder directement à ces derniers avec GetPixels(), ou bien à un pixel
|
||||||
|
// via [Get|Set]PixelColor, mais pour cette occasion nous utiliserons une méthode bien pratique, Fill.
|
||||||
|
unsigned int blockCountX = image.GetWidth()/16;
|
||||||
|
unsigned int blockCountY = image.GetHeight()/16;
|
||||||
|
for (unsigned int x = 0; x < blockCountX; ++x)
|
||||||
|
{
|
||||||
|
for (unsigned int y = 0; y < blockCountY; ++y)
|
||||||
|
{
|
||||||
|
// Une belle texture de damier
|
||||||
|
NzColor color = (x%2 == y%2) ? NzColor::White : NzColor::Black;
|
||||||
|
// Fill remplit une zone de la texture avec une couleur
|
||||||
|
image.Fill(color, NzRectui(x*16, y*16, 16, 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!texture->LoadFromImage(image)) // Nous créons notre texture depuis notre image
|
||||||
|
{
|
||||||
|
// Nous n'avons vraiment pas beaucoup de chance..
|
||||||
|
std::cout << "Failed to load image" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
texture->SetAnisotropyLevel(NzRenderer::GetMaxAnisotropyLevel()); // Un filtrage anisotropique pour la texture
|
||||||
|
texture->SetWrapMode(nzTextureWrap_Repeat); // Si les coordonnées de texture dépassent 1.f, la texture sera répétée
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CreateFloorMesh(NzMesh* mesh)
|
||||||
|
{
|
||||||
|
// Cette fonction créé un mesh statique simpliste pour servir de sol
|
||||||
|
|
||||||
|
// Nous créons un mesh statique
|
||||||
|
if (!mesh->Create(nzAnimationType_Static))
|
||||||
|
{
|
||||||
|
// L'échec est techniquement impossible mais le moteur étant en constante évolution ...
|
||||||
|
std::cout << "Failed to create mesh" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Les vertex declaration ont pour seul but de décrire l'agencement d'un vertex buffer
|
||||||
|
// Elles sont composées de VertexElement, chacun décrivant un élément du buffer
|
||||||
|
NzVertexDeclaration* declaration = new NzVertexDeclaration;
|
||||||
|
|
||||||
|
// Il y a cinq paramètres différents (stream, usage, type, offset, usageIndex)
|
||||||
|
// -Stream: À quoi serviront les données ? À définir des sommets (nzElementStream_VertexData) ou à l'instancing (nzElementStream_InstancedData)
|
||||||
|
// -Usage: Comment cette donnée doit-elle être envoyée au shader
|
||||||
|
// -Type: Comment sont stockées ces données ? (Un triplet de float ? Deux double ? ..)
|
||||||
|
// -Offset: La position de la donnée dans le buffer (les données sont entrelacées)
|
||||||
|
// -UsageIndex: Pour les coordonnées de texture, définit l'indice de texture utilisé.
|
||||||
|
NzVertexElement elements[2];
|
||||||
|
elements[0].usage = nzElementUsage_Position; // Notre premier élément sera la position des vertices
|
||||||
|
elements[0].offset = 0; // Celles-ci sont placées au début
|
||||||
|
elements[0].type = nzElementType_Float3; // Sont composées de trois flottants
|
||||||
|
|
||||||
|
elements[1].usage = nzElementUsage_TexCoord;
|
||||||
|
elements[1].offset = 3*sizeof(float);
|
||||||
|
elements[1].type = nzElementType_Float2;
|
||||||
|
|
||||||
|
if (!declaration->Create(elements, 2))
|
||||||
|
{
|
||||||
|
// Nos éléments sont invalides !
|
||||||
|
std::cout << "Failed to create vertex declaration" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nous créons ensuite un buffer de 4 vertices (le second argument précise l'espace pris par chaque vertex), le stockage
|
||||||
|
// Et nous indiquons que nous n'y toucherons plus
|
||||||
|
NzVertexBuffer* buffer = new NzVertexBuffer(4, declaration->GetStride(nzElementStream_VertexData), nzBufferStorage_Hardware, nzBufferUsage_Static);
|
||||||
|
|
||||||
|
// Doit respecter la declaration
|
||||||
|
float vertices[] =
|
||||||
|
{
|
||||||
|
// Vertex 1
|
||||||
|
-1000.f, 0.f, -1000.f, // Position
|
||||||
|
0.f, 0.f, // UV
|
||||||
|
|
||||||
|
// Vertex 2
|
||||||
|
-1000.f, 0.f, 1000.f, // Position
|
||||||
|
0.f, 10.f, // UV
|
||||||
|
|
||||||
|
// Vertex 3
|
||||||
|
1000.f, 0.f, -1000.f, // Position
|
||||||
|
10.f, 0.f, // UV
|
||||||
|
|
||||||
|
// Vertex 4
|
||||||
|
1000.f, 0.f, 1000.f, // Position
|
||||||
|
10.f, 10.f // UV
|
||||||
|
};
|
||||||
|
|
||||||
|
// Afin de modifier un buffer, il nous faut soit le verrouiller (accès bas-niveau), soit le remplir (accès de plus haut niveau)
|
||||||
|
if (!buffer->Fill(vertices, 0, 4)) // Nous remplissons à partir de l'index 0, et nous envoyons 4 vertices
|
||||||
|
{
|
||||||
|
std::cout << "Failed to fill buffer" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
NzStaticMesh* subMesh = new NzStaticMesh(mesh);
|
||||||
|
if (!subMesh->Create(declaration, buffer))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to create subMesh" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
subMesh->SetPrimitiveType(nzPrimitiveType_TriangleStrip);
|
||||||
|
|
||||||
|
// On ajoute le submesh au mesh
|
||||||
|
mesh->AddSubMesh(subMesh);
|
||||||
|
|
||||||
|
// Nos ressources sont notifiées utilisées par le mesh et le submesh, nous pouvons les rendre éphèmères.
|
||||||
|
// Les ressources seront donc automatiquement libérées lorsqu'elles ne seront plus référencées par une classe
|
||||||
|
buffer->SetPersistent(false);
|
||||||
|
declaration->SetPersistent(false);
|
||||||
|
subMesh->SetPersistent(false); // Pour le submesh, c'est déjà le comportement par défaut
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawModel(const Model& model)
|
||||||
|
{
|
||||||
|
// La matrice world est celle qui représente les transformations du modèle
|
||||||
|
NzRenderer::SetMatrix(nzMatrixType_World, model.matrix);
|
||||||
|
|
||||||
|
NzShader* shader = NzRenderer::GetShader();// On récupère le shader du rendu
|
||||||
|
shader->SendTexture(shader->GetUniformLocation("texture"), &model.texture);
|
||||||
|
|
||||||
|
// Un mesh est divisé en plusieurs submeshes
|
||||||
|
unsigned int subMeshCount = model.mesh.GetSubMeshCount();
|
||||||
|
for (unsigned int i = 0; i < subMeshCount; ++i)
|
||||||
|
{
|
||||||
|
// On récupère le submesh
|
||||||
|
const NzSubMesh* subMesh = model.mesh.GetSubMesh(i);
|
||||||
|
|
||||||
|
// On paramètre le Renderer avec ses données
|
||||||
|
NzRenderer::SetIndexBuffer(subMesh->GetIndexBuffer());
|
||||||
|
NzRenderer::SetVertexBuffer(subMesh->GetVertexBuffer());
|
||||||
|
NzRenderer::SetVertexDeclaration(subMesh->GetVertexDeclaration());
|
||||||
|
|
||||||
|
// On fait le rendu
|
||||||
|
NzRenderer::DrawPrimitives(subMesh->GetPrimitiveType(), 0, subMesh->GetVertexCount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetSequence(AnimatedModel& model, const NzString& sequenceName)
|
||||||
|
{
|
||||||
|
// On récupère l'animation du mesh
|
||||||
|
const NzAnimation* animation = model.mesh.GetAnimation();
|
||||||
|
|
||||||
|
// Nous nous basons sur l'assertion que la séquence existe (Chose que nous pouvons tester avec HasSequence())
|
||||||
|
const NzSequence* sequence = animation->GetSequence(sequenceName);
|
||||||
|
if (model.currentSequence != sequence)
|
||||||
|
{
|
||||||
|
model.currentSequence = sequence;
|
||||||
|
|
||||||
|
// Pour avoir une interpolation entre la séquence précédente et celle-ci, nous n'affectons que nextFrame
|
||||||
|
model.nextFrame = model.currentSequence->firstFrame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
kind "ConsoleApp"
|
||||||
|
|
||||||
|
files "main.cpp"
|
||||||
|
|
||||||
|
if (_OPTIONS["one-library"]) then
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraEngine-s-d"
|
||||||
|
|
||||||
|
configuration "ReleaseStatic"
|
||||||
|
links "NazaraEngine-s"
|
||||||
|
|
||||||
|
configuration "DebugDLL"
|
||||||
|
links "NazaraEngine-d"
|
||||||
|
|
||||||
|
configuration "ReleaseDLL"
|
||||||
|
links "NazaraEngine"
|
||||||
|
else
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraAudio-s-d"
|
||||||
|
links "NazaraUtility-s-d"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
|
||||||
|
configuration "ReleaseStatic"
|
||||||
|
links "NazaraAudio-s"
|
||||||
|
links "NazaraUtility-s"
|
||||||
|
links "NazaraCore-s"
|
||||||
|
|
||||||
|
configuration "DebugDLL"
|
||||||
|
links "NazaraAudio-d"
|
||||||
|
links "NazaraUtility-d"
|
||||||
|
links "NazaraCore-d"
|
||||||
|
|
||||||
|
configuration "ReleaseDLL"
|
||||||
|
links "NazaraAudio"
|
||||||
|
links "NazaraUtility"
|
||||||
|
links "NazaraCore"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
#include <Nazara/Audio.hpp>
|
||||||
|
#include <Nazara/Core/Clock.hpp>
|
||||||
|
#include <Nazara/Core/Thread.hpp> // Thread::Sleep
|
||||||
|
#include <Nazara/Math/Vector3.hpp>
|
||||||
|
#include <Nazara/Utility/Keyboard.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// NzKeyboard ne nécessite pas l'initialisation du module Utilitaire
|
||||||
|
NzInitializer<NzAudio> audio;
|
||||||
|
if (!audio)
|
||||||
|
{
|
||||||
|
std::cout << "Failed to initialize audio module" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
NzSound sound;
|
||||||
|
if (!sound.LoadFromFile("resources/siren.wav"))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to load sound" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Demonstration de l'effet doppler avec Nazara" << std::endl;
|
||||||
|
std::cout << "Appuyez sur entree pour demarrer" << std::endl;
|
||||||
|
std::cout << "Appuyez sur echap pour arreter" << std::endl;
|
||||||
|
|
||||||
|
std::getchar();
|
||||||
|
|
||||||
|
// On fait en sorte de répéter le son
|
||||||
|
sound.EnableLooping(true);
|
||||||
|
|
||||||
|
// La source du son se situe vers la gauche (Et un peu en avant)
|
||||||
|
sound.SetPosition(NzVector3f::Left()*50.f + NzVector3f::Forward()*5.);
|
||||||
|
|
||||||
|
// Et possède une vitesse de 10 par seconde vers la droite
|
||||||
|
sound.SetVelocity(NzVector3f::Left()*-10.f);
|
||||||
|
|
||||||
|
// On joue le son
|
||||||
|
sound.Play();
|
||||||
|
|
||||||
|
// La boucle du programme (Pour déplacer le son)
|
||||||
|
NzClock clock;
|
||||||
|
while (sound.GetStatus() == nzSoundStatus_Playing)
|
||||||
|
{
|
||||||
|
// Comme le son se joue dans un thread séparé, on peut mettre en pause le principal régulièrement
|
||||||
|
int sleepTime = 1000/60 - clock.GetMilliseconds(); // 60 FPS
|
||||||
|
|
||||||
|
if (sleepTime > 0)
|
||||||
|
NzThread::Sleep(sleepTime);
|
||||||
|
|
||||||
|
// On bouge la source du son en fonction du temps depuis chaque mise à jour
|
||||||
|
NzVector3f pos = sound.GetPosition() + sound.GetVelocity()*clock.GetSeconds();
|
||||||
|
sound.SetPosition(pos);
|
||||||
|
|
||||||
|
std::cout << "Sound position: " << pos << std::endl;
|
||||||
|
|
||||||
|
// Si la position de la source atteint une certaine position, ou si l'utilisateur appuie sur echap
|
||||||
|
if (pos.x > NzVector3f::Left().x*-50.f || NzKeyboard::IsKeyPressed(NzKeyboard::Escape))
|
||||||
|
sound.Stop(); // On arrête le son (Stoppant également la boucle)
|
||||||
|
|
||||||
|
clock.Restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
kind "ConsoleApp"
|
||||||
|
|
||||||
|
files "main.cpp"
|
||||||
|
|
||||||
|
if (_OPTIONS["one-library"]) then
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraEngine-s-d"
|
||||||
|
|
||||||
|
configuration "ReleaseStatic"
|
||||||
|
links "NazaraEngine-s"
|
||||||
|
|
||||||
|
configuration "DebugDLL"
|
||||||
|
links "NazaraEngine-d"
|
||||||
|
|
||||||
|
configuration "ReleaseDLL"
|
||||||
|
links "NazaraEngine"
|
||||||
|
else
|
||||||
|
configuration "DebugStatic"
|
||||||
|
links "NazaraUtility-s-d"
|
||||||
|
links "NazaraCore-s-d"
|
||||||
|
|
||||||
|
configuration "ReleaseStatic"
|
||||||
|
links "NazaraUtility-s"
|
||||||
|
links "NazaraCore-s"
|
||||||
|
|
||||||
|
configuration "DebugDLL"
|
||||||
|
links "NazaraUtility-d"
|
||||||
|
links "NazaraCore-d"
|
||||||
|
|
||||||
|
configuration "ReleaseDLL"
|
||||||
|
links "NazaraUtility"
|
||||||
|
links "NazaraCore"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
#include <Nazara/Utility/Mesh.hpp>
|
||||||
|
#include <Nazara/Utility/Utility.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Pour charger des ressources, il est impératif d'initialiser le module utilitaire
|
||||||
|
NzInitializer<NzUtility> utility;
|
||||||
|
if (!utility)
|
||||||
|
{
|
||||||
|
// Ça n'a pas fonctionné, le pourquoi se trouve dans le fichier NazaraLog.log
|
||||||
|
std::cout << "Failed to initialize Nazara, see NazaraLog.log for further informations" << std::endl;
|
||||||
|
std::getchar(); // On laise le temps de voir l'erreur
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Le Renderer n'étant pas chargé, nous devons indiquer que nous désirons un stockage software de notre mesh
|
||||||
|
NzMeshParams parameters;
|
||||||
|
parameters.storage = nzBufferStorage_Software;
|
||||||
|
|
||||||
|
NzMesh drfreak;
|
||||||
|
if (!drfreak.LoadFromFile("resources/drfreak.md2", parameters))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to load Dr. Freak's mesh" << std::endl;
|
||||||
|
std::getchar();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drfreak.HasAnimation()) // Si le mesh possède des animations
|
||||||
|
{
|
||||||
|
std::cout << "Mesh has animation" << std::endl;
|
||||||
|
|
||||||
|
// Un objet NzAnimation représente un ensemble d'informations sur des animations
|
||||||
|
const NzAnimation* animation = drfreak.GetAnimation();
|
||||||
|
|
||||||
|
// Une séquence définit une "action", chaque séquence possède un nom, une frame de départ, une d'arrivée ainsi qu'un framerate
|
||||||
|
unsigned int sequenceCount = animation->GetSequenceCount();
|
||||||
|
std::cout << sequenceCount << " sequences:" << std::endl;
|
||||||
|
for (unsigned int i = 0; i < sequenceCount; ++i)
|
||||||
|
std::cout << "-" << (i+1) << ": " << animation->GetSequence(i)->name << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::cout << "Mesh has no animation" << std::endl;
|
||||||
|
|
||||||
|
std::getchar(); // Une attente pour avoir le temps de lire :-)
|
||||||
|
|
||||||
|
// Le module utilitaire et le mesh sont déchargés automatiquement
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
#version 110
|
||||||
|
|
||||||
|
varying vec2 TexCoord;
|
||||||
|
|
||||||
|
uniform sampler2D texture;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_FragColor = texture2D(texture, TexCoord);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#version 110
|
||||||
|
|
||||||
|
attribute vec3 Position;
|
||||||
|
attribute vec2 TexCoord0;
|
||||||
|
|
||||||
|
uniform mat4 WorldViewProjMatrix;
|
||||||
|
|
||||||
|
varying vec2 TexCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = WorldViewProjMatrix * vec4(Position, 1.0);
|
||||||
|
TexCoord = TexCoord0;
|
||||||
|
}
|
||||||
3630
include/GL3/gl3.h
3630
include/GL3/gl3.h
File diff suppressed because it is too large
Load Diff
11823
include/GL3/glext.h
11823
include/GL3/glext.h
File diff suppressed because it is too large
Load Diff
1001
include/GL3/glxext.h
1001
include/GL3/glxext.h
File diff suppressed because it is too large
Load Diff
|
|
@ -1,943 +0,0 @@
|
||||||
#ifndef __wglext_h_
|
|
||||||
#define __wglext_h_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Copyright (c) 2007-2012 The Khronos Group Inc.
|
|
||||||
**
|
|
||||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
** copy of this software and/or associated documentation files (the
|
|
||||||
** "Materials"), to deal in the Materials without restriction, including
|
|
||||||
** without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
|
||||||
** permit persons to whom the Materials are furnished to do so, subject to
|
|
||||||
** the following conditions:
|
|
||||||
**
|
|
||||||
** The above copyright notice and this permission notice shall be included
|
|
||||||
** in all copies or substantial portions of the Materials.
|
|
||||||
**
|
|
||||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Function declaration macros - to move into glplatform.h */
|
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
|
||||||
#define WIN32_LEAN_AND_MEAN 1
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef APIENTRY
|
|
||||||
#define APIENTRY
|
|
||||||
#endif
|
|
||||||
#ifndef APIENTRYP
|
|
||||||
#define APIENTRYP APIENTRY *
|
|
||||||
#endif
|
|
||||||
#ifndef GLAPI
|
|
||||||
#define GLAPI extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
|
|
||||||
/* Header file version number */
|
|
||||||
/* wglext.h last updated 2012/01/04 */
|
|
||||||
/* Current version at http://www.opengl.org/registry/ */
|
|
||||||
#define WGL_WGLEXT_VERSION 24
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_buffer_region
|
|
||||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
|
||||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
|
||||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
|
||||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_multisample
|
|
||||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
|
||||||
#define WGL_SAMPLES_ARB 0x2042
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_extensions_string
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_pixel_format
|
|
||||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
|
||||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
|
||||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
|
||||||
#define WGL_ACCELERATION_ARB 0x2003
|
|
||||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
|
||||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
|
||||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
|
||||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
|
||||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
|
||||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
|
||||||
#define WGL_TRANSPARENT_ARB 0x200A
|
|
||||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
|
||||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
|
||||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
|
||||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
|
||||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
|
||||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
|
||||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
|
||||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
|
||||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
|
||||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
|
||||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
|
||||||
#define WGL_STEREO_ARB 0x2012
|
|
||||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
|
||||||
#define WGL_COLOR_BITS_ARB 0x2014
|
|
||||||
#define WGL_RED_BITS_ARB 0x2015
|
|
||||||
#define WGL_RED_SHIFT_ARB 0x2016
|
|
||||||
#define WGL_GREEN_BITS_ARB 0x2017
|
|
||||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
|
||||||
#define WGL_BLUE_BITS_ARB 0x2019
|
|
||||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
|
||||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
|
||||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
|
||||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
|
||||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
|
||||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
|
||||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
|
||||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
|
||||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
|
||||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
|
||||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
|
||||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
|
||||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
|
||||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
|
||||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
|
||||||
#define WGL_SWAP_COPY_ARB 0x2029
|
|
||||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
|
||||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
|
||||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_make_current_read
|
|
||||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
|
||||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_pbuffer
|
|
||||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
|
||||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
|
||||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
|
||||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
|
||||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
|
||||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
|
||||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
|
||||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_render_texture
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
|
||||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
|
||||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
|
||||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
|
||||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
|
||||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
|
||||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
|
||||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
|
||||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
|
||||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
|
||||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
|
||||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
|
||||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
|
||||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
|
||||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
|
||||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
|
||||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
|
||||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
|
||||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
|
||||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
|
||||||
#define WGL_BACK_LEFT_ARB 0x2085
|
|
||||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
|
||||||
#define WGL_AUX0_ARB 0x2087
|
|
||||||
#define WGL_AUX1_ARB 0x2088
|
|
||||||
#define WGL_AUX2_ARB 0x2089
|
|
||||||
#define WGL_AUX3_ARB 0x208A
|
|
||||||
#define WGL_AUX4_ARB 0x208B
|
|
||||||
#define WGL_AUX5_ARB 0x208C
|
|
||||||
#define WGL_AUX6_ARB 0x208D
|
|
||||||
#define WGL_AUX7_ARB 0x208E
|
|
||||||
#define WGL_AUX8_ARB 0x208F
|
|
||||||
#define WGL_AUX9_ARB 0x2090
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_pixel_format_float
|
|
||||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_framebuffer_sRGB
|
|
||||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_create_context
|
|
||||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
|
||||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
|
||||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
|
||||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
|
||||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
|
||||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
|
||||||
#define ERROR_INVALID_VERSION_ARB 0x2095
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_create_context_profile
|
|
||||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
|
||||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
|
||||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
|
||||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_create_context_robustness
|
|
||||||
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
|
|
||||||
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
|
|
||||||
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
|
|
||||||
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_make_current_read
|
|
||||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_pixel_format
|
|
||||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
|
||||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
|
||||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
|
||||||
#define WGL_ACCELERATION_EXT 0x2003
|
|
||||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
|
||||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
|
||||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
|
||||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
|
||||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
|
||||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
|
||||||
#define WGL_TRANSPARENT_EXT 0x200A
|
|
||||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
|
||||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
|
||||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
|
||||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
|
||||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
|
||||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
|
||||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
|
||||||
#define WGL_STEREO_EXT 0x2012
|
|
||||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
|
||||||
#define WGL_COLOR_BITS_EXT 0x2014
|
|
||||||
#define WGL_RED_BITS_EXT 0x2015
|
|
||||||
#define WGL_RED_SHIFT_EXT 0x2016
|
|
||||||
#define WGL_GREEN_BITS_EXT 0x2017
|
|
||||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
|
||||||
#define WGL_BLUE_BITS_EXT 0x2019
|
|
||||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
|
||||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
|
||||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
|
||||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
|
||||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
|
||||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
|
||||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
|
||||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
|
||||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
|
||||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
|
||||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
|
||||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
|
||||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
|
||||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
|
||||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
|
||||||
#define WGL_SWAP_COPY_EXT 0x2029
|
|
||||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
|
||||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
|
||||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_pbuffer
|
|
||||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
|
||||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
|
||||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
|
||||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
|
||||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
|
||||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
|
||||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
|
||||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
|
||||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_depth_float
|
|
||||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_3DFX_multisample
|
|
||||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
|
||||||
#define WGL_SAMPLES_3DFX 0x2061
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_multisample
|
|
||||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
|
||||||
#define WGL_SAMPLES_EXT 0x2042
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_digital_video_control
|
|
||||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
|
||||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
|
||||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
|
||||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_gamma
|
|
||||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
|
||||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_genlock
|
|
||||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
|
||||||
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
|
|
||||||
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
|
|
||||||
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
|
|
||||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
|
||||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
|
||||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
|
||||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
|
||||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_image_buffer
|
|
||||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
|
||||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_swap_frame_lock
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_render_depth_texture
|
|
||||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
|
||||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
|
||||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
|
||||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_render_texture_rectangle
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
|
||||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ATI_pixel_format_float
|
|
||||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_float_buffer
|
|
||||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
|
||||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
|
||||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
|
||||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
|
||||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
|
||||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_3DL_stereo_control
|
|
||||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
|
||||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
|
||||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
|
||||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_pixel_format_packed_float
|
|
||||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_framebuffer_sRGB
|
|
||||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_present_video
|
|
||||||
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_video_out
|
|
||||||
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
|
|
||||||
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
|
|
||||||
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
|
|
||||||
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
|
|
||||||
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
|
|
||||||
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
|
|
||||||
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
|
||||||
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
|
||||||
#define WGL_VIDEO_OUT_FRAME 0x20C8
|
|
||||||
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
|
|
||||||
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
|
|
||||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
|
|
||||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_swap_group
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_gpu_affinity
|
|
||||||
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
|
||||||
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_AMD_gpu_association
|
|
||||||
#define WGL_GPU_VENDOR_AMD 0x1F00
|
|
||||||
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
|
|
||||||
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
|
|
||||||
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
|
|
||||||
#define WGL_GPU_RAM_AMD 0x21A3
|
|
||||||
#define WGL_GPU_CLOCK_AMD 0x21A4
|
|
||||||
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
|
|
||||||
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
|
|
||||||
#define WGL_GPU_NUM_RB_AMD 0x21A7
|
|
||||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_video_capture
|
|
||||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
|
||||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_copy_image
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_multisample_coverage
|
|
||||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
|
||||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_create_context_es2_profile
|
|
||||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_DX_interop
|
|
||||||
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
|
|
||||||
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
|
|
||||||
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_DX_interop2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_swap_control_tear
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_pbuffer
|
|
||||||
DECLARE_HANDLE(HPBUFFERARB);
|
|
||||||
#endif
|
|
||||||
#ifndef WGL_EXT_pbuffer
|
|
||||||
DECLARE_HANDLE(HPBUFFEREXT);
|
|
||||||
#endif
|
|
||||||
#ifndef WGL_NV_present_video
|
|
||||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
|
||||||
#endif
|
|
||||||
#ifndef WGL_NV_video_output
|
|
||||||
DECLARE_HANDLE(HPVIDEODEV);
|
|
||||||
#endif
|
|
||||||
#ifndef WGL_NV_gpu_affinity
|
|
||||||
DECLARE_HANDLE(HPGPUNV);
|
|
||||||
DECLARE_HANDLE(HGPUNV);
|
|
||||||
|
|
||||||
typedef struct _GPU_DEVICE {
|
|
||||||
DWORD cb;
|
|
||||||
CHAR DeviceName[32];
|
|
||||||
CHAR DeviceString[128];
|
|
||||||
DWORD Flags;
|
|
||||||
RECT rcVirtualScreen;
|
|
||||||
} GPU_DEVICE, *PGPU_DEVICE;
|
|
||||||
#endif
|
|
||||||
#ifndef WGL_NV_video_capture
|
|
||||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_buffer_region
|
|
||||||
#define WGL_ARB_buffer_region 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
|
|
||||||
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
|
|
||||||
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
|
|
||||||
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
|
||||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_multisample
|
|
||||||
#define WGL_ARB_multisample 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_extensions_string
|
|
||||||
#define WGL_ARB_extensions_string 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_pixel_format
|
|
||||||
#define WGL_ARB_pixel_format 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
|
||||||
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
|
||||||
extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_make_current_read
|
|
||||||
#define WGL_ARB_make_current_read 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
|
||||||
extern HDC WINAPI wglGetCurrentReadDCARB (void);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
|
||||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_pbuffer
|
|
||||||
#define WGL_ARB_pbuffer 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
|
||||||
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
|
|
||||||
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
|
|
||||||
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
|
|
||||||
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
|
||||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
|
||||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_render_texture
|
|
||||||
#define WGL_ARB_render_texture 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
|
||||||
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
|
||||||
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_pixel_format_float
|
|
||||||
#define WGL_ARB_pixel_format_float 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_framebuffer_sRGB
|
|
||||||
#define WGL_ARB_framebuffer_sRGB 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_create_context
|
|
||||||
#define WGL_ARB_create_context 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_create_context_profile
|
|
||||||
#define WGL_ARB_create_context_profile 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ARB_create_context_robustness
|
|
||||||
#define WGL_ARB_create_context_robustness 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_display_color_table
|
|
||||||
#define WGL_EXT_display_color_table 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
|
|
||||||
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
|
|
||||||
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
|
|
||||||
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
|
||||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
|
||||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
|
||||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_extensions_string
|
|
||||||
#define WGL_EXT_extensions_string 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern const char * WINAPI wglGetExtensionsStringEXT (void);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_make_current_read
|
|
||||||
#define WGL_EXT_make_current_read 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
|
||||||
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
|
||||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_pbuffer
|
|
||||||
#define WGL_EXT_pbuffer 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
|
||||||
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
|
|
||||||
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
|
|
||||||
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
|
|
||||||
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
|
||||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
|
||||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_pixel_format
|
|
||||||
#define WGL_EXT_pixel_format 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
|
||||||
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
|
||||||
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_swap_control
|
|
||||||
#define WGL_EXT_swap_control 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglSwapIntervalEXT (int interval);
|
|
||||||
extern int WINAPI wglGetSwapIntervalEXT (void);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
|
||||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_depth_float
|
|
||||||
#define WGL_EXT_depth_float 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_vertex_array_range
|
|
||||||
#define WGL_NV_vertex_array_range 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
|
||||||
extern void WINAPI wglFreeMemoryNV (void *pointer);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
|
||||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_3DFX_multisample
|
|
||||||
#define WGL_3DFX_multisample 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_multisample
|
|
||||||
#define WGL_EXT_multisample 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_OML_sync_control
|
|
||||||
#define WGL_OML_sync_control 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
|
||||||
extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
|
|
||||||
extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
|
||||||
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
|
||||||
extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
|
||||||
extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
|
||||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
|
||||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_digital_video_control
|
|
||||||
#define WGL_I3D_digital_video_control 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
|
||||||
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_gamma
|
|
||||||
#define WGL_I3D_gamma 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
|
||||||
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
|
||||||
extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
|
||||||
extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_genlock
|
|
||||||
#define WGL_I3D_genlock 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
|
|
||||||
extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
|
|
||||||
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
|
|
||||||
extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
|
|
||||||
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
|
|
||||||
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
|
|
||||||
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
|
|
||||||
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
|
|
||||||
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
|
|
||||||
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
|
|
||||||
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
|
|
||||||
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_image_buffer
|
|
||||||
#define WGL_I3D_image_buffer 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
|
|
||||||
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
|
|
||||||
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
|
||||||
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_swap_frame_lock
|
|
||||||
#define WGL_I3D_swap_frame_lock 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglEnableFrameLockI3D (void);
|
|
||||||
extern BOOL WINAPI wglDisableFrameLockI3D (void);
|
|
||||||
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
|
|
||||||
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_I3D_swap_frame_usage
|
|
||||||
#define WGL_I3D_swap_frame_usage 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
|
|
||||||
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
|
||||||
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
|
|
||||||
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_ATI_pixel_format_float
|
|
||||||
#define WGL_ATI_pixel_format_float 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_float_buffer
|
|
||||||
#define WGL_NV_float_buffer 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_3DL_stereo_control
|
|
||||||
#define WGL_3DL_stereo_control 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_pixel_format_packed_float
|
|
||||||
#define WGL_EXT_pixel_format_packed_float 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_framebuffer_sRGB
|
|
||||||
#define WGL_EXT_framebuffer_sRGB 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_present_video
|
|
||||||
#define WGL_NV_present_video 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
|
||||||
extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
|
||||||
extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_video_output
|
|
||||||
#define WGL_NV_video_output 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
|
||||||
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
|
|
||||||
extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
|
||||||
extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
|
||||||
extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
|
||||||
extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_swap_group
|
|
||||||
#define WGL_NV_swap_group 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
|
|
||||||
extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
|
|
||||||
extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
|
|
||||||
extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
|
||||||
extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
|
|
||||||
extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_gpu_affinity
|
|
||||||
#define WGL_NV_gpu_affinity 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
|
|
||||||
extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
|
||||||
extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
|
|
||||||
extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
|
||||||
extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
|
||||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_AMD_gpu_association
|
|
||||||
#define WGL_AMD_gpu_association 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
|
|
||||||
extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
|
|
||||||
extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
|
|
||||||
extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
|
|
||||||
extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
|
|
||||||
extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
|
|
||||||
extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
|
|
||||||
extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
|
|
||||||
extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
|
|
||||||
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
|
|
||||||
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
|
|
||||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
|
|
||||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
|
|
||||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
|
||||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_video_capture
|
|
||||||
#define WGL_NV_video_capture 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
|
||||||
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
|
||||||
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
|
||||||
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
|
||||||
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
|
||||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_copy_image
|
|
||||||
#define WGL_NV_copy_image 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_multisample_coverage
|
|
||||||
#define WGL_NV_multisample_coverage 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_DX_interop
|
|
||||||
#define WGL_NV_DX_interop 1
|
|
||||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
|
||||||
extern BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
|
|
||||||
extern HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
|
|
||||||
extern BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
|
|
||||||
extern HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
|
||||||
extern BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
|
|
||||||
extern BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
|
|
||||||
extern BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
|
||||||
extern BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
|
||||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
|
|
||||||
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
|
|
||||||
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
|
||||||
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_NV_DX_interop2
|
|
||||||
#define WGL_NV_DX_interop2 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WGL_EXT_swap_control_tear
|
|
||||||
#define WGL_EXT_swap_control_tear 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
/*
|
// This file was automatically generated by Nazara
|
||||||
Nazara Engine
|
|
||||||
|
|
||||||
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
/*
|
||||||
|
Nazara Engine - Audio module
|
||||||
|
|
||||||
|
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
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
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -24,12 +26,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef NAZARA_CONFIG_NETWORK_HPP
|
#include <Nazara/Audio/Audio.hpp>
|
||||||
#define NAZARA_CONFIG_NETWORK_HPP
|
#include <Nazara/Audio/Config.hpp>
|
||||||
|
#include <Nazara/Audio/Enums.hpp>
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
#include <Nazara/Audio/Sound.hpp>
|
||||||
|
#include <Nazara/Audio/SoundBuffer.hpp>
|
||||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
#include <Nazara/Audio/SoundEmitter.hpp>
|
||||||
#define NAZARA_NETWORK_MEMORYLEAKTRACKER 0
|
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_NETWORK_HPP
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_AUDIO_HPP
|
||||||
|
#define NAZARA_AUDIO_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Audio/Enums.hpp>
|
||||||
|
#include <Nazara/Core/Initializer.hpp>
|
||||||
|
#include <Nazara/Math/Quaternion.hpp>
|
||||||
|
#include <Nazara/Math/Vector3.hpp>
|
||||||
|
|
||||||
|
class NAZARA_API NzAudio
|
||||||
|
{
|
||||||
|
friend class NzMusic;
|
||||||
|
friend class NzSoundBuffer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
NzAudio() = delete;
|
||||||
|
~NzAudio() = delete;
|
||||||
|
|
||||||
|
static nzAudioFormat GetAudioFormat(unsigned int channelCount);
|
||||||
|
static float GetDopplerFactor();
|
||||||
|
static float GetGlobalVolume();
|
||||||
|
static NzVector3f GetListenerDirection();
|
||||||
|
static NzVector3f GetListenerPosition();
|
||||||
|
//static NzQuaternionf GetListenerRotation();
|
||||||
|
static NzVector3f GetListenerVelocity();
|
||||||
|
static float GetSpeedOfSound();
|
||||||
|
|
||||||
|
static bool Initialize();
|
||||||
|
|
||||||
|
static bool IsFormatSupported(nzAudioFormat format);
|
||||||
|
static bool IsInitialized();
|
||||||
|
|
||||||
|
static void SetDopplerFactor(float dopplerFactor);
|
||||||
|
static void SetGlobalVolume(float volume);
|
||||||
|
static void SetListenerDirection(const NzVector3f& direction);
|
||||||
|
static void SetListenerDirection(float dirX, float dirY, float dirZ);
|
||||||
|
static void SetListenerPosition(const NzVector3f& position);
|
||||||
|
static void SetListenerPosition(float x, float y, float z);
|
||||||
|
//static void SetListenerRotation(const NzQuaternionf& rotation);
|
||||||
|
static void SetListenerVelocity(const NzVector3f& velocity);
|
||||||
|
static void SetListenerVelocity(float velX, float velY, float velZ);
|
||||||
|
static void SetSpeedOfSound(float speed);
|
||||||
|
|
||||||
|
static void Uninitialize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static unsigned int GetOpenALFormat(nzAudioFormat format);
|
||||||
|
|
||||||
|
static unsigned int s_moduleReferenceCouter;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_AUDIO_HPP
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine
|
Nazara Engine - Audio module
|
||||||
|
|
||||||
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
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
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -27,9 +27,15 @@
|
||||||
#ifndef NAZARA_CONFIG_AUDIO_HPP
|
#ifndef NAZARA_CONFIG_AUDIO_HPP
|
||||||
#define NAZARA_CONFIG_AUDIO_HPP
|
#define NAZARA_CONFIG_AUDIO_HPP
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||||
#define NAZARA_AUDIO_MEMORYLEAKTRACKER 0
|
#define NAZARA_AUDIO_MEMORYLEAKTRACKER 0
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_AUDIOs_HPP
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
|
#define NAZARA_AUDIO_SAFE 1
|
||||||
|
|
||||||
|
// Le nombre de buffers utilisés lors du streaming d'objets audio (Au moins deux)
|
||||||
|
#define NAZARA_AUDIO_STREAMEDBUFFERCOUNT 2
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_AUDIO_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Audio/Config.hpp>
|
#include <Nazara/Audio/Config.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_AUDIO_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
#if NAZARA_AUDIO_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_ENUMS_HPP
|
||||||
|
#define NAZARA_ENUMS_HPP
|
||||||
|
|
||||||
|
enum nzAudioFormat
|
||||||
|
{
|
||||||
|
nzAudioFormat_Unknown = -1,
|
||||||
|
|
||||||
|
// La valeur entière est le nombre de canaux possédés par ce format
|
||||||
|
nzAudioFormat_Mono = 1,
|
||||||
|
nzAudioFormat_Stereo = 2,
|
||||||
|
nzAudioFormat_Quad = 4,
|
||||||
|
nzAudioFormat_5_1 = 6,
|
||||||
|
nzAudioFormat_6_1 = 7,
|
||||||
|
nzAudioFormat_7_1 = 8,
|
||||||
|
|
||||||
|
nzAudioFormat_Max = nzAudioFormat_7_1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum nzSoundStatus
|
||||||
|
{
|
||||||
|
nzSoundStatus_Playing,
|
||||||
|
nzSoundStatus_Paused,
|
||||||
|
nzSoundStatus_Stopped
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_ENUMS_HPP
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_SOUND_HPP
|
||||||
|
#define NAZARA_SOUND_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Audio/Enums.hpp>
|
||||||
|
#include <Nazara/Audio/SoundBuffer.hpp>
|
||||||
|
#include <Nazara/Audio/SoundEmitter.hpp>
|
||||||
|
|
||||||
|
class NAZARA_API NzSound : public NzSoundEmitter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NzSound() = default;
|
||||||
|
NzSound(const NzSoundBuffer* soundBuffer);
|
||||||
|
NzSound(const NzSound& sound);
|
||||||
|
~NzSound();
|
||||||
|
|
||||||
|
void EnableLooping(bool loop);
|
||||||
|
|
||||||
|
const NzSoundBuffer* GetBuffer() const;
|
||||||
|
nzUInt32 GetDuration() const;
|
||||||
|
nzUInt32 GetPlayingOffset() const;
|
||||||
|
nzSoundStatus GetStatus() const;
|
||||||
|
|
||||||
|
bool IsLooping() const;
|
||||||
|
|
||||||
|
bool LoadFromFile(const NzString& filePath, const NzSoundBufferParams& params = NzSoundBufferParams());
|
||||||
|
bool LoadFromMemory(const void* data, std::size_t size, const NzSoundBufferParams& params = NzSoundBufferParams());
|
||||||
|
bool LoadFromStream(NzInputStream& stream, const NzSoundBufferParams& params = NzSoundBufferParams());
|
||||||
|
|
||||||
|
void Pause();
|
||||||
|
bool Play();
|
||||||
|
|
||||||
|
void SetBuffer(const NzSoundBuffer* buffer);
|
||||||
|
void SetPlayingOffset(nzUInt32 offset);
|
||||||
|
|
||||||
|
void Stop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
const NzSoundBuffer* m_buffer = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_SOUND_HPP
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_SOUNDBUFFER_HPP
|
||||||
|
#define NAZARA_SOUNDBUFFER_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Audio/Enums.hpp>
|
||||||
|
#include <Nazara/Core/InputStream.hpp>
|
||||||
|
#include <Nazara/Core/NonCopyable.hpp>
|
||||||
|
#include <Nazara/Core/Resource.hpp>
|
||||||
|
#include <Nazara/Core/ResourceLoader.hpp>
|
||||||
|
|
||||||
|
struct NzSoundBufferParams
|
||||||
|
{
|
||||||
|
bool IsValid() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NzSound;
|
||||||
|
class NzSoundBuffer;
|
||||||
|
|
||||||
|
using NzSoundBufferLoader = NzResourceLoader<NzSoundBuffer, NzSoundBufferParams>;
|
||||||
|
|
||||||
|
struct NzSoundBufferImpl;
|
||||||
|
|
||||||
|
class NAZARA_API NzSoundBuffer : public NzResource, public NzNonCopyable
|
||||||
|
{
|
||||||
|
friend NzSound;
|
||||||
|
friend NzSoundBufferLoader;
|
||||||
|
|
||||||
|
public:
|
||||||
|
NzSoundBuffer() = default;
|
||||||
|
NzSoundBuffer(nzAudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const nzInt16* samples);
|
||||||
|
~NzSoundBuffer();
|
||||||
|
|
||||||
|
bool Create(nzAudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const nzInt16* samples);
|
||||||
|
void Destroy();
|
||||||
|
|
||||||
|
nzUInt32 GetDuration() const;
|
||||||
|
nzAudioFormat GetFormat() const;
|
||||||
|
const nzInt16* GetSamples() const;
|
||||||
|
unsigned int GetSampleCount() const;
|
||||||
|
unsigned int GetSampleRate() const;
|
||||||
|
|
||||||
|
bool IsValid() const;
|
||||||
|
|
||||||
|
bool LoadFromFile(const NzString& filePath, const NzSoundBufferParams& params = NzSoundBufferParams());
|
||||||
|
bool LoadFromMemory(const void* data, std::size_t size, const NzSoundBufferParams& params = NzSoundBufferParams());
|
||||||
|
bool LoadFromStream(NzInputStream& stream, const NzSoundBufferParams& params = NzSoundBufferParams());
|
||||||
|
|
||||||
|
static bool IsFormatSupported(nzAudioFormat format);
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int GetOpenALBuffer() const;
|
||||||
|
|
||||||
|
NzSoundBufferImpl* m_impl = nullptr;
|
||||||
|
|
||||||
|
static NzSoundBufferLoader::LoaderList s_loaders;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_SOUNDBUFFER_HPP
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_SOUNDEMITTER_HPP
|
||||||
|
#define NAZARA_SOUNDEMITTER_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Audio/Enums.hpp>
|
||||||
|
#include <Nazara/Core/InputStream.hpp>
|
||||||
|
#include <Nazara/Core/NonCopyable.hpp>
|
||||||
|
#include <Nazara/Math/Vector3.hpp>
|
||||||
|
|
||||||
|
class NAZARA_API NzSoundEmitter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~NzSoundEmitter();
|
||||||
|
|
||||||
|
virtual void EnableLooping(bool loop) = 0;
|
||||||
|
void EnableSpatialization(bool spatialization);
|
||||||
|
|
||||||
|
float GetAttenuation() const;
|
||||||
|
virtual nzUInt32 GetDuration() const = 0;
|
||||||
|
float GetMinDistance() const;
|
||||||
|
float GetPitch() const;
|
||||||
|
virtual nzUInt32 GetPlayingOffset() const = 0;
|
||||||
|
NzVector3f GetPosition() const;
|
||||||
|
NzVector3f GetVelocity() const;
|
||||||
|
virtual nzSoundStatus GetStatus() const = 0;
|
||||||
|
float GetVolume() const;
|
||||||
|
|
||||||
|
virtual bool IsLooping() const = 0;
|
||||||
|
bool IsSpatialized() const;
|
||||||
|
|
||||||
|
virtual void Pause() = 0;
|
||||||
|
virtual bool Play() = 0;
|
||||||
|
|
||||||
|
void SetAttenuation(float attenuation);
|
||||||
|
void SetMinDistance(float minDistance);
|
||||||
|
void SetPitch(float pitch);
|
||||||
|
void SetPosition(const NzVector3f& position);
|
||||||
|
void SetPosition(float x, float y, float z);
|
||||||
|
void SetVelocity(const NzVector3f& velocity);
|
||||||
|
void SetVelocity(float velX, float velY, float velZ);
|
||||||
|
void SetVolume(float volume);
|
||||||
|
|
||||||
|
virtual void Stop() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NzSoundEmitter();
|
||||||
|
NzSoundEmitter(const NzSoundEmitter& emitter);
|
||||||
|
|
||||||
|
nzSoundStatus GetInternalStatus() const;
|
||||||
|
|
||||||
|
unsigned int m_source;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_SOUNDEMITTER_HPP
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
// This file was automatically generated by Nazara
|
||||||
|
|
||||||
|
/*
|
||||||
|
Nazara Engine - Core module
|
||||||
|
|
||||||
|
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||||
|
|
||||||
|
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
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Nazara/Core/ByteArray.hpp>
|
||||||
|
#include <Nazara/Core/Clock.hpp>
|
||||||
|
#include <Nazara/Core/Color.hpp>
|
||||||
|
#include <Nazara/Core/ConditionVariable.hpp>
|
||||||
|
#include <Nazara/Core/Config.hpp>
|
||||||
|
#include <Nazara/Core/Core.hpp>
|
||||||
|
#include <Nazara/Core/Directory.hpp>
|
||||||
|
#include <Nazara/Core/DynLib.hpp>
|
||||||
|
#include <Nazara/Core/Endianness.hpp>
|
||||||
|
#include <Nazara/Core/Enums.hpp>
|
||||||
|
#include <Nazara/Core/Error.hpp>
|
||||||
|
#include <Nazara/Core/File.hpp>
|
||||||
|
#include <Nazara/Core/Format.hpp>
|
||||||
|
#include <Nazara/Core/Functor.hpp>
|
||||||
|
#include <Nazara/Core/Hash.hpp>
|
||||||
|
#include <Nazara/Core/Hashable.hpp>
|
||||||
|
#include <Nazara/Core/HashDigest.hpp>
|
||||||
|
#include <Nazara/Core/HashImpl.hpp>
|
||||||
|
#include <Nazara/Core/Initializer.hpp>
|
||||||
|
#include <Nazara/Core/InputStream.hpp>
|
||||||
|
#include <Nazara/Core/LockGuard.hpp>
|
||||||
|
#include <Nazara/Core/Log.hpp>
|
||||||
|
#include <Nazara/Core/MemoryStream.hpp>
|
||||||
|
#include <Nazara/Core/Mutex.hpp>
|
||||||
|
#include <Nazara/Core/NonCopyable.hpp>
|
||||||
|
#include <Nazara/Core/Resource.hpp>
|
||||||
|
#include <Nazara/Core/ResourceListener.hpp>
|
||||||
|
#include <Nazara/Core/ResourceLoader.hpp>
|
||||||
|
#include <Nazara/Core/Semaphore.hpp>
|
||||||
|
#include <Nazara/Core/String.hpp>
|
||||||
|
#include <Nazara/Core/StringStream.hpp>
|
||||||
|
#include <Nazara/Core/Thread.hpp>
|
||||||
|
#include <Nazara/Core/Tuple.hpp>
|
||||||
|
#include <Nazara/Core/Unicode.hpp>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
#define NAZARA_BYTEARRAY_HPP
|
#define NAZARA_BYTEARRAY_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequesites.hpp>
|
#include <Nazara/Prerequesites.hpp>
|
||||||
#include <Nazara/Core/Conig.hpp>
|
#include <Nazara/Core/Config.hpp>
|
||||||
#include <Nazara/Core/Hashable.hpp>
|
#include <Nazara/Core/Hashable.hpp>
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_BYTEARRAY
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_BYTEARRAY
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
|
@ -28,7 +28,7 @@ class NAZARA_API NzByteArray : public NzHashable
|
||||||
NzByteArray();
|
NzByteArray();
|
||||||
NzByteArray(const nzUInt8* buffer, unsigned int bufferLength);
|
NzByteArray(const nzUInt8* buffer, unsigned int bufferLength);
|
||||||
NzByteArray(const NzByteArray& buffer);
|
NzByteArray(const NzByteArray& buffer);
|
||||||
NzByteArray(NzByteArray&& buffer);
|
NzByteArray(NzByteArray&& buffer) noexcept;
|
||||||
NzByteArray(SharedArray* sharedArray);
|
NzByteArray(SharedArray* sharedArray);
|
||||||
~NzByteArray();
|
~NzByteArray();
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ class NAZARA_API NzByteArray : public NzHashable
|
||||||
NzByteArray& Trim(nzUInt8 byte = '\0');
|
NzByteArray& Trim(nzUInt8 byte = '\0');
|
||||||
NzByteArray Trimmed(nzUInt8 byte = '\0') const;
|
NzByteArray Trimmed(nzUInt8 byte = '\0') const;
|
||||||
|
|
||||||
// Méthodes compatibles STD
|
// Méthodes compatibles STD
|
||||||
nzUInt8* begin();
|
nzUInt8* begin();
|
||||||
const nzUInt8* begin() const;
|
const nzUInt8* begin() const;
|
||||||
nzUInt8* end();
|
nzUInt8* end();
|
||||||
|
|
@ -74,13 +74,13 @@ class NAZARA_API NzByteArray : public NzHashable
|
||||||
typedef nzUInt8* iterator;
|
typedef nzUInt8* iterator;
|
||||||
//typedef nzUInt8* reverse_iterator;
|
//typedef nzUInt8* reverse_iterator;
|
||||||
typedef nzUInt8 value_type;
|
typedef nzUInt8 value_type;
|
||||||
// Méthodes compatibles STD
|
// Méthodes compatibles STD
|
||||||
|
|
||||||
nzUInt8& operator[](unsigned int pos);
|
nzUInt8& operator[](unsigned int pos);
|
||||||
nzUInt8 operator[](unsigned int pos) const;
|
nzUInt8 operator[](unsigned int pos) const;
|
||||||
|
|
||||||
NzByteArray& operator=(const NzByteArray& byteArray);
|
NzByteArray& operator=(const NzByteArray& byteArray);
|
||||||
NzByteArray& operator=(NzByteArray&& byteArray);
|
NzByteArray& operator=(NzByteArray&& byteArray) noexcept;
|
||||||
|
|
||||||
NzByteArray operator+(const NzByteArray& byteArray) const;
|
NzByteArray operator+(const NzByteArray& byteArray) const;
|
||||||
NzByteArray& operator+=(const NzByteArray& byteArray);
|
NzByteArray& operator+=(const NzByteArray& byteArray);
|
||||||
|
|
@ -89,10 +89,7 @@ class NAZARA_API NzByteArray : public NzHashable
|
||||||
|
|
||||||
struct NAZARA_API SharedArray
|
struct NAZARA_API SharedArray
|
||||||
{
|
{
|
||||||
SharedArray() :
|
SharedArray() = default;
|
||||||
refCount(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedArray(unsigned short referenceCount, unsigned int bufferSize, unsigned int arraySize, nzUInt8* ptr) :
|
SharedArray(unsigned short referenceCount, unsigned int bufferSize, unsigned int arraySize, nzUInt8* ptr) :
|
||||||
capacity(bufferSize),
|
capacity(bufferSize),
|
||||||
|
|
@ -104,7 +101,7 @@ class NAZARA_API NzByteArray : public NzHashable
|
||||||
|
|
||||||
unsigned int capacity;
|
unsigned int capacity;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned short refCount;
|
unsigned short refCount = 1;
|
||||||
nzUInt8* buffer;
|
nzUInt8* buffer;
|
||||||
|
|
||||||
NazaraMutex(mutex)
|
NazaraMutex(mutex)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <Nazara/Prerequesites.hpp>
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_CLOCK
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_CLOCK
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
// http://www.easyrgb.com/index.php?X=MATH
|
// http://www.easyrgb.com/index.php?X=MATH
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <Nazara/Utility/Debug.hpp>
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
inline NzColor::NzColor()
|
inline NzColor::NzColor()
|
||||||
{
|
{
|
||||||
|
|
@ -198,26 +198,26 @@ inline NzColor NzColor::FromXYZ(float x, float y, float z)
|
||||||
y /= 100; // Y from 0 to 100.000
|
y /= 100; // Y from 0 to 100.000
|
||||||
z /= 100; // Z from 0 to 108.883
|
z /= 100; // Z from 0 to 108.883
|
||||||
|
|
||||||
double r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
float r = x * 3.2406f + y * -1.5372f + z * -0.4986f;
|
||||||
double g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
float g = x * -0.9689f + y * 1.8758f + z * 0.0415f;
|
||||||
double b = x * 0.0557 + y * -0.2040 + z * 1.0570;
|
float b = x * 0.0557f + y * -0.2040f + z * 1.0570f;
|
||||||
|
|
||||||
if (r > 0.0031308f)
|
if (r > 0.0031308f)
|
||||||
r = 1.055 * (std::pow(r, 1.0/2.4)) - 0.055;
|
r = 1.055f * (std::pow(r, 1.f/2.4f)) - 0.055f;
|
||||||
else
|
else
|
||||||
r *= 12.92;
|
r *= 12.92f;
|
||||||
|
|
||||||
if (g > 0.0031308f)
|
if (g > 0.0031308f)
|
||||||
g = 1.055 * (std::pow(g, 1.0/2.4)) - 0.055;
|
g = 1.055f * (std::pow(r, 1.f/2.4f)) - 0.055f;
|
||||||
else
|
else
|
||||||
g *= 12.92;
|
g *= 12.92f;
|
||||||
|
|
||||||
if (b > 0.0031308f)
|
if (b > 0.0031308f)
|
||||||
b = 1.055 * (std::pow(b, 1.0/2.4)) - 0.055;
|
b = 1.055f * (std::pow(r, 1.f/2.4f)) - 0.055f;
|
||||||
else
|
else
|
||||||
b *= 12.92;
|
b *= 12.92f;
|
||||||
|
|
||||||
return NzColor(r * 255.0, g * 255.0, b * 255.0);
|
return NzColor(r * 255.f, g * 255.f, b * 255.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void NzColor::ToCMY(const NzColor& color, float* cyan, float* magenta, float* yellow)
|
inline void NzColor::ToCMY(const NzColor& color, float* cyan, float* magenta, float* yellow)
|
||||||
|
|
@ -378,7 +378,7 @@ inline void NzColor::ToXYZ(const NzColor& color, float* x, float* y, float* z)
|
||||||
g *= 100.0;
|
g *= 100.0;
|
||||||
b *= 100.0;
|
b *= 100.0;
|
||||||
|
|
||||||
//Observer. = 2°, Illuminant = D65
|
//Observer. = 2°, Illuminant = D65
|
||||||
*x = r*0.4124 + g*0.3576 + b*0.1805;
|
*x = r*0.4124 + g*0.3576 + b*0.1805;
|
||||||
*y = r*0.2126 + g*0.7152 + b*0.0722;
|
*y = r*0.2126 + g*0.7152 + b*0.0722;
|
||||||
*z = r*0.0193 + g*0.1192 + b*0.9505;
|
*z = r*0.0193 + g*0.1192 + b*0.9505;
|
||||||
|
|
@ -409,4 +409,4 @@ inline std::ostream& operator<<(std::ostream& out, const NzColor& color)
|
||||||
return out << color.ToString();
|
return out << color.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Utility/DebugOff.hpp>
|
#include <Nazara/Core/DebugOff.hpp>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONDITIONVARIABLE_HPP
|
||||||
|
#define NAZARA_CONDITIONVARIABLE_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
|
||||||
|
class NzConditionVariableImpl;
|
||||||
|
class NzMutex;
|
||||||
|
|
||||||
|
class NAZARA_API NzConditionVariable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NzConditionVariable();
|
||||||
|
~NzConditionVariable();
|
||||||
|
|
||||||
|
void Signal();
|
||||||
|
void SignalAll();
|
||||||
|
|
||||||
|
void Wait(NzMutex* mutex);
|
||||||
|
bool Wait(NzMutex* mutex, nzUInt32 timeout);
|
||||||
|
|
||||||
|
private:
|
||||||
|
NzConditionVariableImpl* m_impl;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_CONDITIONVARIABLE_HPP
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine
|
Nazara Engine - Core module
|
||||||
|
|
||||||
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||||
|
|
||||||
|
|
@ -44,34 +44,37 @@
|
||||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||||
#define NAZARA_CORE_MEMORYLEAKTRACKER 0
|
#define NAZARA_CORE_MEMORYLEAKTRACKER 0
|
||||||
|
|
||||||
// Standardise les séparateurs des dossiers selon le système d'exploitation courant
|
// Standardise les séparateurs des dossiers selon le système d'exploitation courant (Léger coût à l'exécution)
|
||||||
#define NAZARA_CORE_NORMALIZE_DIRECTORY_SEPARATORS 1
|
#define NAZARA_CORE_NORMALIZE_DIRECTORY_SEPARATORS 1
|
||||||
|
|
||||||
// Précision des réels lors de la transformation en texte (Max. chiffres après la virgule)
|
// Précision des réels lors de la transformation en texte (Max. chiffres après la virgule)
|
||||||
#define NAZARA_CORE_REAL_PRECISION 6
|
#define NAZARA_CORE_REAL_PRECISION 6
|
||||||
|
|
||||||
// Redirige la sortie du log sur le flux d'erreur standard (cerr) en cas d'erreur d'écriture (ou d'ouverture du fichier)
|
// Duplique la sortie du log sur le flux de sortie standard (cout)
|
||||||
#define NAZARA_CORE_REDIRECT_TO_CERR_ON_LOG_FAILURE 1
|
#define NAZARA_CORE_DUPLICATE_TO_COUT 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_CORE_SAFE 1
|
#define NAZARA_CORE_SAFE 1
|
||||||
|
|
||||||
// Protège le module des accès concurrentiels
|
// Protège les classes des accès concurrentiels
|
||||||
#define NAZARA_CORE_THREADSAFE 1
|
#define NAZARA_CORE_THREADSAFE 1
|
||||||
|
|
||||||
#if NAZARA_CORE_THREADSAFE
|
// Les classes à protéger des accès concurrentiels
|
||||||
#define NAZARA_THREADSAFETY_BYTEARRAY 1 // NzByteArray (COW)
|
#define NAZARA_THREADSAFETY_BYTEARRAY 1 // NzByteArray (COW)
|
||||||
#define NAZARA_THREADSAFETY_CLOCK 0 // NzClock
|
#define NAZARA_THREADSAFETY_CLOCK 0 // NzClock
|
||||||
#define NAZARA_THREADSAFETY_DIRECTORY 1 // NzDirectory
|
#define NAZARA_THREADSAFETY_DIRECTORY 1 // NzDirectory
|
||||||
#define NAZARA_THREADSAFETY_DYNLIB 1 // NzDynLib
|
#define NAZARA_THREADSAFETY_DYNLIB 1 // NzDynLib
|
||||||
#define NAZARA_THREADSAFETY_FILE 1 // NzFile
|
#define NAZARA_THREADSAFETY_FILE 1 // NzFile
|
||||||
#define NAZARA_THREADSAFETY_HASHDIGEST 0 // NzHashDigest
|
#define NAZARA_THREADSAFETY_HASHDIGEST 0 // NzHashDigest
|
||||||
#define NAZARA_THREADSAFETY_LOG 1 // NzLog
|
#define NAZARA_THREADSAFETY_LOG 1 // NzLog
|
||||||
#define NAZARA_THREADSAFETY_STRING 1 // NzString (COW)
|
#define NAZARA_THREADSAFETY_RESOURCE 1 // NzResource
|
||||||
#define NAZARA_THREADSAFETY_STRINGSTREAM 0 // NzStringStream
|
#define NAZARA_THREADSAFETY_STRING 1 // NzString (COW)
|
||||||
#endif
|
#define NAZARA_THREADSAFETY_STRINGSTREAM 0 // NzStringStream
|
||||||
|
|
||||||
// Optimise certaines parties du code avec les avancées venues de Windows Vista (Nécessite Vista ou supérieur et compilateur compatible)
|
// Le nombre de spinlocks à utiliser avec les critical sections de Windows (0 pour désactiver)
|
||||||
|
#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096
|
||||||
|
|
||||||
|
// Optimise certaines parties du code avec certaines avancées venues de Windows Vista (Casse la compatibilité XP mais n'affecte pas les autres OS)
|
||||||
#define NAZARA_CORE_WINDOWS_VISTA 0
|
#define NAZARA_CORE_WINDOWS_VISTA 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CORE_HPP
|
||||||
|
#define NAZARA_CORE_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Core/Initializer.hpp>
|
||||||
|
|
||||||
|
class NAZARA_API NzCore
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NzCore() = delete;
|
||||||
|
~NzCore() = delete;
|
||||||
|
|
||||||
|
static bool Initialize();
|
||||||
|
|
||||||
|
static bool IsInitialized();
|
||||||
|
|
||||||
|
static void Uninitialize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static unsigned int s_moduleReferenceCouter;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_CORE_HPP
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Core/Config.hpp>
|
#include <Nazara/Core/Config.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_CORE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
#if NAZARA_CORE_MEMORYLEAKTRACKER || defined(NAZARA_DEBUG)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#define NAZARA_DIRECTORY_SEPARATOR '/'
|
#define NAZARA_DIRECTORY_SEPARATOR '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_DIRECTORY
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_DIRECTORY
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
|
@ -36,10 +36,12 @@ class NAZARA_API NzDirectory
|
||||||
|
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
|
NzString GetPattern() const;
|
||||||
NzString GetResultName() const;
|
NzString GetResultName() const;
|
||||||
NzString GetResultPath() const;
|
NzString GetResultPath() const;
|
||||||
nzUInt64 GetResultSize() const;
|
nzUInt64 GetResultSize() const;
|
||||||
|
|
||||||
|
bool IsOpen() const;
|
||||||
bool IsResultDirectory() const;
|
bool IsResultDirectory() const;
|
||||||
|
|
||||||
bool NextResult(bool skipDots = true);
|
bool NextResult(bool skipDots = true);
|
||||||
|
|
@ -47,6 +49,7 @@ class NAZARA_API NzDirectory
|
||||||
bool Open();
|
bool Open();
|
||||||
|
|
||||||
void SetDirectory(const NzString& dirPath);
|
void SetDirectory(const NzString& dirPath);
|
||||||
|
void SetPattern(const NzString& pattern);
|
||||||
|
|
||||||
static bool Copy(const NzString& sourcePath, const NzString& destPath);
|
static bool Copy(const NzString& sourcePath, const NzString& destPath);
|
||||||
static bool Create(const NzString& dirPath, bool recursive = false);
|
static bool Create(const NzString& dirPath, bool recursive = false);
|
||||||
|
|
@ -59,7 +62,8 @@ class NAZARA_API NzDirectory
|
||||||
NazaraMutexAttrib(m_mutex, mutable)
|
NazaraMutexAttrib(m_mutex, mutable)
|
||||||
|
|
||||||
NzString m_dirPath;
|
NzString m_dirPath;
|
||||||
NzDirectoryImpl* m_impl;
|
NzString m_pattern;
|
||||||
|
NzDirectoryImpl* m_impl = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NAZARA_DIRECTORY_HPP
|
#endif // NAZARA_DIRECTORY_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -11,18 +11,18 @@
|
||||||
#include <Nazara/Core/NonCopyable.hpp>
|
#include <Nazara/Core/NonCopyable.hpp>
|
||||||
#include <Nazara/Core/String.hpp>
|
#include <Nazara/Core/String.hpp>
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_DYNLIB
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_DYNLIB
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class NzDynLibImpl;
|
class NzDynLibImpl;
|
||||||
typedef int (*NzDynLibFunc)(); // Type "générique" de pointeur sur fonction
|
typedef int (*NzDynLibFunc)(); // Type "générique" de pointeur sur fonction
|
||||||
|
|
||||||
class NzDynLib : NzNonCopyable
|
class NzDynLib : NzNonCopyable
|
||||||
{
|
{
|
||||||
friend class NzDynLibImpl;
|
friend NzDynLibImpl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NzDynLib(const NzString& libraryPath);
|
NzDynLib(const NzString& libraryPath);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <Nazara/Core/Enums.hpp>
|
#include <Nazara/Core/Enums.hpp>
|
||||||
|
|
||||||
#if !defined(NAZARA_BIG_ENDIAN) && !defined(NAZARA_LITTLE_ENDIAN)
|
#if !defined(NAZARA_BIG_ENDIAN) && !defined(NAZARA_LITTLE_ENDIAN)
|
||||||
// Détection automatique selon les macros du compilateur
|
// Détection automatique selon les macros du compilateur
|
||||||
#if defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || (defined(__MIPS__) && defined(__MISPEB__)) || \
|
#if defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || (defined(__MIPS__) && defined(__MISPEB__)) || \
|
||||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || defined(__sparc__) || defined(__hppa__)
|
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || defined(__sparc__) || defined(__hppa__)
|
||||||
#define NAZARA_BIG_ENDIAN
|
#define NAZARA_BIG_ENDIAN
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -9,9 +9,12 @@
|
||||||
|
|
||||||
enum nzEndianness
|
enum nzEndianness
|
||||||
{
|
{
|
||||||
|
nzEndianness_Unknown = -1,
|
||||||
|
|
||||||
nzEndianness_BigEndian,
|
nzEndianness_BigEndian,
|
||||||
nzEndianness_LittleEndian,
|
nzEndianness_LittleEndian,
|
||||||
nzEndianness_Unknown
|
|
||||||
|
nzEndianness_Max = nzEndianness_LittleEndian
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nzErrorType
|
enum nzErrorType
|
||||||
|
|
@ -19,7 +22,16 @@ enum nzErrorType
|
||||||
nzErrorType_AssertFailed,
|
nzErrorType_AssertFailed,
|
||||||
nzErrorType_Internal,
|
nzErrorType_Internal,
|
||||||
nzErrorType_Normal,
|
nzErrorType_Normal,
|
||||||
nzErrorType_Warning
|
nzErrorType_Warning,
|
||||||
|
|
||||||
|
nzErrorType_Max = nzErrorType_Warning
|
||||||
|
};
|
||||||
|
|
||||||
|
enum nzStreamOptionFlags
|
||||||
|
{
|
||||||
|
nzStreamOption_None = 0x0,
|
||||||
|
|
||||||
|
nzStreamOption_Text = 0x1
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NAZARA_ENUMS_CORE_HPP
|
#endif // NAZARA_ENUMS_CORE_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
#include <Nazara/Core/NonCopyable.hpp>
|
#include <Nazara/Core/NonCopyable.hpp>
|
||||||
#include <Nazara/Core/String.hpp>
|
#include <Nazara/Core/String.hpp>
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_FILE
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_FILE
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
|
@ -29,7 +29,7 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
|
||||||
public:
|
public:
|
||||||
enum CursorPosition
|
enum CursorPosition
|
||||||
{
|
{
|
||||||
AtBegin, // Début du fichier
|
AtBegin, // Début du fichier
|
||||||
AtCurrent, // Position du pointeur
|
AtCurrent, // Position du pointeur
|
||||||
AtEnd // Fin du fichier
|
AtEnd // Fin du fichier
|
||||||
};
|
};
|
||||||
|
|
@ -38,19 +38,19 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
|
||||||
{
|
{
|
||||||
Current = 0x00, // Utilise le mode d'ouverture actuel
|
Current = 0x00, // Utilise le mode d'ouverture actuel
|
||||||
|
|
||||||
Append = 0x01, // Empêche l'écriture sur la partie déjà existante et met le curseur à la fin
|
Append = 0x01, // Empêche l'écriture sur la partie déjà existante et met le curseur à la fin
|
||||||
Lock = 0x02, // Empêche le fichier d'être modifié tant qu'il est ouvert
|
Lock = 0x02, // Empêche le fichier d'être modifié tant qu'il est ouvert
|
||||||
ReadOnly = 0x04, // Ouvre uniquement en lecture
|
ReadOnly = 0x04, // Ouvre uniquement en lecture
|
||||||
ReadWrite = 0x08, // Ouvre en lecture/écriture
|
ReadWrite = 0x08, // Ouvre en lecture/écriture
|
||||||
Text = 0x10, // Ouvre en mode texte
|
Text = 0x10, // Ouvre en mode texte
|
||||||
Truncate = 0x20, // Créé le fichier s'il n'existe pas et le vide s'il existe
|
Truncate = 0x20, // Créé le fichier s'il n'existe pas et le vide s'il existe
|
||||||
WriteOnly = 0x40 // Ouvre uniquement en écriture, créé le fichier s'il n'existe pas
|
WriteOnly = 0x40 // Ouvre uniquement en écriture, créé le fichier s'il n'existe pas
|
||||||
};
|
};
|
||||||
|
|
||||||
NzFile();
|
NzFile();
|
||||||
NzFile(const NzString& filePath);
|
NzFile(const NzString& filePath);
|
||||||
NzFile(const NzString& filePath, unsigned long openMode);
|
NzFile(const NzString& filePath, unsigned long openMode);
|
||||||
NzFile(NzFile&& file);
|
NzFile(NzFile&& file) noexcept;
|
||||||
~NzFile();
|
~NzFile();
|
||||||
|
|
||||||
bool Copy(const NzString& newFilePath);
|
bool Copy(const NzString& newFilePath);
|
||||||
|
|
@ -59,6 +59,7 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
|
||||||
bool Delete();
|
bool Delete();
|
||||||
|
|
||||||
bool EndOfFile() const;
|
bool EndOfFile() const;
|
||||||
|
bool EndOfStream() const;
|
||||||
|
|
||||||
bool Exists() const;
|
bool Exists() const;
|
||||||
|
|
||||||
|
|
@ -71,7 +72,6 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
|
||||||
NzString GetFileName() const;
|
NzString GetFileName() const;
|
||||||
time_t GetLastAccessTime() const;
|
time_t GetLastAccessTime() const;
|
||||||
time_t GetLastWriteTime() const;
|
time_t GetLastWriteTime() const;
|
||||||
NzString GetLine(unsigned int lineSize = 0);
|
|
||||||
nzUInt64 GetSize() const;
|
nzUInt64 GetSize() const;
|
||||||
|
|
||||||
bool IsOpen() const;
|
bool IsOpen() const;
|
||||||
|
|
@ -92,7 +92,7 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
|
||||||
std::size_t Write(const void* buffer, std::size_t typeSize, unsigned int count);
|
std::size_t Write(const void* buffer, std::size_t typeSize, unsigned int count);
|
||||||
|
|
||||||
NzFile& operator=(const NzString& filePath);
|
NzFile& operator=(const NzString& filePath);
|
||||||
NzFile& operator=(NzFile&& file);
|
NzFile& operator=(NzFile&& file) noexcept;
|
||||||
|
|
||||||
static NzString AbsolutePath(const NzString& filePath);
|
static NzString AbsolutePath(const NzString& filePath);
|
||||||
static bool Copy(const NzString& sourcePath, const NzString& targetPath);
|
static bool Copy(const NzString& sourcePath, const NzString& targetPath);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <Nazara/Core/Tuple.hpp>
|
#include <Nazara/Core/Tuple.hpp>
|
||||||
|
|
||||||
// Inspiré du code de la SFML par Laurent Gomila
|
// Inspiré du code de la SFML par Laurent Gomila
|
||||||
|
|
||||||
struct NzFunctor
|
struct NzFunctor
|
||||||
{
|
{
|
||||||
|
|
@ -18,27 +18,40 @@ struct NzFunctor
|
||||||
virtual void Run() = 0;
|
virtual void Run() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename F> struct NzFunctorWithoutArgs : NzFunctor
|
template<typename F>
|
||||||
|
struct NzFunctorWithoutArgs : NzFunctor
|
||||||
{
|
{
|
||||||
NzFunctorWithoutArgs(F func);
|
NzFunctorWithoutArgs(F func);
|
||||||
|
|
||||||
void Run();
|
void Run();
|
||||||
|
|
||||||
F function;
|
private:
|
||||||
|
F m_func;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename F, typename... Args> struct NzFunctorWithArgs : NzFunctor
|
template<typename F, typename... Args>
|
||||||
|
struct NzFunctorWithArgs : NzFunctor
|
||||||
{
|
{
|
||||||
NzFunctorWithArgs(F func, Args&... args);
|
NzFunctorWithArgs(F func, Args&... args);
|
||||||
|
|
||||||
void Run();
|
void Run();
|
||||||
|
|
||||||
F function;
|
private:
|
||||||
std::tuple<Args...> arguments;
|
F m_func;
|
||||||
|
std::tuple<Args...> m_args;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename F> struct NzFunctorWithoutArgs;
|
template<typename C>
|
||||||
template<typename F, typename... Args> struct NzFunctorWithArgs;
|
struct NzMemberWithoutArgs : NzFunctor
|
||||||
|
{
|
||||||
|
NzMemberWithoutArgs(void (C::*func)(), C* object);
|
||||||
|
|
||||||
|
void Run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void (C::*m_func)();
|
||||||
|
C* m_object;
|
||||||
|
};
|
||||||
|
|
||||||
#include <Nazara/Core/Functor.inl>
|
#include <Nazara/Core/Functor.inl>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,42 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
template<typename F> NzFunctorWithoutArgs<F>::NzFunctorWithoutArgs(F func) :
|
template<typename F>
|
||||||
function(func)
|
NzFunctorWithoutArgs<F>::NzFunctorWithoutArgs(F func) :
|
||||||
|
m_func(func)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F> void NzFunctorWithoutArgs<F>::Run()
|
template<typename F>
|
||||||
|
void NzFunctorWithoutArgs<F>::Run()
|
||||||
{
|
{
|
||||||
function();
|
m_func();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F, typename... Args> NzFunctorWithArgs<F, Args...>::NzFunctorWithArgs(F func, Args&... args) :
|
template<typename F, typename... Args>
|
||||||
function(func),
|
NzFunctorWithArgs<F, Args...>::NzFunctorWithArgs(F func, Args&... args) :
|
||||||
arguments(args...)
|
m_func(func),
|
||||||
|
m_args(args...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F, typename... Args> void NzFunctorWithArgs<F, Args...>::Run()
|
template<typename F, typename... Args>
|
||||||
|
void NzFunctorWithArgs<F, Args...>::Run()
|
||||||
{
|
{
|
||||||
NzUnpackTuple(function, arguments);
|
NzUnpackTuple(m_func, m_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename C>
|
||||||
|
NzMemberWithoutArgs<C>::NzMemberWithoutArgs(void (C::*func)(), C* object) :
|
||||||
|
m_func(func),
|
||||||
|
m_object(object)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename C>
|
||||||
|
void NzMemberWithoutArgs<C>::Run()
|
||||||
|
{
|
||||||
|
(m_object->*m_func)();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -17,7 +17,7 @@ class NAZARA_API NzHashDigest
|
||||||
NzHashDigest();
|
NzHashDigest();
|
||||||
NzHashDigest(const NzString& hashName, const nzUInt8* digest, unsigned int length);
|
NzHashDigest(const NzString& hashName, const nzUInt8* digest, unsigned int length);
|
||||||
NzHashDigest(const NzHashDigest& rhs);
|
NzHashDigest(const NzHashDigest& rhs);
|
||||||
NzHashDigest(NzHashDigest&& rhs);
|
NzHashDigest(NzHashDigest&& rhs) noexcept;
|
||||||
~NzHashDigest();
|
~NzHashDigest();
|
||||||
|
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
@ -31,7 +31,7 @@ class NAZARA_API NzHashDigest
|
||||||
nzUInt8 operator[](unsigned short pos) const;
|
nzUInt8 operator[](unsigned short pos) const;
|
||||||
|
|
||||||
NzHashDigest& operator=(const NzHashDigest& rhs);
|
NzHashDigest& operator=(const NzHashDigest& rhs);
|
||||||
NzHashDigest& operator=(NzHashDigest&& rhs);
|
NzHashDigest& operator=(NzHashDigest&& rhs) noexcept;
|
||||||
|
|
||||||
bool operator==(const NzHashDigest& rhs) const;
|
bool operator==(const NzHashDigest& rhs) const;
|
||||||
bool operator!=(const NzHashDigest& rhs) const;
|
bool operator!=(const NzHashDigest& rhs) const;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -22,7 +22,6 @@ enum nzHash
|
||||||
nzHash_Whirlpool
|
nzHash_Whirlpool
|
||||||
};
|
};
|
||||||
|
|
||||||
class NzHash;
|
|
||||||
class NzHashDigest;
|
class NzHashDigest;
|
||||||
class NzHashImpl;
|
class NzHashImpl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_INITIALIZER_HPP
|
||||||
|
#define NAZARA_INITIALIZER_HPP
|
||||||
|
|
||||||
|
///TODO: Utiliser les variadic template pour initialiser plusieurs modules à la fois ?
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class NzInitializer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template<typename... Args> NzInitializer(Args... args);
|
||||||
|
~NzInitializer();
|
||||||
|
|
||||||
|
bool IsInitialized() const;
|
||||||
|
|
||||||
|
operator bool() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include <Nazara/Core/Initializer.inl>
|
||||||
|
|
||||||
|
#endif // NAZARA_INITIALIZER_HPP
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
// http://www.easyrgb.com/index.php?X=MATH
|
||||||
|
|
||||||
|
#include <Nazara/Core/Initializer.hpp>
|
||||||
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
template<typename... Args>
|
||||||
|
NzInitializer<T>::NzInitializer(Args... args)
|
||||||
|
{
|
||||||
|
T::Initialize(args...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
NzInitializer<T>::~NzInitializer()
|
||||||
|
{
|
||||||
|
if (T::IsInitialized())
|
||||||
|
T::Uninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
bool NzInitializer<T>::IsInitialized() const
|
||||||
|
{
|
||||||
|
return T::IsInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
NzInitializer<T>::operator bool() const
|
||||||
|
{
|
||||||
|
return T::IsInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Core/DebugOff.hpp>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -8,18 +8,21 @@
|
||||||
#define NAZARA_INPUTSTREAM_HPP
|
#define NAZARA_INPUTSTREAM_HPP
|
||||||
|
|
||||||
#include <Nazara/Prerequesites.hpp>
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Core/Stream.hpp>
|
||||||
|
|
||||||
class NzInputStream
|
class NzString;
|
||||||
|
|
||||||
|
class NAZARA_API NzInputStream : public NzStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~NzInputStream();
|
virtual ~NzInputStream();
|
||||||
|
|
||||||
virtual nzUInt64 GetCursorPos() const = 0;
|
virtual bool EndOfStream() const = 0;
|
||||||
|
|
||||||
|
virtual NzString GetLine(unsigned int lineSize = 0);
|
||||||
virtual nzUInt64 GetSize() const = 0;
|
virtual nzUInt64 GetSize() const = 0;
|
||||||
|
|
||||||
virtual std::size_t Read(void* buffer, std::size_t size) = 0;
|
virtual std::size_t Read(void* buffer, std::size_t size) = 0;
|
||||||
|
|
||||||
virtual bool SetCursorPos(nzUInt64 offset) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NAZARA_INPUTSTREAM_HPP
|
#endif // NAZARA_INPUTSTREAM_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#include <Nazara/Core/NonCopyable.hpp>
|
#include <Nazara/Core/NonCopyable.hpp>
|
||||||
#include <Nazara/Core/String.hpp>
|
#include <Nazara/Core/String.hpp>
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_LOG
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_LOG
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -11,11 +11,10 @@
|
||||||
#include <Nazara/Core/NonCopyable.hpp>
|
#include <Nazara/Core/NonCopyable.hpp>
|
||||||
|
|
||||||
class NzMutexImpl;
|
class NzMutexImpl;
|
||||||
class NzThreadCondition;
|
|
||||||
|
|
||||||
class NAZARA_API NzMutex : NzNonCopyable
|
class NAZARA_API NzMutex : NzNonCopyable
|
||||||
{
|
{
|
||||||
friend class NzThreadCondition;
|
friend class NzConditionVariable;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NzMutex();
|
NzMutex();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_RESOURCE_HPP
|
||||||
|
#define NAZARA_RESOURCE_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_RESOURCE
|
||||||
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
|
#else
|
||||||
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class NzResourceListener;
|
||||||
|
|
||||||
|
struct NzResourceEntry
|
||||||
|
{
|
||||||
|
NzResourceEntry(NzResourceListener* resourceListener, int i = 0) :
|
||||||
|
listener(resourceListener),
|
||||||
|
index(i)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<(const NzResourceEntry& rhs) const
|
||||||
|
{
|
||||||
|
return listener < rhs.listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
NzResourceListener* listener;
|
||||||
|
int index;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NAZARA_API NzResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NzResource(bool persistent = true);
|
||||||
|
NzResource(const NzResource& resource);
|
||||||
|
virtual ~NzResource();
|
||||||
|
|
||||||
|
void AddResourceListener(NzResourceListener* listener, int index = 0) const;
|
||||||
|
void AddResourceReference() const;
|
||||||
|
|
||||||
|
bool IsPersistent() const;
|
||||||
|
|
||||||
|
void RemoveResourceListener(NzResourceListener* listener) const;
|
||||||
|
void RemoveResourceReference() const;
|
||||||
|
|
||||||
|
void SetPersistent(bool persistent = true);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void NotifyCreated();
|
||||||
|
void NotifyDestroy();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void EnsureResourceListenerUpdate() const;
|
||||||
|
|
||||||
|
NazaraMutexAttrib(m_mutex, mutable)
|
||||||
|
|
||||||
|
// Je fais précéder le nom par 'resource' pour éviter les éventuels conflits de noms
|
||||||
|
mutable std::set<NzResourceEntry> m_resourceListeners;
|
||||||
|
mutable std::set<NzResourceEntry> m_resourceListenersCache;
|
||||||
|
mutable bool m_resourceListenerUpdated;
|
||||||
|
bool m_resourcePersistent;
|
||||||
|
mutable unsigned int m_resourceReferenceCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_RESOURCE_HPP
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_RESOURCELISTENER_HPP
|
||||||
|
#define NAZARA_RESOURCELISTENER_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
|
||||||
|
class NzResource;
|
||||||
|
|
||||||
|
class NAZARA_API NzResourceListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NzResourceListener() = default;
|
||||||
|
virtual ~NzResourceListener();
|
||||||
|
|
||||||
|
virtual void OnResourceCreated(const NzResource* resource, int index);
|
||||||
|
virtual void OnResourceDestroy(const NzResource* resource, int index);
|
||||||
|
virtual void OnResourceReleased(const NzResource* resource, int index);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_RESOURCELISTENER_HPP
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (C) 2012 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
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_RESOURCELOADER_HPP
|
||||||
|
#define NAZARA_RESOURCELOADER_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Core/String.hpp>
|
||||||
|
#include <set>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
|
class NzInputStream;
|
||||||
|
|
||||||
|
template<typename Type, typename Parameters>
|
||||||
|
class NzResourceLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using CheckFunction = bool (*)(NzInputStream& stream, const Parameters& parameters);
|
||||||
|
using LoadFunction = bool (*)(Type* resource, NzInputStream& stream, const Parameters& parameters);
|
||||||
|
|
||||||
|
static bool LoadFromFile(Type* resource, const NzString& filePath, const Parameters& parameters = Parameters());
|
||||||
|
static bool LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters = Parameters());
|
||||||
|
static bool LoadFromStream(Type* resource, NzInputStream& stream, const Parameters& parameters = Parameters());
|
||||||
|
|
||||||
|
static void RegisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadfunc);
|
||||||
|
static void UnregisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadfunc);
|
||||||
|
|
||||||
|
using Loader = std::tuple<std::set<NzString>, CheckFunction, LoadFunction>;
|
||||||
|
using LoaderList = std::set<Loader>;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include <Nazara/Core/ResourceLoader.inl>
|
||||||
|
|
||||||
|
#endif // NAZARA_RESOURCELOADER_HPP
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
// Copyright (C) 2012 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/Core/Config.hpp>
|
||||||
|
#include <Nazara/Core/Error.hpp>
|
||||||
|
#include <Nazara/Core/File.hpp>
|
||||||
|
#include <Nazara/Core/InputStream.hpp>
|
||||||
|
#include <Nazara/Core/MemoryStream.hpp>
|
||||||
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
template<typename Type, typename Parameters>
|
||||||
|
bool NzResourceLoader<Type, Parameters>::LoadFromFile(Type* resource, const NzString& filePath, const Parameters& parameters)
|
||||||
|
{
|
||||||
|
#if NAZARA_CORE_SAFE
|
||||||
|
if (!parameters.IsValid())
|
||||||
|
{
|
||||||
|
NazaraError("Invalid parameters");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NzString path = NzFile::NormalizePath(filePath);
|
||||||
|
NzString ext = path.SubstrFrom('.', -1, true);
|
||||||
|
if (ext.IsEmpty())
|
||||||
|
{
|
||||||
|
NazaraError("Failed to get file extension");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
NzFile file(path, NzFile::ReadOnly);
|
||||||
|
if (!file.IsOpen())
|
||||||
|
{
|
||||||
|
NazaraError("Failed to open file");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto loader = Type::s_loaders.begin(); loader != Type::s_loaders.end(); ++loader)
|
||||||
|
{
|
||||||
|
for (const NzString& loaderExt : std::get<0>(*loader))
|
||||||
|
{
|
||||||
|
int cmp = NzString::Compare(loaderExt, ext);
|
||||||
|
if (cmp == 0)
|
||||||
|
{
|
||||||
|
if (!std::get<1>(*loader)(file, parameters))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
file.SetCursorPos(0);
|
||||||
|
|
||||||
|
// Chargement de la ressource
|
||||||
|
if (std::get<2>(*loader)(resource, file, parameters))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
NazaraWarning("Loader failed");
|
||||||
|
|
||||||
|
file.SetCursorPos(0);
|
||||||
|
}
|
||||||
|
else if (cmp < 0) // S'il est encore possible que l'extension se situe après
|
||||||
|
continue;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NazaraError("Failed to load file: no loader");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Type, typename Parameters>
|
||||||
|
bool NzResourceLoader<Type, Parameters>::LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters)
|
||||||
|
{
|
||||||
|
NzMemoryStream stream(data, size);
|
||||||
|
|
||||||
|
return LoadFromStream(resource, stream, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Type, typename Parameters>
|
||||||
|
bool NzResourceLoader<Type, Parameters>::LoadFromStream(Type* resource, NzInputStream& stream, const Parameters& parameters)
|
||||||
|
{
|
||||||
|
#if NAZARA_CORE_SAFE
|
||||||
|
if (!parameters.IsValid())
|
||||||
|
{
|
||||||
|
NazaraError("Invalid parameters");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream.GetSize() == 0 || stream.GetCursorPos() >= stream.GetSize())
|
||||||
|
{
|
||||||
|
NazaraError("No data to load");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nzUInt64 streamPos = stream.GetCursorPos();
|
||||||
|
for (auto loader = Type::s_loaders.begin(); loader != Type::s_loaders.end(); ++loader)
|
||||||
|
{
|
||||||
|
// Le loader supporte-t-il les données ?
|
||||||
|
if (!std::get<1>(*loader)(stream, parameters))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// On repositionne le stream au début
|
||||||
|
stream.SetCursorPos(streamPos);
|
||||||
|
|
||||||
|
// Chargement de la ressource
|
||||||
|
if (std::get<2>(*loader)(resource, stream, parameters))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
NazaraWarning("Loader failed");
|
||||||
|
stream.SetCursorPos(streamPos); // On repositionne au début
|
||||||
|
}
|
||||||
|
|
||||||
|
NazaraError("Failed to load file: no loader");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Type, typename Parameters>
|
||||||
|
void NzResourceLoader<Type, Parameters>::RegisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadFunc)
|
||||||
|
{
|
||||||
|
///FIXME: Trouver une alternative à ce code monstrueux
|
||||||
|
std::vector<NzString> exts;
|
||||||
|
fileExtensions.SplitAny(exts, " /\\.,;|-_");
|
||||||
|
|
||||||
|
std::set<NzString> extensions;
|
||||||
|
std::copy(exts.begin(), exts.end(), std::inserter(extensions, extensions.begin()));
|
||||||
|
|
||||||
|
Type::s_loaders.insert(std::make_tuple(std::move(extensions), checkFunc, loadFunc));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Type, typename Parameters>
|
||||||
|
void NzResourceLoader<Type, Parameters>::UnregisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadFunc)
|
||||||
|
{
|
||||||
|
std::vector<NzString> exts;
|
||||||
|
fileExtensions.SplitAny(exts, " /\\.,;|-_");
|
||||||
|
|
||||||
|
std::set<NzString> extensions;
|
||||||
|
std::copy(exts.begin(), exts.end(), std::inserter(extensions, extensions.begin()));
|
||||||
|
|
||||||
|
Type::s_loaders.erase(std::make_tuple(std::move(extensions), checkFunc, loadFunc));
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <Nazara/Core/DebugOff.hpp>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_STREAM_HPP
|
||||||
|
#define NAZARA_STREAM_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Core/Enums.hpp>
|
||||||
|
|
||||||
|
class NAZARA_API NzStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NzStream() = default;
|
||||||
|
virtual ~NzStream();
|
||||||
|
|
||||||
|
virtual nzUInt64 GetCursorPos() const = 0;
|
||||||
|
unsigned int GetStreamOptions() const;
|
||||||
|
|
||||||
|
virtual bool SetCursorPos(nzUInt64 offset) = 0;
|
||||||
|
void SetStreamOptions(unsigned int options);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
unsigned int m_streamOptions = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_STREAM_HPP
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_STRING
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_STRING
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
|
@ -27,11 +27,11 @@ class NAZARA_API NzString : public NzHashable
|
||||||
public:
|
public:
|
||||||
enum Flags
|
enum Flags
|
||||||
{
|
{
|
||||||
None = 0x00, // Mode par défaut
|
None = 0x00, // Mode par défaut
|
||||||
CaseInsensitive = 0x01, // Insensible à la casse
|
CaseInsensitive = 0x01, // Insensible à la casse
|
||||||
HandleUtf8 = 0x02, // Traite les octets comme une suite de caractères UTF-8
|
HandleUtf8 = 0x02, // Traite les octets comme une suite de caractères UTF-8
|
||||||
TrimOnlyLeft = 0x04, // Trim(med), ne coupe que la partie gauche de la chaîne
|
TrimOnlyLeft = 0x04, // Trim(med), ne coupe que la partie gauche de la chaîne
|
||||||
TrimOnlyRight = 0x08 // Trim(med), ne coupe que la partie droite de la chaîne
|
TrimOnlyRight = 0x08 // Trim(med), ne coupe que la partie droite de la chaîne
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SharedString;
|
struct SharedString;
|
||||||
|
|
@ -41,7 +41,7 @@ class NAZARA_API NzString : public NzHashable
|
||||||
NzString(const char* string);
|
NzString(const char* string);
|
||||||
NzString(const std::string& string);
|
NzString(const std::string& string);
|
||||||
NzString(const NzString& string);
|
NzString(const NzString& string);
|
||||||
NzString(NzString&& string);
|
NzString(NzString&& string) noexcept;
|
||||||
NzString(SharedString* sharedString);
|
NzString(SharedString* sharedString);
|
||||||
~NzString();
|
~NzString();
|
||||||
|
|
||||||
|
|
@ -89,7 +89,6 @@ class NAZARA_API NzString : public NzHashable
|
||||||
char16_t* GetUtf16Buffer(unsigned int* size = nullptr) const;
|
char16_t* GetUtf16Buffer(unsigned int* size = nullptr) const;
|
||||||
char32_t* GetUtf32Buffer(unsigned int* size = nullptr) const;
|
char32_t* GetUtf32Buffer(unsigned int* size = nullptr) const;
|
||||||
wchar_t* GetWideBuffer(unsigned int* size = nullptr) const;
|
wchar_t* GetWideBuffer(unsigned int* size = nullptr) const;
|
||||||
|
|
||||||
NzString GetWord(unsigned int index, nzUInt32 flags = None) const;
|
NzString GetWord(unsigned int index, nzUInt32 flags = None) const;
|
||||||
unsigned int GetWordPosition(unsigned int index, nzUInt32 flags = None) const;
|
unsigned int GetWordPosition(unsigned int index, nzUInt32 flags = None) const;
|
||||||
|
|
||||||
|
|
@ -112,8 +111,8 @@ class NAZARA_API NzString : public NzHashable
|
||||||
unsigned int Replace(const char* oldString, const char* replaceString, int start = 0, nzUInt32 flags = None);
|
unsigned int Replace(const char* oldString, const char* replaceString, int start = 0, nzUInt32 flags = None);
|
||||||
unsigned int Replace(const NzString& oldString, const NzString& replaceString, int start = 0, nzUInt32 flags = None);
|
unsigned int Replace(const NzString& oldString, const NzString& replaceString, int start = 0, nzUInt32 flags = None);
|
||||||
unsigned int ReplaceAny(const char* oldCharacters, char replaceCharacter, int start = 0, nzUInt32 flags = None);
|
unsigned int ReplaceAny(const char* oldCharacters, char replaceCharacter, int start = 0, nzUInt32 flags = None);
|
||||||
unsigned int ReplaceAny(const char* oldCharacters, const char* replaceString, int start = 0, nzUInt32 flags = None);
|
//unsigned int ReplaceAny(const char* oldCharacters, const char* replaceString, int start = 0, nzUInt32 flags = None);
|
||||||
unsigned int ReplaceAny(const NzString& oldCharacters, const NzString& replaceString, int start = 0, nzUInt32 flags = None);
|
//unsigned int ReplaceAny(const NzString& oldCharacters, const NzString& replaceString, int start = 0, nzUInt32 flags = None);
|
||||||
|
|
||||||
void Reserve(unsigned int bufferSize);
|
void Reserve(unsigned int bufferSize);
|
||||||
|
|
||||||
|
|
@ -157,7 +156,7 @@ class NAZARA_API NzString : public NzHashable
|
||||||
NzString Trimmed(nzUInt32 flags = None) const;
|
NzString Trimmed(nzUInt32 flags = None) const;
|
||||||
NzString Trimmed(char character, nzUInt32 flags = None) const;
|
NzString Trimmed(char character, nzUInt32 flags = None) const;
|
||||||
|
|
||||||
// Méthodes STD
|
// Méthodes STD
|
||||||
char* begin();
|
char* begin();
|
||||||
const char* begin() const;
|
const char* begin() const;
|
||||||
char* end();
|
char* end();
|
||||||
|
|
@ -173,7 +172,7 @@ class NAZARA_API NzString : public NzHashable
|
||||||
typedef char* iterator;
|
typedef char* iterator;
|
||||||
//typedef char* reverse_iterator;
|
//typedef char* reverse_iterator;
|
||||||
typedef char value_type;
|
typedef char value_type;
|
||||||
// Méthodes STD
|
// Méthodes STD
|
||||||
|
|
||||||
operator std::string() const;
|
operator std::string() const;
|
||||||
|
|
||||||
|
|
@ -184,7 +183,7 @@ class NAZARA_API NzString : public NzHashable
|
||||||
NzString& operator=(const char* string);
|
NzString& operator=(const char* string);
|
||||||
NzString& operator=(const std::string& string);
|
NzString& operator=(const std::string& string);
|
||||||
NzString& operator=(const NzString& string);
|
NzString& operator=(const NzString& string);
|
||||||
NzString& operator=(NzString&& string);
|
NzString& operator=(NzString&& string) noexcept;
|
||||||
|
|
||||||
NzString operator+(char character) const;
|
NzString operator+(char character) const;
|
||||||
NzString operator+(const char* string) const;
|
NzString operator+(const char* string) const;
|
||||||
|
|
@ -282,10 +281,7 @@ class NAZARA_API NzString : public NzHashable
|
||||||
|
|
||||||
struct NAZARA_API SharedString
|
struct NAZARA_API SharedString
|
||||||
{
|
{
|
||||||
SharedString() :
|
SharedString() = default;
|
||||||
refCount(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedString(unsigned short referenceCount, unsigned int bufferSize, unsigned int stringSize, char* str) :
|
SharedString(unsigned short referenceCount, unsigned int bufferSize, unsigned int stringSize, char* str) :
|
||||||
capacity(bufferSize),
|
capacity(bufferSize),
|
||||||
|
|
@ -299,12 +295,12 @@ class NAZARA_API NzString : public NzHashable
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
char* string;
|
char* string;
|
||||||
|
|
||||||
unsigned short refCount;
|
unsigned short refCount = 1;
|
||||||
NazaraMutex(mutex)
|
NazaraMutex(mutex)
|
||||||
};
|
};
|
||||||
|
|
||||||
static SharedString emptyString;
|
static SharedString emptyString;
|
||||||
static unsigned int npos;
|
static const unsigned int npos;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EnsureOwnership();
|
void EnsureOwnership();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if NAZARA_THREADSAFETY_STRINGSTREAM
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_STRINGSTREAM
|
||||||
#include <Nazara/Core/ThreadSafety.hpp>
|
#include <Nazara/Core/ThreadSafety.hpp>
|
||||||
#else
|
#else
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
// Inspiré du code de la SFML par Laurent Gomila
|
// Inspiré du code de la SFML par Laurent Gomila
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
@ -17,16 +17,16 @@ class NzThreadImpl;
|
||||||
|
|
||||||
class NAZARA_API NzThread : NzNonCopyable
|
class NAZARA_API NzThread : NzNonCopyable
|
||||||
{
|
{
|
||||||
friend class NzThreadImpl;
|
friend NzThreadImpl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class NAZARA_API Id
|
class NAZARA_API Id
|
||||||
{
|
{
|
||||||
friend class NzThread;
|
friend NzThread;
|
||||||
friend class NzThreadImpl;
|
friend NzThreadImpl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Id() : m_handle(nullptr) {}
|
Id() = default;
|
||||||
Id(Id&& rhs) = default;
|
Id(Id&& rhs) = default;
|
||||||
~Id();
|
~Id();
|
||||||
|
|
||||||
|
|
@ -38,11 +38,12 @@ class NAZARA_API NzThread : NzNonCopyable
|
||||||
Id(void* handle) : m_handle(handle) {}
|
Id(void* handle) : m_handle(handle) {}
|
||||||
Id(const NzThreadImpl* thread);
|
Id(const NzThreadImpl* thread);
|
||||||
|
|
||||||
void* m_handle;
|
void* m_handle = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename F> NzThread(F function);
|
template<typename F> NzThread(F function);
|
||||||
template<typename F, typename... Args> NzThread(F function, Args... args);
|
template<typename F, typename... Args> NzThread(F function, Args... args);
|
||||||
|
template<typename C> NzThread(void (C::*function)(), C* object);
|
||||||
~NzThread();
|
~NzThread();
|
||||||
|
|
||||||
Id GetId() const;
|
Id GetId() const;
|
||||||
|
|
@ -56,7 +57,7 @@ class NAZARA_API NzThread : NzNonCopyable
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NzFunctor* m_func;
|
NzFunctor* m_func;
|
||||||
NzThreadImpl* m_impl;
|
NzThreadImpl* m_impl = nullptr;
|
||||||
bool m_independent;
|
bool m_independent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,24 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Core/Debug.hpp>
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
template<typename F> NzThread::NzThread(F function) :
|
template<typename F>
|
||||||
m_func(new NzFunctorWithoutArgs<F>(function)),
|
NzThread::NzThread(F function) :
|
||||||
m_impl(nullptr)
|
m_func(new NzFunctorWithoutArgs<F>(function))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F, typename... Args> NzThread::NzThread(F function, Args... args) :
|
template<typename F, typename... Args>
|
||||||
m_func(new NzFunctorWithArgs<F, Args...>(function, args...)),
|
NzThread::NzThread(F function, Args... args) :
|
||||||
m_impl(nullptr)
|
m_func(new NzFunctorWithArgs<F, Args...>(function, args...))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename C>
|
||||||
|
NzThread::NzThread(void (C::*function)(), C* object) :
|
||||||
|
m_func(new NzMemberWithoutArgs<C>(function, object))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
|
||||||
// This file is part of the "Nazara Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef NAZARA_THREADCONDITION_HPP
|
|
||||||
#define NAZARA_THREADCONDITION_HPP
|
|
||||||
|
|
||||||
#include <Nazara/Prerequesites.hpp>
|
|
||||||
|
|
||||||
class NzMutex;
|
|
||||||
class NzThreadConditionImpl;
|
|
||||||
|
|
||||||
class NAZARA_API NzThreadCondition
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NzThreadCondition();
|
|
||||||
~NzThreadCondition();
|
|
||||||
|
|
||||||
void Signal();
|
|
||||||
void SignalAll();
|
|
||||||
|
|
||||||
void Wait(NzMutex* mutex);
|
|
||||||
bool Wait(NzMutex* mutex, nzUInt32 timeout);
|
|
||||||
|
|
||||||
private:
|
|
||||||
NzThreadConditionImpl* m_impl;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // NAZARA_THREADCONDITION_HPP
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
// Pas de header guard
|
// Pas de header guard
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <Nazara/Core/LockGuard.hpp>
|
#include <Nazara/Core/LockGuard.hpp>
|
||||||
#include <Nazara/Core/Mutex.hpp>
|
#include <Nazara/Core/Mutex.hpp>
|
||||||
|
|
||||||
// Ces macros peuvent changer pour n'importe quel fichier qui l'utilise dans une même unité de compilation
|
// Ces macros peuvent changer pour n'importe quel fichier qui l'utilise dans une même unité de compilation
|
||||||
#undef NazaraLock
|
#undef NazaraLock
|
||||||
#undef NazaraMutex
|
#undef NazaraMutex
|
||||||
#undef NazaraMutexAttrib
|
#undef NazaraMutexAttrib
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue