77 lines
2.6 KiB
HTML
77 lines
2.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Going to 3D mode</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
|
|
<!--START-->
|
|
|
|
<h3>Going to 3D mode</h3>
|
|
|
|
If you want to use 3D mode you first need to set <i>Game Maker</i> in 3D mode. You can later
|
|
switch back to 2D mode if you want. The following two functions exist for this.
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>d3d_start()</b></tt>
|
|
Start using 3D mode. Returns whether successful.<br>
|
|
<tt><b>d3d_end()</b></tt>
|
|
Stop using 3D mode. Returns whether successful.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
Note that all functions related to 3D mode start with <tt>d3d_</tt>.
|
|
|
|
<p>
|
|
Starting 3D mode will result in the following changes. First of all hidden surface removal
|
|
is switched on (using a 16-bit z-buffer). This means that for each pixel on the screen
|
|
only the drawing with the smallest z-value (= depth value) is drawn. If instances have the
|
|
same depth it is unclear what will happen and you can get ugly effects. Make sure instances
|
|
that might overlap do not have the same depth value!
|
|
|
|
<p>
|
|
Secondly, the normal orthographic projection is replaced by a perspective one. This means the
|
|
following. Normally the size of instances on the screen is independent on its depth. With a
|
|
perspective projection instances that have a greater depth will appear smaller. When the depth
|
|
is 0 it is equal to the old size (unless you change the projection; see below). The viewpoint
|
|
for the camera is placed at a distance above the room. (This distance is equal to the width
|
|
of the room; that gives a reasonable default projection.) Only instances in front of the camera
|
|
are drawn. So don't use instances with a depth smaller than 0 (or at least not smaller than -w
|
|
where w is the width of the room or the view).
|
|
|
|
<p>
|
|
Thirdly, the vertical y-coordinate is reversed. While normally the (0,0) position is at the top-left
|
|
of the view, in 3D mode the (0,0) position is at the bottom-left position, as is normal for
|
|
3-dimensional views.
|
|
|
|
<p>
|
|
You can actually switch hidden surface remove and perspective projection on or off using the
|
|
following functions.
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>d3d_set_hidden(enable)</b></tt>
|
|
Enables hidden surface removal (true) or disables it (false).<br>
|
|
<tt><b>d3d_set_perspective(enable)</b></tt>
|
|
Enables the use of a perspective projection (true) or disables it (false).<br>
|
|
</blockquote>
|
|
|
|
|
|
<!--END-->
|
|
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
hidden surface removal
|
|
z-buffer
|
|
|
|
d3d_start()
|
|
d3d_end()
|
|
d3d_set_hidden()
|
|
d3d_set_perspective()
|
|
|
|
--> |