Compare commits
9 Commits
821a01c167
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b72cd39f8 | |||
| f2c7c0d882 | |||
| c0a0d101eb | |||
| 70dbf1a649 | |||
| 78fa51384a | |||
| 5168be0ea9 | |||
| 7f013bf36b | |||
| fb2d5d2d0c | |||
| f50871e3d8 |
@@ -41,3 +41,4 @@ debug
|
|||||||
build
|
build
|
||||||
debug
|
debug
|
||||||
.cache
|
.cache
|
||||||
|
tmp
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# polypartiCL
|
# polypartiCL
|
||||||
|
|
||||||
Naive photon simulator with SYCL and [raylib](https://raylib.com)
|
Naive photon simulator using [SYCL](https://khronos.org/sycl/) and [raylib](https://raylib.com)
|
||||||
|
|
||||||
This project uses the [raylib-cpp](https://robloach.github.io/raylib-cpp) wrapper library and is provided in the /include directory.
|
This project uses the [raylib-cpp](https://robloach.github.io/raylib-cpp) wrapper library and is provided in the /include directory.
|
||||||
raylib-cpp is licensed under an unmodified zlib/libpng license. A copy of this license is provided at /include/LICENSE.
|
raylib-cpp is licensed under an unmodified zlib/libpng license. A copy of this license is provided at /include/LICENSE.
|
||||||
@@ -8,12 +8,23 @@ raylib-cpp is licensed under an unmodified zlib/libpng license. A copy of this l
|
|||||||
cmake assumes icpx and the [Intel OneAPI](https://www.intel.com/content/www/us/en/developer/tools/oneapi/overview.html) environment is installed.
|
cmake assumes icpx and the [Intel OneAPI](https://www.intel.com/content/www/us/en/developer/tools/oneapi/overview.html) environment is installed.
|
||||||
You'll need these even if you don't compile with cmake until SYCL gets native LLVM support.
|
You'll need these even if you don't compile with cmake until SYCL gets native LLVM support.
|
||||||
|
|
||||||
polypartiCL is licensed with the 3-clause BSD license.
|
All simulation code uses single-precision floating point arithmetic to ensure compatability with (integrated) graphics packages that do not support 64-bit floating point.
|
||||||
|
|
||||||
|
polypartiCL is licensed with the 3-clause BSD license. Initial development of GLSL shaders (./shaders/*.fs) was assisted by generative AI (Claude Sonnet).
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
- Reduce corner escaping
|
||||||
|
- Ability limited by f32 precision
|
||||||
- Rewrite & optimize simulation code, store all points/velocites in one array and submit once
|
- Rewrite & optimize simulation code, store all points/velocites in one array and submit once
|
||||||
- Consider modelling each particle and all its relevant data points individually
|
- Consider modelling each particle and all its relevant data points individually
|
||||||
- Submit each relevant data point by pointer offset, size of struct is irrelevant as long as it is constant, only necessary data will be submitted to kernel
|
- Submit each relevant data point by pointer offset, size of struct is irrelevant as long as it is constant, only necessary data will be submitted to kernel
|
||||||
- Add linear beams
|
- Add linear beams
|
||||||
- Add environment objects / multiple rooms per screen
|
- Add environment objects / multiple rooms per screen
|
||||||
- Add timed events
|
- Add timed events
|
||||||
|
- Add MIDI support for real-time music visualization
|
||||||
|
- Add compile option for 64-bit floating point simulation
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Center Delay
|
||||||
|
count velocity x y theta_i theta_f color start end decayrate
|
||||||
|
===================================================
|
||||||
|
s
|
||||||
|
20000 70 0.5 0.5 0 360 red 1 0 0
|
||||||
|
20000 70 0.5 0.5 0 360 green 3.30769 0 0
|
||||||
|
20000 70 0.5 0.5 0 360 blue 5.61538 0 0
|
||||||
|
20000 70 0.5 0.5 0 360 white 7.92308 0 0
|
||||||
+4
-3
@@ -2,6 +2,7 @@ Center Delay
|
|||||||
count velocity x y theta_i theta_f color start end decayrate
|
count velocity x y theta_i theta_f color start end decayrate
|
||||||
===================================================
|
===================================================
|
||||||
s
|
s
|
||||||
16000 79 0.5 0.5 0 360 cyan 1 0 0
|
10000 40 0.5 0.5 0 360 orange 1 0 0
|
||||||
16000 79 0.5 0.5 0 360 magenta 2.075 0 0
|
10000 40 0.5 0.5 0 360 cyan 3.30769 0 0
|
||||||
16000 79 0.5 0.5 0 360 yellow 4.931 0 0
|
10000 40 0.5 0.5 0 360 violet 5.61538 0 0
|
||||||
|
10000 40 0.5 0.5 0 360 green 7.92308 0 0
|
||||||
|
|||||||
+7
-9
@@ -1,11 +1,9 @@
|
|||||||
Big Hexagon (fixed 1080)
|
Big Diamond (relative)
|
||||||
x y
|
x y
|
||||||
==================
|
==================
|
||||||
f
|
r
|
||||||
960.0 1.303
|
0.5 0.0
|
||||||
1426.525 270.652
|
0.78125 0.5
|
||||||
1426.525 809.348
|
0.5 1.0
|
||||||
960.0 1078.697
|
0.21875 0.5
|
||||||
493.475 809.348
|
0.5 0.0
|
||||||
493.475 270.652
|
|
||||||
960.0 1.303
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 211 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 233 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 758 KiB |
@@ -67,6 +67,8 @@ int main(int argc, char* argv[]) {
|
|||||||
raylib::Vector2 mouse_i, mouse_f, mouse_d;
|
raylib::Vector2 mouse_i, mouse_f, mouse_d;
|
||||||
raylib::Vector2 midpoint(screenWidth * 0.5, screenHeight * 0.5);
|
raylib::Vector2 midpoint(screenWidth * 0.5, screenHeight * 0.5);
|
||||||
|
|
||||||
|
raylib::Image screenshot(screenWidth, screenHeight, WHITE);
|
||||||
|
|
||||||
|
|
||||||
float dirH[2] = {1.0f, 0.0f};
|
float dirH[2] = {1.0f, 0.0f};
|
||||||
float dirV[2] = {0.0f, 1.0f};
|
float dirV[2] = {0.0f, 1.0f};
|
||||||
@@ -89,6 +91,10 @@ int main(int argc, char* argv[]) {
|
|||||||
if (IsKeyPressed(KEY_B)) useShader = !useShader;
|
if (IsKeyPressed(KEY_B)) useShader = !useShader;
|
||||||
if (IsKeyPressed(KEY_SPACE)) paused = !paused;
|
if (IsKeyPressed(KEY_SPACE)) paused = !paused;
|
||||||
if (IsKeyPressed(KEY_T)) sim.reverseInterval();
|
if (IsKeyPressed(KEY_T)) sim.reverseInterval();
|
||||||
|
if (IsKeyPressed(KEY_S)) {
|
||||||
|
screenshot.LoadFromScreen();
|
||||||
|
screenshot.ExportAsCode("screenshot" + std::to_string(window.GetTime()));
|
||||||
|
}
|
||||||
|
|
||||||
if (!paused) {
|
if (!paused) {
|
||||||
sim.updateFields(window.GetTime());
|
sim.updateFields(window.GetTime());
|
||||||
|
|||||||
+6
-6
@@ -30,9 +30,9 @@ struct Polyparti::ParticleField::ColCode {
|
|||||||
|
|
||||||
//Pointers to malloc on GPU VRAM for calculations. malloc_shared pointers are entry/exit
|
//Pointers to malloc on GPU VRAM for calculations. malloc_shared pointers are entry/exit
|
||||||
//point for data in CPU RAM
|
//point for data in CPU RAM
|
||||||
float *v_ptr = malloc_shared<float>(2 * len_points, q);
|
float *v_ptr = malloc_device<float>(2 * len_points, q);
|
||||||
float *d_ptr = malloc_shared<float>(2 * len_points, q);
|
float *d_ptr = malloc_device<float>(2 * len_points, q);
|
||||||
float *c_ptr = malloc_shared<float>(2 * len_points, q);
|
float *c_ptr = malloc_device<float>(2 * len_points, q);
|
||||||
float *ray_ptr = malloc_device<float>(2 * len_points, q);
|
float *ray_ptr = malloc_device<float>(2 * len_points, q);
|
||||||
float *det_ptr = malloc_device<float>(len_points, q);
|
float *det_ptr = malloc_device<float>(len_points, q);
|
||||||
float *bestA_ptr = malloc_device<float>(2 * len_points, q);
|
float *bestA_ptr = malloc_device<float>(2 * len_points, q);
|
||||||
@@ -170,9 +170,9 @@ struct Polyparti::ParticleField::ColCode {
|
|||||||
void moveParticles() {
|
void moveParticles() {
|
||||||
queue& q = q_shared();
|
queue& q = q_shared();
|
||||||
int len = positions.size();
|
int len = positions.size();
|
||||||
float *v_ptr = malloc_shared<float>(2 * len, q);
|
float *v_ptr = malloc_device<float>(2 * len, q);
|
||||||
float *p_ptr = malloc_shared<float>(2 * len, q);
|
float *p_ptr = malloc_device<float>(2 * len, q);
|
||||||
float *t_ptr = malloc_shared<float>(1, q);
|
float *t_ptr = malloc_device<float>(1, q);
|
||||||
|
|
||||||
q.submit([&](handler& h) {
|
q.submit([&](handler& h) {
|
||||||
h.memcpy(p_ptr, &positions[0], len * 2 * sizeof(float));
|
h.memcpy(p_ptr, &positions[0], len * 2 * sizeof(float));
|
||||||
|
|||||||
Reference in New Issue
Block a user