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

Merging dev into main #34

Merged
merged 29 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8882919
Merge pull request #30 from jbikker/main
jbikker Nov 28, 2024
40b1136
Update README.md
jbikker Nov 28, 2024
22b9a0c
Compressed tri int on GPU, GPU output validation.
jbikker Nov 29, 2024
6db59c7
Add BuildQuick (midpoint) bvh. Terrible for Sponza, ok for flake.
jbikker Nov 29, 2024
1a6a5f4
Add BVH::Build for array of aabbs.
jbikker Nov 29, 2024
6f71e05
Preparing for TLAS.
jbikker Nov 29, 2024
abc490c
Fix to speedtest.
jbikker Nov 29, 2024
1676f94
TLAS progress, KISS GPU4 leaf handling.
jbikker Nov 30, 2024
078d2b9
Slightly faster GPU BVH4 traversal.
jbikker Nov 30, 2024
e12c5e7
Preparations for double-precision layout.
jbikker Nov 30, 2024
0f930c3
Correct Intersect_Afra steps counting
TheSFReader Dec 1, 2024
1930b01
Use same scene loading as fenster (check two locations for scene data…
TheSFReader Dec 1, 2024
6ef414e
Minimize changes to the external fenster.h file
TheSFReader Dec 1, 2024
94ae1b6
Minimize changes to the external fenster.h file
TheSFReader Dec 1, 2024
faeb971
Merge branch 'dev' of https://github.com/TheSFReader/tinybvh into dev
TheSFReader Dec 1, 2024
c6ab6c8
Update comment on rendering type
TheSFReader Dec 1, 2024
7720305
Merge pull request #32 from TheSFReader/dev
jbikker Dec 1, 2024
2a2b587
Compromise on fenster.
jbikker Dec 1, 2024
795f30d
Double-precision build, under construction.
jbikker Dec 1, 2024
4614dfc
Verts ptr now set on every build.
jbikker Dec 2, 2024
141311b
'Far away' can now be specified.
jbikker Dec 2, 2024
39edeb7
Shadow ray validation, proper tests.
jbikker Dec 2, 2024
9c12f50
Synchronize working dir between g++ / msvc.
jbikker Dec 2, 2024
a24dbc1
Comment on occlusion verification procedure.
jbikker Dec 2, 2024
9fe81b1
Double-precision builder appears to work.
jbikker Dec 2, 2024
38a629b
Double-precision builder done.
jbikker Dec 2, 2024
d54e5c5
Double-precision traversal (nodes only).
jbikker Dec 2, 2024
3094235
Double precision traversal complete.
jbikker Dec 2, 2024
83595c6
Double-precision feature toggle.
jbikker Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# dev
This is the **development branch** for tinybvh. New features will be tested and finetuned here first, so main stays stable.

# tinybvh
Single-header BVH construction and traversal library written as "Sane C++" (or "C with classes"). The library has no dependencies.

Expand Down
64 changes: 36 additions & 28 deletions external/fenster.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef FENSTER_H
#define FENSTER_H

#define SCRWIDTH 800
#define SCRHEIGHT 600

#if defined(__APPLE__)
#include <CoreGraphics/CoreGraphics.h>
#include <objc/NSObjCRuntime.h>
Expand All @@ -22,6 +19,19 @@
#include <stdlib.h>
#include <chrono>

struct Timer
{
Timer() { reset(); }
float elapsed() const
{
std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2 - start);
return (float)time_span.count();
}
void reset() { start = std::chrono::high_resolution_clock::now(); }
std::chrono::high_resolution_clock::time_point start;
};

struct fenster {
const char *title;
const int width;
Expand All @@ -44,18 +54,10 @@ struct fenster {
#endif
};

struct Timer
{
Timer() { reset(); }
float elapsed() const
{
std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2 - start);
return (float)time_span.count();
}
void reset() { start = std::chrono::high_resolution_clock::now(); }
std::chrono::high_resolution_clock::time_point start;
};
// forward-declare these methods which we will implement in our own code.
void Init();
void Tick(float delta_time_s, fenster& f, uint32_t* buf);
void Shutdown();

#ifndef FENSTER_API
#define FENSTER_API extern
Expand Down Expand Up @@ -386,34 +388,40 @@ class Fenster {

#endif /* !FENSTER_HEADER */

void Init();
void Tick( uint32_t* buf );
void Shutdown();
int run()
#ifdef FENSTER_APP_IMPLEMENTATION

// application entry point and message loop implementation.
int run()
{
uint32_t* buf = new uint32_t[SCRWIDTH * SCRHEIGHT];
struct fenster f = { .title = "tiny_bvh", .width = SCRWIDTH, .height = SCRHEIGHT, .buf = buf, };
fenster_open( &f );

fenster_open(&f);
Timer t;
Init();
while (fenster_loop( &f ) == 0)
{
Tick( buf );
t.reset();
while (fenster_loop(&f) == 0) {
float elapsed = t.elapsed();
t.reset();
Tick(elapsed, f, buf);
if (f.keys[27]) break;
}
Shutdown();
fenster_close( &f );
delete [] buf;
fenster_close(&f);
delete[] buf;
return 0;
}

#if defined(_WIN32)
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine,
int nCmdShow ) {
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine,
int nCmdShow) {
(void)hInstance, (void)hPrevInstance, (void)pCmdLine, (void)nCmdShow;
return run();
}
#else
int main() { return run(); }
#endif

#endif /* FENSTER_H */
#endif /* FENSTER_APP_IMPLEMENTATION */

#endif /* FENSTER_H */
Loading
Loading