Graphics Reference
In-Depth Information
class UWB _ WindowHandler : public UWB _ IWindowHandler {
// copy camera settings
Source file.
uwbgl _ WindowHandler5.h/cpp
files in the Common Files/
WindowHandler
A: virtual void SetCamera( const UWB _ Camera &c);
// Get a reference of the camera
virtual UWB _ Camera& GetCamera();
// Transforms a DC point to WC
B: virtual void DeviceToWorld(...) const ;
// Compute and load the VIEW matrix processor
virtual void LoadViewXform() const =0;
// Compute and load the PROJECTION matrix processor
virtual void LoadProjectionXform() const =0;
protected :
.
// An instance of the camera object
C: UWB _ Camera
subfolder
UWBGL _ D3D _ Lib14
of
the
project.
m _ Camera;
};
// This is the uwbgl _ WindowHandler5.cpp source file.
.
void UWB _ WindowHandler::SetCamera( const UWB _ Camera &c) { m _ Camera = c; }
UWB _ Camera& UWB _ WindowHandler::GetCamera() { return m _ Camera; }
.
Listing 15.7. The UWB _ WindowHandler class of Lib14.
implementation of camera support functions. Listing 15.8 shows the implemen-
tation details of the UWBD3D _ WindowHandler class, our D3D-specific subclass
of the UWB _ WindowHandler class. The main responsibilities of this class are to
compute/load the view/projection matrices (labels A and B) and support inverse
transformation from DC to WC space (label C).
View matrix (label A). The LoadViewXform() function computes the view
matrix viewMat (at label A1) and loads this matrix into the VIEW matrix
processor (at label A2). The viewMat is computed by the ComputeView
Matrix() function, where at label A1a we access the camera parameters
(defined in the UWB _ WindowHandler superclass) and at label A1b we call
the D3DXMatrixLookAtRH() function to compute the actual matrix. No-
tice that we are calling the exact same function as that of label B1 in List-
ing 14.4. In this case, we have abstracted the exact same functionality into
Search WWH ::




Custom Search