Commit Graph

31 Commits

Author SHA1 Message Date
Aaron Fenyes
3d7ee98dd6 Ray-caster: check layer count
In debug mode, show the layer count instead of the shaded image. This
reveals a bug: testing whether the hit depth is NaN doesn't actually
detect sphere misses, because `sphere_cast` returns -1 rather than NaN
to indicate a miss.
2024-08-28 01:55:46 -07:00
Aaron Fenyes
c04e29f586 Reduce the frame interval sample frequency
At the higher frequency we were using earlier, the overhead from
updating the readout contributed significantly to the frame interval.
2024-08-28 01:47:38 -07:00
Aaron Fenyes
01c2af6615 Rotate and translate construction
In the process, write code to make updates that depend on the time
between frames.
2024-08-27 18:39:58 -07:00
Aaron Fenyes
a40a110788 Ray-caster: only draw when the scene is changed
This is how I typically schedule draw calls in JavaScript applications.
The baseline CPU activity for the display prototype is now in line with
other pages (though perhaps a bit higher), and the profiler shows little
time being spent in draw calls, even when I'm continually moving a
slider. The interface feels pretty responsive overall, although the
sliders seem to be lagging a bit.
2024-08-27 13:55:08 -07:00
Aaron Fenyes
f62f44b5a7 Optimization: decouple internal and uniform SPHERE_MAX 2024-08-27 00:00:48 -07:00
Aaron Fenyes
ec48592ef1 Ray-caster: add a frame time monitor
It's time to start optimizing. Frame time is easy to measure, and we can
use it to gauge responsiveness.
2024-08-26 23:39:51 -07:00
Aaron Fenyes
5e9c5db231 Ray-caster: switch from draw effect to animation loop
This wastes a lot of CPU time, as explained on lines 253--258 of
`main.rs`, but it's better than the previous version, which could block
graphics updates system-wide for seconds on end.
2024-08-26 16:06:37 -07:00
Aaron Fenyes
bf140efaf7 Ray-caster: remove hard-coded test construction 2024-08-26 13:51:01 -07:00
Aaron Fenyes
cbec31f5df Ray-caster: pass colors in through uniforms 2024-08-26 13:41:34 -07:00
Aaron Fenyes
b9370ceb41 Ray-caster: label controls 2024-08-26 01:47:53 -07:00
Aaron Fenyes
85db7b9be0 Ray-caster: pass the sphere count as a uniform
In the process, start exploring array size limits of various kinds.
2024-08-26 00:58:20 -07:00
Aaron Fenyes
c5fe725b1b Ray-caster: automate getting uniform array locations 2024-08-25 22:22:14 -07:00
Aaron Fenyes
5bf23fa789 Ray-caster: pass spheres in through uniforms
Keep the hard-coded spheres for comparison.
2024-08-25 21:40:59 -07:00
Aaron Fenyes
206a2df480 Ray-caster: add a third test sphere
This helps confirm that the generalized depth-sorting is working.
2024-08-25 16:41:31 -07:00
Aaron Fenyes
c18cac642b Ray-caster: generalize depth sorting
Switch from a hard-coded sorting network for four fragments to an
insertion sort, which should work for any number of fragments.
2024-08-25 00:47:36 -07:00
Aaron Fenyes
8798683d25 Ray-caster: store sphere data in arrays
This is a first step toward general depth sorting.
2024-08-25 00:00:28 -07:00
Aaron Fenyes
b9587872d3 Ray-caster: don't bother clearing the screen
The ray-caster triangles cover the whole viewport, so they'll completely
overdraw the previous frame.
2024-08-24 11:31:22 -07:00
Aaron Fenyes
766d56027c Ray-caster: move shaders to separate files
This properly reflects the modularity of the code, and it simplifies
indentation and syntax highlighting.
2024-08-24 11:27:19 -07:00
Aaron Fenyes
25da6ca062 Ray-caster: adjust opacity of highlighting 2024-08-24 11:08:31 -07:00
Aaron Fenyes
e3df765f16 Ray-caster: highlight intersections and cusps 2024-08-24 01:38:06 -07:00
Aaron Fenyes
f1029b3102 Ray-caster: map output into sRGB space
Change the base color and default opacity to keep the picture looking
broadly the same.
2024-08-24 01:05:19 -07:00
Aaron Fenyes
87763fc458 Ray-caster: tidy up sphere shading 2024-08-24 00:29:11 -07:00
Aaron Fenyes
2ef0fdd3e2 Ray-cast two spheres, with hard-coded depth sorting 2024-08-23 12:56:54 -07:00
Aaron Fenyes
d2cecf69db Ray-cast a translucent sphere 2024-08-23 00:16:41 -07:00
Aaron Fenyes
c78a041dc7 Write a ray-caster for inversive spheres 2024-08-22 22:08:34 -07:00
Aaron Fenyes
f274119da6 Enable depth testing
To get the right order, flip the sign of the `z` component in the output
of the projection map.
2024-08-22 18:17:01 -07:00
Aaron Fenyes
1fbeb23194 Add rotation control
In the process, find and correct an error in the --+ vertex, which was
miswritten as ---.
2024-08-22 00:04:58 -07:00
Aaron Fenyes
80b210e667 Make the projection map a uniform 2024-08-21 23:07:14 -07:00
Aaron Fenyes
81f9b8e040 Find vertex attribute indices in advance 2024-08-21 22:36:56 -07:00
Aaron Fenyes
5885189b04 Draw a mesh in perspective, and in color 2024-08-21 17:31:17 -07:00
Aaron Fenyes
fd3cbae1b4 Get a WebGL canvas working in Sycamore 2024-08-21 13:01:33 -07:00