Mercurial > hg > Game > Cerium
annotate Renderer/Engine/main.cc @ 1127:c4287bf771a0 draft
CreatePolygonFromSceneGraph can work on Mac OSX.
author | Yutaka_Kinjyo |
---|---|
date | Sun, 13 Feb 2011 23:27:22 +0900 |
parents | 19bfb73617ad |
children |
rev | line source |
---|---|
539 | 1 #include "TaskManager.h" |
2 #include "viewer.h" | |
3 #include "viewerSDL.h" | |
4 #include "viewerFB.h" | |
922 | 5 #include "viewerGL.h" |
981
fdb36a9c5030
add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
944
diff
changeset
|
6 #include "viewerPS3.h" |
1111 | 7 #include "viewerNONE.h" |
541
1a31b8820a4d
Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
539
diff
changeset
|
8 #include "Application.h" |
539 | 9 |
10 /* prototype */ | |
556 | 11 extern int init(TaskManager *manager, int argc, char *argv[]); |
539 | 12 |
13 extern void task_initialize(); | |
541
1a31b8820a4d
Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
539
diff
changeset
|
14 extern Application *application(); |
556 | 15 extern int init(TaskManager *manager, int argc, char *argv[]); |
539 | 16 |
556 | 17 // 大域変数は禁止 |
539 | 18 //static Viewer *screen; |
19 | |
556 | 20 /* |
539 | 21 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n\ |
22 -cpu Number of SPE (default 1)\n\ | |
895
b662e9dd26b0
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
728
diff
changeset
|
23 -width, -height window size (default 640x480), -bpp bits per pixcel\n\ |
b662e9dd26b0
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
728
diff
changeset
|
24 -video {sdl|fb} in case of frame buffer, width,height,bpp is automatically set\n\ |
b662e9dd26b0
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
728
diff
changeset
|
25 \n"; |
556 | 26 */ |
539 | 27 |
28 int | |
29 init(TaskManager *manager, int argc, char *argv[]) | |
30 { | |
31 int bpp = 32; | |
32 int width = 640; | |
33 int height = 480; | |
34 int spenum = 1; | |
35 video_type vtype = VTYPE_SDL; | |
36 | |
914 | 37 int mem_flag = 0; |
925
292bb8c79cdb
add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
38 int profile = 0; |
914 | 39 |
539 | 40 for(int i = 1; argv[i]; ++i) |
41 { | |
42 if (strcmp(argv[i], "-bpp") == 0) { | |
43 bpp = atoi(argv[++i]); | |
44 } | |
45 if (strcmp(argv[i], "-width") == 0) { | |
46 width = atoi(argv[++i]); | |
47 } | |
48 if (strcmp(argv[i], "-height") == 0) { | |
49 height = atoi(argv[++i]); | |
50 } | |
51 if (strcmp(argv[i], "-cpu") == 0) { | |
52 spenum = atoi(argv[++i]); | |
53 } | |
925
292bb8c79cdb
add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
54 if (strcmp(argv[i], "-p") == 0) { |
1117 | 55 profile = 1; |
56 } | |
539 | 57 if (strcmp(argv[i], "-video") == 0) { |
58 if (strcmp(argv[i+1], "sdl") == 0) { | |
59 vtype = VTYPE_SDL; | |
60 } else if (strcmp(argv[i+1], "fb") == 0) { | |
61 vtype = VTYPE_FB; | |
922 | 62 } else if (strcmp(argv[i+1], "gl") == 0) { |
63 vtype = VTYPE_GL; | |
981
fdb36a9c5030
add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
944
diff
changeset
|
64 } else if (strcmp(argv[i+1], "ps3") == 0) { |
fdb36a9c5030
add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
944
diff
changeset
|
65 vtype = VTYPE_PS3; |
985 | 66 } else if (strcmp(argv[i+1], "sdl") == 0) { |
67 vtype = VTYPE_SDL; | |
1111 | 68 } else if (strcmp(argv[i+1], "none") == 0) { |
69 vtype = VTYPE_NONE; | |
539 | 70 } |
71 i++; | |
72 } | |
914 | 73 if (strcmp(argv[i], "-mem") == 0) { |
74 mem_flag = 1; | |
75 } | |
539 | 76 } |
77 | |
78 Viewer *screen; | |
79 if (vtype == VTYPE_SDL) { | |
728 | 80 ViewerDevice *dev = new ViewerSDL(manager); |
81 screen = new Viewer(manager, dev, bpp, width, height, spenum); | |
539 | 82 } else if (vtype == VTYPE_FB) { |
728 | 83 ViewerDevice *dev = new ViewerFB(manager); |
84 screen = new Viewer(manager, dev, bpp, width, height, spenum); | |
922 | 85 } else if (vtype == VTYPE_GL) { |
944 | 86 screen = new ViewerGL(manager, bpp, width, height, spenum); |
981
fdb36a9c5030
add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
944
diff
changeset
|
87 } else if (vtype == VTYPE_PS3) { |
fdb36a9c5030
add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
944
diff
changeset
|
88 ViewerDevice *dev = new ViewerPS3(); |
fdb36a9c5030
add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
944
diff
changeset
|
89 screen = new Viewer(manager, dev, bpp, width, height, spenum); |
1111 | 90 } else if (vtype == VTYPE_NONE) { |
91 ViewerDevice *dev = new ViewerNONE(manager); | |
92 screen = new Viewer(manager, dev, bpp, width, height, spenum); | |
922 | 93 } else { |
728 | 94 ViewerDevice *dev = new ViewerSDL(manager); |
95 screen = new Viewer(manager, dev, bpp, width, height, spenum); | |
1117 | 96 } |
914 | 97 screen->mem_flag = mem_flag; |
1117 | 98 screen->profile = profile; |
541
1a31b8820a4d
Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
539
diff
changeset
|
99 screen->run_init(manager, application()); |
539 | 100 |
101 return 0; | |
102 } | |
103 | |
556 | 104 #if 0 |
606
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
105 |
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
106 // These are defined in Application |
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
107 |
539 | 108 int |
109 TMmain(TaskManager *manager, int argc, char *argv[]) | |
110 { | |
111 task_initialize(); | |
556 | 112 manager->set_TMend(TMend); |
539 | 113 return init(manager, argc, argv); |
114 | |
115 } | |
116 | |
117 void | |
118 TMend(TaskManager *manager) | |
119 { | |
120 } | |
556 | 121 |
122 #endif | |
606
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
123 |
242a9db53612
32bit/64bit ABI (64 bit is not tested yet).
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
556
diff
changeset
|
124 /* end */ |