------

[ AD ] Port Monitor ( Try to use a Best WebSite Monitoring Tool )

------
// Dark GDK - The Game Creators - www.thegamecreators.com

// include the Dark GDK header
#include "DarkGDK.h"

enum SEQ
{
	ID_TEXTURE=1,
	ID_DETAIL=2,
	ID_TERRAIN=1,
	ID_HEIGHT=1,
	ID_OBJECT=2,
	ID_CAMERA=0,
};

void DarkGDK ( void )
{
	// entry point for the application

	// switch on sync rate and set to a maximum of 60 fps
	dbSyncOn ( );
	dbSyncRate ( 60 );

	// we are going to use a skybox in this demo and it will
	// be scaled up to quite a large size, this will initially
	// result in it being outside of the cameras default range
	// therefore it will not be drawn, to adjust this we simply
	// increase the cameras range

	// void dbSetCameraRange ( float fNear, float fFar )
	dbSetCameraRange ( 1.0f,	30000.0f );

	// two textures are going to be used for the terrain, the first
	// will be the diffuse part and the second will be used to
	// create extra detail on the terrain
	dbLoadImage ( "texture.jpg",		ID_TEXTURE );
	dbLoadImage ( "detail.jpg",			ID_DETAIL );
	
	// the first step in creating a terrain is to call the
	// function dbSetupTerrain, this will perform some internal
	// work that allows us to get started
	dbSetupTerrain ( ); // -------------------------------  doesn't exists help 

	// now we can get started on making the terrain object
	dbMakeObjectTerrain ( ID_TERRAIN );

	// here we pass in a heightmap that will be used to create the terrain
	dbSetTerrainHeightMap ( ID_HEIGHT, "map.bmp" );

	// now we set the scale, this will have the effect of making
	// the terrain large on the X and Z axis but quite small on the Y

	// void dbSetTerrainScale ( int iID, float fX, float fY, float fZ )
	dbSetTerrainScale ( ID_TERRAIN, 3.0f, 0.6f, 3.0f );

	// adjust the lighting for the terrain, this function takes the ID
	// number, then a direction for the light, then 3 colours for the light
	// and finally the scale, by using this function we can adjust the
	// overall colour of the terrain

	// void dbSetTerrainLight ( int iID,
	//	float fXDir, float fYDir, float fZDir,
	//	int iRed, int iGreen, int iBlue,
	//	float fScale )
	dbSetTerrainLight ( ID_TERRAIN, 
				1.0f, -0.25f, 0.0f, 
				1.0f, 1.0f, 0.78f, 
				0.5f );

	// in this call we're telling the terrain that its diffuse texture
	// will come from image 1 and its detail texture will come from
	// image 2

	// void dbSetTerrainTexture ( int iID, int iBase, int iDetail )
	dbSetTerrainTexture ( ID_TERRAIN, ID_TEXTURE, ID_DETAIL );

	// once we have set all properties of the terrain we can build it,
	// at this point it gets created and added into your world
	dbBuildTerrain ( ID_TERRAIN );

	// with the terrain in place we can now load a skybox
	dbLoadObject ( "skybox2.x", ID_OBJECT );

	// we dont need it to respond to light so switch light off

	// void dbSetObjectLight ( int iObject, int iFlag ) 

	dbSetObjectLight ( ID_OBJECT, 0 );

	// make the skybox much larger

	// void dbScaleObject ( int iObject, float fX, float fY, float fZ )
	dbScaleObject ( ID_OBJECT, 30000, 30000, 30000 );
	
	// position the camera

	// void dbPositionCamera ( float fX, float fY, float fZ ) 
	dbPositionCamera ( 385, 23, 100 );

	// adjust texture properties of sky box

	// void dbSetObjectTexture ( int iObject, int iMode, int iMipMaps ) 
	dbSetObjectTexture ( ID_OBJECT, 3, 1 );

	// now onto our main loop
	while ( LoopGDK ( ) )
	{
		// let the user move the camera around with the arrow keys

		// void dbControlCameraUsingArrowKeys ( int iCamera, float fMove, float fTurn ) 
		dbControlCameraUsingArrowKeys ( ID_CAMERA, 2.0f, 2.0f );

		// find the ground height of the terrain

		// float dbGetTerrainGroundHeight ( int iID, float fX, float fZ )
		float fHeight = dbGetTerrainGroundHeight ( ID_TERRAIN, dbCameraPositionX ( ), dbCameraPositionZ ( ) );

		// reposition the camera so it is directly above the ground

		// void dbPositionCamera ( float fX, float fY, float fZ ) 
		dbPositionCamera ( dbCameraPositionX ( ),  fHeight + 10.0f,  dbCameraPositionZ ( ) );

		// update the terrain
		dbUpdateTerrain ( );   // -------------------------------  doesn't exists help

		// update the screen
		dbSync ( );
	}


}






'온라인게임' 카테고리의 다른 글

Dark GDK - Asteroid / 2D  (0) 2011.10.28
DarkGDK - Sprite Animation / 2D  (0) 2011.10.28
Dark GDK - FPS 게임 화면 만들기 / 3D  (3) 2011.10.26
Dark GDK - 이미지 로딩 예제 / 2D  (0) 2011.10.25
MS SQL Server Alter Table  (0) 2011.10.24

+ Recent posts