Merge pull request #326 from DigitalPulseSoftware/vulkan
Add OpenGL / Vulkan renderers
This commit is contained in:
commit
a28635ec70
|
|
@ -0,0 +1,2 @@
|
||||||
|
github: [SirLynix]
|
||||||
|
custom: ['https://paypal.me/sirlynixvanfrietjes']
|
||||||
|
|
@ -1,6 +1,13 @@
|
||||||
# Nazara build
|
# Nazara build
|
||||||
build/config.lua
|
build/config.lua
|
||||||
|
|
||||||
|
# Nazara binaries
|
||||||
|
bin/*
|
||||||
|
|
||||||
|
# Build files
|
||||||
|
build/gmake*/
|
||||||
|
build/vs*/
|
||||||
|
|
||||||
# Nazara libraries
|
# Nazara libraries
|
||||||
lib/*
|
lib/*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
FROM debian:buster
|
FROM debian:buster
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y build-essential clang libopenal-dev libsndfile1-dev libxcb-cursor-dev libxcb-ewmh-dev libxcb-randr0-dev libxcb-icccm4-dev libxcb-keysyms1-dev libx11-dev libfreetype6-dev mesa-common-dev libgl1-mesa-dev libassimp-dev
|
RUN apt-get update && apt-get install -y build-essential clang libopenal-dev libsndfile1-dev libfreetype6-dev libassimp-dev libsdl2-dev
|
||||||
|
|
||||||
RUN mkdir /NazaraEngine
|
RUN mkdir /NazaraEngine
|
||||||
WORKDIR /NazaraEngine
|
WORKDIR /NazaraEngine
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// This file was automatically generated
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NDK_COMPONENTS_GLOBAL_HPP
|
||||||
|
#define NDK_COMPONENTS_GLOBAL_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#endif // NDK_COMPONENTS_GLOBAL_HPP
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// This file was automatically generated
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NDK_SYSTEMS_GLOBAL_HPP
|
||||||
|
#define NDK_SYSTEMS_GLOBAL_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#endif // NDK_SYSTEMS_GLOBAL_HPP
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// This file was automatically generated
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NDK_WIDGETS_GLOBAL_HPP
|
||||||
|
#define NDK_WIDGETS_GLOBAL_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#endif // NDK_WIDGETS_GLOBAL_HPP
|
||||||
|
|
@ -24,3 +24,18 @@ ServerMode = false
|
||||||
|
|
||||||
-- Builds modules as one united library (useless on POSIX systems)
|
-- Builds modules as one united library (useless on POSIX systems)
|
||||||
UniteModules = false
|
UniteModules = false
|
||||||
|
|
||||||
|
-- Qt5 directories (required for ShaderNodes editor)
|
||||||
|
--Qt5IncludeDir = [[C:\Projets\Libs\Qt\5.15.0\msvc2019\include]]
|
||||||
|
--Qt5BinDir_x86 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019\bin]]
|
||||||
|
--Qt5BinDir_x64 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\bin]]
|
||||||
|
--Qt5LibDir_x86 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019\lib]]
|
||||||
|
--Qt5LibDir_x64 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\lib]]
|
||||||
|
|
||||||
|
|
||||||
|
-- QtNodes directories (required for ShaderNodes editor)
|
||||||
|
--QtNodesIncludeDir = [[C:\Projets\Libs\nodeeditor\include]]
|
||||||
|
--QtNodesBinDir_x86 = [[C:\Projets\Libs\nodeeditor\build32\bin\Release]]
|
||||||
|
--QtNodesBinDir_x64 = [[C:\Projets\Libs\nodeeditor\build64\bin\Release]]
|
||||||
|
--QtNodesLibDir_x86 = [[C:\Projets\Libs\nodeeditor\build32\lib\Release]]
|
||||||
|
--QtNodesLibDir_x64 = [[C:\Projets\Libs\nodeeditor\build64\lib\Release]]
|
||||||
|
|
@ -42,6 +42,19 @@ ACTION.Function = function ()
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
table.insert(paths, {
|
||||||
|
Excludes = {
|
||||||
|
["DeviceFunctions.hpp"] = true,
|
||||||
|
["GlobalFunctions.hpp"] = true,
|
||||||
|
["InstanceFunctions.hpp"] = true,
|
||||||
|
},
|
||||||
|
HeaderGuard = "NAZARA_GLOBAL_VULKANRENDERER_WRAPPER_HPP",
|
||||||
|
Name = "Vulkan wrapper",
|
||||||
|
SearchDir = "../include/Nazara/VulkanRenderer/Wrapper",
|
||||||
|
TopDir = "Nazara",
|
||||||
|
Target = "../include/Nazara/VulkanRenderer/Wrapper.hpp"
|
||||||
|
})
|
||||||
|
|
||||||
table.insert(paths, {
|
table.insert(paths, {
|
||||||
Excludes = {},
|
Excludes = {},
|
||||||
HeaderGuard = "NDK_COMPONENTS_GLOBAL_HPP",
|
HeaderGuard = "NDK_COMPONENTS_GLOBAL_HPP",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,223 @@
|
||||||
|
ACTION.Name = "UpdateSpirV"
|
||||||
|
ACTION.Description = "Download and parse the SpirV grammar and generate a .cpp file for it"
|
||||||
|
|
||||||
|
local spirvGrammarURI = "https://raw.githubusercontent.com/KhronosGroup/SPIRV-Headers/master/include/spirv/unified1/spirv.core.grammar.json"
|
||||||
|
|
||||||
|
ACTION.Function = function()
|
||||||
|
io.write("Downloading Spir-V grammar... ")
|
||||||
|
local content, resultStr, resultCode = http.get(spirvGrammarURI, {
|
||||||
|
headers = { "From: Premake", "Referer: Premake" }
|
||||||
|
})
|
||||||
|
|
||||||
|
if (resultCode ~= 200) then
|
||||||
|
error("Failed to download SpirV grammar: " .. resultStr)
|
||||||
|
end
|
||||||
|
|
||||||
|
print("Done")
|
||||||
|
|
||||||
|
local result, err = json.decode(content)
|
||||||
|
assert(result, err)
|
||||||
|
|
||||||
|
local instructions = {}
|
||||||
|
local instructionById = {}
|
||||||
|
for _, instruction in pairs(result.instructions) do
|
||||||
|
local duplicateId = instructionById[instruction.opcode]
|
||||||
|
if (duplicateId == nil) then
|
||||||
|
table.insert(instructions, instruction)
|
||||||
|
instructionById[instruction.opcode] = #instructions
|
||||||
|
else
|
||||||
|
instructions[duplicateId] = instruction
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local operands = {}
|
||||||
|
local operandByInstruction = {}
|
||||||
|
for _, instruction in pairs(instructions) do
|
||||||
|
if (instruction.operands) then
|
||||||
|
local firstId = #operands
|
||||||
|
local operandCount = #instruction.operands
|
||||||
|
for _, operand in pairs(instruction.operands) do
|
||||||
|
table.insert(operands, operand)
|
||||||
|
end
|
||||||
|
|
||||||
|
operandByInstruction[instruction.opcode] = { firstId = firstId, count = operandCount }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local headerFile = io.open("../include/Nazara/Shader/SpirvData.hpp", "w+")
|
||||||
|
assert(headerFile, "failed to open Spir-V header")
|
||||||
|
|
||||||
|
headerFile:write([[
|
||||||
|
// Copyright (C) ]] .. os.date("%Y") .. [[ Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Shader generator"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp"
|
||||||
|
|
||||||
|
// This file was generated automatically, please do not edit
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_SPIRVDATA_HPP
|
||||||
|
#define NAZARA_SPIRVDATA_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequisites.hpp>
|
||||||
|
#include <Nazara/Shader/Config.hpp>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- SpirV operations
|
||||||
|
headerFile:write([[
|
||||||
|
enum class SpirvOp
|
||||||
|
{
|
||||||
|
]])
|
||||||
|
|
||||||
|
for _, instruction in pairs(result.instructions) do
|
||||||
|
headerFile:write("\t\t" .. instruction.opname .. " = " .. instruction.opcode .. ",\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
headerFile:write([[
|
||||||
|
};
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- SpirV operands
|
||||||
|
headerFile:write([[
|
||||||
|
enum class SpirvOperandKind
|
||||||
|
{
|
||||||
|
]])
|
||||||
|
|
||||||
|
for _, operand in pairs(result.operand_kinds) do
|
||||||
|
headerFile:write("\t\t" .. operand.kind .. ",\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
headerFile:write([[
|
||||||
|
};
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- SpirV enums
|
||||||
|
for _, operand in pairs(result.operand_kinds) do
|
||||||
|
if (operand.category == "ValueEnum") then
|
||||||
|
headerFile:write([[
|
||||||
|
enum class Spirv]] .. operand.kind .. [[
|
||||||
|
|
||||||
|
{
|
||||||
|
]])
|
||||||
|
|
||||||
|
for _, enumerant in pairs(operand.enumerants) do
|
||||||
|
local eName = enumerant.enumerant:match("^%d") and operand.kind .. enumerant.enumerant or enumerant.enumerant
|
||||||
|
headerFile:write([[
|
||||||
|
]] .. eName .. [[ = ]] .. enumerant.value .. [[,
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
|
||||||
|
headerFile:write([[
|
||||||
|
};
|
||||||
|
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Struct
|
||||||
|
headerFile:write([[
|
||||||
|
struct SpirvInstruction
|
||||||
|
{
|
||||||
|
struct Operand
|
||||||
|
{
|
||||||
|
SpirvOperandKind kind;
|
||||||
|
const char* name;
|
||||||
|
};
|
||||||
|
|
||||||
|
SpirvOp op;
|
||||||
|
const char* name;
|
||||||
|
const Operand* operands;
|
||||||
|
std::size_t minOperandCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Functions signatures
|
||||||
|
headerFile:write([[
|
||||||
|
NAZARA_SHADER_API const SpirvInstruction* GetInstructionData(UInt16 op);
|
||||||
|
]])
|
||||||
|
|
||||||
|
headerFile:write([[
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
]])
|
||||||
|
|
||||||
|
local sourceFile = io.open("../src/Nazara/Shader/SpirvData.cpp", "w+")
|
||||||
|
assert(sourceFile, "failed to open Spir-V source")
|
||||||
|
|
||||||
|
sourceFile:write([[
|
||||||
|
// Copyright (C) ]] .. os.date("%Y") .. [[ Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Shader generator"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp"
|
||||||
|
|
||||||
|
// This file was generated automatically, please do not edit
|
||||||
|
|
||||||
|
#include <Nazara/Shader/SpirvData.hpp>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
namespace Nz
|
||||||
|
{
|
||||||
|
static constexpr std::array<SpirvInstruction::Operand, ]] .. #operands .. [[> s_operands = {
|
||||||
|
{
|
||||||
|
]])
|
||||||
|
for _, operand in pairs(operands) do
|
||||||
|
sourceFile:write([[
|
||||||
|
{
|
||||||
|
SpirvOperandKind::]] .. operand.kind .. [[,
|
||||||
|
R"(]] .. (operand.name or operand.kind) .. [[)"
|
||||||
|
},
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
|
||||||
|
sourceFile:write([[
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::array<SpirvInstruction, ]] .. #instructions .. [[> s_instructions = {
|
||||||
|
{
|
||||||
|
]])
|
||||||
|
|
||||||
|
for _, instruction in pairs(instructions) do
|
||||||
|
local opByInstruction = operandByInstruction[instruction.opcode]
|
||||||
|
|
||||||
|
sourceFile:write([[
|
||||||
|
{
|
||||||
|
SpirvOp::]] .. instruction.opname .. [[,
|
||||||
|
R"(]] .. instruction.opname .. [[)",
|
||||||
|
]] .. (opByInstruction and "&s_operands[" .. opByInstruction.firstId .. "]" or "nullptr") .. [[,
|
||||||
|
]] .. (opByInstruction and opByInstruction.count or "0") .. [[,
|
||||||
|
},
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
|
||||||
|
sourceFile:write([[
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Operand to string
|
||||||
|
sourceFile:write([[
|
||||||
|
const SpirvInstruction* GetInstructionData(UInt16 op)
|
||||||
|
{
|
||||||
|
auto it = std::lower_bound(std::begin(s_instructions), std::end(s_instructions), op, [](const SpirvInstruction& inst, UInt16 op) { return UInt16(inst.op) < op; });
|
||||||
|
if (it != std::end(s_instructions) && UInt16(it->op) == op)
|
||||||
|
return &*it;
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
sourceFile:write([[
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -298,16 +298,19 @@ function NazaraBuild:Execute()
|
||||||
debugdir(destPath)
|
debugdir(destPath)
|
||||||
includedirs({
|
includedirs({
|
||||||
"../include",
|
"../include",
|
||||||
"../thirdparty/include"
|
"../thirdparty/include",
|
||||||
|
exampleTable.Includes
|
||||||
|
})
|
||||||
|
libdirs({
|
||||||
|
"../lib",
|
||||||
|
exampleTable.LibDir
|
||||||
})
|
})
|
||||||
libdirs("../lib")
|
|
||||||
|
|
||||||
files(exampleTable.Files)
|
files(exampleTable.Files)
|
||||||
excludes(exampleTable.FilesExcluded)
|
excludes(exampleTable.FilesExcluded)
|
||||||
|
|
||||||
defines(exampleTable.Defines)
|
defines(exampleTable.Defines)
|
||||||
flags(exampleTable.Flags)
|
flags(exampleTable.Flags)
|
||||||
includedirs(exampleTable.Includes)
|
|
||||||
links(exampleTable.Libraries)
|
links(exampleTable.Libraries)
|
||||||
targetdir(destPath)
|
targetdir(destPath)
|
||||||
|
|
||||||
|
|
@ -406,6 +409,7 @@ function NazaraBuild:Initialize()
|
||||||
if (f) then
|
if (f) then
|
||||||
MODULE = {}
|
MODULE = {}
|
||||||
self:SetupModuleTable(MODULE)
|
self:SetupModuleTable(MODULE)
|
||||||
|
Config = self.Config
|
||||||
|
|
||||||
f()
|
f()
|
||||||
|
|
||||||
|
|
@ -548,6 +552,7 @@ function NazaraBuild:LoadConfig()
|
||||||
AddBoolOption("PremakeProject", "premakeproject", "Add a PremakeProject as a shortcut to call Premake")
|
AddBoolOption("PremakeProject", "premakeproject", "Add a PremakeProject as a shortcut to call Premake")
|
||||||
AddBoolOption("ServerMode", "server", "Excludes client-only modules/tools/examples")
|
AddBoolOption("ServerMode", "server", "Excludes client-only modules/tools/examples")
|
||||||
AddBoolOption("UniteModules", "united", "Builds all the modules as one united library")
|
AddBoolOption("UniteModules", "united", "Builds all the modules as one united library")
|
||||||
|
AddBoolOption("PlatformSDL2", "platform-sdl2", "Use SDL2 instead of native APIs")
|
||||||
|
|
||||||
-- AdditionalCompilationOptions
|
-- AdditionalCompilationOptions
|
||||||
do
|
do
|
||||||
|
|
@ -694,6 +699,24 @@ local PosixOSes = {
|
||||||
["solaris"] = true
|
["solaris"] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function ProcessOption(libName, option, enable)
|
||||||
|
return libName:gsub("%%" .. option .. "%((.+)%)", enable and "%1" or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function HandleLib(infoTable, libName)
|
||||||
|
local debugDynamic = ProcessOption(ProcessOption(libName, "d", true), "s", false)
|
||||||
|
local debugStatic = ProcessOption(ProcessOption(libName, "d", true), "s", true)
|
||||||
|
local releaseStatic = ProcessOption(ProcessOption(libName, "d", false), "s", true)
|
||||||
|
local releaseDynamic = ProcessOption(ProcessOption(libName, "d", false), "s", false)
|
||||||
|
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.DebugStatic, debugStatic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, releaseStatic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, releaseStatic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, debugDynamic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, releaseDynamic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, releaseDynamic)
|
||||||
|
end
|
||||||
|
|
||||||
function NazaraBuild:Process(infoTable)
|
function NazaraBuild:Process(infoTable)
|
||||||
if (infoTable.Excluded) then
|
if (infoTable.Excluded) then
|
||||||
return false
|
return false
|
||||||
|
|
@ -713,16 +736,11 @@ function NazaraBuild:Process(infoTable)
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
library = "NazaraEngine"
|
library = "NazaraEngine"
|
||||||
else
|
else
|
||||||
library = "Nazara" .. libraryTable.Name
|
library = "Nazara" .. libraryTable.Name .. "%s(-s)%d(-d)"
|
||||||
end
|
end
|
||||||
|
|
||||||
if (not self.Config["UniteModules"] or infoTable.Type ~= "Module") then
|
if (not self.Config["UniteModules"] or infoTable.Type ~= "Module") then
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
|
HandleLib(infoTable, library)
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-d")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library)
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, library)
|
|
||||||
end
|
end
|
||||||
elseif (libraryTable.Type == "ExternLib") then
|
elseif (libraryTable.Type == "ExternLib") then
|
||||||
library = libraryTable.Name
|
library = libraryTable.Name
|
||||||
|
|
@ -730,15 +748,10 @@ function NazaraBuild:Process(infoTable)
|
||||||
if (self.Config["BuildDependencies"]) then
|
if (self.Config["BuildDependencies"]) then
|
||||||
table.insert(libraries, library)
|
table.insert(libraries, library)
|
||||||
else
|
else
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
|
HandleLib(infoTable, library)
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-s-d")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, library .. "-s")
|
|
||||||
end
|
end
|
||||||
elseif (libraryTable.Type == "Tool") then
|
elseif (libraryTable.Type == "Tool") then
|
||||||
library = "Nazara" .. libraryTable.Name
|
library = "Nazara" .. libraryTable.Name .. "%s(-s)%d(-d)"
|
||||||
|
|
||||||
-- Import tools includes
|
-- Import tools includes
|
||||||
for k,v in ipairs(libraryTable.Includes) do
|
for k,v in ipairs(libraryTable.Includes) do
|
||||||
|
|
@ -756,19 +769,14 @@ function NazaraBuild:Process(infoTable)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
|
HandleLib(infoTable, library)
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-d")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library)
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, library)
|
|
||||||
else
|
else
|
||||||
infoTable.Excluded = true
|
infoTable.Excluded = true
|
||||||
infoTable.ExcludeReason = "dependency " .. library .. " has invalid type \"" .. libraryTable.Type .. "\""
|
infoTable.ExcludeReason = "dependency " .. library .. " has invalid type \"" .. libraryTable.Type .. "\""
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
table.insert(libraries, library)
|
HandleLib(infoTable, library)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
infoTable.Libraries = libraries
|
infoTable.Libraries = libraries
|
||||||
|
|
@ -876,9 +884,11 @@ function NazaraBuild:PreconfigGenericProject()
|
||||||
filter("configurations:*Dynamic")
|
filter("configurations:*Dynamic")
|
||||||
kind("SharedLib")
|
kind("SharedLib")
|
||||||
|
|
||||||
-- Enable MSVC conformance (not required but better)
|
-- Enable MSVC conformance (not required but better) and some extra warnings
|
||||||
filter("action:vs*")
|
filter("action:vs*")
|
||||||
buildoptions({"/permissive-", "/Zc:__cplusplus", "/Zc:referenceBinding", "/Zc:throwingNew"})
|
buildoptions({"/permissive-", "/Zc:__cplusplus", "/Zc:referenceBinding", "/Zc:throwingNew"})
|
||||||
|
--enablewarnings("4062") -- switch case not handled
|
||||||
|
buildoptions("/w44062") -- looks like enablewarnings is broken currently for msvc
|
||||||
|
|
||||||
-- Enable SSE math and vectorization optimizations
|
-- Enable SSE math and vectorization optimizations
|
||||||
filter({"configurations:Release*", clangGccActions})
|
filter({"configurations:Release*", clangGccActions})
|
||||||
|
|
|
||||||
|
|
@ -2,32 +2,17 @@ MODULE.Name = "Platform"
|
||||||
|
|
||||||
MODULE.ClientOnly = true
|
MODULE.ClientOnly = true
|
||||||
|
|
||||||
|
MODULE.Defines = {
|
||||||
|
"NAZARA_PLATFORM_SDL2"
|
||||||
|
}
|
||||||
|
|
||||||
MODULE.Libraries = {
|
MODULE.Libraries = {
|
||||||
"NazaraCore",
|
"NazaraCore",
|
||||||
"NazaraUtility"
|
"NazaraUtility",
|
||||||
|
"SDL2"
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE.OsFiles.Windows = {
|
MODULE.Files = {
|
||||||
"../src/Nazara/Platform/Win32/**.hpp",
|
"../src/Nazara/Platform/SDL2/**.hpp",
|
||||||
"../src/Nazara/Platform/Win32/**.cpp"
|
"../src/Nazara/Platform/SDL2/**.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE.OsFiles.Posix = {
|
|
||||||
"../src/Nazara/Platform/X11/**.hpp",
|
|
||||||
"../src/Nazara/Platform/X11/**.cpp"
|
|
||||||
}
|
|
||||||
|
|
||||||
MODULE.OsLibraries.Windows = {
|
|
||||||
"gdi32"
|
|
||||||
}
|
|
||||||
|
|
||||||
MODULE.OsLibraries.Posix = {
|
|
||||||
"X11",
|
|
||||||
"xcb",
|
|
||||||
"xcb-cursor",
|
|
||||||
"xcb-ewmh",
|
|
||||||
"xcb-icccm",
|
|
||||||
"xcb-keysyms",
|
|
||||||
"xcb-randr"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,9 @@ MODULE.Name = "Renderer"
|
||||||
|
|
||||||
MODULE.ClientOnly = true
|
MODULE.ClientOnly = true
|
||||||
|
|
||||||
MODULE.Defines = {
|
|
||||||
"NAZARA_RENDERER_OPENGL"
|
|
||||||
}
|
|
||||||
|
|
||||||
MODULE.Libraries = {
|
MODULE.Libraries = {
|
||||||
"NazaraCore",
|
"NazaraCore",
|
||||||
|
"NazaraShader",
|
||||||
"NazaraUtility",
|
"NazaraUtility",
|
||||||
"NazaraPlatform"
|
"NazaraPlatform"
|
||||||
}
|
}
|
||||||
|
|
@ -22,13 +19,3 @@ MODULE.OsFiles.Posix = {
|
||||||
"../src/Nazara/Renderer/GLX/**.cpp"
|
"../src/Nazara/Renderer/GLX/**.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE.OsLibraries.Windows = {
|
|
||||||
"gdi32",
|
|
||||||
"opengl32",
|
|
||||||
"winmm"
|
|
||||||
}
|
|
||||||
|
|
||||||
MODULE.OsLibraries.Posix = {
|
|
||||||
"GL",
|
|
||||||
"X11"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
MODULE.Name = "Shader"
|
||||||
|
|
||||||
|
MODULE.Libraries = {
|
||||||
|
"NazaraCore",
|
||||||
|
"NazaraUtility"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
TOOL.Name = "OpenGLRenderer"
|
||||||
|
|
||||||
|
TOOL.ClientOnly = true
|
||||||
|
|
||||||
|
TOOL.Kind = "Library"
|
||||||
|
TOOL.TargetDirectory = "../lib"
|
||||||
|
|
||||||
|
TOOL.Defines = {
|
||||||
|
"NAZARA_BUILD",
|
||||||
|
"NAZARA_OPENGLRENDERER_BUILD"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Includes = {
|
||||||
|
"../include",
|
||||||
|
"../src/",
|
||||||
|
"../extlibs/include"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Files = {
|
||||||
|
"../include/Nazara/OpenGLRenderer/**.hpp",
|
||||||
|
"../include/Nazara/OpenGLRenderer/**.inl",
|
||||||
|
"../src/Nazara/OpenGLRenderer/**.hpp",
|
||||||
|
"../src/Nazara/OpenGLRenderer/**.inl",
|
||||||
|
"../src/Nazara/OpenGLRenderer/**.cpp"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Libraries = {
|
||||||
|
"NazaraCore",
|
||||||
|
"NazaraPlatform",
|
||||||
|
"NazaraRenderer",
|
||||||
|
"NazaraShader",
|
||||||
|
"NazaraUtility"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.OsFiles.Windows = {
|
||||||
|
"../src/Nazara/OpenGLRenderer/Win32/**.hpp",
|
||||||
|
"../src/Nazara/OpenGLRenderer/Win32/**.cpp"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
TOOL.Name = "ShaderNodes"
|
||||||
|
|
||||||
|
TOOL.ClientOnly = true
|
||||||
|
TOOL.EnableConsole = true
|
||||||
|
TOOL.Kind = "Application"
|
||||||
|
TOOL.TargetDirectory = "../bin"
|
||||||
|
|
||||||
|
TOOL.Defines = {
|
||||||
|
"NODE_EDITOR_SHARED"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Includes = {
|
||||||
|
"../include",
|
||||||
|
"../extlibs/include",
|
||||||
|
"../src"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Files = {
|
||||||
|
"../src/ShaderNode/**.hpp",
|
||||||
|
"../src/ShaderNode/**.inl",
|
||||||
|
"../src/ShaderNode/**.cpp"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Libraries = {
|
||||||
|
"NazaraCore%s(-s)%d(-d)",
|
||||||
|
"NazaraShader%s(-s)%d(-d)",
|
||||||
|
"NazaraUtility%s(-s)%d(-d)",
|
||||||
|
"Qt5Core%d(d)",
|
||||||
|
"Qt5Gui%d(d)",
|
||||||
|
"Qt5Widgets%d(d)",
|
||||||
|
"nodes%d(d)"
|
||||||
|
}
|
||||||
|
|
||||||
|
local function AppendValues(tab, value)
|
||||||
|
if (type(value) == "table") then
|
||||||
|
for _, v in pairs(value) do
|
||||||
|
AppendValues(tab, v)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table.insert(tab, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TOOL:ValidateLib(libName)
|
||||||
|
local config = NazaraBuild:GetConfig()
|
||||||
|
local includes = config[libName .. "IncludeDir"]
|
||||||
|
local binDir32 = config[libName .. "BinDir_x86"]
|
||||||
|
local binDir64 = config[libName .. "BinDir_x64"]
|
||||||
|
local libDir32 = config[libName .. "LibDir_x86"]
|
||||||
|
local libDir64 = config[libName .. "LibDir_x64"]
|
||||||
|
if (not includes) then
|
||||||
|
return false, "missing " .. libName .. " includes directories in config.lua"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not libDir32 and not libDir64) then
|
||||||
|
return false, "missing " .. libName .. " library search directories in config.lua"
|
||||||
|
end
|
||||||
|
|
||||||
|
AppendValues(self.Includes, includes)
|
||||||
|
|
||||||
|
if (binDir32) then
|
||||||
|
AppendValues(self.BinaryPaths.x86, binDir32)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (binDir64) then
|
||||||
|
AppendValues(self.BinaryPaths.x64, binDir64)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (libDir32) then
|
||||||
|
AppendValues(self.LibraryPaths.x86, libDir32)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (libDir64) then
|
||||||
|
AppendValues(self.LibraryPaths.x64, libDir64)
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function TOOL:Validate()
|
||||||
|
local success, err = self:ValidateLib("Qt5")
|
||||||
|
if (not success) then
|
||||||
|
return false, err
|
||||||
|
end
|
||||||
|
|
||||||
|
local success, err = self:ValidateLib("QtNodes")
|
||||||
|
if (not success) then
|
||||||
|
return false, err
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
TOOL.Name = "VulkanRenderer"
|
||||||
|
|
||||||
|
TOOL.ClientOnly = true
|
||||||
|
|
||||||
|
TOOL.Kind = "Library"
|
||||||
|
TOOL.TargetDirectory = "../lib"
|
||||||
|
|
||||||
|
TOOL.Defines = {
|
||||||
|
"NAZARA_BUILD",
|
||||||
|
"NAZARA_VULKANRENDERER_BUILD",
|
||||||
|
"VK_NO_PROTOTYPES"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Includes = {
|
||||||
|
"../include",
|
||||||
|
"../src/",
|
||||||
|
"../extlibs/include"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Files = {
|
||||||
|
"../include/Nazara/VulkanRenderer/**.hpp",
|
||||||
|
"../include/Nazara/VulkanRenderer/**.inl",
|
||||||
|
"../src/Nazara/VulkanRenderer/**.hpp",
|
||||||
|
"../src/Nazara/VulkanRenderer/**.inl",
|
||||||
|
"../src/Nazara/VulkanRenderer/**.cpp"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.Libraries = {
|
||||||
|
"NazaraCore",
|
||||||
|
"NazaraPlatform",
|
||||||
|
"NazaraRenderer",
|
||||||
|
"NazaraShader",
|
||||||
|
"NazaraUtility"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.OsDefines.Linux = {
|
||||||
|
-- "VK_USE_PLATFORM_MIR_KHR",
|
||||||
|
"VK_USE_PLATFORM_XCB_KHR"
|
||||||
|
-- "VK_USE_PLATFORM_XLIB_KHR",
|
||||||
|
-- "VK_USE_PLATFORM_WAYLAND_KHR"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.OsDefines.BSD = TOOL.OsDefines.Linux
|
||||||
|
TOOL.OsDefines.Solaris = TOOL.OsDefines.Linux
|
||||||
|
|
||||||
|
TOOL.OsDefines.Windows = {
|
||||||
|
"VK_USE_PLATFORM_WIN32_KHR"
|
||||||
|
}
|
||||||
|
|
||||||
|
TOOL.OsFiles.Windows = {
|
||||||
|
"../src/Nazara/VulkanRenderer/Win32/**.hpp",
|
||||||
|
"../src/Nazara/VulkanRenderer/Win32/**.cpp"
|
||||||
|
}
|
||||||
|
|
@ -71,7 +71,7 @@ int main()
|
||||||
std::cout << "Sound position: " << pos << std::endl;
|
std::cout << "Sound position: " << pos << std::endl;
|
||||||
|
|
||||||
// Si la position de la source atteint une certaine position, ou si l'utilisateur appuie sur echap
|
// Si la position de la source atteint une certaine position, ou si l'utilisateur appuie sur echap
|
||||||
if (pos.x > Nz::Vector3f::Left().x*-50.f || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Escape))
|
if (pos.x > Nz::Vector3f::Left().x*-50.f || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Escape))
|
||||||
sound.Stop(); // On arrête le son (Stoppant également la boucle)
|
sound.Stop(); // On arrête le son (Stoppant également la boucle)
|
||||||
|
|
||||||
clock.Restart();
|
clock.Restart();
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,7 @@ EXAMPLE.Files = {
|
||||||
EXAMPLE.Libraries = {
|
EXAMPLE.Libraries = {
|
||||||
"NazaraSDK"
|
"NazaraSDK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if Config.PlatformSDL2 then
|
||||||
|
table.insert(EXAMPLE.Defines, "NAZARA_PLATFORM_SDL2")
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,8 @@ int main()
|
||||||
//Gestion des Evenements
|
//Gestion des Evenements
|
||||||
Nz::EventHandler& eventHandler = window.GetEventHandler();
|
Nz::EventHandler& eventHandler = window.GetEventHandler();
|
||||||
|
|
||||||
|
Nz::Mouse::SetRelativeMouseMode(true);
|
||||||
|
|
||||||
eventHandler.OnMouseMoved.Connect([&camAngles, &cameraNode, &window](const Nz::EventHandler*, const Nz::WindowEvent::MouseMoveEvent& event)
|
eventHandler.OnMouseMoved.Connect([&camAngles, &cameraNode, &window](const Nz::EventHandler*, const Nz::WindowEvent::MouseMoveEvent& event)
|
||||||
{
|
{
|
||||||
if (Ndk::Application::Instance()->IsConsoleEnabled())
|
if (Ndk::Application::Instance()->IsConsoleEnabled())
|
||||||
|
|
@ -285,19 +287,14 @@ int main()
|
||||||
|
|
||||||
// On applique les angles d'Euler à notre caméra
|
// On applique les angles d'Euler à notre caméra
|
||||||
cameraNode.SetRotation(camAngles);
|
cameraNode.SetRotation(camAngles);
|
||||||
|
|
||||||
// Pour éviter que le curseur ne sorte de l'écran, nous le renvoyons au centre de la fenétre
|
|
||||||
// Cette fonction est codée de sorte à ne pas provoquer d'événement MouseMoved
|
|
||||||
Nz::Vector2ui size = window.GetSize();
|
|
||||||
Nz::Mouse::SetPosition(size.x / 2, size.y / 2, window);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
eventHandler.OnKeyPressed.Connect([&targetPos, &cameraNode, &smoothMovement, &window](const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& event)
|
eventHandler.OnKeyPressed.Connect([&targetPos, &cameraNode, &smoothMovement, &window](const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& event)
|
||||||
{
|
{
|
||||||
// Une touche a été pressée !
|
// Une touche a été pressée !
|
||||||
if (event.code == Nz::Keyboard::Key::Escape)
|
if (event.virtualKey == Nz::Keyboard::VKey::Escape)
|
||||||
window.Close();
|
window.Close();
|
||||||
else if (event.code == Nz::Keyboard::F1)
|
else if (event.virtualKey == Nz::Keyboard::VKey::F1)
|
||||||
{
|
{
|
||||||
if (smoothMovement)
|
if (smoothMovement)
|
||||||
{
|
{
|
||||||
|
|
@ -338,34 +335,34 @@ int main()
|
||||||
if (move)
|
if (move)
|
||||||
{
|
{
|
||||||
// Si la touche espace est enfoncée, notre vitesse de déplacement est multipliée par deux
|
// Si la touche espace est enfoncée, notre vitesse de déplacement est multipliée par deux
|
||||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Space))
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Space))
|
||||||
cameraSpeed *= 2.f;
|
cameraSpeed *= 2.f;
|
||||||
|
|
||||||
// Pour que nos déplacement soient liés à la rotation de la caméra, nous allons utiliser
|
// Pour que nos déplacement soient liés à la rotation de la caméra, nous allons utiliser
|
||||||
// les directions locales de la caméra
|
// les directions locales de la caméra
|
||||||
|
|
||||||
// Si la flèche du haut ou la touche Z (vive ZQSD !!) est pressée, on avance
|
// Si la flèche du haut ou la touche Z (vive ZQSD !!) est pressée, on avance
|
||||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Up) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Z))
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Up) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Z))
|
||||||
targetPos += cameraNode.GetForward() * cameraSpeed;
|
targetPos += cameraNode.GetForward() * cameraSpeed;
|
||||||
|
|
||||||
// Si la flèche du bas ou la touche S est pressée, on recule
|
// Si la flèche du bas ou la touche S est pressée, on recule
|
||||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Down) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::S))
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Down) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::S))
|
||||||
targetPos += cameraNode.GetBackward() * cameraSpeed;
|
targetPos += cameraNode.GetBackward() * cameraSpeed;
|
||||||
|
|
||||||
// Etc...
|
// Etc...
|
||||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Left) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Q))
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Left) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Q))
|
||||||
targetPos += cameraNode.GetLeft() * cameraSpeed;
|
targetPos += cameraNode.GetLeft() * cameraSpeed;
|
||||||
|
|
||||||
// Etc...
|
// Etc...
|
||||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Right) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::D))
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Right) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::D))
|
||||||
targetPos += cameraNode.GetRight() * cameraSpeed;
|
targetPos += cameraNode.GetRight() * cameraSpeed;
|
||||||
|
|
||||||
// Majuscule pour monter, notez l'utilisation d'une direction globale (Non-affectée par la rotation)
|
// Majuscule pour monter, notez l'utilisation d'une direction globale (Non-affectée par la rotation)
|
||||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::LShift) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::RShift))
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::LShift) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::RShift))
|
||||||
targetPos += Nz::Vector3f::Up() * cameraSpeed;
|
targetPos += Nz::Vector3f::Up() * cameraSpeed;
|
||||||
|
|
||||||
// Contrôle (Gauche ou droite) pour descendre dans l'espace global, etc...
|
// Contrôle (Gauche ou droite) pour descendre dans l'espace global, etc...
|
||||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::LControl) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::RControl))
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::LControl) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::RControl))
|
||||||
targetPos += Nz::Vector3f::Down() * cameraSpeed;
|
targetPos += Nz::Vector3f::Down() * cameraSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,6 @@ EXAMPLE.Libraries = {
|
||||||
"NazaraUtility"
|
"NazaraUtility"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if Config.PlatformSDL2 then
|
||||||
|
table.insert(EXAMPLE.Defines, "NAZARA_PLATFORM_SDL2")
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ LogoExample::LogoExample(ExampleShared& sharedData) :
|
||||||
ParticleDemo("Logo", sharedData)
|
ParticleDemo("Logo", sharedData)
|
||||||
{
|
{
|
||||||
Nz::ImageParams params;
|
Nz::ImageParams params;
|
||||||
params.loadFormat = Nz::PixelFormatType_RGBA8;
|
params.loadFormat = Nz::PixelFormat_RGBA8;
|
||||||
|
|
||||||
m_logo = Nz::Image::LoadFromFile("E:/Twitch/avatar_interested.png", params);
|
m_logo = Nz::Image::LoadFromFile("E:/Twitch/avatar_interested.png", params);
|
||||||
if (!m_logo)
|
if (!m_logo)
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ ParticleDemo("Space battle", sharedData)
|
||||||
}
|
}
|
||||||
|
|
||||||
Nz::TextureRef skyboxCubemap = Nz::Texture::New();
|
Nz::TextureRef skyboxCubemap = Nz::Texture::New();
|
||||||
if (skyboxCubemap->Create(Nz::ImageType_Cubemap, Nz::PixelFormatType_RGBA8, 2048, 2048))
|
if (skyboxCubemap->Create(Nz::ImageType_Cubemap, Nz::PixelFormat_RGBA8, 2048, 2048))
|
||||||
{
|
{
|
||||||
skyboxCubemap->LoadFaceFromFile(Nz::CubemapFace_PositiveX, "resources/purple_nebula_skybox/purple_nebula_skybox_right1.png");
|
skyboxCubemap->LoadFaceFromFile(Nz::CubemapFace_PositiveX, "resources/purple_nebula_skybox/purple_nebula_skybox_right1.png");
|
||||||
skyboxCubemap->LoadFaceFromFile(Nz::CubemapFace_PositiveY, "resources/purple_nebula_skybox/purple_nebula_skybox_top3.png");
|
skyboxCubemap->LoadFaceFromFile(Nz::CubemapFace_PositiveY, "resources/purple_nebula_skybox/purple_nebula_skybox_top3.png");
|
||||||
|
|
@ -680,6 +680,7 @@ void SpacebattleExample::Leave(Ndk::StateMachine& fsm)
|
||||||
{
|
{
|
||||||
m_ambientMusic.Stop();
|
m_ambientMusic.Stop();
|
||||||
m_onMouseMoved.Disconnect();
|
m_onMouseMoved.Disconnect();
|
||||||
|
if (m_shared.target)
|
||||||
m_shared.target->SetCursor(Nz::SystemCursor_Default);
|
m_shared.target->SetCursor(Nz::SystemCursor_Default);
|
||||||
m_shared.world3D->RemoveSystem<LaserBeamSystem>();
|
m_shared.world3D->RemoveSystem<LaserBeamSystem>();
|
||||||
m_shared.world3D->RemoveSystem<SpaceshipSystem>();
|
m_shared.world3D->RemoveSystem<SpaceshipSystem>();
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,7 @@ EXAMPLE.Files = {
|
||||||
EXAMPLE.Libraries = {
|
EXAMPLE.Libraries = {
|
||||||
"NazaraSDK"
|
"NazaraSDK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if Config.PlatformSDL2 then
|
||||||
|
table.insert(EXAMPLE.Defines, "NAZARA_PLATFORM_SDL2")
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -123,17 +123,17 @@ int main()
|
||||||
{
|
{
|
||||||
case Nz::WindowEventType_KeyPressed:
|
case Nz::WindowEventType_KeyPressed:
|
||||||
{
|
{
|
||||||
switch (event.key.code)
|
switch (event.key.virtualKey)
|
||||||
{
|
{
|
||||||
case Nz::Keyboard::Backspace:
|
case Nz::Keyboard::VKey::Backspace:
|
||||||
stateMachine.ChangeState(shared.demos[demoIndex]);
|
stateMachine.ChangeState(shared.demos[demoIndex]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Nz::Keyboard::Escape:
|
case Nz::Keyboard::VKey::Escape:
|
||||||
app.Quit();
|
app.Quit();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Nz::Keyboard::Left:
|
case Nz::Keyboard::VKey::Left:
|
||||||
{
|
{
|
||||||
if (shared.demos.size() <= 1)
|
if (shared.demos.size() <= 1)
|
||||||
break;
|
break;
|
||||||
|
|
@ -146,7 +146,7 @@ int main()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Nz::Keyboard::Right:
|
case Nz::Keyboard::VKey::Right:
|
||||||
{
|
{
|
||||||
if (shared.demos.size() <= 1)
|
if (shared.demos.size() <= 1)
|
||||||
break;
|
break;
|
||||||
|
|
@ -159,17 +159,17 @@ int main()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Nz::Keyboard::Pause:
|
case Nz::Keyboard::VKey::Pause:
|
||||||
{
|
{
|
||||||
auto& velocitySystem = shared.world3D->GetSystem<Ndk::VelocitySystem>();
|
auto& velocitySystem = shared.world3D->GetSystem<Ndk::VelocitySystem>();
|
||||||
velocitySystem.Enable(!velocitySystem.IsEnabled());
|
velocitySystem.Enable(!velocitySystem.IsEnabled());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Nz::Keyboard::F5:
|
case Nz::Keyboard::VKey::F5:
|
||||||
{
|
{
|
||||||
Nz::Image screenshot;
|
Nz::Image screenshot;
|
||||||
screenshot.Create(Nz::ImageType_2D, Nz::PixelFormatType_RGBA8, 1920, 1080);
|
screenshot.Create(Nz::ImageType_2D, Nz::PixelFormat_RGBA8, 1920, 1080);
|
||||||
window.CopyToImage(&screenshot);
|
window.CopyToImage(&screenshot);
|
||||||
|
|
||||||
static unsigned int counter = 1;
|
static unsigned int counter = 1;
|
||||||
|
|
@ -197,5 +197,7 @@ int main()
|
||||||
window.Display();
|
window.Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shared.target = nullptr;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,7 @@ EXAMPLE.Libraries = {
|
||||||
"NazaraUtility",
|
"NazaraUtility",
|
||||||
"NazaraSDK"
|
"NazaraSDK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if Config.PlatformSDL2 then
|
||||||
|
table.insert(EXAMPLE.Defines, "NAZARA_PLATFORM_SDL2")
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ int main(int argc, char* argv[])
|
||||||
Ndk::Application application(argc, argv);
|
Ndk::Application application(argc, argv);
|
||||||
|
|
||||||
// Do what you want here
|
// Do what you want here
|
||||||
|
Nz::LuaInstance lua;
|
||||||
|
std::cout << lua.Execute("return {key = 42}") << std::endl;
|
||||||
|
std::cout << lua.DumpStack() << std::endl;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,7 @@ EXAMPLE.Files = {
|
||||||
EXAMPLE.Libraries = {
|
EXAMPLE.Libraries = {
|
||||||
"NazaraSDK"
|
"NazaraSDK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if Config.PlatformSDL2 then
|
||||||
|
table.insert(EXAMPLE.Defines, "NAZARA_PLATFORM_SDL2")
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,7 @@ EXAMPLE.Files = {
|
||||||
EXAMPLE.Libraries = {
|
EXAMPLE.Libraries = {
|
||||||
"NazaraSDK"
|
"NazaraSDK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if Config.PlatformSDL2 then
|
||||||
|
table.insert(EXAMPLE.Defines, "NAZARA_PLATFORM_SDL2")
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ int main(int argc, char* argv[])
|
||||||
Nz::EventHandler& eventHandler = mainWindow.GetEventHandler();
|
Nz::EventHandler& eventHandler = mainWindow.GetEventHandler();
|
||||||
eventHandler.OnKeyPressed.Connect([](const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& e)
|
eventHandler.OnKeyPressed.Connect([](const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& e)
|
||||||
{
|
{
|
||||||
std::cout << Nz::Keyboard::GetKeyName(e.code) << std::endl;
|
std::cout << Nz::Keyboard::GetKeyName(e.virtualKey) << std::endl;
|
||||||
|
|
||||||
// Profitons-en aussi pour nous donner un moyen de quitter le programme
|
// Profitons-en aussi pour nous donner un moyen de quitter le programme
|
||||||
if (e.code == Nz::Keyboard::Escape)
|
if (e.virtualKey == Nz::Keyboard::VKey::Escape)
|
||||||
Ndk::Application::Instance()->Quit(); // Cette ligne casse la boucle Run() de l'application
|
Ndk::Application::Instance()->Quit(); // Cette ligne casse la boucle Run() de l'application
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
EXAMPLE.Name = "VulkanTest"
|
||||||
|
|
||||||
|
EXAMPLE.EnableConsole = true
|
||||||
|
|
||||||
|
EXAMPLE.Files = {
|
||||||
|
"main.cpp"
|
||||||
|
}
|
||||||
|
|
||||||
|
EXAMPLE.Libraries = {
|
||||||
|
"NazaraCore",
|
||||||
|
"NazaraPlatform",
|
||||||
|
"NazaraRenderer",
|
||||||
|
"NazaraUtility"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,355 @@
|
||||||
|
#include <Nazara/Utility.hpp>
|
||||||
|
#include <Nazara/Renderer.hpp>
|
||||||
|
#include <array>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Nz::Initializer<Nz::Renderer> loader;
|
||||||
|
if (!loader)
|
||||||
|
{
|
||||||
|
std::cout << "Failed to initialize Vulkan" << std::endl;
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
Nz::RenderWindow window;
|
||||||
|
|
||||||
|
Nz::MeshParams meshParams;
|
||||||
|
meshParams.matrix = Nz::Matrix4f::Rotate(Nz::EulerAnglesf(0.f, 90.f, 180.f)) * Nz::Matrix4f::Scale(Nz::Vector3f(0.002f));
|
||||||
|
meshParams.vertexDeclaration = Nz::VertexDeclaration::Get(Nz::VertexLayout_XYZ_Normal_UV);
|
||||||
|
|
||||||
|
Nz::String windowTitle = "Vulkan Test";
|
||||||
|
if (!window.Create(Nz::VideoMode(800, 600, 32), windowTitle))
|
||||||
|
{
|
||||||
|
std::cout << "Failed to create Window" << std::endl;
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Nz::RenderDevice> device = window.GetRenderDevice();
|
||||||
|
|
||||||
|
auto fragmentShader = device->InstantiateShaderStage(Nz::ShaderStageType::Fragment, Nz::ShaderLanguage::NazaraBinary, "frag.shader");
|
||||||
|
if (!fragmentShader)
|
||||||
|
{
|
||||||
|
std::cout << "Failed to instantiate fragment shader" << std::endl;
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto vertexShader = device->InstantiateShaderStage(Nz::ShaderStageType::Vertex, Nz::ShaderLanguage::NazaraBinary, "vert.shader");
|
||||||
|
if (!vertexShader)
|
||||||
|
{
|
||||||
|
std::cout << "Failed to instantiate fragment shader" << std::endl;
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
Nz::MeshRef drfreak = Nz::Mesh::LoadFromFile("resources/Spaceship/spaceship.obj", meshParams);
|
||||||
|
|
||||||
|
if (!drfreak)
|
||||||
|
{
|
||||||
|
NazaraError("Failed to load model");
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
Nz::StaticMesh* drfreakMesh = static_cast<Nz::StaticMesh*>(drfreak->GetSubMesh(0));
|
||||||
|
|
||||||
|
const Nz::VertexBuffer* drfreakVB = drfreakMesh->GetVertexBuffer();
|
||||||
|
const Nz::IndexBuffer* drfreakIB = drfreakMesh->GetIndexBuffer();
|
||||||
|
|
||||||
|
// Index buffer
|
||||||
|
std::cout << "Index count: " << drfreakIB->GetIndexCount() << std::endl;
|
||||||
|
|
||||||
|
// Vertex buffer
|
||||||
|
std::cout << "Vertex count: " << drfreakVB->GetVertexCount() << std::endl;
|
||||||
|
|
||||||
|
// Texture
|
||||||
|
Nz::ImageRef drfreakImage = Nz::Image::LoadFromFile("resources/Spaceship/Texture/diffuse.png");
|
||||||
|
if (!drfreakImage || !drfreakImage->Convert(Nz::PixelFormat_RGBA8))
|
||||||
|
{
|
||||||
|
NazaraError("Failed to load image");
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
Nz::TextureInfo texParams;
|
||||||
|
texParams.pixelFormat = drfreakImage->GetFormat();
|
||||||
|
texParams.type = drfreakImage->GetType();
|
||||||
|
texParams.width = drfreakImage->GetWidth();
|
||||||
|
texParams.height = drfreakImage->GetHeight();
|
||||||
|
texParams.depth = drfreakImage->GetDepth();
|
||||||
|
|
||||||
|
std::unique_ptr<Nz::Texture> texture = device->InstantiateTexture(texParams);
|
||||||
|
if (!texture->Update(drfreakImage->GetConstPixels()))
|
||||||
|
{
|
||||||
|
NazaraError("Failed to update texture");
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Nz::TextureSampler> textureSampler = device->InstantiateTextureSampler({});
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
Nz::Matrix4f projectionMatrix;
|
||||||
|
Nz::Matrix4f modelMatrix;
|
||||||
|
Nz::Matrix4f viewMatrix;
|
||||||
|
}
|
||||||
|
ubo;
|
||||||
|
|
||||||
|
Nz::Vector2ui windowSize = window.GetSize();
|
||||||
|
ubo.projectionMatrix = Nz::Matrix4f::Perspective(70.f, float(windowSize.x) / windowSize.y, 0.1f, 1000.f);
|
||||||
|
ubo.viewMatrix = Nz::Matrix4f::Translate(Nz::Vector3f::Backward() * 1);
|
||||||
|
ubo.modelMatrix = Nz::Matrix4f::Translate(Nz::Vector3f::Forward() * 2 + Nz::Vector3f::Right());
|
||||||
|
|
||||||
|
Nz::UInt32 uniformSize = sizeof(ubo);
|
||||||
|
|
||||||
|
Nz::RenderPipelineLayoutInfo pipelineLayoutInfo;
|
||||||
|
auto& uboBinding = pipelineLayoutInfo.bindings.emplace_back();
|
||||||
|
uboBinding.index = 0;
|
||||||
|
uboBinding.shaderStageFlags = Nz::ShaderStageType::Vertex;
|
||||||
|
uboBinding.type = Nz::ShaderBindingType::UniformBuffer;
|
||||||
|
|
||||||
|
auto& textureBinding = pipelineLayoutInfo.bindings.emplace_back();
|
||||||
|
textureBinding.index = 1;
|
||||||
|
textureBinding.shaderStageFlags = Nz::ShaderStageType::Fragment;
|
||||||
|
textureBinding.type = Nz::ShaderBindingType::Texture;
|
||||||
|
|
||||||
|
std::shared_ptr<Nz::RenderPipelineLayout> renderPipelineLayout = device->InstantiateRenderPipelineLayout(std::move(pipelineLayoutInfo));
|
||||||
|
|
||||||
|
Nz::ShaderBindingPtr shaderBinding = renderPipelineLayout->AllocateShaderBinding();
|
||||||
|
|
||||||
|
std::unique_ptr<Nz::AbstractBuffer> uniformBuffer = device->InstantiateBuffer(Nz::BufferType_Uniform);
|
||||||
|
if (!uniformBuffer->Initialize(uniformSize, Nz::BufferUsage_DeviceLocal))
|
||||||
|
{
|
||||||
|
NazaraError("Failed to create uniform buffer");
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
shaderBinding->Update({
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
Nz::ShaderBinding::UniformBufferBinding {
|
||||||
|
uniformBuffer.get(), 0, uniformSize
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
1,
|
||||||
|
Nz::ShaderBinding::TextureBinding {
|
||||||
|
texture.get(), textureSampler.get()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Nz::RenderPipelineInfo pipelineInfo;
|
||||||
|
pipelineInfo.pipelineLayout = renderPipelineLayout;
|
||||||
|
|
||||||
|
pipelineInfo.depthBuffer = true;
|
||||||
|
pipelineInfo.shaderStages.emplace_back(fragmentShader);
|
||||||
|
pipelineInfo.shaderStages.emplace_back(vertexShader);
|
||||||
|
|
||||||
|
auto& vertexBuffer = pipelineInfo.vertexBuffers.emplace_back();
|
||||||
|
vertexBuffer.binding = 0;
|
||||||
|
vertexBuffer.declaration = drfreakVB->GetVertexDeclaration();
|
||||||
|
|
||||||
|
std::unique_ptr<Nz::RenderPipeline> pipeline = device->InstantiateRenderPipeline(pipelineInfo);
|
||||||
|
|
||||||
|
Nz::RenderDevice* renderDevice = window.GetRenderDevice().get();
|
||||||
|
|
||||||
|
Nz::RenderWindowImpl* windowImpl = window.GetImpl();
|
||||||
|
std::unique_ptr<Nz::CommandPool> commandPool = windowImpl->CreateCommandPool(Nz::QueueType::Graphics);
|
||||||
|
|
||||||
|
Nz::RenderBuffer* renderBufferIB = static_cast<Nz::RenderBuffer*>(drfreakIB->GetBuffer()->GetImpl());
|
||||||
|
Nz::RenderBuffer* renderBufferVB = static_cast<Nz::RenderBuffer*>(drfreakVB->GetBuffer()->GetImpl());
|
||||||
|
|
||||||
|
if (!renderBufferIB->Synchronize(renderDevice))
|
||||||
|
{
|
||||||
|
NazaraError("Failed to synchronize render buffer");
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!renderBufferVB->Synchronize(renderDevice))
|
||||||
|
{
|
||||||
|
NazaraError("Failed to synchronize render buffer");
|
||||||
|
return __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
|
Nz::AbstractBuffer* indexBufferImpl = renderBufferIB->GetHardwareBuffer(renderDevice);
|
||||||
|
Nz::AbstractBuffer* vertexBufferImpl = renderBufferVB->GetHardwareBuffer(renderDevice);
|
||||||
|
|
||||||
|
std::unique_ptr<Nz::CommandBuffer> drawCommandBuffer;
|
||||||
|
auto RebuildCommandBuffer = [&]
|
||||||
|
{
|
||||||
|
Nz::Vector2ui windowSize = window.GetSize();
|
||||||
|
|
||||||
|
drawCommandBuffer = commandPool->BuildCommandBuffer([&](Nz::CommandBufferBuilder& builder)
|
||||||
|
{
|
||||||
|
Nz::Recti renderRect(0, 0, window.GetSize().x, window.GetSize().y);
|
||||||
|
|
||||||
|
Nz::CommandBufferBuilder::ClearValues clearValues[2];
|
||||||
|
clearValues[0].color = Nz::Color::Black;
|
||||||
|
clearValues[1].depth = 1.f;
|
||||||
|
clearValues[1].stencil = 0;
|
||||||
|
|
||||||
|
builder.BeginDebugRegion("Main window rendering", Nz::Color::Green);
|
||||||
|
{
|
||||||
|
builder.BeginRenderPass(windowImpl->GetFramebuffer(), windowImpl->GetRenderPass(), renderRect, { clearValues[0], clearValues[1] });
|
||||||
|
{
|
||||||
|
builder.BindIndexBuffer(indexBufferImpl);
|
||||||
|
builder.BindPipeline(*pipeline);
|
||||||
|
builder.BindVertexBuffer(0, vertexBufferImpl);
|
||||||
|
builder.BindShaderBinding(*shaderBinding);
|
||||||
|
|
||||||
|
builder.SetScissor(Nz::Recti{ 0, 0, int(windowSize.x), int(windowSize.y) });
|
||||||
|
builder.SetViewport(Nz::Recti{ 0, 0, int(windowSize.x), int(windowSize.y) });
|
||||||
|
|
||||||
|
builder.DrawIndexed(drfreakIB->GetIndexCount());
|
||||||
|
}
|
||||||
|
builder.EndRenderPass();
|
||||||
|
}
|
||||||
|
builder.EndDebugRegion();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
RebuildCommandBuffer();
|
||||||
|
|
||||||
|
|
||||||
|
Nz::Vector3f viewerPos = Nz::Vector3f::Zero();
|
||||||
|
|
||||||
|
Nz::EulerAnglesf camAngles(0.f, 0.f, 0.f);
|
||||||
|
Nz::Quaternionf camQuat(camAngles);
|
||||||
|
|
||||||
|
window.EnableEventPolling(true);
|
||||||
|
|
||||||
|
Nz::Clock updateClock;
|
||||||
|
Nz::Clock secondClock;
|
||||||
|
unsigned int fps = 0;
|
||||||
|
bool uboUpdate = true;
|
||||||
|
|
||||||
|
Nz::Mouse::SetRelativeMouseMode(true);
|
||||||
|
|
||||||
|
while (window.IsOpen())
|
||||||
|
{
|
||||||
|
Nz::WindowEvent event;
|
||||||
|
while (window.PollEvent(&event))
|
||||||
|
{
|
||||||
|
switch (event.type)
|
||||||
|
{
|
||||||
|
case Nz::WindowEventType_Quit:
|
||||||
|
window.Close();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Nz::WindowEventType_MouseMoved: // La souris a bougé
|
||||||
|
{
|
||||||
|
// Gestion de la caméra free-fly (Rotation)
|
||||||
|
float sensitivity = 0.3f; // Sensibilité de la souris
|
||||||
|
|
||||||
|
// On modifie l'angle de la caméra grâce au déplacement relatif sur X de la souris
|
||||||
|
camAngles.yaw = Nz::NormalizeAngle(camAngles.yaw - event.mouseMove.deltaX*sensitivity);
|
||||||
|
|
||||||
|
// Idem, mais pour éviter les problèmes de calcul de la matrice de vue, on restreint les angles
|
||||||
|
camAngles.pitch = Nz::Clamp(camAngles.pitch + event.mouseMove.deltaY*sensitivity, -89.f, 89.f);
|
||||||
|
|
||||||
|
camQuat = camAngles;
|
||||||
|
|
||||||
|
uboUpdate = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Nz::WindowEventType_Resized:
|
||||||
|
{
|
||||||
|
Nz::Vector2ui windowSize = window.GetSize();
|
||||||
|
ubo.projectionMatrix = Nz::Matrix4f::Perspective(70.f, float(windowSize.x) / windowSize.y, 0.1f, 1000.f);
|
||||||
|
uboUpdate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateClock.GetMilliseconds() > 1000 / 60)
|
||||||
|
{
|
||||||
|
float cameraSpeed = 2.f * updateClock.GetSeconds();
|
||||||
|
updateClock.Restart();
|
||||||
|
|
||||||
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Up) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Z))
|
||||||
|
viewerPos += camQuat * Nz::Vector3f::Forward() * cameraSpeed;
|
||||||
|
|
||||||
|
// Si la flèche du bas ou la touche S est pressée, on recule
|
||||||
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Down) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::S))
|
||||||
|
viewerPos += camQuat * Nz::Vector3f::Backward() * cameraSpeed;
|
||||||
|
|
||||||
|
// Etc...
|
||||||
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Left) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Q))
|
||||||
|
viewerPos += camQuat * Nz::Vector3f::Left() * cameraSpeed;
|
||||||
|
|
||||||
|
// Etc...
|
||||||
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Right) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::D))
|
||||||
|
viewerPos += camQuat * Nz::Vector3f::Right() * cameraSpeed;
|
||||||
|
|
||||||
|
// Majuscule pour monter, notez l'utilisation d'une direction globale (Non-affectée par la rotation)
|
||||||
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::LShift) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::RShift))
|
||||||
|
viewerPos += Nz::Vector3f::Up() * cameraSpeed;
|
||||||
|
|
||||||
|
// Contrôle (Gauche ou droite) pour descendre dans l'espace global, etc...
|
||||||
|
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::LControl) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::RControl))
|
||||||
|
viewerPos += Nz::Vector3f::Down() * cameraSpeed;
|
||||||
|
|
||||||
|
uboUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Nz::RenderFrame frame = windowImpl->Acquire();
|
||||||
|
if (!frame)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (frame.IsFramebufferInvalidated())
|
||||||
|
RebuildCommandBuffer();
|
||||||
|
|
||||||
|
ubo.viewMatrix = Nz::Matrix4f::ViewMatrix(viewerPos, camAngles);
|
||||||
|
|
||||||
|
if (uboUpdate)
|
||||||
|
{
|
||||||
|
auto& allocation = frame.GetUploadPool().Allocate(uniformSize);
|
||||||
|
|
||||||
|
std::memcpy(allocation.mappedPtr, &ubo, sizeof(ubo));
|
||||||
|
|
||||||
|
frame.Execute([&](Nz::CommandBufferBuilder& builder)
|
||||||
|
{
|
||||||
|
builder.BeginDebugRegion("UBO Update", Nz::Color::Yellow);
|
||||||
|
{
|
||||||
|
builder.PreTransferBarrier();
|
||||||
|
builder.CopyBuffer(allocation, uniformBuffer.get());
|
||||||
|
builder.PostTransferBarrier();
|
||||||
|
}
|
||||||
|
builder.EndDebugRegion();
|
||||||
|
}, Nz::QueueType::Transfer);
|
||||||
|
|
||||||
|
uboUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
frame.SubmitCommandBuffer(drawCommandBuffer.get(), Nz::QueueType::Graphics);
|
||||||
|
|
||||||
|
frame.Present();
|
||||||
|
|
||||||
|
window.Display();
|
||||||
|
|
||||||
|
// On incrémente le compteur de FPS improvisé
|
||||||
|
fps++;
|
||||||
|
|
||||||
|
if (secondClock.GetMilliseconds() >= 1000) // Toutes les secondes
|
||||||
|
{
|
||||||
|
// Et on insère ces données dans le titre de la fenêtre
|
||||||
|
window.SetTitle(windowTitle + " - " + Nz::String::Number(fps) + " FPS");
|
||||||
|
|
||||||
|
/*
|
||||||
|
Note: En C++11 il est possible d'insérer de l'Unicode de façon standard, quel que soit l'encodage du fichier,
|
||||||
|
via quelque chose de similaire à u8"Cha\u00CEne de caract\u00E8res".
|
||||||
|
Cependant, si le code source est encodé en UTF-8 (Comme c'est le cas dans ce fichier),
|
||||||
|
cela fonctionnera aussi comme ceci : "Chaîne de caractères".
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Et on réinitialise le compteur de FPS
|
||||||
|
fps = 0;
|
||||||
|
|
||||||
|
// Et on relance l'horloge pour refaire ça dans une seconde
|
||||||
|
secondClock.Restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,3 @@
|
||||||
|
glslangvalidator -V triangle.vert -o triangle.vert.spv --client opengl100
|
||||||
|
glslangvalidator -V triangle.frag -o triangle.frag.spv --client opengl100
|
||||||
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
#extension GL_ARB_separate_shader_objects : enable
|
||||||
|
#extension GL_ARB_shading_language_420pack : enable
|
||||||
|
|
||||||
|
layout(binding = 1) uniform sampler2D texSampler;
|
||||||
|
|
||||||
|
layout (location = 0) in vec3 inNormal;
|
||||||
|
layout (location = 1) in vec2 inUV;
|
||||||
|
|
||||||
|
layout (location = 0) out vec4 outFragColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec3 lightDir = vec3(0.0, -0.707, 0.707);
|
||||||
|
float lightFactor = dot(inNormal, lightDir);
|
||||||
|
|
||||||
|
float gamma = 2.2;
|
||||||
|
outFragColor = lightFactor * vec4(pow(texture(texSampler, inUV).xyz, vec3(1.0/gamma)), 1.0);
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,32 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
#extension GL_ARB_separate_shader_objects : enable
|
||||||
|
#extension GL_ARB_shading_language_420pack : enable
|
||||||
|
|
||||||
|
layout (location = 0) in vec3 inPos;
|
||||||
|
layout (location = 1) in vec3 inNormals;
|
||||||
|
layout (location = 2) in vec2 inTexCoord;
|
||||||
|
|
||||||
|
layout (binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 projectionMatrix;
|
||||||
|
mat4 modelMatrix;
|
||||||
|
mat4 viewMatrix;
|
||||||
|
} ubo;
|
||||||
|
|
||||||
|
layout (location = 0) out vec3 outNormal;
|
||||||
|
layout (location = 1) out vec2 outTexCoords;
|
||||||
|
|
||||||
|
out gl_PerVertex
|
||||||
|
{
|
||||||
|
vec4 gl_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
outNormal = inNormals;
|
||||||
|
outTexCoords = inTexCoord;
|
||||||
|
gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos, 1.0);
|
||||||
|
gl_Position.y = -gl_Position.y;
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@
|
||||||
#include <Nazara/Core/MemoryStream.hpp>
|
#include <Nazara/Core/MemoryStream.hpp>
|
||||||
#include <Nazara/Core/MemoryView.hpp>
|
#include <Nazara/Core/MemoryView.hpp>
|
||||||
#include <Nazara/Core/MovablePtr.hpp>
|
#include <Nazara/Core/MovablePtr.hpp>
|
||||||
|
#include <Nazara/Core/MovableValue.hpp>
|
||||||
#include <Nazara/Core/ObjectHandle.hpp>
|
#include <Nazara/Core/ObjectHandle.hpp>
|
||||||
#include <Nazara/Core/ObjectLibrary.hpp>
|
#include <Nazara/Core/ObjectLibrary.hpp>
|
||||||
#include <Nazara/Core/ObjectRef.hpp>
|
#include <Nazara/Core/ObjectRef.hpp>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
@ -21,6 +21,8 @@ namespace Nz
|
||||||
class AbstractHash;
|
class AbstractHash;
|
||||||
class ByteArray;
|
class ByteArray;
|
||||||
|
|
||||||
|
template<typename T> constexpr T Align(T offset, T alignment);
|
||||||
|
template<typename T> constexpr T AlignPow2(T offset, T alignment);
|
||||||
template<typename F, typename Tuple> decltype(auto) Apply(F&& fn, Tuple&& t);
|
template<typename F, typename Tuple> decltype(auto) Apply(F&& fn, Tuple&& t);
|
||||||
template<typename O, typename F, typename Tuple> decltype(auto) Apply(O& object, F&& fn, Tuple&& t);
|
template<typename O, typename F, typename Tuple> decltype(auto) Apply(O& object, F&& fn, Tuple&& t);
|
||||||
template<typename T> constexpr std::size_t BitCount();
|
template<typename T> constexpr std::size_t BitCount();
|
||||||
|
|
@ -29,7 +31,9 @@ namespace Nz
|
||||||
template<typename T, std::size_t N> constexpr std::size_t CountOf(T(&name)[N]) noexcept;
|
template<typename T, std::size_t N> constexpr std::size_t CountOf(T(&name)[N]) noexcept;
|
||||||
template<typename T> std::size_t CountOf(const T& c);
|
template<typename T> std::size_t CountOf(const T& c);
|
||||||
template<typename T> void HashCombine(std::size_t& seed, const T& v);
|
template<typename T> void HashCombine(std::size_t& seed, const T& v);
|
||||||
|
template<typename T> bool IsPowerOfTwo(T value);
|
||||||
template<typename T> T ReverseBits(T integer);
|
template<typename T> T ReverseBits(T integer);
|
||||||
|
template<typename T> constexpr auto UnderlyingCast(T value) -> std::underlying_type_t<T>;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct AlwaysFalse : std::false_type {};
|
struct AlwaysFalse : std::false_type {};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <Nazara/Core/ByteArray.hpp>
|
#include <Nazara/Core/ByteArray.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Core/Stream.hpp>
|
#include <Nazara/Core/Stream.hpp>
|
||||||
|
#include <cassert>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <Nazara/Core/Debug.hpp>
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
@ -35,6 +36,43 @@ namespace Nz
|
||||||
NAZARA_CORE_API extern const UInt8 BitReverseTable256[256];
|
NAZARA_CORE_API extern const UInt8 BitReverseTable256[256];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \ingroup core
|
||||||
|
* \brief Align an offset
|
||||||
|
* \return Aligned offset according to alignment
|
||||||
|
*
|
||||||
|
* \param offset Base offset
|
||||||
|
* \param alignment Non-zero alignment
|
||||||
|
*
|
||||||
|
* \see AlignPow2
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
constexpr T Align(T offset, T alignment)
|
||||||
|
{
|
||||||
|
assert(alignment > 0);
|
||||||
|
return ((offset + alignment - 1) / alignment) * alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \ingroup core
|
||||||
|
* \brief Align an offset
|
||||||
|
* \return Aligned offset according to a power of two alignment
|
||||||
|
*
|
||||||
|
* \param offset Base offset
|
||||||
|
* \param alignment Non-zero power of two alignment
|
||||||
|
*
|
||||||
|
* \see Align
|
||||||
|
* \remark This function is quicker than Align but only works with power of two alignment values
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
constexpr T AlignPow2(T offset, T alignment)
|
||||||
|
{
|
||||||
|
assert(alignment > 0);
|
||||||
|
assert(IsPowerOfTwo(alignment));
|
||||||
|
|
||||||
|
return (offset + alignment - 1) & ~(alignment - 1);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \brief Applies the tuple to the function (e.g. calls the function using the tuple content as arguments)
|
* \brief Applies the tuple to the function (e.g. calls the function using the tuple content as arguments)
|
||||||
|
|
@ -178,6 +216,20 @@ namespace Nz
|
||||||
seed = static_cast<std::size_t>(b * kMul);
|
seed = static_cast<std::size_t>(b * kMul);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \ingroup core
|
||||||
|
* \brief Check if a value is a power of two
|
||||||
|
* \return true if value is a power of two
|
||||||
|
*
|
||||||
|
* \param value Non-zero value
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
bool IsPowerOfTwo(T value)
|
||||||
|
{
|
||||||
|
assert(value != 0);
|
||||||
|
return (value & (value - 1)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \brief Reverse the bit order of the integer
|
* \brief Reverse the bit order of the integer
|
||||||
|
|
@ -195,6 +247,12 @@ namespace Nz
|
||||||
return reversed;
|
return reversed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
constexpr auto UnderlyingCast(T value) -> std::underlying_type_t<T>
|
||||||
|
{
|
||||||
|
return static_cast<std::underlying_type_t<T>>(value);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T> struct PointedType<T*> { using type = T; };
|
template<typename T> struct PointedType<T*> { using type = T; };
|
||||||
template<typename T> struct PointedType<T* const> { using type = T; };
|
template<typename T> struct PointedType<T* const> { using type = T; };
|
||||||
template<typename T> struct PointedType<T* volatile> { using type = T; };
|
template<typename T> struct PointedType<T* volatile> { using type = T; };
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
@ -1208,7 +1208,8 @@ namespace Nz
|
||||||
template<typename Block, class Allocator>
|
template<typename Block, class Allocator>
|
||||||
Block Bitset<Block, Allocator>::GetLastBlockMask() const
|
Block Bitset<Block, Allocator>::GetLastBlockMask() const
|
||||||
{
|
{
|
||||||
return (Block(1U) << GetBitIndex(m_bitCount)) - 1U;
|
std::size_t bitIndex = GetBitIndex(m_bitCount);
|
||||||
|
return (bitIndex) ? (Block(1U) << bitIndex) - 1U : fullBitMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -1218,9 +1219,7 @@ namespace Nz
|
||||||
template<typename Block, class Allocator>
|
template<typename Block, class Allocator>
|
||||||
void Bitset<Block, Allocator>::ResetExtraBits()
|
void Bitset<Block, Allocator>::ResetExtraBits()
|
||||||
{
|
{
|
||||||
Block mask = GetLastBlockMask();
|
m_blocks.back() &= GetLastBlockMask();
|
||||||
if (mask)
|
|
||||||
m_blocks.back() &= mask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2019 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2019 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Development Kit"
|
// This file is part of the "Nazara Development Kit"
|
||||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Development Kit"
|
// This file is part of the "Nazara Development Kit"
|
||||||
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 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) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 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) 2017 Jérôme Leclercq
|
// Copyright (C) 2020 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
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue