Mercurial > hg > Members > kono > Cerium
comparison Renderer/test_render/viewer_types.cpp @ 283:55ea4465b1a2
fix test_render
author | e065746@localhost.localdomain |
---|---|
date | Fri, 05 Jun 2009 16:49:12 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
282:ef061be0baff | 283:55ea4465b1a2 |
---|---|
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 } |