-
Notifications
You must be signed in to change notification settings - Fork 0
/
DESIGN
38 lines (31 loc) · 1.27 KB
/
DESIGN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# TODO
Diffuse lighting:
* Modify structs to contain normal vectors -- fruit
* Migrate main program loop to Racket -- brain
* Update vboify to convert normal vectors as well
* Check order of vertices in each face in example.plum
## Input/Output
Input:
* Error code
Output (Racket -> C):
* struct Mesh -- when user loaded .plum file for the first time
e.g. (draw-mesh c-mesh)
* Mesh changeset (delta)
## Sending mesh data from Racket to C
There are two ways:
* Flatten Racket mesh into a giant array and send to C
+ May introduce less bugs
- Inefficient in converting list to vector and back and forth:
- Homemade vector-flatten and vector-apply are inefficient
- vector-append might be expensive (and list append without a doubt)
- list->pointer conversion function only receives list; mesh is vector
- Have to send C the whole changeset of VBO array, which is bulky
(since C is not aware of Mesh data anymore)
* Convert Racket mesh into C struct and flatten it there
+ Expected to be faster
+ More uniform code, since the C struct is the only ring of connection
between Racket and C
+ Only have to send idiomatic changeset (eg. move 11th vector by delta-vector)
which is cheap and cool
- May introduce more bugs
- Have to fiddle with list lengths