#include "dxstdafx.h"
#include "resource.h"
#include <math.h>
#include <stdio.h>
#include <time.h>
#include "Cube.h"
#include "Mesh.h"
#include "Parameters.h"
#include "EnvMap.h"
Defines | |
#define | FX_FILENAME L"EnvMap.fx" |
File containing the shader code. | |
Functions | |
bool CALLBACK | IsDeviceAcceptable (D3DCAPS9 *pCaps, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, bool bWindowed, void *pUserContext) |
DXUT callback (Rejects any devices that aren't acceptable by returning false). | |
bool CALLBACK | ModifyDeviceSettings (DXUTDeviceSettings *pDeviceSettings, const D3DCAPS9 *pCaps, void *pUserContext) |
DXUT callback (Before a device is created, modifies the device settings as needed). | |
HRESULT CALLBACK | OnCreateDevice (IDirect3DDevice9 *g_pd3dDevice, const D3DSURFACE_DESC *pBackBufferSurfaceDesc, void *pUserContext) |
DXUT callback (You should create any D3DPOOL_MANAGED resources here). | |
HRESULT CALLBACK | OnResetDevice (IDirect3DDevice9 *g_pd3dDevice, const D3DSURFACE_DESC *pBackBufferSurfaceDesc, void *pUserContext) |
DXUT callback (You should create any D3DPOOL_DEFAULT resources here). | |
void CALLBACK | OnFrameMove (IDirect3DDevice9 *g_pd3dDevice, double fTime, float fElapsedTime, void *pUserContext) |
DXUT callback (Handle updates to the scene). | |
void CALLBACK | OnFrameRender (IDirect3DDevice9 *g_pd3dDevice, double fTime, float fElapsedTime, void *pUserContext) |
DXUT callback (Render the scene). Also responsible for screenshot taking. | |
LRESULT CALLBACK | MsgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool *pbNoFurtherProcessing, void *pUserContext) |
DXUT callback (Message processing). | |
void CALLBACK | KeyboardProc (UINT nChar, bool bKeyDown, bool bAltDown, void *pUserContext) |
DXUT callback (Keystroke messages). | |
void CALLBACK | OnGUIEvent (UINT nEvent, int nControlID, CDXUTControl *pControl, void *pUserContext) |
DXUT callback (called by the framework in case of GUI events). Forwards GUI event to the parameter-manager class Parameters (see pp). | |
void CALLBACK | OnLostDevice (void *pUserContext) |
DXUT callback (You should release resources created in the OnResetDevice callback here). | |
void CALLBACK | OnDestroyDevice (void *pUserContext) |
DXUT callback (You should release resources created in the OnCreateDevice callback here). | |
void | InitParams () |
Defines application-specific parameters and creates GUI controls (sliders, checkboxes) for them. Finally, loads initial values for the parameters from file called .params0 (Reset). Use Parameters::Add to create GUI controls. | |
void | RenderText () |
Renders help and statistics text and displays algorithmic-specific parameters. | |
void | SaveCameraPosition (char *fileName) |
Writes current camera settings to file. | |
void | LoadCameraPosition (char *fileName) |
Loads camera settings from file. | |
int | GenerateNewFileName (int &counter) |
Generates a non-existing filename to store the screenshot in the shots directory. | |
INT WINAPI | WinMain (HINSTANCE, HINSTANCE, LPSTR, int) |
Entry point to the program. | |
void | OnLoad () |
(Load, Save, Reset are default buttons.) | |
void | OnSave () |
(Load, Save, Reset are default buttons.) | |
void | OnReset () |
(Load, Save, Reset are default buttons.) | |
float | Exponent (float f) |
Callback of type CONVERTER. | |
void | OnChangeCubeMap () |
Actions to be taken when the cubemaps get invalid. Callback of type ONCHANGE_CALLBACK. | |
void | OnChangeMesh () |
Actions to be taken when the central mesh object is changed. Callback of type ONCHANGE_CALLBACK. | |
void | OnChangeMeshSize () |
Actions to be taken when the size of the central mesh is to change. Callback of type ONCHANGE_CALLBACK. | |
void | OnChangeShininess () |
Actions to be taken when the shininess is to change. Callback of type ONCHANGE_CALLBACK. | |
void | OnChangeResolution () |
Actions to be taken when the resolution is to change. Callback of type ONCHANGE_CALLBACK. | |
Variables | |
const int | WIDTH = 800 |
screen width | |
const int | HEIGHT = 800 |
screen height | |
const int | CHARBUFFER_SIZE = 200 |
length of the buffer (one line to be saved to file) | |
IDirect3DDevice9 * | g_pd3dDevice |
THE D3D DEVICE. | |
ID3DXEffect * | g_pEffect |
THE EFFECT FILE. | |
EnvMap * | envmapRenderer |
PROBLEM-SPECIFIC CLASS. | |
Parameters | pp |
HELPER CLASS TO MANAGE VARIOUS PARAMETERS. | |
CDXUTDialogResourceManager | g_DialogResourceManager |
Manager for shared resources of dialogs. | |
CD3DSettingsDlg | g_SettingsDlg |
Device settings dialog. | |
CDXUTDialog | g_HUD |
Dialog for sample specific controls. | |
ID3DXFont * | g_pFont |
Font for drawing text. | |
ID3DXSprite * | g_pTextSprite |
Sprite for batching draw text calls. | |
IDirect3DSurface9 * | g_pSaveSurface |
surface for screenshot capturing | |
bool | bSavingScreenshot = false |
boolean for screenshot capturing | |
int | counter = 0 |
counter for screenshots (see GenerateNewFileName()) | |
HRESULT | hr |
CModelViewerCamera | camera |
the camera |
|
File containing the shader code.
|
|
Callback of type CONVERTER.
|
|
Generates a non-existing filename to store the screenshot in the shots directory. Generated file names are shots/000.png, shots/001.png, ... |
|
Defines application-specific parameters and creates GUI controls (sliders, checkboxes) for them. Finally, loads initial values for the parameters from file called .params0 (Reset). Use Parameters::Add to create GUI controls.
|
|
DXUT callback (Rejects any devices that aren't acceptable by returning false). DXUT callback. Rejects any devices that aren't acceptable by returning false. |
|
DXUT callback (Keystroke messages).
|
|
Loads camera settings from file. Loads camera settings (world matrix and camera position) from an existing file. Useful when capturing multiple screenshots from the same view.
|
|
DXUT callback (Before a device is created, modifies the device settings as needed).
|
|
DXUT callback (Message processing). Forwards messages to the DirectX settings window, the GUI controls or the camera, respecively. |
|
Actions to be taken when the cubemaps get invalid. Callback of type ONCHANGE_CALLBACK.
|
|
Actions to be taken when the central mesh object is changed. Callback of type ONCHANGE_CALLBACK.
|
|
Actions to be taken when the size of the central mesh is to change. Callback of type ONCHANGE_CALLBACK.
|
|
Actions to be taken when the resolution is to change. Callback of type ONCHANGE_CALLBACK.
|
|
Actions to be taken when the shininess is to change. Callback of type ONCHANGE_CALLBACK.
|
|
DXUT callback (You should create any D3DPOOL_MANAGED resources here). Compiles the effect file (EnvMap.fx) and displays error message if compilation fails. Finally, forwards call to EnvMap::OnCreateDevice. |
|
DXUT callback (You should release resources created in the OnCreateDevice callback here). Forwards call to EnvMap::OnDestroyDevice. |
|
DXUT callback (Handle updates to the scene).
|
|
DXUT callback (Render the scene). Also responsible for screenshot taking. If a screenshot is being taken (bSavingScreenshot), sets g_pSaveSurface as the render target and saves it to a non-existent file (GenerateNewFileName()). Also saves current camera parameters (SaveCameraPosition()). To perform actual rendering, it forwards call to EnvMap::OnFrameRender with current camera matrices. |
|
DXUT callback (called by the framework in case of GUI events). Forwards GUI event to the parameter-manager class Parameters (see pp).
|
|
(Load, Save, Reset are default buttons.)
|
|
DXUT callback (You should release resources created in the OnResetDevice callback here).
|
|
(Load, Save, Reset are default buttons.)
|
|
DXUT callback (You should create any D3DPOOL_DEFAULT resources here). Resets camera and HUD elements. Initializes g_pSaveSurface according to the current screen resolution. Then it forwards call to EnvMap::OnResetDevice. |
|
(Load, Save, Reset are default buttons.)
|
|
Renders help and statistics text and displays algorithmic-specific parameters.
|
|
Writes current camera settings to file. Writes current camera settings (world matrix and camera position) to file. Useful when capturing multiple screenshots from the same view.
|
|
Entry point to the program. Initializes everything and goes into a message processing loop. Idle time is used to render the scene. |
|
boolean for screenshot capturing
|
|
the camera
|
|
length of the buffer (one line to be saved to file)
|
|
counter for screenshots (see GenerateNewFileName())
|
|
PROBLEM-SPECIFIC CLASS.
|
|
Manager for shared resources of dialogs.
|
|
Dialog for sample specific controls.
|
|
THE D3D DEVICE.
|
|
THE EFFECT FILE.
|
|
Font for drawing text.
|
|
surface for screenshot capturing
|
|
Sprite for batching draw text calls.
|
|
Device settings dialog.
|
|
screen height
|
|
|
|
HELPER CLASS TO MANAGE VARIOUS PARAMETERS.
|
|
screen width
|