-
Notifications
You must be signed in to change notification settings - Fork 9
/
camera3d.h
75 lines (56 loc) · 2.04 KB
/
camera3d.h
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
#ifndef PHP_RAYLIB_CAMERA3D_H
#define PHP_RAYLIB_CAMERA3D_H
#include "include/hashmap.h"
#include "vector3.h"
extern zend_class_entry * php_raylib_camera3d_ce;
// External Free Objects - Prevent Circular Dependency
extern void php_raylib_vector3_free_storage(zend_object *object);
extern void php_raylib_camera3d_free_storage(zend_object * object);
extern zend_object * php_raylib_camera3d_new(zend_class_entry * ce);
extern zend_object * php_raylib_camera3d_new_ex(zend_class_entry *ce, zend_object *orig);
extern zend_object_handlers php_raylib_camera3d_object_handlers;
typedef enum {
RL_CAMERA3D_IS_POINTER,
RL_CAMERA3D_IS_VALUE
} RLCamera3DDataType;
typedef union {
Camera3D *p;
Camera3D v;
} Camera3DUnion;
struct RL_Camera3D {
unsigned int id;
char *guid;
Camera3DUnion data;
RLCamera3DDataType type;
unsigned refCount;
unsigned char deleted;
};
static struct RL_Camera3D **RL_Camera3D_Object_List;
static hashmap *RL_Camera3D_Object_Map;
char* RL_Camera3D_Hash_Id(char *str, size_t size);
struct RL_Camera3D* RL_Camera3D_Create();
void RL_Camera3D_Delete(struct RL_Camera3D* object, int index);
void RL_Camera3D_Free(struct RL_Camera3D* object);
typedef struct _php_raylib_camera3d_object {
struct RL_Camera3D *camera3d;
HashTable *prop_handler;
zval position;
zval target;
zval up;
zend_object std;
} php_raylib_camera3d_object;
static inline php_raylib_camera3d_object *php_raylib_camera3d_fetch_object(zend_object *obj) {
return (php_raylib_camera3d_object *)((char *)obj - XtOffsetOf(php_raylib_camera3d_object, std));
}
static inline Camera3D *php_raylib_camera3d_fetch_data(php_raylib_camera3d_object *obj) {
Camera3D *my_camera3d;
if (obj->camera3d->type == RL_CAMERA3D_IS_POINTER) {
my_camera3d = obj->camera3d->data.p;
} else {
my_camera3d = &obj->camera3d->data.v;
}
return my_camera3d;
}
#define Z_CAMERA3D_OBJ_P(zv) php_raylib_camera3d_fetch_object(Z_OBJ_P(zv));
void php_raylib_camera3d_startup(INIT_FUNC_ARGS);
#endif //PHP_RAYLIB_CAMERA3D_H