-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
24c11bf
commit af150e7
Showing
46 changed files
with
1,981 additions
and
2,015 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
BasedOnStyle: Google |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
Build-And-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: libavutil58 libavcodec-dev libavformat-dev libswscale-dev libswresample-dev | ||
version: 1.2 | ||
execute_install_scripts: true | ||
- name: CMake config & build | ||
run: | | ||
cmake -B build -DCMAKE_BUILD_TYPE=Release . | ||
cmake --build build --parallel 4 | ||
- name: Run test | ||
run: ./build/tools/test/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: '' # Use the sha / tag you want to point at | ||
hooks: | ||
- id: clang-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,35 @@ | ||
#ifndef __BOUNDING_BOX_H__ | ||
#define __BOUNDING_BOX_H__ | ||
|
||
//##################################################################### | ||
// Function #in | ||
//##################################################################### | ||
// ##################################################################### | ||
// Function #in | ||
// ##################################################################### | ||
#include "objects/object.hpp" | ||
#include "ray.hpp" | ||
#include "vec.hpp" | ||
|
||
template<class T, int d> | ||
vec<T,d> componentwise_max(const vec<T,d>& a, const vec<T,d>& b) | ||
{ | ||
vec<T,d> r; | ||
for(int i=0; i<d; i++) r[i] = std::max(a[i], b[i]); | ||
return r; | ||
template <class T, int d> | ||
vec<T, d> componentwise_max(const vec<T, d> &a, const vec<T, d> &b) { | ||
vec<T, d> r; | ||
for (int i = 0; i < d; i++) r[i] = std::max(a[i], b[i]); | ||
return r; | ||
} | ||
|
||
template<class T, int d> | ||
vec<T,d> componentwise_min(const vec<T,d>& a, const vec<T,d>& b) | ||
{ | ||
vec<T,d> r; | ||
for(int i=0; i<d; i++) r[i] = std::min(a[i], b[i]); | ||
return r; | ||
template <class T, int d> | ||
vec<T, d> componentwise_min(const vec<T, d> &a, const vec<T, d> &b) { | ||
vec<T, d> r; | ||
for (int i = 0; i < d; i++) r[i] = std::min(a[i], b[i]); | ||
return r; | ||
} | ||
|
||
class Bounding_Box | ||
{ | ||
public: | ||
// lowermost and uppermost corners of bounding box | ||
vec3 lo,hi; | ||
class Bounding_Box { | ||
public: | ||
// lowermost and uppermost corners of bounding box | ||
vec3 lo, hi; | ||
|
||
bool Intersection(const Ray& ray, double& dist); | ||
bool Intersection(const Ray &ray, double &dist); | ||
|
||
Bounding_Box Union(const Bounding_Box& bb) const; | ||
Bounding_Box Union(const Bounding_Box &bb) const; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
#ifndef __BOX_H__ | ||
#define __BOX_H__ | ||
|
||
#include "ray.hpp" | ||
#include "misc.hpp" | ||
#include <limits> | ||
|
||
class Box | ||
{ | ||
public: | ||
// lowermost and uppermost corners of bounding box | ||
vec3 lo,hi; | ||
#include "misc.hpp" | ||
#include "ray.hpp" | ||
|
||
class Box { | ||
public: | ||
// lowermost and uppermost corners of bounding box | ||
vec3 lo, hi; | ||
|
||
// Return whether the ray intersects this box. | ||
bool Intersection(const Ray& ray) const; | ||
// Return whether the ray intersects this box. | ||
bool Intersection(const Ray &ray) const; | ||
|
||
// Compute the smallest box that contains both *this and bb. | ||
Box Union(const Box& bb) const; | ||
// Compute the smallest box that contains both *this and bb. | ||
Box Union(const Box &bb) const; | ||
|
||
// Enlarge this box (if necessary) so that pt also lies inside it. | ||
void Include_Point(const vec3& pt); | ||
// Enlarge this box (if necessary) so that pt also lies inside it. | ||
void Include_Point(const vec3 &pt); | ||
|
||
// Create a box to which points can be correctly added using Include_Point. | ||
void Make_Empty(); | ||
// Create a box to which points can be correctly added using Include_Point. | ||
void Make_Empty(); | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.