summaryrefslogtreecommitdiff
path: root/fobjects-internal.h
blob: 8eeab7dd2fbda35242a9497fc270086103f75714 (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
#include <math.h>

#include <compiz-core.h>
#include "fobjects_options.h"

#define GET_SNOW_DISPLAY(d)                            \
    ((FObjectsDisplay *) (d)->base.privates[displayPrivateIndex].ptr)

#define SNOW_DISPLAY(d)                                \
    FObjectsDisplay *sd = GET_SNOW_DISPLAY (d)

#define GET_SNOW_SCREEN(s, sd)                         \
    ((FObjectsScreen *) (s)->base.privates[(sd)->screenPrivateIndex].ptr)

#define SNOW_SCREEN(s)                                 \
    FObjectsScreen *ss = GET_SNOW_SCREEN (s, GET_SNOW_DISPLAY (s->display))

static int displayPrivateIndex = 0;

/* -------------------  STRUCTS ----------------------------- */
typedef struct _FObjectsDisplay
{
    int screenPrivateIndex;

    Bool useTextures;

    int             fobjectsTexNFiles;
    CompOptionValue *fobjectsTexFiles;
} FObjectsDisplay;

typedef struct _FObjectsTexture
{
    CompTexture tex;

    unsigned int width;
    unsigned int height;

    Bool   loaded;
    GLuint dList;
} FObjectsTexture;

typedef struct _FObjectsObject
{
    float x, y, z;
    float xs, ys, zs;
    float ra; /* rotation angle */
    float rs; /* rotation speed */

    FObjectsTexture *tex;
} FObjectsObject;

typedef struct _FObjectsScreen
{
    CompScreen *s;

    Bool active;

    CompTimeoutHandle timeoutHandle;

    PaintOutputProc paintOutput;
    DrawWindowProc  drawWindow;

    FObjectsTexture *fobjectsTex;
    int         fobjectsTexturesLoaded;

    GLuint displayList;
    Bool   displayListNeedsUpdate;

    FObjectsObject *allObjects;
} FObjectsScreen;

/* some forward declarations */
static void initiateFObjectsObject (FObjectsScreen * ss, FObjectsObject * sf);
static void fobjectsMove (CompDisplay *d, FObjectsObject * sf);