' settings ---------------------------------
map_pic_c = 8 'how many maps available ?
map_pic$(0) = "need/physical-world-map.jpg": mp_t$(0) = "earth"
map_pic$(1) = "need/outline-world-map.jpg": mp_t$(1) = "earth"
map_pic$(2) = "need/map_hd.bmp": mp_t$(2) = "earth"
map_pic$(3) = "need/geological-world-map.jpg": mp_t$(3) = "earth"
map_pic$(4) = "need/continental-world-map.jpg": mp_t$(4) = "earth"
map_pic$(5) = "need/moon_map_mercator.jpg": mp_t$(5) = "moon"
map_pic$(6) = "need/mars_map.jpg": mp_t$(6) = "mars"
map_pic$(7) = "need/squares.bmp": mp_t$(7) = ""
da = 70 'resolution 360/da degree horisontal
db = 70 'resolution 360/db degree vertical
zoom_xy = 100
zoom_distance = 50
stepping = .08
msenx = .05
msenz = .05
max_couch = 70
'pre ---------------------------------------
fnt
= _LOADFONT("need/cyberbit.ttf", monx
/ 50)pip180
= _PI / 180: points
= da
* db: sqs
= points
DIM points
(points
- 1, 9), sq
(sqs
- 1, 7, map_pic_c
- 1), cam
(9), me
(19)
'creating 3d points
FOR da2
= 0 TO da
- 1: dega
= 360 / (da
- 1) * da2
* pip180:
FOR db2
= 0 TO db
- 1: degb
= 180 / (db
- 1) * db2
* pip180
ap
= da2
* db
+ db2: points
(ap
, 0) = SIN(degb
) * COS(dega
): points
(ap
, 1) = SIN(degb
) * SIN(dega
): points
(ap
, 2) = COS(degb
):
NEXT db2
, da2
'creating squares
FOR map
= 0 TO map_pic_c
- 1:
FOR da2
= 0 TO da
- 2:
FOR db2
= 0 TO db
- 2: sqa
= da2
* db
+ db2
'actual square sq(sqa, 0, map) = sqa: sq(sqa, 1, map) = sq(sqa, 0, map) + 1: sq(sqa, 2, map) = sq(sqa, 0, map) + db: sq(sqa, 3, map) = sq(sqa, 2, map) + 1 '3d points ser
sq
(sqa
, 4, map
) = _WIDTH(wmap
(map
)) - (_WIDTH(wmap
(map
)) / (da
- 1) * da2
) - 1 sq
(sqa
, 5, map
) = _WIDTH(wmap
(map
)) - (_WIDTH(wmap
(map
)) / (da
- 1) * (da2
+ 1)) - 1 sq
(sqa
, 6, map
) = INT(_HEIGHT(wmap
(map
)) / (db
- 1) * db2
): sq
(sqa
, 7, map
) = INT(_HEIGHT(wmap
(map
)) / (db
- 1) * (db2
+ 1))
me(0) = -1.31: me(1) = .575: me(2) = 1.5: me(10) = 1.94: me(11) = 2.05 'start position
'boss cycle -----------------------------------------------
'control
elt_xy
= SIN(elt2
* pip180
) * elt1: elt_z
= COS(elt2
* pip180
) * elt1
szog_xy_elt
= -90 * ABS(ka
) + 90 * ABS(kd
): szog_xy
= me
(10) + (szog_xy_elt
+ elt_xy
) * pip180: szog_z
= me
(11) + pip180
* (90 + elt_z
) irx
= -SIN(szog_xy
) * COS(szog_z
): iry
= -COS(szog_xy
) * COS(szog_z
): irz
= SIN(szog_z
): ir
= et_ir: multi
= stepping
* ir
* pre_calc
* 2 multi = stepping * ir / max_couch * (max_couch - elt1): me(0) = me(0) + irx * multi: me(1) = me(1) + iry * multi
me
(2) = me
(2) + irz
* multi:
END IF:
NEXT elt2
, elt1
'mousex = 0: mousey = 0
me(11) = me(11) + mousey / 7 * msenz
me
(11) = me
(11) - 2 * _PI * ABS(me
(11) > 2 * _PI): me
(11) = me
(11) + 2 * _PI * ABS(me
(11) < 0): inv_me10
= 1:
IF me
(11) < _PI THEN inv_me10
= -1 me(10) = me(10) + mousex / 5 * msenx * inv_me10
'calculating points
cam
(0) = me
(0) - SIN(me
(10) - 180 * pip180
) * me
(3) / 2: cam
(1) = me
(1) - COS(me
(10) - 180 * pip180
) * me
(3) / 2 cam
(2) = me
(2) + me
(5) / 4: cam
(3) = me
(10): cam
(4) = me
(11): cosrotz
= COS(cam
(3)): sinrotz
= SIN(cam
(3)): cosrotx
= COS(cam
(4)): sinrotx
= SIN(cam
(4)) FOR actual_point
= 0 TO points
- 1 px = points(actual_point, 0) - cam(0): py = points(actual_point, 1) - cam(1): pz2 = points(actual_point, 2) - cam(2)
px3 = px * cosrotz - py * sinrotz: py2 = px * sinrotz + py * cosrotz: py3 = py2 * cosrotx - pz2 * sinrotx: pz3 = py2 * sinrotx + pz2 * cosrotx
points(actual_point, 4) = -px3 * zoom_xy: points(actual_point, 5) = -py3 * zoom_xy: points(actual_point, 6) = -pz3 * zoom_distance
'draw
wx0 = points(sq(asq, 0, act_map), 4): wy0 = points(sq(asq, 0, act_map), 5): wz0 = points(sq(asq, 0, act_map), 6)
wx1 = points(sq(asq, 1, act_map), 4): wy1 = points(sq(asq, 1, act_map), 5): wz1 = points(sq(asq, 1, act_map), 6)
wx2 = points(sq(asq, 2, act_map), 4): wy2 = points(sq(asq, 2, act_map), 5): wz2 = points(sq(asq, 2, act_map), 6)
wx3 = points(sq(asq, 3, act_map), 4): wy3 = points(sq(asq, 3, act_map), 5): wz3 = points(sq(asq, 3, act_map), 6)
sy0 = sq(asq, 6, act_map): sx0 = sq(asq, 4, act_map): sy1 = sq(asq, 7, act_map): sx1 = sq(asq, 4, act_map)
sy2 = sq(asq, 6, act_map): sx2 = sq(asq, 5, act_map): sy3 = sq(asq, 7, act_map): sx3 = sq(asq, 5, act_map)
_MAPTRIANGLE (sx0
, sy0
)-(sx1
, sy1
)-(sx2
, sy2
), wmap
(act_map
) TO(wx0
, wy0
, wz0
)-(wx1
, wy1
, wz1
)-(wx2
, wy2
, wz2
), , _SMOOTH _MAPTRIANGLE (sx3
, sy3
)-(sx1
, sy1
)-(sx2
, sy2
), wmap
(act_map
) TO(wx3
, wy3
, wz3
)-(wx1
, wy1
, wz1
)-(wx2
, wy2
, wz2
), , _SMOOTH
'view
_PRINTSTRING (0, 0), "MOVING:WASD+mouse NEXT MAP:space key " distance
= SQR(me
(0) * me
(0) + me
(1) * me
(1) + me
(2) * me
(2)): diam
= 0 CASE "earth": diam
= 12742 distance_km = -(1 - distance) * diam / 2