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