comparison Renderer/Engine/viewer_types.cc @ 507:735f76483bb2

Reorganization..
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 12 Oct 2009 09:39:35 +0900
parents
children 49b3c753e209
comparison
equal deleted inserted replaced
506:1d4a8a86f26b 507:735f76483bb2
1 #include "viewer_types.h"
2
3 static int
4 getLocalPosition(int d, int offset)
5 {
6 /**
7 * offset が 2 の冪乗の時だけ使える。
8 * 現在は offset は 2 の冪乗のみなので
9 * これで問題ないけどどうなの?
10 */
11 return d & (offset-1);
12
13 // offset が 2 の冪乗以外はこれにしないとだめ
14 //return d % offset;
15 }
16
17 /**
18 * ワールド座標における x の値を
19 * split_screen_w で分割した領域(1 〜 split_screen_w)での座標に変換する
20 * (ex. split_screen_w が 256 の場合、
21 * x = 1 -> 1
22 * x = 256 -> 256
23 * x = 257 -> 1
24 */
25 int
26 getLocalX(int x)
27 {
28 return getLocalPosition(x, split_screen_w);
29 }
30
31 /**
32 * getLocalX に同じ
33 */
34 int
35 getLocalY(int y)
36 {
37 return getLocalPosition(y, split_screen_h);
38 }