Graphics Reference
In-Depth Information
class UWBD3D _ WindowHandler : public UWB _ WindowHandler {
public :
A: virtual void LoadViewXform() const ;
B: virtual void LoadProjectionXform() const ;
C: virtual void DeviceToWorld( int dcX, int dcY, vec3 & wcPt, vec3 & wcRay) const ;
.
};
void UWBD3D _ WindowHandler::LoadViewXform() const {
Source file.
uwbgl _ D3DWindowHandler6.h/cpp
files in the D3D Files/ Win-
dowHandler subfolder of the
UWBGL _ D3D _ Lib14 project.
A1: ComputeViewMatrix(viewMat);
A2: m _ pD3DDevice->SetTransform(D3DTS _ VIEW, &viewMat);
}
void UWBD3D _ WindowHandler::ComputeViewMatrix( D3DXMATRIX &mat) const {
A1a: m _ Camera.GetCameraPosition(p.x, p.y, p.z); // m _ Camera is an instance variable
m _ Camera.GetCameraLookAt(a.x, a.y, a.z); // defined in the super class: UWB _ WindowHandler
m _ Camera.GetCameraUpVector(u.x, u.y, u.z);
A1b: D3DXMatrixLookAtRH( &mat, &p, &a, &u );
A1c: // now factor in camera rotations ... details to be discussed in Tutorial 15.3
}
void UWBD3D _ WindowHandler::LoadProjectionXform() const {
B1: ComputeProjectionMatrix(projMat);
B2: m _ pD3DDevice->SetTransform(D3DTS _ PROJECTION, &projMat);
}
void UWBD3D _ WindowHandler::ComputeProjectionMatrix( D3DXMATRIX &mat) const {
B1a: m _ Camera.GetViewVolumeFOVInRadian(v); // m _ Camera is an instance of UWB _ Camera class
m _ Camera.GetViewVolumeNearPlane(n);
// defined in the super class: UWB _ WindowHandler
m _ Camera.GetViewVolumeFarPlane(f);
B1b: D3DXMatrixPerspectiveFovRH(&mat, v, GetAspectRatio(), n, f);
}
void UWBD3D _ WindowHandler::DeviceToWorld( int dcX, int dcY, vec3 & wcPt, vec3 & wcRay) const {
C1: // details to be discussed in Tutorial 15.4
}
Listing 15.8. The UWBD3D _ WindowHandler class of Lib14.
Search WWH ::




Custom Search