00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #include "WinMainSelector.h"
00025 #if defined COMPILE_DEMOTERRAIN
00026
00027 #include "..\AEngine\AEngine.h"
00028
00029
00030 AMesh skyMesh;
00031 ATexture skyTexture;
00032 ATexture texLow, texHigh, texNormal;
00033 FLOAT camTheta, camRadius, camHeight;
00034 ATerrain terrain;
00035
00036
00037 void init()
00038 {
00039 sys_showConsole(false);
00040
00041 texLow = load_texture("textures\\environment\\terrainDryLand.dds");
00042 texHigh = load_texture("textures\\environment\\terrainRockyMoss.dds");
00043
00044 texNormal = load_texture("textures\\environment\\terrainBump.dds");
00045
00046 skyMesh = load_mesh("models\\parts\\sky.obj");
00047 skyTexture = load_texture("textures\\environment\\sky_plain.tga");
00048
00049 camTheta = 0.0f;
00050 camRadius = 30.0f;
00051 camHeight = 30.0f;
00052
00053 sys_setSkipRate(0);
00054
00055 terrain = load_terrain("maps\\map1.tga", 300.0f, 300.0f, 65.0f );
00056 }
00057
00058 void update()
00059 {
00060 Vec3D camPos( cosf(camTheta)*camRadius, sinf(camTheta)*camRadius, camHeight );
00061 const Vec3D origin(0.0f,0.0f,0.0f);
00062 camera_set( camPos, origin, 0.1f );
00063
00064
00065 if( input_isKeyDown(KeyCodes::key_LEFT) ) camTheta -= 0.05f;
00066 if( input_isKeyDown(KeyCodes::key_RIGHT) ) camTheta += 0.05f;
00067 if( input_isKeyDown(KeyCodes::key_UP) ) camRadius -= 0.3f;
00068 if( input_isKeyDown(KeyCodes::key_DOWN) ) camRadius += 0.3f;
00069 if( input_isKeyDown(KeyCodes::key_PRIOR) ) camHeight += 1.3f;
00070 if( input_isKeyDown(KeyCodes::key_NEXT) ) camHeight -= 1.3f;
00071 }
00072
00073 void render()
00074 {
00075 terrain_render(terrain,texLow,texHigh,texNormal);
00076
00077 mesh_render( skyMesh, Vec3D(0.0f,0.0f,0.0f), Vec3D(300.0f,300.0f,150.0f), Vec3D(0.0f,0.0f,0.0f), skyTexture );
00078
00079 overlay_text() << "Use the arrow keys and the PgUp/PgDown to control CAMERA" << endl;
00080 overlay_textOut( Vec2D(0.0f,0.0f), 1.0f );
00081 }
00082
00083 INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR, INT )
00084 {
00085 sys_init(hInst,800,600,32,false);
00086 sys_setInitFunc(init);
00087 sys_setUpdateFunc(update);
00088 sys_setRenderFunc(render);
00089 sys_go();
00090 return 0;
00091 }
00092
00093 #endif