Application prototype #14

Merged
glen merged 101 commits from app-proto into main 2024-10-21 23:38:28 +00:00

101 Commits

Author SHA1 Message Date
Aaron Fenyes
5e117d5877 Merge branch 'main' into app-proto
Incorporate the engine prototype from pull request #13, which just got
merged into `main`.
2024-10-21 00:25:59 -07:00
Aaron Fenyes
517fd327fa Assembly: mark constraints as active or not 2024-10-16 23:22:25 -07:00
Aaron Fenyes
f1690b62e1 Move full interface prototype to top level 2024-10-14 17:08:44 -07:00
Aaron Fenyes
cca5a781c4 Remove standalone display prototype 2024-10-14 16:43:13 -07:00
Aaron Fenyes
abe231126d Display: restore intersection and cusp highlighting
This increases resource use a bit, because we now have to hold two
fragments in memory at once instead of just one. It's still much better
than holding all of the top twelve fragments, though!
2024-10-14 16:36:52 -07:00
Aaron Fenyes
ee1c691787 Display: shade fragments after depth sorting
This reduces register pressure significantly. This stepping stone commit
temporarily removes highlighting of intersections and cusps.
2024-10-14 16:04:56 -07:00
Aaron Fenyes
19907838ce Display: remove redundant depth test 2024-09-30 17:59:48 -07:00
Aaron Fenyes
e3120f7109 Display: remove unused fragment-sorting function 2024-09-30 16:48:36 -07:00
Aaron Fenyes
18ebf3be2c Display: add turntable for benchmarking
Together with 25fa108 and 4f8f360, this lets us do a benchmarking
routine for `full-interface` which is comparable to the one we've been
using for `inversive-display`.
2024-09-30 00:44:13 -07:00
Aaron Fenyes
edace8e4ea Outline: include ID and label in element diff key 2024-09-29 23:41:16 -07:00
Aaron Fenyes
70bd39b9e5 App: remove unused imports 2024-09-29 23:30:35 -07:00
Aaron Fenyes
25fa108e9b AddRemove: add low-curvature test assembly from inversive-display 2024-09-28 19:37:43 -07:00
Aaron Fenyes
7977b11caf AddRemove: switch between pre-made test assemblies 2024-09-28 18:56:33 -07:00
Aaron Fenyes
1c9fec36e5 Display: make scene change flag track element list 2024-09-28 18:51:28 -07:00
Aaron Fenyes
721a8716d4 Assembly: don't track element list when inserting
Calling `try_insert_element` or `insert_new_element` in a responsive
context shouldn't make the context track `elements_by_id`.
2024-09-28 18:49:17 -07:00
Aaron Fenyes
4f8f36053f App: use general test assembly from inversive-display
This moves us toward dropping the separate display prototype.
2024-09-28 14:18:04 -07:00
Aaron Fenyes
28b1ecb8e9 App: use element insertion method in test 2024-09-28 13:29:09 -07:00
Aaron Fenyes
b08dbd6f93 Assembly: factor out element insertion 2024-09-28 13:27:03 -07:00
Aaron Fenyes
bd0982f821 AddRemove: make a button that adds elements
In the process, switch selection storage back to `FxHashSet`, reverting
commit b3afd6f.
2024-09-27 14:33:49 -07:00
Aaron Fenyes
2444649dd1 AddRemove: underscore unused event variables 2024-09-26 19:17:57 -07:00
Aaron Fenyes
b3afd6f555 App: Store selection in BTreeSet
Since we're using `BTreeSet` for element constraint sets now, we might
as well use it for the selection set too. This removes the `rustc-hash`
dependency.
2024-09-26 19:16:41 -07:00
Aaron Fenyes
9b39fe56b8 Outline: include constraints in element diff key
This tells Sycamore that the outline view of an element should update
when the element's constraint set has changed. To make the constraint
set hashable, so we can include it in the diff key, we store it as a
`BTreeSet` instead of an `FxHashSet`.
2024-09-26 19:10:34 -07:00
Aaron Fenyes
f5486fb0dd AddRemove: make a button that adds constraints 2024-09-26 15:02:51 -07:00
Aaron Fenyes
4e3c86fb71 Ignore profiling folders 2024-09-26 13:23:56 -07:00
Aaron Fenyes
7ff1b9cb65 App: rename directory 2024-09-26 13:22:48 -07:00
Aaron Fenyes
e6281cdcc6 Display: shrink canvas to 600px
This makes profiling more comparable with `inversive-display`.
2024-09-25 14:48:58 -07:00
Aaron Fenyes
fc85d15f83 Outline: show constraint details 2024-09-23 00:39:14 -07:00
Aaron Fenyes
7709c61f71 Outline: spruce up styling
Use `details` elements to hide and show constraints.
2024-09-22 23:55:07 -07:00
Aaron Fenyes
edee153e37 App: remove unused import 2024-09-22 23:50:16 -07:00
Aaron Fenyes
4a24a01928 App: insert constraints consistently
Also, write constructors for state objects.
2024-09-22 14:40:31 -07:00
Aaron Fenyes
050e2373a6 App: store constraints
Draft listing of constraints in outline view.
2024-09-22 14:05:40 -07:00
Aaron Fenyes
147e275823 App: don't bother copying key into element
When we access an element, we always have its key, either because the
slab iterator yielded it along side the element or because we used it to
get the element from the slab.
2024-09-22 02:38:17 -07:00
Aaron Fenyes
d121385c18 App: store assembly elements in slab 2024-09-22 02:21:45 -07:00
Aaron Fenyes
78f8ef8215 Outline: switch to single selection 2024-09-19 17:53:07 -07:00
Aaron Fenyes
96f8b6b5f3 App: store selection in hash map
Switch `Assembly.elements` to a hash map too, since that's probably
closer to what we'll want in the future.
2024-09-19 16:08:55 -07:00
Aaron Fenyes
96afad0c97 Display: highlight selected elements 2024-09-16 15:46:45 -07:00
Aaron Fenyes
a60624884a App: add element selection 2024-09-16 11:29:44 -07:00
Aaron Fenyes
93190e99da Display: bring in keyboard navigation code 2024-09-15 11:54:39 -07:00
Aaron Fenyes
e2d3af2867 Display: say "assembly" instead of "construction"
Update variable names and comments in code from the display prototype.
2024-09-15 11:41:16 -07:00
Aaron Fenyes
7cb01bab82 Ray-caster: drop outdated performance comment
The size of the internal fragment arrays is what really matters, as
discussed in the "Display" page on the wiki.
2024-09-15 11:38:32 -07:00
Aaron Fenyes
f47be08d98 Display: get the assembly from the app state 2024-09-15 11:31:22 -07:00
Aaron Fenyes
cd18d594e0 Display: bring in ray-casting code 2024-09-14 11:46:24 -07:00
Aaron Fenyes
49655a8d62 Ray-caster: remove debug code
Remove GPU code and uniforms that were used as scaffolding during
initial development, but have now been replaced by CPU analogues.
2024-09-14 10:58:46 -07:00
Aaron Fenyes
959e4cc8b5 App: pass app state into outline as context 2024-09-13 15:15:55 -07:00
Aaron Fenyes
49170671b4 App: add display canvas 2024-09-13 14:53:12 -07:00
Aaron Fenyes
0c2869d3f3 Outline: improve code formatting 2024-09-13 00:43:19 -07:00
Aaron Fenyes
e6d1e0b865 Outline: encapsulate assembly data 2024-09-13 00:40:34 -07:00
Aaron Fenyes
d481181ef8 Outline: sort elements by ID 2024-09-13 00:07:49 -07:00
Aaron Fenyes
20b96a9764 Outline: switch from "Editor" to "App" 2024-09-12 22:39:21 -07:00
Aaron Fenyes
634e97b659 Outline: switch to user-facing ID 2024-09-12 22:36:54 -07:00
Aaron Fenyes
336b940471 Outline: start on editor state and outline view 2024-09-12 15:24:41 -07:00
Aaron Fenyes
d3c9a08d22 Add zoom to keyboard controls 2024-09-10 04:08:49 -07:00
Aaron Fenyes
aceac5e5c4 Add roll to keyboard controls 2024-09-10 03:14:33 -07:00
Aaron Fenyes
20d072d615 Combine key-down and key-up handlers 2024-09-10 02:29:50 -07:00
Aaron Fenyes
c67f37c934 Implement keyboard navigation 2024-09-09 19:41:15 -07:00
Aaron Fenyes
2efc08d6c0 Enable focus for tabs and display
You can now switch tabs from the keyboard using the usual radio button
interaction.
2024-09-09 02:15:04 -07:00
Aaron Fenyes
69ab888d5b Simplify control labeling 2024-09-09 00:32:29 -07:00
Aaron Fenyes
0173b63e19 Add picture plane to circles in triangle 2024-09-08 23:43:26 -07:00
Aaron Fenyes
b289d2d4c3 Distinguish odd layer counts in debug mode
The low-curvature construction admits odd layer counts.
2024-09-08 23:31:48 -07:00
Aaron Fenyes
163361184b Ray-caster: avoid roundoff error in quadratic equation 2024-09-08 23:00:28 -07:00
Aaron Fenyes
ab830b194e Use circles in triangle as low-curvature construction
In the process, add a way to build a sphere by offset and curvature.
2024-09-06 19:01:18 -07:00
Aaron Fenyes
3493a798d1 Add low-curvature construction
Also add infrastructure for switching between constructions.
2024-09-04 16:27:28 -07:00
Aaron Fenyes
121934c4c3 Encapsulate construction 2024-09-04 12:58:55 -07:00
Aaron Fenyes
a4236a34df Ray-caster: dim the interior layers of spheres
This seems to weaken the intersection disk illusion.
2024-09-02 15:15:18 -07:00
Aaron Fenyes
f148552964 Ray-caster: only draw the top few fragments
This seems to increase graphics pipe use from 50--60% to 55--65%.
2024-08-29 15:01:38 -07:00
Aaron Fenyes
6db9f5be6c Enlarge the test construction to six spheres
In debug mode, assign most of the color scale to even layer counts. Odd
layer counts are topologically prohibited, so we should rarely see bugs
severe enough to produce them.
2024-08-28 17:14:55 -07:00
Aaron Fenyes
3a721a4cc8 Ray-caster: enlarge the construction data uniforms
No noticeable effect on GPU performance.
2024-08-28 16:06:33 -07:00
Aaron Fenyes
8fde202911 Ray-caster: drop unused depth-pair array
This doesn't affect GPU performance noticeably, so benchmarks before and
after the change should be comparable.
2024-08-28 15:52:19 -07:00
Aaron Fenyes
4afc82034b Ray-caster: sort fragments while shading 2024-08-28 14:37:29 -07:00
Aaron Fenyes
e80adf831d Ray-caster: correct hit detection 2024-08-28 01:59:46 -07:00
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