annotate Renderer/Engine/viewer.h @ 747:18d31d18a6b2 draft

TaskManager changeset 683, Renderer changeset 746
author hiroki
date Mon, 25 Jan 2010 18:01:19 +0900
parents 7761ebf9c62a
children 4d83a6a958fd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #ifndef INCLUDED_VIEWER
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #define INCLUDED_VIEWER
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
4 #include <SDL.h>
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
5
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
6 #include "viewer_types.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
7 #include "TaskManager.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
8 #include "KeyStat.h"
542
109a33b72b10 continue...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
9 #include "MainLoop.h"
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
10 #include "Application.h"
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
11 #include "SceneGraphRoot.h"
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
12 #include "ViewerDevice.h"
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
13
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
14 class SceneGraphRoot;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
15
543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
16 class Application;
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17
543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
18 class Viewer : public MainLoop {
542
109a33b72b10 continue...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
19
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 public:
542
109a33b72b10 continue...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
21
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
22 Viewer(TaskManager *manager, ViewerDevice *dev, int bpp, int width, int height, int spenum);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23
542
109a33b72b10 continue...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
24 virtual ~Viewer() {}
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
25 BASE_NEW_DELETE(Viewer);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
27 ViewerDevice *dev;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
28 Application *app;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
29
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
30 TaskManager *manager;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
31 key_stat *keyPtr;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
32 HTaskPtr draw_dummy;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
33
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
34 /* screen info */
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 int bpp;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
37 int rgb_size[3];
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 int spe_num;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
39 int width;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
40 int height;
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
41
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
42 //float light_xyz[4] __attribute__((aligned(16)));
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
43 float *light_xyz;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
44 float *light_xyz_stock;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
45
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
46
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47 Uint32 video_flags;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 Uint32 *pixels;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
50 SceneGraphRoot *sgroot;
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
51
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
52 //Uint32 *video_init(TaskManager *manager, int bpp, int width, int height);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 void init();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55 int get_ticks();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56 bool quit_check();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57 void quit();
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
58 HTaskPtr initLoop();
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
59
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
60 void clean_pixels() {}
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
61
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
62 void run_init(TaskManager *manager, Application *app);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
63 void run_loop(HTaskPtr task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
64 void run_draw(HTaskPtr task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
65 void run_finish();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
66 void run_move(HTaskPtr task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
67 void run_collision();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
68 void rendering(HTaskPtr task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
69 void common_draw(HTaskPtr task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
70 void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
71
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
72 void spe_rendering(HTaskPtr task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
73 void spe_draw(HTaskPtr task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 671
diff changeset
74 // void exchange_sgroot(TaskManager *manager);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
75
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
76 void getKey();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
77 void get_send_controll();
543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
78
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
79 // void createFromXMLfile(const char *file);
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
80 // SceneGraph *createSceneGraph(int id);
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
81 // SceneGraph *createSceneGraph();
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
82 // void setSceneData(SceneGraph *g);
544
dc59679d9a36 ball_bound worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 543
diff changeset
83 void mainLoop();
543
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 542
diff changeset
84
671
7761ebf9c62a fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 589
diff changeset
85 void createFromXMLmemory(SceneGraph * node, char *data, int len)
7761ebf9c62a fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 589
diff changeset
86 {
7761ebf9c62a fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 589
diff changeset
87 sgroot->createFromXMLmemory(manager, node, data, len);
7761ebf9c62a fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 589
diff changeset
88 }
7761ebf9c62a fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 589
diff changeset
89
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
90 void createFromXMLfile(const char *file)
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
91 {
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
92 sgroot->createFromXMLfile(manager, file);
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
93 }
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
94
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
95 SceneGraph * createSceneGraph(int id)
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
96 {
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
97 return sgroot->createSceneGraph(id);
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
98 }
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
99
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
100 SceneGraph * createSceneGraph(const char *id)
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
101 {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
102 return sgroot->createSceneGraph(id);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
103 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
104
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
105 int getSgid(const char *id)
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
106 {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
107 return sgroot->getSgid(id);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
108 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
109
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
110 SceneGraph * createSceneGraph()
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
111 {
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
112 return sgroot->createSceneGraph();
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
113 }
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
114
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
115 void setSceneData(SceneGraph *g)
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
116 {
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
117 sgroot->setSceneData(g);
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
118 }
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
119
589
e112f38275d5 add viwer.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
120 int getLast()
e112f38275d5 add viwer.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
121 {
e112f38275d5 add viwer.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
122 return sgroot->getLast();
e112f38275d5 add viwer.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
123 }
e112f38275d5 add viwer.cc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
124
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
125 };
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
126
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
127 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
128
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
129
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
130 #endif
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
131