home *** CD-ROM | disk | FTP | other *** search
- //-----------------------------------------------------------------------------
- // System Includes
- //-----------------------------------------------------------------------------
- #include <windows.h>
-
- //-----------------------------------------------------------------------------
- // Engine Includes
- //-----------------------------------------------------------------------------
- #include "..\Engine\Engine.h"
-
- //-----------------------------------------------------------------------------
- // Test State Class
- //-----------------------------------------------------------------------------
- class TestState : public State
- {
- public:
- //-------------------------------------------------------------------------
- // Allows the test state to preform any pre-processing construction.
- //-------------------------------------------------------------------------
- virtual void Load()
- {
- m_mesh = new Mesh( "Gun.x", "./Assets/" );
-
- // Set a suitable view matrix for viewing the test mesh.
- D3DXMATRIX view;
- D3DXMatrixLookAtLH( &view, &D3DXVECTOR3( -50.0f, 50.0f, -150.0f ), &D3DXVECTOR3( 0.0f, 0.0f, 0.0f ), &D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );
- g_engine->GetDevice()->SetTransform( D3DTS_VIEW, &view );
- };
-
- //-------------------------------------------------------------------------
- // Allows the test state to preform any post-processing destruction.
- //-------------------------------------------------------------------------
- virtual void Close()
- {
- SAFE_DELETE( m_mesh );
- };
-
- //-------------------------------------------------------------------------
- // Returns the view setup details for the given frame.
- //-------------------------------------------------------------------------
- virtual void RequestViewer( ViewerSetup *viewer )
- {
- viewer->viewClearFlags = D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER;
- }
-
- //-------------------------------------------------------------------------
- // Renders the test state.
- //-------------------------------------------------------------------------
- virtual void Render()
- {
- m_mesh->Render();
- };
-
- private:
- Mesh *m_mesh; // The test mesh.
- };
-
- //-----------------------------------------------------------------------------
- // Application specific state setup.
- //-----------------------------------------------------------------------------
- void StateSetup()
- {
- g_engine->AddState( new TestState, true );
- }
-
- //-----------------------------------------------------------------------------
- // Entry point for the application.
- //-----------------------------------------------------------------------------
- int WINAPI WinMain( HINSTANCE instance, HINSTANCE prev, LPSTR cmdLine, int cmdShow )
- {
- // Create the engine setup structure.
- EngineSetup setup;
- setup.instance = instance;
- setup.name = "Mesh/Material Test";
- setup.scale = 0.01f;
- setup.StateSetup = StateSetup;
-
- // Create the engine (using the setup structure), then run it.
- new Engine( &setup );
- g_engine->Run();
-
- return true;
- }