Skip to content

Commit

Permalink
various source cleanup
Browse files Browse the repository at this point in the history
- missing includes
- missing const
- C cast style
- superfluous inline keyword
  • Loading branch information
pixelflinger committed Jan 17, 2025
1 parent 5472dea commit 040a086
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 169 deletions.
6 changes: 3 additions & 3 deletions filament/include/filament/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,14 @@ class UTILS_PUBLIC Camera : public FilamentAPI {
* engine.getTransformManager().getInstance(camera->getEntity()), model);
* ~~~~~~~~~~~
*
* @param model The camera position and orientation provided as a rigid transform matrix.
* @param modelMatrix The camera position and orientation provided as a rigid transform matrix.
*
* @note The Camera "looks" towards its -z axis
*
* @warning \p model must be a rigid transform
*/
void setModelMatrix(const math::mat4& model) noexcept;
void setModelMatrix(const math::mat4f& model) noexcept; //!< @overload
void setModelMatrix(const math::mat4& modelMatrix) noexcept;
void setModelMatrix(const math::mat4f& modelMatrix) noexcept; //!< @overload

/** Set the position of an eye relative to this Camera (head).
*
Expand Down
2 changes: 1 addition & 1 deletion filament/include/filament/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class UTILS_PUBLIC Material : public FilamentAPI {
* memory or other resources.
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
*/
Material* UTILS_NULLABLE build(Engine& engine);
Material* UTILS_NULLABLE build(Engine& engine) const;
private:
friend class FMaterial;
};
Expand Down
28 changes: 24 additions & 4 deletions filament/src/Froxelizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,47 @@

#include "Froxelizer.h"

#include "Allocators.h"
#include "Intersections.h"

#include "details/Engine.h"
#include "details/Scene.h"

#include "private/backend/DriverApi.h"
#include <private/filament/EngineEnums.h>
#include <private/backend/DriverApi.h>

#include <filament/Box.h>
#include <filament/Viewport.h>

#include <backend/DriverEnums.h>

#include <utils/BinaryTreeArray.h>
#include <utils/JobSystem.h>
#include <utils/Log.h>
#include <utils/Slice.h>
#include <utils/Systrace.h>
#include <utils/compiler.h>
#include <utils/debug.h>

#include <math/mat4.h>
#include <math/fast.h>
#include <math/mat3.h>
#include <math/mat4.h>
#include <math/scalar.h>
#include <math/vec2.h>
#include <math/vec3.h>
#include <math/vec4.h>

#include <algorithm>
#include <utils/architecture.h>
#include <array>
#include <cmath>
#include <limits>
#include <type_traits>
#include <utility>

#include <stddef.h>
#include <stdint.h>
#include <string.h>

using namespace filament::math;
using namespace utils;
Expand Down Expand Up @@ -603,7 +623,7 @@ void Froxelizer::froxelizeLoop(FEngine& engine,
JobSystem& js = engine.getJobSystem();

constexpr bool SINGLE_THREADED = false;
if (!SINGLE_THREADED) {
if constexpr (!SINGLE_THREADED) {
auto *parent = js.createJob();
for (size_t i = 0; i < GROUP_COUNT; i++) {
js.run(jobs::createJob(js, parent, std::cref(process),
Expand Down Expand Up @@ -737,7 +757,7 @@ void Froxelizer::froxelizeAssignRecordsCompress() noexcept {
;
}

static inline float2 project(mat4f const& p, float3 const& v) noexcept {
static float2 project(mat4f const& p, float3 const& v) noexcept {
const float vx = v[0];
const float vy = v[1];
const float vz = v[2];
Expand Down
8 changes: 7 additions & 1 deletion filament/src/Frustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
#include "Culler.h"

#include <utils/compiler.h>
#include <utils/Log.h>
#include <utils/ostream.h>

#include <math/vec3.h>
#include <math/vec4.h>
#include <math/mat4.h>

#include <algorithm>

using namespace filament::math;

Expand Down
18 changes: 16 additions & 2 deletions filament/src/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,22 @@

#include "details/Material.h"

#include <filament/Material.h>
#include <filament/MaterialEnums.h>

#include <backend/CallbackHandler.h>
#include <backend/DriverEnums.h>

#include <utils/Invocable.h>

#include <utility>

#include <stddef.h>

namespace filament {

class MaterialInstance;

using namespace backend;

MaterialInstance* Material::createInstance(const char* name) const noexcept {
Expand Down Expand Up @@ -140,9 +154,9 @@ MaterialInstance const* Material::getDefaultInstance() const noexcept {
return downcast(this)->getDefaultInstance();
}

void Material::compile(CompilerPriorityQueue const priority, UserVariantFilterMask const variantFilter,
void Material::compile(CompilerPriorityQueue const priority, UserVariantFilterMask const variants,
CallbackHandler* handler, utils::Invocable<void(Material*)>&& callback) noexcept {
downcast(this)->compile(priority, variantFilter, handler, std::move(callback));
downcast(this)->compile(priority, variants, handler, std::move(callback));
}

UserVariantFilterMask Material::getSupportedVariants() const noexcept {
Expand Down
Loading

0 comments on commit 040a086

Please sign in to comment.