Starts but segfaults sometimes, yay

This commit is contained in:
2021-10-16 12:59:11 +02:00
parent b1d8ef4120
commit 528b79812e
20 changed files with 226 additions and 230 deletions
+12 -6
View File
@@ -105,19 +105,25 @@ add_subdirectory(src/)
if(MSVC)
set(_CRT_SECURE_NO_WARNINGS)
# target_compile_options(SeeleEngine PRIVATE /DEBUG:FASTLINK /Zi)
target_compile_options(SeeleEngine PRIVATE /DEBUG:FASTLINK /Zi)
else()
target_compile_options(SeeleEngine PRIVATE -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines)
target_compile_options(SeeleEngine PRIVATE -g -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines)
endif()
add_executable(Seele_unit_tests "")
add_subdirectory(test/)
add_custom_target(copy-runtime-files ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res $<TARGET_FILE_DIR:SeeleEngine>
if(WIN32)
add_custom_target(copy-binaries ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SLANG_BINARIES} $<TARGET_FILE_DIR:SeeleEngine>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SLANG_GLSLANG} $<TARGET_FILE_DIR:SeeleEngine>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GLFW_BINARY} $<TARGET_FILE_DIR:SeeleEngine>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ASSIMP_BINARY} $<TARGET_FILE_DIR:SeeleEngine>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NSAM_BINARIES} $<TARGET_FILE_DIR:SeeleEngine>
DEPENDS SeeleEngine)
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NSAM_BINARIES} $<TARGET_FILE_DIR:SeeleEngine>)
else()
add_custom_target(copy-binaries ALL COMMAND "")
endif()
add_custom_target(copy-runtime-files ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res $<TARGET_FILE_DIR:SeeleEngine>
DEPENDS SeeleEngine copy-binaries)
+2 -2
View File
@@ -72,7 +72,7 @@ else()
DOC "The directory where GL/nsam.h resides")
find_file(
NSAM_BINARY
NSAM_LIBRARY
NAMES libGFSDK_Aftermath_Lib.${CMAKE_PLATFORM}.so
PATHS
/usr/lib64
@@ -86,7 +86,7 @@ else()
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(NSAM DEFAULT_MSG NSAM_INCLUDE_DIR NSAM_BINARY)
find_package_handle_standard_args(NSAM DEFAULT_MSG NSAM_INCLUDE_DIR NSAM_LIBRARY)
# Define NSAM_LIBRARIES and NSAM_INCLUDE_DIRS
if (NSAM_FOUND)
+3 -18
View File
@@ -78,7 +78,7 @@ ShaderCollection& ShaderMap::createShaders(
Array<char> buffer(static_cast<uint32>(fileSize));
codeStream.read(buffer.data(), fileSize);
createInfo.shaderCode.add(std::string(buffer.data()));
createInfo.shaderCode.add(std::string(buffer.data(), 0, fileSize));
collection.vertexShader = graphics->createVertexShader(createInfo);
@@ -113,6 +113,7 @@ void DescriptorLayout::addDescriptorBinding(uint32 bindingIndex, SeDescriptorTyp
PDescriptorSet DescriptorLayout::allocateDescriptorSet()
{
std::unique_lock lock(allocatorLock);
PDescriptorSet result;
allocator->allocateDescriptorSet(result);
return result;
@@ -120,6 +121,7 @@ PDescriptorSet DescriptorLayout::allocateDescriptorSet()
void DescriptorLayout::reset()
{
std::unique_lock lock(allocatorLock);
allocator->reset();
}
@@ -129,24 +131,7 @@ void PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layo
{
descriptorSetLayouts.resize(setIndex + 1);
}
// After a second thought, merging descriptor layout bindings is not a good idea
/*if (descriptorSetLayouts[setIndex] != nullptr)
{
auto &thisBindings = descriptorSetLayouts[setIndex]->descriptorBindings;
auto &otherBindings = layout->descriptorBindings;
thisBindings.resize(otherBindings.size());
for (size_t i = 0; i < otherBindings.size(); ++i)
{
if (otherBindings[i].descriptorType != SE_DESCRIPTOR_TYPE_MAX_ENUM)
{
thisBindings[i] = otherBindings[i];
}
}
}
else*/
{
descriptorSetLayouts[setIndex] = layout;
}
layout->setIndex = setIndex;
}
+1
View File
@@ -232,6 +232,7 @@ public:
protected:
Array<DescriptorBinding> descriptorBindings;
PDescriptorAllocator allocator;
std::mutex allocatorLock;
uint32 setIndex;
std::string name;
friend class PipelineLayout;
@@ -144,10 +144,6 @@ void BasePass::beginFrame()
descriptorSets[INDEX_VIEW_PARAMS] = viewLayout->allocateDescriptorSet();
descriptorSets[INDEX_VIEW_PARAMS]->updateBuffer(0, viewParamBuffer);
descriptorSets[INDEX_VIEW_PARAMS]->writeChanges();
for(auto &&meshBatch : passData.staticDrawList)
{
meshBatch.material->updateDescriptorData();
}
}
void BasePass::render()
@@ -125,10 +125,6 @@ void DepthPrepass::beginFrame()
descriptorSets[INDEX_VIEW_PARAMS] = viewLayout->allocateDescriptorSet();
descriptorSets[INDEX_VIEW_PARAMS]->updateBuffer(0, viewParamBuffer);
descriptorSets[INDEX_VIEW_PARAMS]->writeChanges();
for(auto &&meshBatch : passData.staticDrawList)
{
meshBatch.material->updateDescriptorData();
}
}
void DepthPrepass::render()
@@ -1,5 +1,10 @@
target_sources(SeeleEngine
PRIVATE
NsightAftermathGpuCrashTracker.h
NsightAftermathGpuCrashTracker.cpp
NsightAftermathHelpers.h
NsightAftermathShaderDatabase.h
NsightAftermathShaderDatabase.cpp
VulkanAllocator.h
VulkanAllocator.cpp
VulkanBuffer.cpp
@@ -91,7 +91,7 @@ void GpuCrashTracker::OnShaderDebugInfo(const void* pShaderDebugInfo, const uint
// Get shader debug information identifier
GFSDK_Aftermath_ShaderDebugInfoIdentifier identifier = {};
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GetShaderDebugInfoIdentifier(
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetShaderDebugInfoIdentifier(
GFSDK_Aftermath_Version_API,
pShaderDebugInfo,
shaderDebugInfoSize,
@@ -124,7 +124,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
{
// Create a GPU crash dump decoder object for the GPU crash dump.
GFSDK_Aftermath_GpuCrashDump_Decoder decoder = {};
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_CreateDecoder(
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_CreateDecoder(
GFSDK_Aftermath_Version_API,
pGpuCrashDump,
gpuCrashDumpSize,
@@ -133,19 +133,19 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
// Use the decoder object to read basic information, like application
// name, PID, etc. from the GPU crash dump.
GFSDK_Aftermath_GpuCrashDump_BaseInfo baseInfo = {};
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GetBaseInfo(decoder, &baseInfo));
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetBaseInfo(decoder, &baseInfo));
// Use the decoder object to query the application name that was set
// in the GPU crash dump description.
uint32_t applicationNameLength = 0;
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GetDescriptionSize(
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetDescriptionSize(
decoder,
GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName,
&applicationNameLength));
std::vector<char> applicationName(applicationNameLength, '\0');
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GetDescription(
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetDescription(
decoder,
GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName,
uint32_t(applicationName.size()),
@@ -176,7 +176,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
// Decode the crash dump to a JSON string.
// Step 1: Generate the JSON and get the size.
uint32_t jsonSize = 0;
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GenerateJSON(
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GenerateJSON(
decoder,
GFSDK_Aftermath_GpuCrashDumpDecoderFlags_ALL_INFO,
GFSDK_Aftermath_GpuCrashDumpFormatterFlags_NONE,
@@ -188,7 +188,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
&jsonSize));
// Step 2: Allocate a buffer and fetch the generated JSON.
std::vector<char> json(jsonSize);
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_GetJSON(
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_GetJSON(
decoder,
uint32_t(json.size()),
json.data()));
@@ -203,7 +203,7 @@ void GpuCrashTracker::WriteGpuCrashDumpToFile(const void* pGpuCrashDump, const u
}
// Destroy the GPU crash dump decoder object.
AFTERMATH_CHECK_ERROR(PFN_GFSDK_Aftermath_GpuCrashDump_DestroyDecoder(decoder));
AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GpuCrashDump_DestroyDecoder(decoder));
}
// Helper for writing shader debug information to a file
@@ -147,6 +147,7 @@ void CmdBuffer::refreshFence()
{
descriptor->unbind();
}
boundDescriptors.clear();
state = State::ReadyBegin;
}
}
@@ -249,7 +250,7 @@ void RenderCommand::bindDescriptor(Gfx::PDescriptorSet descriptorSet)
{
auto descriptor = descriptorSet.cast<DescriptorSet>();
boundDescriptors.add(descriptor.getHandle());
descriptor->bind();
descriptor->bind(this);
VkDescriptorSet setHandle = descriptor->getHandle();
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->getLayout(), descriptorSet->getSetIndex(), 1, &setHandle, 0, nullptr);
@@ -260,7 +261,7 @@ void RenderCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptorS
for(uint32 i = 0; i < descriptorSets.size(); ++i)
{
auto descriptorSet = descriptorSets[i].cast<DescriptorSet>();
descriptorSet->bind();
descriptorSet->bind(this);
boundDescriptors.add(descriptorSet.getHandle());
sets[descriptorSet->getSetIndex()] = descriptorSet->getHandle();
@@ -333,7 +334,7 @@ void ComputeCommand::bindDescriptor(Gfx::PDescriptorSet descriptorSet)
{
auto descriptor = descriptorSet.cast<DescriptorSet>();
boundDescriptors.add(descriptor.getHandle());
descriptor->bind();
descriptor->bind(this);
//std::cout << "Binding descriptor " << descriptor->getHandle() << " to cmd " << handle << std::endl;
VkDescriptorSet setHandle = descriptor->getHandle();
vkCmdBindDescriptorSets(handle, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->getLayout(), descriptorSet->getSetIndex(), 1, &setHandle, 0, nullptr);
@@ -346,7 +347,7 @@ void ComputeCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptor
{
auto descriptorSet = descriptorSets[i].cast<DescriptorSet>();
boundDescriptors.add(descriptorSet.getHandle());
descriptorSet->bind();
descriptorSet->bind(this);
//std::cout << "Binding descriptor " << descriptorSet->getHandle() << " to cmd " << handle << std::endl;
sets[descriptorSet->getSetIndex()] = descriptorSet->getHandle();
}
@@ -393,7 +394,7 @@ PRenderCommand CommandBufferManager::createRenderCommand(const std::string& name
for (uint32 i = 0; i < allocatedRenderCommands.size(); ++i)
{
PRenderCommand cmdBuffer = allocatedRenderCommands[i];
if (cmdBuffer->ready)
if (cmdBuffer->isReady())
{
cmdBuffer->begin(activeCmdBuffer);
return cmdBuffer;
@@ -290,7 +290,7 @@ void DescriptorAllocator::allocateDescriptorSet(Gfx::PDescriptorSet &descriptorS
//If it hasnt been initialized, allocate it
VK_CHECK(vkAllocateDescriptorSets(graphics->getDevice(), &allocInfo, &cachedHandles[setIndex]->setHandle));
}
cachedHandles[setIndex]->currentlyInUse = true;
cachedHandles[setIndex]->allocate();
descriptorSet = cachedHandles[setIndex];
PDescriptorSet vulkanSet = descriptorSet.cast<DescriptorSet>();
@@ -55,7 +55,7 @@ private:
};
DEFINE_REF(PipelineLayout)
DECLARE_REF(SecondaryCmdBuffer)
class DescriptorSet : public Gfx::DescriptorSet
{
public:
@@ -63,6 +63,7 @@ public:
: setHandle(VK_NULL_HANDLE)
, graphics(graphics)
, owner(owner)
, boundBuffer(nullptr)
, currentlyBound(false)
, currentlyInUse(false)
{
@@ -83,14 +84,20 @@ public:
{
return currentlyInUse;
}
void bind()
void bind(PSecondaryCmdBuffer cmdBuffer)
{
boundBuffer = cmdBuffer;
currentlyBound = true;
}
void unbind()
{
boundBuffer = nullptr;
currentlyBound = false;
}
void allocate()
{
currentlyInUse = true;
}
void free()
{
currentlyInUse = false;
@@ -112,7 +119,7 @@ private:
VkDescriptorSet setHandle;
PGraphics graphics;
PDescriptorAllocator owner;
//PCmdBuffer currentlyBound;
PSecondaryCmdBuffer boundBuffer;
bool currentlyBound;
bool currentlyInUse;
friend class DescriptorAllocator;
@@ -414,7 +414,7 @@ void Graphics::setupDebugCallback()
VK_CHECK(CreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &callback));
//crashTracker.Initialize();
crashTracker.Initialize();
}
void Graphics::pickPhysicalDevice()
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include "VulkanGraphicsResources.h"
#include "Graphics/Graphics.h"
#include "NsightAftermathGpuCrashTracker.h"
namespace Seele
{
@@ -98,7 +99,7 @@ protected:
Map<uint32, PFramebuffer> allocatedFramebuffers;
PAllocator allocator;
PStagingManager stagingManager;
//GpuCrashTracker crashTracker;
GpuCrashTracker crashTracker;
friend class Window;
};
@@ -22,7 +22,6 @@ Queue::~Queue()
void Queue::submitCommandBuffer(PCmdBuffer cmdBuffer, uint32 numSignalSemaphores, VkSemaphore *signalSemaphores)
{
std::scoped_lock lck(queueLock);
assert(cmdBuffer->state == CmdBuffer::State::Ended);
@@ -87,6 +87,16 @@ void Shader::create(const ShaderCreateInfo& createInfo)
char const* diagnostics = spGetDiagnosticOutput(request);
std::cout << "Compile error for shader " << createInfo.name << std::endl;
std::cout << diagnostics << std::endl;
std::cout << "Defines: " << std::endl;
for(auto define : createInfo.defines)
{
std::cout << define.key << ": " << define.value << std::endl;
}
std::cout << "For shader code: " << std::endl;
for(auto code : createInfo.shaderCode)
{
std::cout << code << std::endl;
}
return;
}
size_t dataSize = 0;
+27 -48
View File
@@ -56,77 +56,56 @@ void BlinnPhong::generateMaterialCode(std::ofstream& codeStream, json codeJson)
{
for(auto code : codeJson[key].items())
{
accessorStream << code.value().get<std::string>() << ";" << std::endl;
accessorStream << "\t\t" << code.value().get<std::string>() << ";" << std::endl;
}
}
else
{
accessorStream << "return " << defaultVal << ";";
accessorStream << "\t\treturn " << defaultVal << ";\n";
}
};
accessorStream << "float3 getBaseColor(MaterialFragmentParameter input) {\n";
accessorStream << "\tfloat3 getBaseColor(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "baseColor", "float3(0.5f, 0.5f, 0.5f)");
accessorStream << "}";
accessorStream << "\t}\n";
accessorStream << "float getMetallic(MaterialFragmentParameter input) {\n";
accessorStream << "\tfloat getMetallic(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "metallic", "0.f");
accessorStream << "}";
accessorStream << "\t}\n";
accessorStream << "float3 getNormal(MaterialFragmentParameter input) {\n";
accessorStream << "\tfloat3 getNormal(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "normal", "float3(0, 1, 0)");
accessorStream << "}";
accessorStream << "\t}\n";
accessorStream << "float getSpecular(MaterialFragmentParameter input) {\n";
accessorStream << "\tfloat getSpecular(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "specular", "0.f");
accessorStream << "}";
accessorStream << "\t}\n";
accessorStream << "float getRoughness(MaterialFragmentParameter input) {\n";
accessorStream << "\tfloat getRoughness(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "roughness", "0.f");
accessorStream << "}";
accessorStream << "\t}\n";
accessorStream << "float getSheen(MaterialFragmentParameter input) {\n";
accessorStream << "\tfloat getSheen(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "sheen", "0.f");
accessorStream << "}";
accessorStream << "\t}\n";
/*accessorStream << "float getSpecularTint(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "specularTint", "0.f");
accessorStream << "}";
accessorStream << "float getAnisotropic(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "anisotropic", "0.f");
accessorStream << "}";
accessorStream << "float getSheenTint(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "sheenTint", "0.f");
accessorStream << "}";
accessorStream << "float getClearCoat(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "clearCoat", "0.f");
accessorStream << "}";
accessorStream << "float getClearCoatGloss(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "clearCoatGloss", "0.f");
accessorStream << "}";*/
accessorStream << "float3 getWorldOffset() {\n";
accessorStream << "\tfloat3 getWorldOffset() {\n";
generateAccessor(accessorStream, "worldOffset", "0.f");
accessorStream << "}";
accessorStream << "\t}\n";
codeStream << accessorStream.str();
codeStream << "typedef " << name << " BRDF;" << std::endl;
codeStream << name << " prepare(MaterialFragmentParameter geometry){" << std::endl;
codeStream << name << " result;" << std::endl;
codeStream << "result.baseColor = getBaseColor(geometry);" << std::endl;
codeStream << "result.metallic = getMetallic(geometry);" << std::endl;
codeStream << "result.normal = getNormal(geometry);" << std::endl;
codeStream << "result.specular = getSpecular(geometry);" << std::endl;
codeStream << "result.roughness = getRoughness(geometry);" << std::endl;
codeStream << "result.sheen = getSheen(geometry);" << std::endl;
codeStream << "return result;" << std::endl;
codeStream << "}" << std::endl;
codeStream << "\ttypedef " << name << " BRDF;" << std::endl;
codeStream << "\t" << name << " prepare(MaterialFragmentParameter geometry) {" << std::endl;
codeStream << "\t\t" << name << " result;" << std::endl;
codeStream << "\t\tresult.baseColor = getBaseColor(geometry);" << std::endl;
codeStream << "\t\tresult.metallic = getMetallic(geometry);" << std::endl;
codeStream << "\t\tresult.normal = getNormal(geometry);" << std::endl;
codeStream << "\t\tresult.specular = getSpecular(geometry);" << std::endl;
codeStream << "\t\tresult.roughness = getRoughness(geometry);" << std::endl;
codeStream << "\t\tresult.sheen = getSheen(geometry);" << std::endl;
codeStream << "\t\treturn result;" << std::endl;
codeStream << "\t}" << std::endl;
}
IMPLEMENT_BRDF(BlinnPhong)
+4 -5
View File
@@ -56,7 +56,7 @@ void Material::compile()
codeStream << "import VERTEX_INPUT_IMPORT;" << std::endl;
codeStream << "import Material;" << std::endl;
codeStream << "import BRDF;" << std::endl;
codeStream << "import MaterialParameter;" << std::endl;
codeStream << "import MaterialParameter;" << std::endl << std::endl;
codeStream << "struct " << materialName << " : IMaterial {" << std::endl;
uint32 uniformBufferOffset = 0;
@@ -69,7 +69,7 @@ void Material::compile()
if(type.compare("float") == 0)
{
PFloatParameter p = new FloatParameter(param.key(), uniformBufferOffset, 0);
codeStream << "layout(offset = " << uniformBufferOffset << ")";
codeStream << "\tlayout(offset = " << uniformBufferOffset << ")";
if(uniformBinding == -1)
{
layout->addDescriptorBinding(bindingCounter, Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
@@ -85,7 +85,7 @@ void Material::compile()
else if(type.compare("float3") == 0)
{
PVectorParameter p = new VectorParameter(param.key(), uniformBufferOffset, 0);
codeStream << "layout(offset = " << uniformBufferOffset << ")";
codeStream << "\tlayout(offset = " << uniformBufferOffset << ")";
if(uniformBinding == -1)
{
layout->addDescriptorBinding(bindingCounter, Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
@@ -105,7 +105,6 @@ void Material::compile()
if(defaultValue != param.value().end())
{
std::string defaultString = defaultValue.value().get<std::string>();
std::cout << "Texture parameter " << defaultString << std::endl;
p->data = AssetRegistry::findTexture(defaultString);
}
else
@@ -127,7 +126,7 @@ void Material::compile()
{
std::cout << "Error unsupported parameter type" << std::endl;
}
codeStream << type << " " << param.key() << ";\n";
codeStream << "\t" << type << " " << param.key() << ";\n";
}
uniformDataSize = uniformBufferOffset;
if(uniformDataSize != 0)
+9 -2
View File
@@ -150,7 +150,14 @@ bool Transform::equals(const Transform &other, float tolerance)
{
return false;
}
if (abs(rotation.x - other.rotation.x) <= tolerance && abs(rotation.y - other.rotation.y) <= tolerance && abs(rotation.z - other.rotation.z) <= tolerance && abs(rotation.w - other.rotation.w) <= tolerance || abs(rotation.x + other.rotation.x) <= tolerance && abs(rotation.y + other.rotation.y) <= tolerance && abs(rotation.z + other.rotation.z) <= tolerance && abs(rotation.w - other.rotation.w) <= tolerance)
if ((abs(rotation.x - other.rotation.x) <= tolerance
&& abs(rotation.y - other.rotation.y) <= tolerance
&& abs(rotation.z - other.rotation.z) <= tolerance
&& abs(rotation.w - other.rotation.w) <= tolerance)
|| (abs(rotation.x + other.rotation.x) <= tolerance
&& abs(rotation.y + other.rotation.y) <= tolerance
&& abs(rotation.z + other.rotation.z) <= tolerance
&& abs(rotation.w + other.rotation.w) <= tolerance))
{
return false;
}
@@ -191,5 +198,5 @@ Transform Transform::operator*(const Transform &other) const
{
Transform outTransform;
multiply(&outTransform, this, &other);
return std::move(outTransform);
return outTransform;
}
+4
View File
@@ -38,6 +38,10 @@ Scene::~Scene()
void Scene::tick(double deltaTime)
{
updater->runUpdates(static_cast<float>(deltaTime));
for(auto &&meshBatch : staticMeshes)
{
meshBatch.material->updateDescriptorData();
}
}
void Scene::addActor(PActor actor)