3D projection of the floor / road
In Wolf'2004 no sex, and existing
on ZX races although he is, but dishonest
(According to him you can not drive across the highway and
the opposite direction). This floor must be
get perspective projection on the
screen images (trace) is sufficiently large
of size.
Newart>
The game window is, say, 160 pixels, half of the window is
projected onto the landscape, the length of it, probably before
projection factor of 3 higher than seen in screen after the
projection. Explain how you propose to do without rotation ...
Alone Coder>
Rotation would be, but in the process of transfer
graphics chunkmap. Ie 2 pass:
1. rotate;
2. output chunks.
Newart>
A projection will be during the withdrawal
chanok?
Alone Coder>
Projection during rotation.
Let the height of the land = 80 pixels (40
chunks). The distance at which conclusions can be seen
dimye horizontal lines relate to each
other as 40/40, 40/39, 40/38, etc,
The latter line - 40 / 1. Assume that the map
has a size of, well, at least 256x512 pixels.
Let the 4 most rear line of land can not be seen
(Gray), and we see a distance of no more than
1 / 3 card (depending on the height of the observer).
Then, when a chunk 2x4 on the most neighbors is
niyah be distinguishable pixel texture, but
they receive no more than 2 chunks
if I'm not cheated. Ie Very ter pimo ...
Within each horizontal line is equivalent to
wound, we are moving in texture evenly
equal increments. Before the withdrawal line
only need to calculate it at the top of the tex
tour and a motion vector in texture (and then, and
Both can be figured out by the tables).
Mathematics there is nothing in itself is not Chairman
tionally.
Denote the coordinates of the player through x0,
y0, and its angle - through a. Conditionally
define the z axis from the middle of the screen down
scale - whatever.
Then the distance on the map to the point to
toruyu to withdraw in the middle of the horizontal
z, is equal to: d (z) = k1 / z, where k1 - a coefficient
coefficient (it depends on the height of a player over
surface).
Coordinates of the point on a map if they
measured from the coordinates of the player are:
cx (z, a) = d (z) * cos (a); cy (z, a) = d (z) * sin (a).
Step, which we pass card
drawing a horizontal line z, is: step (z) = k2 / z,
where k2 - some other factor (the ratio
of k1/k2 defines a rectangular "elongated
nutost "image).
Components of this step, the x and y are:
stepx (z, a) = step (z) * sin (a);
stepy (z, a) =- step (z) * cos (a).
Then it is clear that the left point of our Does
Institute of z on the map will have the coordinates:
leftx (z, a) = cx (z)-width * stepx (z, a);
lefty (z, a) = cy (z)-width * stepy (z, a).
That is, instead of mathematics can be
just a table of values stepx, stepy, leftx,
lefty size 36 * 64 (the remaining 192 of the angle a
can be reduced to these 64 simple corners of
replacements coordinates and change their signs). Poes
Kolka, these numbers are 16-bit, then the table Zai
met 18 kilobytes (can be expanded in countries
prone - a special rate is not needed). A
all calculations on the fly will be reduced to simple
addition to adding coordinates of the player (x0, y0)
to read coordinates from a table.
Importantly - the partition maps "znakomes
ta "(tiles). We assume that the tile is
1916 (Y) * 8 (X) texels (texture elements,
pixels). They will be stored at the addresses
% 0110yyyyxxxttttt, where yyyy, xxxx - coordinates within the
tile, ttttt - number of the tile. Then the map will be 16 * 128
= 2048 (Y) 8 * 256 = = 2048 (X).
Projection is a chankovy buffer
(Then it will be possible to impose the sprites).
width = 24; CHRS
(DUP width)
ADD IX, DE; Y
EXX
ADD HL, BC; X
LD E, H; X
LD D, HX; Y
(Set 7, d); not to zashkal.za map
LD A, (DE); room tile, standing in the
; This place cards
XOR L; ml.bayt X (inside the tile)
AND # 1F
XOR L; A =% xxxttttt
EXX
LD L, A
LD A, LX; ml.bayt Y (within the tile)
RRA
SCF
RRA
SCF
RRA
OR A
RRA; A =% 0110yyyy
LD H, A; HL = address of a texel tile
LD B, (HL); color chunk
, And again:
ADD IX, DE; Y
EXX
ADD HL, BC; X
LD E, H; X
LD D, HX; Y
(Set 7, d); not to zashkal.za map
LD A, (DE); room tile, standing in the
; This place cards
XOR L; ml.bayt X (inside the tile)
AND # 1F
XOR L; A =% xxxttttt
EXX
LD L, A
LD A, LX; ml.bayt Y (within the tile)
RRA
SCF
RRA
SCF
RRA
OR A
RRA; A =% 0110yyyy
LD H, A; HL = address of a texel tile
LD C, (HL); color chunk
PUSH BC; put two chunks in chankmep
(EDUP)
The accuracy of calculations = 1 / 8 texels.
Conclusion chunks on the screen:
(DUP width)
POP HL; colors of the two chunks:
;% 1111aaa1,% 1111bbb1
LD A, (HL)
LD (BC), A
LDD; DE = BC +256 (or vice versa)
(EDUP)
You can rotate the output chunks with proetsi
the fore after each line of the picture -
but then no sprites on ekrane.Hotya can
bring them cleverly, too, on line.
Size chankmepa (including the upper half
guilt, where the card is not drawn):
48 (2 * width) * 80 (hgt) = 3840.
No memory left, so you can ISPO
lzovat 2 nd screen, and can reduce the map
the Y twice (to the size of pages) -
add SET 6, D. In fact, these SET -
a matter of taste, you can simply give the player
approaching the border of the map.
A. Coder