summaryrefslogtreecommitdiff
path: root/src/lib/ecore_psl1ght/moveutil.h
blob: bb4b22c09d9e94be8201dd95a6927cb4f2428720 (plain) (blame)
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
/*
 * Copyright (C) Antonio José Ramos Márquez (bigboss)
 * Copyright (C) Youness Alaoui (KaKaRoTo)
 */

#ifndef __MOVEUTIL_H__
#define __MOVEUTIL_H__

#include <ppu-types.h>
#include <spurs/spurs.h>
#include <io/camera.h>
#include <io/move.h>

typedef struct
{
   Spurs         *spurs;
   cameraInfoEx   camInfo;
   cameraReadInfo camRead;
   gemState       state;
} moveContext;

static inline float
vec_array(vec_float4 vec, unsigned int idx)
{
   union {
      vec_float4 vec;
      float      array[4];
   } v;

   v.vec = vec;

   if (idx > 3)
     return -1;
   return v.array[idx];
}

moveContext *initMove();
void         endMove(moveContext *context);
void         readGemState(moveContext *context);
int          processMove(moveContext *context);
void         moveGet3DPosition(moveContext *context, float *x, float *y, float *z);

#endif /* __MOVEUTIL_H__ */