Graphics Reference
In-Depth Information
The following classes are modified to support lighting computation and a cus-
tom
.x
mesh:
•
UWB
_
Primitive
.
As shown on the left of Figure C.19, all primitives now
have an instance of
UWB
_
Material
, which serves as the parameter to the
lighting computation.
•
UWBD3D
_
PrimitiveMesh
.
Modified to include accessors to change the
first submesh's material. When lighting is enabled, the first submesh of
a
.x
mesh file will be drawn based on the material attribute defined in the
Primitive
class.
•
UWB
_
DrawHelper
.
As shown on the left of Figure C.19, this class now has
an instance of
UWB
_
Material
to properly support the lighting attribute of
the
UWB
_
Primitive
class.
•
UWBD3D
_
DrawHelper
.
Modified to allow per-vertex normal specification
and to support lighting computation. Together with the material, this infor-
mation is forwarded to D3D to support Phong illumination computation.
UWBD3D_PointLight
UWBD3D_Light
UWB_Material
#m_bLightIsOn : bool
#m_bDrawLight : bool
#m_LightID : int
#m_d3dLight : D3DLIGHT9
#DrawLightGeometry ()
+UWBD3D_PointLight ()
+~UWBD3D_PointLight ()
-m_Diffuse : UWB_Color
-m_Ambient : UWB_Color
-m_Specular : UWB_Color
-m_Emissive : UWB_Color
-m_Power : float
UWBD3D_DirectionalLight
+UWBD3D_Light (in id : int)
+~UWBD3D_Light()
+DrawLight ()
+GetLightType () : D3DLIGHTTYPE
+SetPosition()
+SetPosition()
+GetPosition()
+SetDirection()
+SetDirection()
+GetDirection()
+SwitchOnLight ()
+SwitchOffLight()
+LightIsSwitchedOn() : bool
+EnableDrawLight ()
+DisableDrawLight ()
+ShouldDrawLight () : bool
+SetLightToDevice()
#DrawLightGeometry ()
#SetToSpotLight ()
#SetToPointLight ()
#SetToDirectionalLight ()
+UWB_Material ()
+SetPower(in s : float)
+GetPower() : float
#DrawLightGeometry ()()
+UWBD3D_DirectionalLight ()
+~UWBD3D_DirectionalLight ()
UWBD3D_SpotLight
+UWBD3D_SpotLight (in id : int)
+~UWBD3D_SpotLight()
1
1
UWB_Primitive
-+on changes are shown
--...
#m _Material : UWB_Material
UWB_DrawHelpe
-+ only changes area shown
--...
#m_Material : UWB_Material
+EnableLighting (in on : bool )
+IsLightingEnabled () : bool
+GetMaterial () : UWB_Material
+SetMaterial()
+SetMaterial ()
+EnableBlending ()
Figure C.19.
UWBGL
_
D3D
_
Lib18
:
UWBD3D
_
Light
hierarchy and
UWB
_
Material
class.
Search WWH ::
Custom Search