3D Basics
451
Determining whether anti-aliasing is supported
Not all 3D renderers can perform the additional calculations that anti-aliasing requires. If
you have a 3D sprite that you want to anti-alias, check first that the 3D renderer supports
anti-aliasing. The renderers that currently support anti-aliasing include the Director software
renderer, and DirectX 5.2 and DirectX 7.0.
If the 3D sprite is in channel 1 of the Score, you would test the
antiAliasingSupported
property of sprite 1, as shown in the following example:
if sprite(1).antiAliasingSupported = TRUE then
Turning on anti-aliasing
If the
antiAliasingSupported
property is
TRUE
, you can turn on anti-aliasing for the 3D sprite
by setting the sprite’s
antiAliasingEnabled
property to
TRUE
.
sprite(1).antiAliasingEnabled = TRUE
For example, if you have a 3D sprite in channel 5 and you want to turn on anti-aliasing for the
sprite when it first appears on the Stage, you would write a
beginSprite
script and attach it to
the sprite. Your script should contain Lingo as shown in the following example:
on beginSprite
-- check whether anti-aliasing is supported by the current 3D renderer
if sprite(5).antiAliasingSupported = TRUE then
-- if it is, turn on anti-aliasing for the sprite
sprite(5).antiAliasingEnabled = TRUE
end if
end beginSprite
Turning off anti-aliasing
If you plan to animate any part of a 3D sprite, you might want to turn anti-aliasing off
temporarily to improve the animation performance. To do this, set the
antiAliasingEnabled
property for the sprite to
FALSE
. You can then set it back to
TRUE
when the animation is
complete.
It is a good idea to turn anti-aliasing on and off on separate handlers. For example, you might
want to animate a model, camera, or light while the mouse button is held down and stop the
animation when the mouse button is released. In that case you would turn off anti-aliasing in a
mouseDown
handler and turn it back on in a
mouseUp
handler, as shown in the following example:
on mouseDown
-- user interaction/animation is about to start so turn
-- anti-aliasing OFF
sprite(1).antiAliasingEnabled = FALSE
-- start animation
end
on mouseUp
-- stop animation
-- the interaction/animation has ended so turn
-- anti-aliasing ON
sprite(1).antiAliasingEnabled = TRUE
end
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...