Mercurial > hg > Game > Cerium
view old/simple_render/task/update_sgp.cpp @ 1740:5a294d8e5643 draft
fix
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 12 Nov 2013 16:56:43 +0900 |
parents | 3bc98f6d31ff |
children |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include <unistd.h> #include <math.h> #include "viewer.h" #include "scene_graph_pack.h" #include "sys.h" using namespace std; #include "error.h" int update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp) { SceneGraphNodePtr node; float y_angle; // 本当はここでやるもんじゃないんだが。。。 static float dest_x = 0.3f; static float dest_y = 0.5f; __debug("[%s]\n", __FUNCTION__); for (int i = 0; i < sgp->info.size; i++) { //(*my_func[node->move])(node); //(*my_func[node->interaction])(node, sgp); node = &sgp->node[i]; // 本当は、ここは上の my_func で行う y_angle = node->angle[1]; y_angle += 1.0f; if (y_angle > 360.0f) y_angle = 0.0f; node->angle[1] = y_angle; //node->obj_pos[0] += 0.5f; //node->obj_pos[1] += 0.5f; //node->obj_pos[2] += 0.5f; //node->obj_pos[0] += dest_x; node->obj_pos[0] = 360.0f; if ((int)node->obj_pos[0] > Viewer::width || (int)node->obj_pos[0] < 0) { dest_x = -dest_x; } node->obj_pos[1] += dest_y; if ((int)node->obj_pos[1] > Viewer::height || (int)node->obj_pos[1] < 0) { dest_y = -dest_y; } if (node->pn != -1) { get_matrix(node->translation, node->angle, node->obj_pos, sgp->node[node->pn].translation); } else { get_matrix(node->translation, node->angle, node->obj_pos, NULL); } } // まあこれは多分駄目なんだけど。 // in/out と update は分ける必要ある? // それはユーザ側で in/out になるように書かせるもの? memcpy(_sgp, sgp, sizeof(SceneGraphPack)); return sizeof(SceneGraphPack); //return 0; }