view TaskManager/Test/test_render/node.cpp @ 137:91c74dbc32e4 draft

SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Fri, 28 Nov 2008 10:07:48 +0900
parents
children f35504025f73
line wrap: on
line source

#include "SceneGraph.h"
#include "xml_file/universe.h"
#include "xml_file/cube.h"


static void
earth_move(SceneGraphPtr node)
{
    node->xyz[0] += 3;
    node->xyz[1] += 3;
}

static void
moon_move(SceneGraphPtr node)
{
}

static void
earth_collision(SceneGraphPtr node, SceneGraphPtr tree)
{
}

static void
moon_collision(SceneGraphPtr node, SceneGraphPtr tree)
{
}

static void
cube_move(SceneGraphPtr node)
{
    static float dest_x = 0.3f;
    static float dest_y = 0.5f;

    node->angle[1] += 1.0f;
    if (node->angle[1] > 360.0f) {
	node->angle[1] = 0.0f;
    }

    node->xyz[0] += dest_x;
    node->xyz[1] += dest_y;
}

static void
cube_collision(SceneGraphPtr node, SceneGraphPtr tree)
{
}

void
node_init(void)
{
#if 1
    scene_graph->set_move_collision(Earth, earth_move, earth_collision);
    scene_graph->set_move_collision(Moon, moon_move, moon_collision);
#else
    scene_graph->set_move_collision(Cube, cube_move, cube_collision);
#endif
}