diff options
author | David Walter Seikel | 2014-05-24 02:45:08 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-24 02:45:08 +1000 |
commit | 88862af74ee318a60fc4f9adc9e569724c2641c5 (patch) | |
tree | 3ab2caea4028f7e40887f570496a40e2c54da8a0 /src/love | |
parent | A tool for running valgrind on SledjHamr's bits. (diff) | |
download | SledjHamr-88862af74ee318a60fc4f9adc9e569724c2641c5.zip SledjHamr-88862af74ee318a60fc4f9adc9e569724c2641c5.tar.gz SledjHamr-88862af74ee318a60fc4f9adc9e569724c2641c5.tar.bz2 SledjHamr-88862af74ee318a60fc4f9adc9e569724c2641c5.tar.xz |
Ideas about how to deal with in world objects. Includes some entirely untested code bits.
Diffstat (limited to 'src/love')
-rw-r--r-- | src/love/love.h | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/src/love/love.h b/src/love/love.h new file mode 100644 index 0000000..223f43d --- /dev/null +++ b/src/love/love.h | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | |||
3 | What do we need as an internal world object format? | ||
4 | |||
5 | Can't call it Things, that's taken already. | ||
6 | |||
7 | "Stuffs" works though. B-) | ||
8 | |||
9 | Love server needs to manage in world stuffs, and send changes to everyone. | ||
10 | |||
11 | Extantz needs to manage what's shown in world, and edit that stuffs. | ||
12 | |||
13 | Combining the data structures seems sane. Letting the love server | ||
14 | define those data structures also seems sane, hence this file. | ||
15 | |||
16 | |||
17 | Extantz needs - | ||
18 | what it looks like (Evas_3D stuff) | ||
19 | "link sets" | ||
20 | what is attached to what | ||
21 | mesh | ||
22 | vertices, triangles, ... | ||
23 | local position and orientation relative to parent | ||
24 | material | ||
25 | textures | ||
26 | colours, including alpha | ||
27 | light | ||
28 | shade mode | ||
29 | where it is | ||
30 | position, orientation | ||
31 | animation stuff | ||
32 | |||
33 | |||
34 | common | ||
35 | UUID | ||
36 | name & description | ||
37 | owner | ||
38 | position, orientation | ||
39 | "link sets" | ||
40 | |||
41 | |||
42 | love needs | ||
43 | UUID | ||
44 | name & description | ||
45 | owner | ||
46 | position, orientation | ||
47 | "link sets" | ||
48 | LL used a list of prims, we can do better I'm sure. | ||
49 | Though for the sake of this experimental version, just use an array of stuffs. | ||
50 | contents | ||
51 | scripts, cards, other stuffs, animations, sounds, textures, ... | ||
52 | content types | ||
53 | |||
54 | */ | ||
55 | |||
56 | |||
57 | /* Stuffs is a single "primitive" object, it can be - | ||
58 | single mesh object - NOTE: Should include a list of materials. | ||
59 | LL style prim, including tree, defined as a small bunch of data defining the type and parameters | ||
60 | LL style mesh "file" | ||
61 | single mesh file, collada, other mesh format | ||
62 | height field, for land, or water | ||
63 | LuaSL script | ||
64 | "notecard", just a text file, with no limits | ||
65 | animation, BVH, Alice's BVJ, or perhaps any other animation file format | ||
66 | sounds, MP3, other sound formats | ||
67 | textures, PNG, JPEG, JPEG2000, TIFF, GIF, other texture formats | ||
68 | other LL stuff | ||
69 | landmark | ||
70 | clothing | ||
71 | body part, shape, skin, hair, or eyes | ||
72 | gesture | ||
73 | calling card | ||
74 | */ | ||
75 | |||
76 | typedef struct _material | ||
77 | { | ||
78 | int face; | ||
79 | //type? | ||
80 | char texture[PATH_MAX]; | ||
81 | //colour | ||
82 | //alpha | ||
83 | //other stuff | ||
84 | } Material; | ||
85 | |||
86 | typedef struct _mesh | ||
87 | { | ||
88 | char fileName[PATH_MAX]; | ||
89 | //type | ||
90 | Evas_Vec3 pos; | ||
91 | Evas_Vec4 rot; | ||
92 | Eina_Inarray materials; // Material | ||
93 | Eina_Inarray parts; // Mesh | ||
94 | } Mesh; | ||
95 | |||
96 | typedef struct _stuffs | ||
97 | { | ||
98 | char UUID[32], *name, *description, owner[32]; | ||
99 | //type | ||
100 | union | ||
101 | { | ||
102 | Mesh *mesh; | ||
103 | script *script; | ||
104 | void *other; | ||
105 | } details; | ||
106 | } Stuffs; | ||
107 | |||
108 | |||
109 | typedef struct _loveStuffs | ||
110 | { | ||
111 | Stuffs stuffs; | ||
112 | Eina_Inarray contents; // Stuffs | ||
113 | } LoveStuffs; | ||
114 | |||
115 | typedef struct _extantzStuffs | ||
116 | { | ||
117 | Stuffs stuffs; | ||
118 | Evas_3D_Mesh *mesh; | ||
119 | Evas_3D_Node *mesh_node; | ||
120 | Eina_Inarray *materials; // Evas_3D_Material | ||
121 | Eina_Inarray *textures; // Evas_3D_Texture | ||
122 | } ExtantzStuffs; | ||
123 | |||
124 | |||
125 | /* Data flow | ||
126 | |||
127 | love server starts up | ||
128 | scans sim disk structure looking for scripts in stuffs | ||
129 | keep track of which script is in which stuffs | ||
130 | -> LuaSL compile script | ||
131 | -> LuaSL load this saved state | ||
132 | -> LuaSL run script | ||
133 | |||
134 | Extantz client starts up | ||
135 | -> love login(name, password) | ||
136 | loads user details | ||
137 | <- love this is your user uuid | ||
138 | get sim details from lspace at this URL (or local disk directory file://) | ||
139 | -> lspace gimme the sim (or just pick up the index.omg file from disk) | ||
140 | <- lspace index.omg | ||
141 | figure out which mesh stuffs to load | ||
142 | -> lspace gimme(uuid) (or load it from disk) | ||
143 | <- lspace uuid.omg | ||
144 | figure out which mesh and texture files to load | ||
145 | -> lspace gimme this mesh file (or load it from disk) | ||
146 | <- lspace mesh file | ||
147 | -> lspace gimme this texture file (or load it from disk) | ||
148 | <- lspace texture file | ||
149 | |||
150 | user clicks on in world stuffs | ||
151 | -> love touched(user uuid, stuffs.uuid) | ||
152 | looks up stuffs, loops through scripts | ||
153 | -> LuaSL script.uuid.touch_start() and the detected stuff | ||
154 | |||
155 | user edits stuffs in world | ||
156 | -> love get contents(stuffs.uuid) | ||
157 | loads stuffs.omg from disk | ||
158 | loads stuffs.index.omg | ||
159 | <- love here's the list of contents Stuffs | ||
160 | -> love change this bit | ||
161 | changes that bit and stores on disk | ||
162 | send update nails commands to everyone/thing watching | ||
163 | */ | ||