Skip to content

Commit

Permalink
Apply clang-format 11 styling
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 4, 2021
1 parent 5256e17 commit 92e6642
Show file tree
Hide file tree
Showing 34 changed files with 415 additions and 421 deletions.
2 changes: 1 addition & 1 deletion fresnel/common/IntersectCylinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ DEVICE inline bool intersect_ray_spherocylinder(float& t,

// determine d_edge
// project C and Oa into the view plane perpendicular to the view direction
const vec3<float> C_vp = C - dot(C, d) * d; // vector rejection assuming view is normalized
const vec3<float> C_vp = C - dot(C, d) * d; // vector rejection assuming view is normalized
const vec3<float> Oa_vp = Oa - dot(Oa, d) * d; // vector rejection assuming view is normalized

// d_edge is r - (the distance from Oa_vp to the line segment (0,0,0) - Oa_vp)
Expand Down
6 changes: 3 additions & 3 deletions fresnel/common/Light.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ namespace fresnel
struct Lights
{
vec3<float> direction[4]; //!< Light directions
RGB<float> color[4]; //!< Color of each light (linearized sRGB color space)
float theta[4]; //!< Half angle of the area light
unsigned int N; //!< Number of lights
RGB<float> color[4]; //!< Color of each light (linearized sRGB color space)
float theta[4]; //!< Half angle of the area light
unsigned int N; //!< Number of lights

//! Default constructor leaves memory uninitialized to support OptiX variables
Lights() { }
Expand Down
12 changes: 6 additions & 6 deletions fresnel/common/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ DEVICE inline float schlick(float x)
*/
struct Material
{
float solid; //!< Set to 1 to pass through solid color
RGB<float> color; //!< Color of the material
float solid; //!< Set to 1 to pass through solid color
RGB<float> color; //!< Color of the material
float primitive_color_mix; //!< Set to 0 to force material color, 1 to use geometry color
float roughness; //!< Set to 0 for a smooth material, non-zero for a rough material
float specular; //!< Set to 0 for no specular highlights, 1 for strong highlights
float metal; //!< Set to 0 for dielectric materials, set to 1 for metals
float spec_trans; //!< Set to 0 for solid materials, 1 for fully transmissive
float roughness; //!< Set to 0 for a smooth material, non-zero for a rough material
float specular; //!< Set to 0 for no specular highlights, 1 for strong highlights
float metal; //!< Set to 0 for dielectric materials, set to 1 for metals
float spec_trans; //!< Set to 0 for solid materials, 1 for fully transmissive

//! Default constructor gives uninitialized material
DEVICE Material() { }
Expand Down
8 changes: 4 additions & 4 deletions fresnel/common/RayGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ class RayGen
}

protected:
unsigned int m_width; //!< Width of the output image (in pixels)
unsigned int m_height; //!< Height of the output image (in pixels)
unsigned int m_width; //!< Width of the output image (in pixels)
unsigned int m_height; //!< Height of the output image (in pixels)
r123::Philox4x32::key_type m_rng_key; //!< Key for the random number generator
unsigned int m_i; //!< i coordinate of the pixel
unsigned int m_j; //!< j coordinate of the pixel
unsigned int m_i; //!< i coordinate of the pixel
unsigned int m_j; //!< j coordinate of the pixel
};

} // namespace fresnel
Expand Down
2 changes: 1 addition & 1 deletion fresnel/common/VectorMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ template<class Real> struct quat
return q;
}

Real s; //!< scalar component
Real s; //!< scalar component
vec3<Real> v; //!< vector component
};

Expand Down
34 changes: 19 additions & 15 deletions fresnel/common/module-common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,32 @@ PYBIND11_MODULE(_common, m)
.def_readwrite("spec_trans", &Material::spec_trans)
.def_readwrite("metal", &Material::metal)
.def_readwrite("color", &Material::color)
.def("__repr__", [](const Material& a) {
ostringstream s;
s << "<fresnel._common.Material:"
<< " solid=" << a.solid << " color=(" << a.color.r << ", " << a.color.g << ", "
<< a.color.b << ")"
<< " primitive_color_mix=" << a.primitive_color_mix << " roughness=" << a.roughness
<< " specular=" << a.specular << " spec_trans=" << a.spec_trans
<< " metal=" << a.metal << ">";
.def("__repr__",
[](const Material& a)
{
ostringstream s;
s << "<fresnel._common.Material:"
<< " solid=" << a.solid << " color=(" << a.color.r << ", " << a.color.g << ", "
<< a.color.b << ")"
<< " primitive_color_mix=" << a.primitive_color_mix
<< " roughness=" << a.roughness << " specular=" << a.specular
<< " spec_trans=" << a.spec_trans << " metal=" << a.metal << ">";

return s.str();
});
return s.str();
});

pybind11::class_<vec3<float>>(m, "vec3f")
.def(pybind11::init<float, float, float>())
.def_readwrite("x", &vec3<float>::x)
.def_readwrite("y", &vec3<float>::y)
.def_readwrite("z", &vec3<float>::z)
.def("__repr__", [](const vec3<float>& a) {
ostringstream s;
s << "<fresnel._common.vec3f (" << a.x << ", " << a.y << ", " << a.z << ")>";
return s.str();
});
.def("__repr__",
[](const vec3<float>& a)
{
ostringstream s;
s << "<fresnel._common.vec3f (" << a.x << ", " << a.y << ", " << a.z << ")>";
return s.str();
});

pybind11::class_<UserCamera>(m, "UserCamera")
.def(pybind11::init<>())
Expand Down
8 changes: 4 additions & 4 deletions fresnel/cpu/Array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ void export_Array(pybind11::module& m)
m,
"ArrayRGBAc",
pybind11::buffer_protocol())
.def_buffer(
[](Array<RGBA<unsigned char>>& t) -> pybind11::buffer_info { return t.getBuffer(); })
.def_buffer([](Array<RGBA<unsigned char>>& t) -> pybind11::buffer_info
{ return t.getBuffer(); })
.def("map", &Array<RGBA<unsigned char>>::map_py)
.def("unmap", &Array<RGBA<unsigned char>>::unmap);

Expand All @@ -38,8 +38,8 @@ void export_Array(pybind11::module& m)
m,
"ArrayRGBc",
pybind11::buffer_protocol())
.def_buffer(
[](Array<RGB<unsigned char>>& t) -> pybind11::buffer_info { return t.getBuffer(); })
.def_buffer([](Array<RGB<unsigned char>>& t) -> pybind11::buffer_info
{ return t.getBuffer(); })
.def("map", &Array<RGB<unsigned char>>::map_py)
.def("unmap", &Array<RGB<unsigned char>>::unmap);

Expand Down
6 changes: 3 additions & 3 deletions fresnel/cpu/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ template<class T> class Array

protected:
std::vector<T> m_data; //!< Stored data
size_t m_w; //!< Width of data array
size_t m_h; //!< Height of data array
unsigned int m_ndim; //!< Number of dimensions in the data array
size_t m_w; //!< Width of data array
size_t m_h; //!< Height of data array
unsigned int m_ndim; //!< Number of dimensions in the data array
};

//! Export Array instantiations to python
Expand Down
6 changes: 3 additions & 3 deletions fresnel/cpu/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Device
throw std::runtime_error("Embree: The operation got cancelled by an Memory Monitor "
"Callback or Progress Monitor Callback function.");
break;
default:
default:
throw std::runtime_error("Embree: An invalid error has occurred.");
break;
}
Expand All @@ -89,9 +89,9 @@ class Device
}

private:
RTCDevice m_device; //!< Store the embree device
RTCDevice m_device; //!< Store the embree device
std::shared_ptr<tbb::task_arena> m_arena; //!< TBB task arena
int m_limit; //!< Cached limit for reporting to users
int m_limit; //!< Cached limit for reporting to users
};

//! Export Device to python
Expand Down
8 changes: 4 additions & 4 deletions fresnel/cpu/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ class Geometry
}

protected:
unsigned int m_geom_id; //!< Associated geometry id
bool m_valid = false; //!< true when the geometry is valid and attached to the Scene
std::shared_ptr<Scene> m_scene; //!< The scene the geometry is attached to
unsigned int m_geom_id; //!< Associated geometry id
bool m_valid = false; //!< true when the geometry is valid and attached to the Scene
std::shared_ptr<Scene> m_scene; //!< The scene the geometry is attached to
std::shared_ptr<Device> m_device; //!< The device the Scene is attached to
RTCGeometry m_geometry; //!< The embree geometry object
RTCGeometry m_geometry; //!< The embree geometry object
};

//! Export Geometry to python
Expand Down
8 changes: 4 additions & 4 deletions fresnel/cpu/GeometryConvexPolyhedron.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ class GeometryConvexPolyhedron : public Geometry
protected:
std::vector<vec3<float>> m_plane_origin; //!< Origins of all the planes in the convex polyhedron
std::vector<vec3<float>> m_plane_normal; //!< Normals of all the planes in the convex polyhedron
std::vector<RGB<float>> m_plane_color; //!< Colors assigned to the polyhedron planes
std::vector<RGB<float>> m_plane_color; //!< Colors assigned to the polyhedron planes

std::shared_ptr<Array<vec3<float>>> m_position; //!< Position of each polyhedron
std::shared_ptr<Array<vec3<float>>> m_position; //!< Position of each polyhedron
std::shared_ptr<Array<quat<float>>> m_orientation; //!< Orientation of each polyhedron
std::shared_ptr<Array<RGB<float>>> m_color; //!< Per-particle color
std::shared_ptr<Array<RGB<float>>> m_color; //!< Per-particle color

float m_radius = 0; //!< Precomputed radius
float m_radius = 0; //!< Precomputed radius
float m_color_by_face = 0.0f; //!< Flag that mixes per particle color with per face color

//! Embree bounding function
Expand Down
4 changes: 2 additions & 2 deletions fresnel/cpu/GeometryCylinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class GeometryCylinder : public Geometry

protected:
std::shared_ptr<Array<vec3<float>>> m_points; //!< Position the start and end of each cylinder
std::shared_ptr<Array<float>> m_radius; //!< Per-particle radii
std::shared_ptr<Array<RGB<float>>> m_color; //!< Color for each start and end point
std::shared_ptr<Array<float>> m_radius; //!< Per-particle radii
std::shared_ptr<Array<RGB<float>>> m_color; //!< Color for each start and end point

//! Embree bounding function
static void bounds(const struct RTCBoundsFunctionArguments* args);
Expand Down
2 changes: 1 addition & 1 deletion fresnel/cpu/GeometryMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class GeometryMesh : public Geometry
m_vertices; //!< Holds the vertex coordinates in ccw order for each face
std::shared_ptr<Array<RGB<float>>> m_color; //!< Color for each vertex point

std::shared_ptr<Array<vec3<float>>> m_position; //!< Position of each polyhedron
std::shared_ptr<Array<vec3<float>>> m_position; //!< Position of each polyhedron
std::shared_ptr<Array<quat<float>>> m_orientation; //!< Orientation of each polyhedron

unsigned int m_N; //!< Number of polyhedra
Expand Down
6 changes: 3 additions & 3 deletions fresnel/cpu/GeometryPolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ class GeometryPolygon : public Geometry

protected:
std::vector<vec2<float>> m_vertices; //!< Polygon vertices
float m_rounding_radius; //!< Spheropolygon rounding radius
float m_rounding_radius; //!< Spheropolygon rounding radius

std::shared_ptr<Array<vec2<float>>> m_position; //!< Position of each polygon
std::shared_ptr<Array<float>> m_angle; //!< Orientation of each polygon
std::shared_ptr<Array<RGB<float>>> m_color; //!< Per-particle color
std::shared_ptr<Array<float>> m_angle; //!< Orientation of each polygon
std::shared_ptr<Array<RGB<float>>> m_color; //!< Per-particle color

float m_radius = 0; //!< Precomputed radius in the xy plane

Expand Down
4 changes: 2 additions & 2 deletions fresnel/cpu/GeometrySphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class GeometrySphere : public Geometry

protected:
std::shared_ptr<Array<vec3<float>>> m_position; //!< Position for each sphere
std::shared_ptr<Array<float>> m_radius; //!< Per-particle radii
std::shared_ptr<Array<RGB<float>>> m_color; //!< Per-particle color
std::shared_ptr<Array<float>> m_radius; //!< Per-particle radii
std::shared_ptr<Array<RGB<float>>> m_color; //!< Per-particle color

//! Embree bounding function
static void bounds(const struct RTCBoundsFunctionArguments* args);
Expand Down
12 changes: 6 additions & 6 deletions fresnel/cpu/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ class Scene
}

private:
RTCScene m_scene; //!< Store the scene
RTCScene m_scene; //!< Store the scene
std::shared_ptr<Device> m_device; //!< The device the scene is attached to

std::vector<Material> m_materials; //!< Materials associated with geometry ids
std::vector<Material> m_materials; //!< Materials associated with geometry ids
std::vector<Material> m_outline_materials; //!< Materials associated with geometry ids
std::vector<float> m_outline_widths; //!< Materials associated with geometry ids
std::vector<float> m_outline_widths; //!< Materials associated with geometry ids

RGB<float> m_background_color; //!< The background color
float m_background_alpha; //!< Background alpha
UserCamera m_camera; //!< The camera
Lights m_lights; //!< The lights
float m_background_alpha; //!< Background alpha
UserCamera m_camera; //!< The camera
Lights m_lights; //!< The lights
};

//! Export Scene to python
Expand Down
6 changes: 3 additions & 3 deletions fresnel/cpu/Tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ class Tracer
}

protected:
std::shared_ptr<Device> m_device; //!< The device the Scene is attached to
std::shared_ptr<Array<RGBA<float>>> m_linear_out; //!< The output buffer (linear space)
std::shared_ptr<Device> m_device; //!< The device the Scene is attached to
std::shared_ptr<Array<RGBA<float>>> m_linear_out; //!< The output buffer (linear space)
std::shared_ptr<Array<RGBA<unsigned char>>> m_srgb_out; //!< The output buffer (srgb space)
bool m_highlight_warning; //!< Set to true to enable highlight warnings in sRGB output
RGB<float> m_highlight_warning_color; //!< The highlight warning color
unsigned int m_seed = 0; //!< Random number seed
unsigned int m_seed = 0; //!< Random number seed
};

//! Export Tracer to python
Expand Down

0 comments on commit 92e6642

Please sign in to comment.