Skip to content

Commit

Permalink
More white-space
Browse files Browse the repository at this point in the history
  • Loading branch information
bfierz committed Sep 9, 2021
1 parent 42fb855 commit 71fcece
Show file tree
Hide file tree
Showing 16 changed files with 116 additions and 117 deletions.
37 changes: 22 additions & 15 deletions src/libs/vcl.core/vcl/core/memory/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ namespace Vcl { namespace Core {
explicit ObjectTraits() noexcept = default;

//! Conversion constructor
template <typename U>
explicit ObjectTraits(ObjectTraits<U> const&) {}
template<typename U>
explicit ObjectTraits(ObjectTraits<U> const&)
{}

//! Compute address of an object
T* address(T& r) { return std::addressof(r); }
Expand All @@ -81,7 +82,7 @@ namespace Vcl { namespace Core {
template<typename U, typename... Args>
void construct(U* p, Args&&... args)
{
::new(static_cast<void*>(p)) U(std::forward<Args>(args)...);
::new (static_cast<void*>(p)) U(std::forward<Args>(args)...);
}

//! Call the destructor of p of type U
Expand All @@ -93,7 +94,7 @@ namespace Vcl { namespace Core {
p->~U();
}
};

//! Object trait avoiding initialization of objects
template<typename T>
class NoInitObjectTraits
Expand All @@ -115,8 +116,9 @@ namespace Vcl { namespace Core {
explicit NoInitObjectTraits() noexcept = default;

//! Conversion constructor
template <typename U>
explicit NoInitObjectTraits(NoInitObjectTraits<U> const&) {}
template<typename U>
explicit NoInitObjectTraits(NoInitObjectTraits<U> const&)
{}

//! Compute address of an object
T* address(T& r) { return std::addressof(r); }
Expand All @@ -129,7 +131,7 @@ namespace Vcl { namespace Core {
void construct(U* p, Args&&...)
{
// Omit the '()' to avoid initialization of the objects
::new(static_cast<void*>(p)) U;
::new (static_cast<void*>(p)) U;
}

//! Provide the object destruction interface
Expand Down Expand Up @@ -163,8 +165,9 @@ namespace Vcl { namespace Core {
public:
explicit StandardAllocPolicy() noexcept = default;
explicit StandardAllocPolicy(StandardAllocPolicy const&) noexcept = default;
template <typename U>
explicit StandardAllocPolicy(StandardAllocPolicy<U> const&) {}
template<typename U>
explicit StandardAllocPolicy(StandardAllocPolicy<U> const&)
{}

public: // Memory allocation
pointer allocate(size_type cnt, const_pointer = nullptr)
Expand Down Expand Up @@ -220,8 +223,9 @@ namespace Vcl { namespace Core {
public:
explicit AlignedAllocPolicy() noexcept = default;
explicit AlignedAllocPolicy(AlignedAllocPolicy const&) noexcept = default;
template <typename U, int AlignmentRhs>
explicit AlignedAllocPolicy(AlignedAllocPolicy<U, AlignmentRhs> const&) {}
template<typename U, int AlignmentRhs>
explicit AlignedAllocPolicy(AlignedAllocPolicy<U, AlignmentRhs> const&)
{}

public: // Memory allocation
pointer allocate(size_type cnt, const_pointer = nullptr)
Expand Down Expand Up @@ -281,17 +285,20 @@ namespace Vcl { namespace Core {
using value_type = typename AllocationPolicy::value_type;

public:
template <typename U>
template<typename U>
struct rebind
{
using other = Allocator<U, typename AllocationPolicy::template rebind<U>::other, typename TTraits::template rebind<U>::other>;
};

public:
explicit Allocator() noexcept = default;
Allocator(Allocator const& rhs) noexcept : Policy(rhs), Traits(rhs) {}
template <typename U, typename P, typename T2>
Allocator(Allocator<U, P, T2> const& rhs) : Policy(rhs), Traits(rhs) {}
Allocator(Allocator const& rhs) noexcept
: Policy(rhs), Traits(rhs) {}
template<typename U, typename P, typename T2>
Allocator(Allocator<U, P, T2> const& rhs)
: Policy(rhs), Traits(rhs)
{}
};

/*
Expand Down
2 changes: 1 addition & 1 deletion src/libs/vcl.core/vcl/util/hashedstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace Vcl { namespace Util {
hash ^= uint32_t(*str++);
hash *= 0x01000193;
}

return hash;
}

Expand Down
26 changes: 10 additions & 16 deletions src/libs/vcl.geometry/vcl/geometry/io/serialiser_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ namespace Vcl { namespace Geometry { namespace IO {
if (idx < 0)
{
return latest_idx + 1 + idx;
}
else
} else
{
return idx - 1;
}
Expand Down Expand Up @@ -105,25 +104,22 @@ namespace Vcl { namespace Geometry { namespace IO {
vN = { p0, p1, p2 };
deserialiser->addNode(vN);
latest_v_idx++;
}
else if (token == "vn")
} else if (token == "vn")
{
parser.readFloat(&v3(0));
parser.readFloat(&v3(1));
parser.readFloat(&v3(2));

deserialiser->addNormal(v3);
latest_vn_idx++;
}
else if (token == "vt")
} else if (token == "vt")
{
parser.readFloat(&v2(0));
parser.readFloat(&v2(1));

//deserialiser->addTexture(v2);
latest_vt_idx++;
}
else if (token == "vc") // Non standard extension
} else if (token == "vc") // Non standard extension
{
parser.readFloat(&v4(0));
parser.readFloat(&v4(1));
Expand All @@ -139,13 +135,11 @@ namespace Vcl { namespace Geometry { namespace IO {
{
VclDebugError("Not implemented.");
//primitive_point
}
else if (token == "l")
} else if (token == "l")
{
VclDebugError("Not implemented.");
//primitive_line
}
else if (token == "f")
} else if (token == "f")
{
std::array<unsigned int, 4> corner;
corner.fill(0xffffffff);
Expand Down Expand Up @@ -199,9 +193,9 @@ namespace Vcl { namespace Geometry { namespace IO {
void ObjSerialiser::store(AbstractSerialiser* serialiser, const std::string& path) const
{
using namespace std;

if (serialiser == NULL) return;

// Definition of the IO format
Eigen::IOFormat io_format(8, 0, "", " ", "", "", "", "");

Expand All @@ -222,7 +216,7 @@ namespace Vcl { namespace Geometry { namespace IO {
std::vector<float> pos;
serialiser->fetchNode(pos);
fout << "v " << pos[0] << " " << pos[1] << " " << pos[2] << endl;

if (serialiser->hasNormals())
{
Vector3f normal;
Expand Down Expand Up @@ -267,7 +261,7 @@ namespace Vcl { namespace Geometry { namespace IO {

// Write footer
fout.close();

// End writing the mesh
serialiser->end();
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/vcl.geometry/vcl/geometry/io/serialiser_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
#pragma once

// VCL configuration
// VCL configuration
#include <vcl/config/global.h>
#include <vcl/config/eigen.h>

Expand Down
3 changes: 1 addition & 2 deletions src/libs/vcl.geometry/vcl/geometry/io/trimesh_serialiser.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Vcl { namespace Geometry { namespace IO {
public:
virtual void begin();
virtual void end();

public:
virtual void sizeHintNodes(unsigned int hint);
virtual void sizeHintEdges(unsigned int hint);
Expand All @@ -61,7 +61,6 @@ namespace Vcl { namespace Geometry { namespace IO {
virtual void addNormal(const Vector3f& normal);

private:

//! Generated mesh
std::unique_ptr<TriMesh> _mesh;

Expand Down
2 changes: 1 addition & 1 deletion src/libs/vcl.geometry/vcl/geometry/meshfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ namespace Vcl { namespace Geometry {
auto mesh = std::make_unique<TriMesh>(positions, faces);

// Create the normals
Eigen::Vector3f center{0.5f, 0.5f, 0.5f};
Eigen::Vector3f center{ 0.5f, 0.5f, 0.5f };
auto normals = mesh->addVertexProperty<Vector3f>("Normals", Vector3f{ 0, 0, 0 });
for (unsigned int i = 0; i < static_cast<unsigned int>(positions.size()); ++i)
normals[i] = (positions[i] - center).normalized();
Expand Down
Loading

0 comments on commit 71fcece

Please sign in to comment.