view Renderer/Engine/task/update_sgp.cc @ 639:70c5c2d2eb24

fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 19 Nov 2009 18:45:24 +0900
parents 735f76483bb2
children
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include "scene_graph_pack.h"
#include "sys.h"
#include "update_sgp.h"

SchedDefineTask(Update_SGP);

static int
run(SchedTask *s,void *rbuf, void *wbuf)
{
    SceneGraphNodePtr node;
    SceneGraphPack *sgp  = (SceneGraphPack*)s->get_input(rbuf, 0);
    SceneGraphPack *_sgp = (SceneGraphPack*)s->get_output(wbuf, 0);
    //int screen_width = get_param(0);
    //int screen_height = get_param(1);

    // 本当はここでやるもんじゃないんだが。。。
    for (int i = 0; i < sgp->info.size && i < 3; i++) {
	node = &sgp->node[i];

	do {
	    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);
	    }

	    node = node->next;
	} while (node);
    }

    memcpy(_sgp, sgp, sizeof(SceneGraphPack));
  
    return 0;
}