Fix some warnings
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled

This commit is contained in:
2026-05-17 13:57:55 -07:00
parent 14ae31dd2c
commit 3e60fdd48a
24 changed files with 89 additions and 78 deletions

View File

@@ -483,7 +483,7 @@ void KRDevice::createDescriptorSets(const std::vector<VkDescriptorSetLayout>& la
VkDescriptorSetAllocateInfo allocInfo{}; VkDescriptorSetAllocateInfo allocInfo{};
allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
allocInfo.descriptorPool = m_descriptorPool; allocInfo.descriptorPool = m_descriptorPool;
allocInfo.descriptorSetCount = descriptorSets.size(); allocInfo.descriptorSetCount = (uint32_t)descriptorSets.size();
allocInfo.pSetLayouts = layouts.data(); allocInfo.pSetLayouts = layouts.data();
if (vkAllocateDescriptorSets(m_logicalDevice, &allocInfo, descriptorSets.data()) != VK_SUCCESS) { if (vkAllocateDescriptorSets(m_logicalDevice, &allocInfo, descriptorSets.data()) != VK_SUCCESS) {
// TODO - Vulkan Refactoring - Error Handling // TODO - Vulkan Refactoring - Error Handling

View File

@@ -53,22 +53,22 @@ KRModelView::~KRModelView()
bool KRModelView::getShaderValue(ShaderValue value, Vector3* output) const bool KRModelView::getShaderValue(ShaderValue value, Vector3* output) const
{ {
switch (value) {
switch (value) { case ShaderValue::camerapos_model_space:
case ShaderValue::camerapos_model_space: {
{ // Transform location of camera to object space for calculation of specular halfVec
// Transform location of camera to object space for calculation of specular halfVec *output = Matrix4::Dot(m_matModelInverse, m_viewport->getCameraPosition());
*output = Matrix4::Dot(m_matModelInverse, m_viewport->getCameraPosition()); return true;
return true;
}
case ShaderValue::view_space_model_origin:
{
// Origin point of model space is the light source position. No perspective, so no w divide required
*output = Matrix4::Dot(m_matModelView, Vector3::Zero());
return true;
}
} }
return false; case ShaderValue::view_space_model_origin:
{
// Origin point of model space is the light source position. No perspective, so no w divide required
*output = Matrix4::Dot(m_matModelView, Vector3::Zero());
return true;
}
default:
return false;
}
} }
bool KRModelView::getShaderValue(ShaderValue value, Matrix4* output) const bool KRModelView::getShaderValue(ShaderValue value, Matrix4* output) const
{ {
@@ -128,8 +128,8 @@ bool KRModelView::getShaderValue(ShaderValue value, Matrix4* output) const
*output = invMVP; *output = invMVP;
return true; return true;
} }
default:
return false;
} }
return false;
} }

View File

@@ -845,7 +845,7 @@ void KRPipeline::bindDescriptorSets(VkCommandBuffer& commandBuffer)
if (m_descriptorSets.empty()) { if (m_descriptorSets.empty()) {
return; return;
} }
int descriptorSetCount = m_descriptorSets.size() / KRENGINE_MAX_FRAMES_IN_FLIGHT; int descriptorSetCount = (int)m_descriptorSets.size() / KRENGINE_MAX_FRAMES_IN_FLIGHT;
int startDescriptorSet = (getContext().getCurrentFrame() % KRENGINE_MAX_FRAMES_IN_FLIGHT) * descriptorSetCount; int startDescriptorSet = (getContext().getCurrentFrame() % KRENGINE_MAX_FRAMES_IN_FLIGHT) * descriptorSetCount;
VkDescriptorSet descriptorSet = m_descriptorSets[startDescriptorSet]; VkDescriptorSet descriptorSet = m_descriptorSets[startDescriptorSet];
if (descriptorSet == VK_NULL_HANDLE) { if (descriptorSet == VK_NULL_HANDLE) {

View File

@@ -29,7 +29,7 @@
// or implied, of Kearwood Gilbert. // or implied, of Kearwood Gilbert.
// //
#include "KRREnderGraphBlackFrame.h" #include "KRRenderGraphBlackFrame.h"
#include "KRRenderPass.h" #include "KRRenderPass.h"
#include "KRSurface.h" #include "KRSurface.h"
#include "KRDevice.h" #include "KRDevice.h"

View File

@@ -29,7 +29,7 @@
// or implied, of Kearwood Gilbert. // or implied, of Kearwood Gilbert.
// //
#include "KRREnderGraphDeferred.h" #include "KRRenderGraphDeferred.h"
#include "KRRenderPass.h" #include "KRRenderPass.h"
#include "KRSurface.h" #include "KRSurface.h"
#include "KRDevice.h" #include "KRDevice.h"

View File

@@ -29,7 +29,7 @@
// or implied, of Kearwood Gilbert. // or implied, of Kearwood Gilbert.
// //
#include "KRREnderGraphForward.h" #include "KRRenderGraphForward.h"
#include "KRRenderPass.h" #include "KRRenderPass.h"
#include "KRSurface.h" #include "KRSurface.h"
#include "KRDevice.h" #include "KRDevice.h"

View File

@@ -246,8 +246,9 @@ bool KRRenderSettings::getShaderValue(ShaderValue value, float* output) const
case ShaderValue::density_premultiplied_squared: case ShaderValue::density_premultiplied_squared:
*output = (float)(-fog_density * fog_density * 1.442695); // -fog_density * fog_density / log(2) *output = (float)(-fog_density * fog_density * 1.442695); // -fog_density * fog_density / log(2)
return true; return true;
default:
return false;
} }
return false;
} }
bool KRRenderSettings::getShaderValue(ShaderValue value, Vector3* output) const bool KRRenderSettings::getShaderValue(ShaderValue value, Vector3* output) const
@@ -256,6 +257,7 @@ bool KRRenderSettings::getShaderValue(ShaderValue value, Vector3* output) const
case ShaderValue::fog_color: case ShaderValue::fog_color:
*output = fog_color; *output = fog_color;
return true; return true;
default:
return false;
} }
return false;
} }

View File

@@ -64,8 +64,9 @@ bool KRViewport::getShaderValue(ShaderValue value, Matrix4* output) const
case ShaderValue::invp: case ShaderValue::invp:
*output = m_matInverseProjection; *output = m_matInverseProjection;
return true; return true;
default:
return false;
} }
return false;
} }
bool KRViewport::getShaderValue(ShaderValue value, Vector4* output) const bool KRViewport::getShaderValue(ShaderValue value, Vector4* output) const
@@ -79,9 +80,9 @@ bool KRViewport::getShaderValue(ShaderValue value, Vector4* output) const
getSize().y getSize().y
); );
return true; return true;
default:
return false;
} }
return false;
} }

View File

@@ -44,10 +44,10 @@ public:
static void InitNodeInfo(KrNodeInfo* nodeInfo); static void InitNodeInfo(KrNodeInfo* nodeInfo);
KRAmbientZone(KRScene& scene, std::string name); KRAmbientZone(KRScene& scene, std::string name);
virtual ~KRAmbientZone(); virtual ~KRAmbientZone() override;
virtual std::string getElementName(); virtual std::string getElementName() override;
virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent); virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent) override;
virtual void loadXML(tinyxml2::XMLElement* e); virtual void loadXML(tinyxml2::XMLElement* e) override;
void render(RenderInfo& ri) override; void render(RenderInfo& ri) override;
@@ -63,7 +63,7 @@ public:
float getAmbientGain(); float getAmbientGain();
void setAmbientGain(float ambient_gain); void setAmbientGain(float ambient_gain);
virtual hydra::AABB getBounds(); virtual hydra::AABB getBounds() override;
float getContainment(const hydra::Vector3& pos); float getContainment(const hydra::Vector3& pos);

View File

@@ -46,10 +46,10 @@ public:
KRAudioSource(KRScene& scene, std::string name); KRAudioSource(KRScene& scene, std::string name);
virtual ~KRAudioSource(); virtual ~KRAudioSource();
virtual std::string getElementName(); virtual std::string getElementName() override;
virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent); virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent) override;
virtual void loadXML(tinyxml2::XMLElement* e); virtual void loadXML(tinyxml2::XMLElement* e) override;
virtual void physicsUpdate(float deltaTime); virtual void physicsUpdate(float deltaTime) override;
void render(RenderInfo& ri) override; void render(RenderInfo& ri) override;

View File

@@ -43,10 +43,10 @@ public:
KRBone(KRScene& scene, std::string name); KRBone(KRScene& scene, std::string name);
virtual ~KRBone(); virtual ~KRBone();
virtual std::string getElementName(); virtual std::string getElementName() override;
virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent); virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent) override;
virtual void loadXML(tinyxml2::XMLElement* e); virtual void loadXML(tinyxml2::XMLElement* e) override;
virtual hydra::AABB getBounds(); virtual hydra::AABB getBounds() override;
void render(RenderInfo& ri) override; void render(RenderInfo& ri) override;

View File

@@ -854,9 +854,11 @@ bool KRCamera::getShaderValue(ShaderValue value, hydra::Vector4* output) const
case ShaderValue::fade_color: case ShaderValue::fade_color:
*output = m_fade_color; *output = m_fade_color;
return true; return true;
default:
return KRNode::getShaderValue(value, output);
} }
return KRNode::getShaderValue(value, output);
} }
bool KRCamera::alwaysStreamResources() bool KRCamera::alwaysStreamResources()

View File

@@ -56,10 +56,10 @@ public:
KRCollider(KRScene& scene, std::string collider_name, std::string model_name, unsigned int layer_mask, float audio_occlusion); KRCollider(KRScene& scene, std::string collider_name, std::string model_name, unsigned int layer_mask, float audio_occlusion);
virtual ~KRCollider(); virtual ~KRCollider();
virtual std::string getElementName(); virtual std::string getElementName() override;
virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent); virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent) override;
virtual void loadXML(tinyxml2::XMLElement* e); virtual void loadXML(tinyxml2::XMLElement* e) override;
virtual hydra::AABB getBounds(); virtual hydra::AABB getBounds() override;
bool lineCast(const hydra::Vector3& v0, const hydra::Vector3& v1, hydra::HitInfo& hitinfo, unsigned int layer_mask); bool lineCast(const hydra::Vector3& v0, const hydra::Vector3& v1, hydra::HitInfo& hitinfo, unsigned int layer_mask);
bool rayCast(const hydra::Vector3& v0, const hydra::Vector3& v1, hydra::HitInfo& hitinfo, unsigned int layer_mask); bool rayCast(const hydra::Vector3& v0, const hydra::Vector3& v1, hydra::HitInfo& hitinfo, unsigned int layer_mask);

View File

@@ -42,16 +42,16 @@ public:
KRDirectionalLight(KRScene& scene, std::string name); KRDirectionalLight(KRScene& scene, std::string name);
virtual ~KRDirectionalLight(); virtual ~KRDirectionalLight();
virtual std::string getElementName(); virtual std::string getElementName() override;
hydra::Vector3 getLocalLightDirection(); hydra::Vector3 getLocalLightDirection();
hydra::Vector3 getWorldLightDirection(); hydra::Vector3 getWorldLightDirection();
virtual void render(RenderInfo& ri) override; virtual void render(RenderInfo& ri) override;
virtual hydra::AABB getBounds(); virtual hydra::AABB getBounds() override;
protected: protected:
virtual int configureShadowBufferViewports(const KRViewport& viewport); virtual int configureShadowBufferViewports(const KRViewport& viewport) override;
}; };

View File

@@ -525,9 +525,9 @@ bool KRLight::getShaderValue(ShaderValue value, float* output) const
case ShaderValue::dust_particle_size: case ShaderValue::dust_particle_size:
*output = m_dust_particle_size; *output = m_dust_particle_size;
return true; return true;
default:
return KRNode::getShaderValue(value, output);
} }
return KRNode::getShaderValue(value, output);
} }
bool KRLight::getShaderValue(ShaderValue value, hydra::Vector3* output) const bool KRLight::getShaderValue(ShaderValue value, hydra::Vector3* output) const
@@ -539,6 +539,7 @@ bool KRLight::getShaderValue(ShaderValue value, hydra::Vector3* output) const
case ShaderValue::light_color: case ShaderValue::light_color:
*output = m_color; *output = m_color;
return true; return true;
default:
return KRNode::getShaderValue(value, output);
} }
return KRNode::getShaderValue(value, output);
} }

View File

@@ -49,9 +49,9 @@ public:
static void InitNodeInfo(KrNodeInfo* nodeInfo); static void InitNodeInfo(KrNodeInfo* nodeInfo);
virtual ~KRLight(); virtual ~KRLight();
virtual std::string getElementName() = 0; virtual std::string getElementName() override = 0;
virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent); virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent) override;
virtual void loadXML(tinyxml2::XMLElement* e); virtual void loadXML(tinyxml2::XMLElement* e) override;
void setIntensity(float intensity); void setIntensity(float intensity);
float getIntensity() const; float getIntensity() const;

View File

@@ -360,8 +360,9 @@ bool KRModel::getShaderValue(ShaderValue value, hydra::Vector3* output) const
case ShaderValue::rim_color: case ShaderValue::rim_color:
*output = m_rim_color; *output = m_rim_color;
return true; return true;
default:
return KRNode::getShaderValue(value, output);
} }
return KRNode::getShaderValue(value, output);
} }
bool KRModel::getShaderValue(ShaderValue value, float* output) const bool KRModel::getShaderValue(ShaderValue value, float* output) const
@@ -370,8 +371,9 @@ bool KRModel::getShaderValue(ShaderValue value, float* output) const
case ShaderValue::rim_power: case ShaderValue::rim_power:
*output = m_rim_power; *output = m_rim_power;
return true; return true;
default:
return KRNode::getShaderValue(value, output);
} }
return KRNode::getShaderValue(value, output);
} }

View File

@@ -117,6 +117,8 @@ bool KRParticleSystemNewtonian::getShaderValue(ShaderValue value, float* output)
case ShaderValue::dust_particle_size: case ShaderValue::dust_particle_size:
*output = 1.0f; *output = 1.0f;
return true; return true;
default:
return KRParticleSystem::getShaderValue(value, output);
} }
return KRParticleSystem::getShaderValue(value, output);
} }

View File

@@ -39,18 +39,18 @@ public:
KRParticleSystemNewtonian(KRScene& scene, std::string name); KRParticleSystemNewtonian(KRScene& scene, std::string name);
virtual ~KRParticleSystemNewtonian(); virtual ~KRParticleSystemNewtonian();
virtual std::string getElementName(); virtual std::string getElementName() override;
virtual void loadXML(tinyxml2::XMLElement* e); virtual void loadXML(tinyxml2::XMLElement* e) override;
virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent); virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent) override;
virtual hydra::AABB getBounds(); virtual hydra::AABB getBounds() override;
virtual void render(RenderInfo& ri) override; virtual void render(RenderInfo& ri) override;
virtual void physicsUpdate(float deltaTime); virtual void physicsUpdate(float deltaTime) override;
virtual bool hasPhysics(); virtual bool hasPhysics() override;
protected: protected:
bool getShaderValue(ShaderValue value, float* output) const override; bool getShaderValue(ShaderValue value, float* output) const override;
private: private:

View File

@@ -40,8 +40,8 @@ public:
KRPointLight(KRScene& scene, std::string name); KRPointLight(KRScene& scene, std::string name);
virtual ~KRPointLight(); virtual ~KRPointLight();
virtual std::string getElementName(); virtual std::string getElementName() override;
virtual hydra::AABB getBounds(); virtual hydra::AABB getBounds() override;
virtual void render(RenderInfo& ri) override; virtual void render(RenderInfo& ri) override;

View File

@@ -44,9 +44,9 @@ public:
KRReverbZone(KRScene& scene, std::string name); KRReverbZone(KRScene& scene, std::string name);
virtual ~KRReverbZone(); virtual ~KRReverbZone();
virtual std::string getElementName(); virtual std::string getElementName() override;
virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent); virtual tinyxml2::XMLElement* saveXML(tinyxml2::XMLNode* parent) override;
virtual void loadXML(tinyxml2::XMLElement* e); virtual void loadXML(tinyxml2::XMLElement* e) override;
void render(RenderInfo& ri) override; void render(RenderInfo& ri) override;
@@ -62,7 +62,7 @@ public:
float getReverbGain(); float getReverbGain();
void setReverbGain(float reverb_gain); void setReverbGain(float reverb_gain);
virtual hydra::AABB getBounds(); virtual hydra::AABB getBounds() override;
float getContainment(const hydra::Vector3& pos); float getContainment(const hydra::Vector3& pos);

View File

@@ -149,6 +149,7 @@ void KRSprite::render(RenderInfo& ri)
bool KRSprite::getShaderValue(ShaderValue value, float* output) const bool KRSprite::getShaderValue(ShaderValue value, float* output) const
{ {
switch (value) { switch (value) {
default:
return KRNode::getShaderValue(value, output);
} }
return KRNode::getShaderValue(value, output);
} }

View File

@@ -207,14 +207,14 @@ KRMesh* KRResource::LoadObj(KRContext& context, const std::string& path)
for (int iSymbol = 1; iSymbol < cSymbols; iSymbol++) { for (int iSymbol = 1; iSymbol < cSymbols; iSymbol++) {
char* pChar = szSymbol[iSymbol]; char* pChar = szSymbol[iSymbol];
if (*pChar == '.' || (*pChar >= '0' && *pChar <= '9')) { if (*pChar == '.' || (*pChar >= '0' && *pChar <= '9')) {
*pFace++ = strtol(pChar, &pChar, 10) - 1; // Vertex Index *pFace++ = (int)strtol(pChar, &pChar, 10) - 1; // Vertex Index
if (*pChar == '/') { if (*pChar == '/') {
pChar++; pChar++;
if (*pChar == '/') { if (*pChar == '/') {
*pFace++ = -1; *pFace++ = -1;
} else { } else {
*pFace++ = strtol(pChar, &pChar, 10) - 1; // Texture Coordinate Index *pFace++ = (int)strtol(pChar, &pChar, 10) - 1; // Texture Coordinate Index
} }
} else { } else {
*pFace++ = -1; *pFace++ = -1;
@@ -225,7 +225,7 @@ KRMesh* KRResource::LoadObj(KRContext& context, const std::string& path)
if (*pChar == '/') { if (*pChar == '/') {
*pFace++ = -1; *pFace++ = -1;
} else { } else {
*pFace++ = strtol(pChar, &pChar, 10) - 1; // Normal Index *pFace++ = (int)strtol(pChar, &pChar, 10) - 1; // Normal Index
} }
} else { } else {
*pFace++ = -1; *pFace++ = -1;

View File

@@ -124,9 +124,9 @@ public:
std::string m_lodBaseName; std::string m_lodBaseName;
virtual std::string getExtension(); virtual std::string getExtension() override;
virtual bool save(const std::string& path); virtual bool save(const std::string& path) override;
virtual bool save(mimir::Block& data); virtual bool save(mimir::Block& data) override;
void LoadData(const mesh_info& mi, bool calculate_normals, bool calculate_tangents); void LoadData(const mesh_info& mi, bool calculate_normals, bool calculate_tangents);
void loadPack(mimir::Block* data); void loadPack(mimir::Block* data);