aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libraries/love.h
blob: 81acf5766407a7820c4f89f41a566a9eb5be932c (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifndef _LOVE_H_
#define _LOVE_H_



/*

What do we need as an internal world object format?

Can't call it Things, that's taken already.

"Stuffs" works though.  B-)

Love server needs to manage in world stuffs, and send changes to everyone.

Extantz needs to manage what's shown in world, and edit that stuffs.

Combining the data structures seems sane.  Letting the love server
define those data structures also seems sane, hence this file.


Extantz needs -
  what it looks like (Evas_3D stuff)
    "link sets"
      what is attached to what
    mesh
      vertices, triangles, ...
      local position and orientation relative to parent
    material
      textures
      colours, including alpha
    light
      shade mode
  where it is
    position, orientation
  animation stuff


common
  UUID
  name & description
  owner
  position, orientation
  "link sets"


love needs
  UUID
  name & description
  owner
  position, orientation
  "link sets"
    LL used a list of prims, we can do better I'm sure.
      Though for the sake of this experimental version, just use an array of stuffs.
  contents
    scripts, cards, other stuffs, animations, sounds, textures, ...
    content types

*/


/* Stuffs is a single "primitive" object, it can be -
  single mesh object - NOTE: Should include a list of materials.
    LL style prim, including tree, defined as a small bunch of data defining the type and parameters
    LL style mesh "file"
    single mesh file, collada, other mesh format
    height field, for land, or water
  LuaSL script
  "notecard", just a text file, with no limits
  animation, BVH, Alice's BVJ, or perhaps any other animation file format
  sounds, MP3, other sound formats
  textures, PNG, JPEG, JPEG2000, TIFF, GIF, other texture formats
  other LL stuff
    landmark
    clothing
    body part, shape, skin, hair, or eyes
    gesture
    calling card
*/

#include "evas_macros.h"
#include "evas_3d_utils.h"	// TODO - Hopefully I can convince the authors to make this public.

#include "Runnr.h"


typedef struct _vec4
{
  float   x;
  float   y;
  float   z;
  float   w;
} vec4;

typedef struct _vec3
{
  float   x;
  float   y;
  float   z;
} vec3;

typedef struct _vec2
{
  float   x;
  float   y;
} vec2;


typedef struct _material
{
  int	face;
  //type?
  char	texture[PATH_MAX];
  //colour
  //alpha
  //other stuff
} Material;

typedef struct _mesh
{
  char		fileName[PATH_MAX];
  //type
  vec3		pos;
  vec4		rot;
  Eina_Inarray	materials;	// Material
  Eina_Inarray	parts;		// Mesh
} Mesh;

typedef struct _stuffs
{
  char UUID[32], *name, *description, owner[32];
  //type
  union
  {
    Mesh	*mesh;
    script	*scrip;	// Not a typo, C++ is fussy about reusing names like this.
    void	*other;
  } details;
} Stuffs;


typedef struct _loveStuffs
{
  Stuffs	stuffs;
  Eina_Inarray	contents;	// Stuffs
} LoveStuffs;

typedef struct _extantzStuffs
{
  Stuffs	stuffs;
//  Evas_3D_Mesh	*mesh;
//  Evas_3D_Node	*mesh_node;	// Multiple Evas_3D_Mesh's can be in one Evas_3D_Node
  Eina_Inarray	*materials;	// Evas_3D_Material
  Eina_Inarray	*textures;	// Evas_3D_Texture
} ExtantzStuffs;


/* Data flow

love server starts up
  scans sim disk structure looking for scripts in stuffs
    keep track of which script is in which stuffs
    -> LuaSL compile script
    -> LuaSL load this saved state
    -> LuaSL run script

Extantz client starts up
  -> love login(name, password)
          loads user details
  <- love this is your user uuid
  get sim details from lspace at this URL (or local disk directory file://)
  -> lspace gimme the sim (or just pick up the index.omg file from disk)
  <- lspace index.omg
  figure out which mesh stuffs to load
    -> lspace gimme(uuid) (or load it from disk)
    <- lspace uuid.omg
    figure out which mesh and texture files to load
      -> lspace gimme this mesh file (or load it from disk)
      <- lspace mesh file
      -> lspace gimme this texture file (or load it from disk)
      <- lspace texture file

  user clicks on in world stuffs
    -> love touched(user uuid, stuffs.uuid)
            looks up stuffs, loops through scripts
            -> LuaSL script.uuid.touch_start() and the detected stuff

  user edits stuffs in world
    -> love get contents(stuffs.uuid)
            loads stuffs.omg from disk
            loads stuffs.index.omg
    <- love here's the list of contents Stuffs
    -> love change this bit
            changes that bit and stores on disk
            send update nails commands to everyone/thing watching
*/

#endif