![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Cutting Edge Direct 3D Programming
Direct3DRMTextureWrap: The Texture Wrap InterfaceA texture wrap is an object that describes a manner in which a texture can be applied to a mesh. Texture wraps control the wrap style (flat, cylindrical, spherical), the wrap orientation, and texture settings such as scale and origin. A texture wrap is created using the settings mentioned and applied to a meshbuilder or mesh object. Texture wraps determine how the texture is to be applied to each face. This saves a significant amount of work because a mesh might have thousands of faces. Texture wraps are represented by the Direct3DRMTextureWrap interface and are created with the Direct3DRM CreateWrap() member function. Direct3DRMMaterial: The Material InterfaceMaterials determine the behavior of light on faces and meshes. An object can be made to appear shiny, dull, or even appear as if it were emitting light by applying different materials. Instances of the Direct3DRMMaterial interface can be created with the Direct3DRM CreateMaterial() member function. The Material interface allows the adjustment of three settings, specular light power, specular light color, and emissive light color. The resulting material can then be assigned to faces, meshbuilders, and meshes. Specular Light PowerSpecular light is the light that reflects off an object and produces specular highlights. The behavior of specular highlights influences the appearance of an object. Small, bright highlights make an object appear shiny. Larger highlights give objects a plastic appearance. Little or no highlights make objects appear dull. The behavior of specular highlights can be controlled with the specular power setting. Small values produce large specular highlights, and large values produce small highlights. The Material interface provides GetPower() and SetPower() member functions to control this setting. Specular Light ColorThe color of the specular highlights can also be adjusted. By default, specular highlights are white. The highlight color can be adjusted with the GetSpecular() and SetSpecular() member functions. Emissive Light ColorEmissive light is light that emanates from the object itself. Emissive light is useful for representing light sources such as lamps or neon lights. By default, objects have no emissive light (an emissive light color of black). The emissive light color is controlled with the GetEmissive() and SetEmissive() member functions.
Direct3DRMLight: The Light InterfaceDirect3D supports five different types of lights: ambient, point, directional, parallel, and spotlight. The only setting shared by all of the light types is color. Every light type supported by Direct3D can be assigned locations and orientations, but some light types ignore the settings. Lights are represented by the Direct3DRMLight interface and are created with the Direct3DRM CreateLight() and CreateLightRGB() member functions. Both functions require that you specify the color and the type of light, although these settings can be changed at any time. Light sources get their location and orientation from frames, so they must be attached to a frame before they can be used in a scene. The Direct3DRMFrame interface provides an AddLight() member function for attaching lights to frames. Ambient LightsAmbient lights are the easiest lights to use because they have only one setting: color. While ambient lights must be attached to a frame before they can become part of a scene, they ignore the frames location and orientation. For this reason, ambient lights can be attached to any frame in a scene. A scene can have any number of ambient lights. The resulting ambient light level is the sum of the ambient light settings. For example, adding three ambient lights to a scene where the lights are colored red, green, and blue respectively is the same as adding a single white ambient light. Point LightsPoint lights emit light in all directions, so their orientation is meaningless. Their location, on the other hand, determines where the light emanates from. Directional LightsA directional light is the opposite of a point light. Directional lights have orientation but no location. Directional lights produce parallel light rays, so they have no location from where the light originates. The parallel rays of a directional light point in the direction indicated by the frame to which the light is attached. Directional lights offer better performance than point lights and are useful for simulating distant light sources. Parallel LightsThe parallel light type is a variation on directional lights. Parallel lights also produce parallel light rays, but instead of casting light in only one direction, parallel light case light in two opposite directions. Both orientation and location affect parallel lights. The orientation determines the two directions in which light is cast, and the lights location determines the plane from which the light is generated. SpotlightsSpotlights produce light in the shape of a cone. Spotlights use a frames location to determine the origin of the light (the tip of the cone) and a frames orientation to determine the direction of the light. The light that a spotlight produces is described with two angles: the umbra and penumbra angles. The umbra angle defines a cone in which the light is at full intensity. The penumbra angle defines a larger cone that determines where the light ends. The light level in the area between the two cones varies depending on its proximity, gradually changing from the spotlights color to black (no light). The umbra and penumbra angles can be adjusted with the SetUmbra() and SetPenumbra() Direct3DRMLight member functions.
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |