Overview
As discussed in the previous article, we saw how Orbit Camera is implemented.
Details
The purpose of Lesson12 is to demonstrate using Orbit Camera.
System class diagram
The scene class overrides camera with an instance of OrbitCamera.
Implementation
Scene
The functionality is implemented in the Scene class derived from BaseScene class.
It creates an instance of WFObjParser which parses the "Solar system" OBJ files and generates instances of MeshInfo objects, MaterialInfo objects, TextureInfo Objects.
Each MeshInfo is associated with a MaterialInfo and 1 TextureInfo Object along with Vertex data. Each MeshInfo is represented by an instance of GenericObj instance.
The Init method creates an instance of OrbitCamera and populates 3D objects of the Solar system
The DrawScene method draws a string and image.
The message handler for IDOK is called when Apply button is pressed after updates are made in the input dialog. It refreshes the display.
The message handler for IDCANCEL is called when in Cancel button is pressed the input dialog. It calls
OnCloseWindow to destroy window.
Finally the WM_CLOSE event is handled in OnCloseWindow function and the window is destroyed and application is shutdown when the window is closed or Escape key is pressed.
Application
Scene class is hosted main.cpp. which creates the scene object and displays it. Message pump is added to process windows messages.
Output
The output looks as shown in the top.
No comments:
Post a Comment