Difference between revisions of "Showview"

From EDukeWiki
Jump to navigation Jump to search
(New page: showview <x> <y> <z> <angle> <horiz> <sector> <scrn_x1> <scrn_y1> <scrn_x2> <scrn_y2> Displays on-screen the view from in-game coordinates (<x>,<y>,<z>), looking at angle <angle> and with...)
 
 
(13 intermediate revisions by 5 users not shown)
Line 1: Line 1:
showview <x> <y> <z> <angle> <horiz> <sector> <scrn_x1> <scrn_y1> <scrn_x2> <scrn_y2>
+
'''''showview''''' <x> <y> <z> <angle> <horiz> <sector> <scrn_x1> <scrn_y1> <scrn_x2> <scrn_y2><br/>
 +
'''''showviewunbiased''''' <x> <y> <z> <angle> <horiz> <sector> <scrn_x1> <scrn_y1> <scrn_x2> <scrn_y2>
  
Displays on-screen the view from in-game coordinates (<x>,<y>,<z>), looking at angle <angle> and with z-angle <horiz>, between screen coordinates (<scrn_x1>,<scrn_y1>) and (<scrn_x2>,<scrn_y2>).
+
Displays on-screen the view from in-game coordinates (<x>,<y>,<z>), looking at angle <angle> and with z-angle (up and down) <horiz>, between screen coordinates (<scrn_x1>,<scrn_y1>) and (<scrn_x2>,<scrn_y2>).
  
 
<sector> is the sector that contains the in-game coordinates.
 
<sector> is the sector that contains the in-game coordinates.
  
The on-screen coordinates can be in any shape; they do not have to be in the same x-y ratio as the screen resolution. However, different ratios can result in warping or graphical glitches in the view. The on-screen coordinates are in 320x200 scale.
+
The on-screen coordinates can be in any shape; they do not have to be in the same x-y ratio as the screen resolution. However, the aspect ratio at which the scene is drawn in the sub-viewport is unspecified and may differ between renderers and settings of ''r_usenewaspect''. (For example, different ratios may result in warping or graphical glitches in the view.)
 +
 
 +
Their permissible range is 0 to 319 for the screen x coordinate, and 0 to 199 for the screen y coordinate, both inclusive.
 +
 
 +
== Coordinates ==
 +
 
 +
These normalized coordinates are transformed to actual screen coordinates depending on the command used:
 +
 
 +
For '''''showview''''', the scaling biases them towards zero, so that the whole screen can never be covered in any other resolution than 320x200:
 +
real_scrn_x = round_towards_zero((<scrn_x>*xdim)/320)
 +
real_scrn_y = round_towards_zero((<scrn_y>*ydim)/200)
 +
 
 +
On the other hand, '''''showviewunbiased''''' transforms them such that the greatest permissible normalized value will be mapped to the greates actual screen coordinate:
 +
real_scrn_x = round_towards_zero((<scrn_x>*(xdim-1))/319)
 +
real_scrn_y = round_towards_zero((<scrn_y>*(ydim-1))/199)
 +
 
 +
The resulting coordinates are 0-based with the origin being the upper left corner and denote an inclusive range of pixels in the x or y direction in the classic renderer.
 +
 
 +
For example, the command
 +
'''''showview''''' x y z a h s  0 0  31 0
 +
draws the view in a one-pixel high line covering about one tenth of the screen length from the left, and
 +
'''''showview''''' x y z a h s  0 0  0 19
 +
a one-pixel wide line covering approximately one tenth of the height from above.
 +
 
 +
The command
 +
'''''showview''''' x y z a h s  0 0  0 0
 +
would use exactly the upper left pixel in the classic renderer.  (Polymost currently behaves differently, but this may be subject to change.)
  
 
Keep in mind when using this command that the game will have to completely redraw everything from the specified perspective, which can produce a sizeable framerate hit.
 
Keep in mind when using this command that the game will have to completely redraw everything from the specified perspective, which can produce a sizeable framerate hit.
  
This example will embed a small version of the player's view near the top left corner of the screen:
+
==Examples==
 +
The correct way of drawing to the whole screen is
 +
'''showviewunbiased''' x y z a h s '''''0 0 319 199'''''
  
<pre>
+
This will embed a small version of the player's view near the top left corner of the screen:
getplayer[THISACTOR].posx x
+
getplayer[THISACTOR].posx x
getplayer[THISACTOR].posy y
+
getplayer[THISACTOR].posy y
getplayer[THISACTOR].posz z
+
getplayer[THISACTOR].posz z
getplayer[THISACTOR].angle ang
+
getplayer[THISACTOR].ang ang
getplayer[THISACTOR].horiz horiz
+
getplayer[THISACTOR].horiz horiz
getplayer[THISACTOR].horizoff temp
+
getplayer[THISACTOR].horizoff temp
addvarvar horiz temp
+
addvarvar horiz temp
updatesectorz x y z sect
+
updatesectorz x y z sect
showview x y z ang horiz sect 16 8 56 39
+
'''showviewunbiased''' x y z ang horiz sect 16 8 56 39
</pre>
 
  
[[Category:EDuke commands]]
+
[[Category:EDuke32 specific commands]]
 
[[Category:Screen drawing commands]]
 
[[Category:Screen drawing commands]]

Latest revision as of 02:17, 20 February 2020

showview <x> <y> <z> <angle> <horiz> <sector> <scrn_x1> <scrn_y1> <scrn_x2> <scrn_y2>
showviewunbiased <x> <y> <z> <angle> <horiz> <sector> <scrn_x1> <scrn_y1> <scrn_x2> <scrn_y2>

Displays on-screen the view from in-game coordinates (<x>,<y>,<z>), looking at angle <angle> and with z-angle (up and down) <horiz>, between screen coordinates (<scrn_x1>,<scrn_y1>) and (<scrn_x2>,<scrn_y2>).

<sector> is the sector that contains the in-game coordinates.

The on-screen coordinates can be in any shape; they do not have to be in the same x-y ratio as the screen resolution. However, the aspect ratio at which the scene is drawn in the sub-viewport is unspecified and may differ between renderers and settings of r_usenewaspect. (For example, different ratios may result in warping or graphical glitches in the view.)

Their permissible range is 0 to 319 for the screen x coordinate, and 0 to 199 for the screen y coordinate, both inclusive.

Coordinates

These normalized coordinates are transformed to actual screen coordinates depending on the command used:

For showview, the scaling biases them towards zero, so that the whole screen can never be covered in any other resolution than 320x200:

real_scrn_x = round_towards_zero((<scrn_x>*xdim)/320)
real_scrn_y = round_towards_zero((<scrn_y>*ydim)/200)

On the other hand, showviewunbiased transforms them such that the greatest permissible normalized value will be mapped to the greates actual screen coordinate:

real_scrn_x = round_towards_zero((<scrn_x>*(xdim-1))/319)
real_scrn_y = round_towards_zero((<scrn_y>*(ydim-1))/199)

The resulting coordinates are 0-based with the origin being the upper left corner and denote an inclusive range of pixels in the x or y direction in the classic renderer.

For example, the command

showview x y z a h s  0 0  31 0

draws the view in a one-pixel high line covering about one tenth of the screen length from the left, and

showview x y z a h s  0 0  0 19

a one-pixel wide line covering approximately one tenth of the height from above.

The command

showview x y z a h s  0 0  0 0

would use exactly the upper left pixel in the classic renderer. (Polymost currently behaves differently, but this may be subject to change.)

Keep in mind when using this command that the game will have to completely redraw everything from the specified perspective, which can produce a sizeable framerate hit.

Examples

The correct way of drawing to the whole screen is

showviewunbiased x y z a h s 0 0 319 199

This will embed a small version of the player's view near the top left corner of the screen:

getplayer[THISACTOR].posx x
getplayer[THISACTOR].posy y
getplayer[THISACTOR].posz z
getplayer[THISACTOR].ang ang
getplayer[THISACTOR].horiz horiz
getplayer[THISACTOR].horizoff temp
addvarvar horiz temp
updatesectorz x y z sect
showviewunbiased x y z ang horiz sect 16 8 56 39