官术网_书友最值得收藏!

  • WebGL Hotshot
  • Mitch Williams
  • 184字
  • 2021-07-16 11:43:28

Lights, camera, action!

"Lights, camera, action!" is an old Hollywood phrase to start filming, but it is just as applicable to interactive 3D graphics. So, let's add lights, cameras, and interactivity to our X3D scenes.

Lights, camera, action!

Engage thrusters

This scene retains the first two objects created previously and adds a point light that can be thought of as a light bulb—a light from a single point emanating in all directions. We turned off the headlight inside the <NavigationInfo> tag, and at the same time, restricted movement in the scene by setting type to NONE, simply to introduce this as part of the demo. At the same time, the <Viewpoint> tag or camera is introduced with its default position value, orientation (rotation) value, and fieldOfView value that defaults to π/4, that is, 0.785 radians. The added code is as follows:

<Scene>
    <NavigationInfo headlight="FALSE" type='"NONE"'/>
    <PointLight location="0 3 2"/>
    <Viewpoint position="0 0 10" orientation="0 0 1 0"
        fieldOfView=".785"/>
    <Transform …>

The point light is 3 units up and 2 units in front, so it clearly shines on the top of the box and to the left-hand side of the cone but not on the left-hand side of the box or the bottom of the cylinder.

主站蜘蛛池模板: 德州市| 景东| 宜宾市| 南汇区| 东光县| 恩平市| 邮箱| 鄄城县| 合水县| 肇州县| 巨野县| 定安县| 灵台县| 铁岭市| 新乡县| 扶沟县| 资阳市| 和平区| 兴业县| 屏山县| 陆河县| 柞水县| 朔州市| 宁国市| 无棣县| 无棣县| 芜湖市| 寿阳县| 开阳县| 杨浦区| 土默特右旗| 嘉义县| 张北县| 沙河市| 武山县| 钟山县| 天镇县| 高雄县| 新建县| 尚志市| 河西区|