Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test sources with latest cppcheck #6726

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix
MNikoliCC committed Dec 11, 2024
commit 49b1db91ba2ea0ed83d3a7e706f6023ebf9bf550
2 changes: 1 addition & 1 deletion src/wren/DirectionalLight.hpp
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ namespace wren {

void setDirection(const glm::vec3 &direction);

LightNode::Type type() override { return TYPE_DIRECTIONAL; }
LightNode::Type type() const override { return TYPE_DIRECTIONAL; }

private:
DirectionalLight();
2 changes: 1 addition & 1 deletion src/wren/LightNode.hpp
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ namespace wren {
bool on() const { return mOn; }
bool castShadows() const { return mCastShadows; }

virtual LightNode::Type type() = 0;
virtual LightNode::Type type() const = 0;

protected:
LightNode();
2 changes: 1 addition & 1 deletion src/wren/PointLight.hpp
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ namespace wren {
// Encapsulate memory management
static PointLight *createPointLight() { return new PointLight(); }

LightNode::Type type() override { return TYPE_POINT; }
LightNode::Type type() const override { return TYPE_POINT; }

private:
PointLight();
2 changes: 1 addition & 1 deletion src/wren/Scene.cpp
Original file line number Diff line number Diff line change
@@ -630,7 +630,7 @@ namespace wren {
bool visible = true;
// Light culling
if (light->type() != LightNode::TYPE_DIRECTIONAL) {
const PositionalLight *positionalLight = static_cast<PositionalLight *>(light);
const PositionalLight *positionalLight = static_cast<const PositionalLight *>(light);
const primitive::Sphere &boundingSphere = renderable->boundingSphere();
const float distance = glm::distance(boundingSphere.mCenter, positionalLight->position());
const float radius = positionalLight->radius() + boundingSphere.mRadius;
2 changes: 1 addition & 1 deletion src/wren/SpotLight.hpp
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ namespace wren {
mIsDirectionDirty = true;
}

LightNode::Type type() override { return TYPE_SPOT; }
LightNode::Type type() const override { return TYPE_SPOT; }

void update() const override {
PositionalLight::update();
4 changes: 2 additions & 2 deletions src/wren/Transform.hpp
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ namespace wren {
public:
// Encapsulate memory management
static Transform *createTransform() { return new Transform(); }
static Transform *copyTransform(Transform *source) { return new Transform(source); }
static Transform *copyTransform(const Transform *source) { return new Transform(source); }

void attachChild(Node *child);
void detachChild(Node *child);
@@ -51,7 +51,7 @@ namespace wren {

protected:
Transform();
explicit Transform(Transform *source);
explicit Transform(const Transform *source);
virtual ~Transform() override;

private:
2 changes: 1 addition & 1 deletion src/wren/TransformNode.cpp
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ namespace wren {
mScaleRelative(glm::vec3(1.0)) {
}

TransformNode::TransformNode(TransformNode *source) :
TransformNode::TransformNode(const TransformNode *source) :
Node(source),
mIsMatrixDirty(source->mIsMatrixDirty),
mPositionRelative(source->mPositionRelative),