Mercurial > hg > Game > Cerium
comparison Renderer/Engine/spe/univers_move.cc @ 766:3541fe06be2b draft
add spe/univers_move
author | hiroki@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Sat, 13 Feb 2010 17:33:38 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
763:4cc05c023ff9 | 766:3541fe06be2b |
---|---|
1 #include <stdio.h> | |
2 #include <string.h> | |
3 #include <math.h> | |
4 #include "universe_move.h" | |
5 #include "Func.h" | |
6 #include "types.h" | |
7 | |
8 /* これは必須 */ | |
9 SchedDefineTask(UniversTask); | |
10 | |
11 typedef struct { | |
12 float xyz[3]; | |
13 float angle[3]; | |
14 float stack_xyz[3]; | |
15 SceneGraphPtr parent; | |
16 SceneGraphPtr children; | |
17 int property_index; | |
18 int parent_index; | |
19 SceneGraphPtr sg; | |
20 const char *name; | |
21 } *PropertyPtr, Property; | |
22 | |
23 static int | |
24 run(SchedTask *s,void *rbuf, void *wbuf) | |
25 { | |
26 PropertyPtr property = (PropertyPtr)s->get_input(rbuf, 0); | |
27 PropertyPtr update_property = (PropertyPtr)s->get_output(wbuf, 0); | |
28 | |
29 property[0]->angle[1] += 1.0f; | |
30 if (property[0]->angle[1] > 360.0f) { | |
31 property[0]->angle[1] = 0.0f; | |
32 } | |
33 | |
34 property[0]->xyz[0] += property[0]->stack_xyz[0]; | |
35 if ((int)property[0]->xyz[0] > screen_w || (int)property[0]->xyz[0] < 0) { | |
36 property[0]->stack_xyz[0] = -property[0]->stack_xyz[0]; | |
37 } | |
38 | |
39 property[0]->xyz[1] += property[0]->stack_xyz[1]; | |
40 if ((int)property[0]->xyz[1] > screen_h || (int)property[0]->xyz[1] < 0) { | |
41 property[0]->stack_xyz[1] = -property[0]->stack_xyz[1]; | |
42 } | |
43 | |
44 memcpy((void*)update_property, (void*)property, sizeof(Property)*2); | |
45 | |
46 return 0; | |
47 } |