109
|
1 #include <stdio.h>
|
|
2 #include <string.h>
|
|
3 #include <unistd.h>
|
|
4 #include <math.h>
|
|
5 #include "scene_graph_pack.h"
|
|
6 #include "sys.h"
|
|
7 #include "update_sgp.hpp"
|
|
8
|
|
9 SchedDefineTask(Update_SGP);
|
|
10
|
|
11 int
|
|
12 Update_SGP::run(void *rbuf, void *wbuf)
|
|
13 {
|
|
14 SceneGraphNodePtr node;
|
|
15 SceneGraphPack *sgp = (SceneGraphPack*)get_input(rbuf, 0);
|
|
16 SceneGraphPack *_sgp = (SceneGraphPack*)get_output(wbuf, 0);
|
|
17 int screen_width = get_param(0);
|
|
18 int screen_height = get_param(1);
|
|
19
|
|
20 // ϤǤʤ
|
|
21 for (int i = 0; i < sgp->info.size && i < 3; i++) {
|
|
22 node = &sgp->node[i];
|
|
23
|
|
24 do {
|
|
25 if (node->pn != -1) {
|
|
26 get_matrix(node->translation,
|
|
27 node->angle, node->obj_pos,
|
|
28 sgp->node[node->pn].translation);
|
|
29 } else {
|
|
30 get_matrix(node->translation,
|
|
31 node->angle, node->obj_pos,
|
|
32 NULL);
|
|
33 }
|
|
34
|
|
35 node = node->next;
|
|
36 } while (node);
|
|
37 }
|
|
38
|
|
39 memcpy(_sgp, sgp, sizeof(SceneGraphPack));
|
|
40
|
|
41 return 0;
|
|
42 }
|