annotate Renderer/Engine/viewer_types.h @ 981:a193a851b5e3

add double buffering frame device
author root@henri.cr.ie.u-ryukyu.ac.jp
date Thu, 30 Sep 2010 23:54:08 +0900
parents 655e11f6e437
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #ifndef INCLUDED_VIEWER_TYPES
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #define INCLUDED_VIEWER_TYPES
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
4 // texture は 8x8 に分割
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
5 // この値は、SpanPack にも使う
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
6 const int TEXTURE_SPLIT_PIXEL = 8;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
7 const int TEXTURE_BLOCK_SIZE = TEXTURE_SPLIT_PIXEL*TEXTURE_SPLIT_PIXEL;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
8
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
9 // 一個の SPE が描画担当する width, height (pixel)
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
10 const int split_screen_w = 256;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
11 const int split_screen_h = 8;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
12
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
13 enum video_type {
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
14 VTYPE_SDL,
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
15 VTYPE_FB,
981
a193a851b5e3 add double buffering frame device
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 922
diff changeset
16 VTYPE_PS3,
922
655e11f6e437 moving OpenGL mode now!
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 918
diff changeset
17 VTYPE_GL
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18 };
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 #if defined(__LITTLE_ENDIAN__)
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 const int redMask = 0x0000ff00;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 const int greenMask = 0x00ff0000;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 const int blueMask = 0xff000000;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
24 const int alphaMask = 0x000000ff;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25 #else
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26 const int redMask = 0x00ff0000;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
27 const int greenMask = 0x0000ff00;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
28 const int blueMask = 0x000000ff;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 const int alphaMask = 0xff000000;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30 #endif
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31
918
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
32 static inline int
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
33 getLocalPosition(int d, int offset)
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
34 {
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
35 /**
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
36 * offset が 2 の冪乗の時だけ使える。
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
37 * 現在は offset は 2 の冪乗のみなので
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
38 * これで問題ないけどどうなの?
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
39 */
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
40 return d & (offset-1);
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
41
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
42 // offset が 2 の冪乗以外はこれにしないとだめ
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
43 //return d % offset;
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
44 }
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
45
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
46 /**
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
47 * ワールド座標における x の値を
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
48 * split_screen_w で分割した領域(1 〜 split_screen_w)での座標に変換する
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
49 * (ex. split_screen_w が 256 の場合、
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
50 * x = 1 -> 1
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
51 * x = 256 -> 256
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
52 * x = 257 -> 1
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
53 */
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
54 static inline int
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
55 getLocalX(int x)
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
56 {
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
57 return getLocalPosition(x, split_screen_w);
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
58 }
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
59
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
60 /**
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
61 * getLocalX に同じ
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
62 */
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
63 static inline int
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
64 getLocalY(int y)
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
65 {
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
66 return getLocalPosition(y, split_screen_h);
49b3c753e209 add loadelf in tmp/old.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
67 }
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
68
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
69 #endif