本文整理汇总了C++中Terrain::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Terrain::Init方法的具体用法?C++ Terrain::Init怎么用?C++ Terrain::Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terrain
的用法示例。
在下文中一共展示了Terrain::Init方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
Display window("Window", 1500, 800);
Camera camera(glm::vec3(0.0f, 0.0f, 0.0f), 70.0f, (float)window.GetReference().getSize().x / (float)window.GetReference().getSize().y, 0.1f, 1800.0f);
BasicShader terrain_shader;
terrain_shader.loadFromFile("./res/shader/BasicShader");
BasicShader skaybox_shader;
skaybox_shader.loadFromFile("./res/shader/BasicShader");
BasicShader grass_shader;
grass_shader.loadFromFile("./res/shader/BasicShader");
grass_shader.SetMinLightStr(0.7);
grass_shader.SetMaxLightStr(1.0);
BasicShader model_shader;
model_shader.loadFromFile("./res/shader/BasicShader");
Skaybox skaybox;
skaybox.SetShader(skaybox_shader);
skaybox.AtachCamera(camera);
skaybox.SetBack("./res/skybox2/skybox_back.bmp");
skaybox.SetFront("./res/skybox2/skybox_front.bmp");
skaybox.SetLeft("./res/skybox2/skybox_left.bmp");
skaybox.SetRight("./res/skybox2/skybox_right.bmp");
skaybox.SetBotom("./res/skybox2/skybox_bottom.bmp");
skaybox.SetTop("./res/skybox2/skybox_top.bmp");
skaybox.SetSize(1000);
skaybox.Init();
Terrain terrain;
terrain.LoadFromFile("./res/height_maps/TestMap.png");
terrain.SetTexture("./res/texture/grass_m.jpg");
terrain.SetShader(terrain_shader);
terrain.AtachCamera(camera);
terrain.SetHeight(25);
terrain.Init();
Mesh Grass[100];
Mesh Tree[25];
for (int i = 0; i < 100; i++) {
Grass[i].LoadMesh("./res/models/Grass pack/Grass_02.obj");
Grass[i].SetShader(grass_shader);
Grass[i].AtachCamera(camera);
int x = 0 + rand() % (int)terrain.GetSize().x ;
int y = 0 + rand() % (int)terrain.GetSize().y ;
Grass[i].SetPosition(x,terrain.GetHeightOnPoint(x,y)-0.4,y);
}
for (int i = 0; i < 25; i++) {
Tree[i].LoadMesh("./res/models/Tree/Tree.obj");
Tree[i].SetShader(model_shader);
Tree[i].AtachCamera(camera);
int x = 0 + rand() % (int)terrain.GetSize().x;
int y = 0 + rand() % (int)terrain.GetSize().y;
Tree[i].SetPosition(x, terrain.GetHeightOnPoint(x, y) - 0.4, y);
}
sf::Clock clock;
float speed;
camera.setPosition(glm::vec3(terrain.GetSize().x / 2, 8, terrain.GetSize().y / 2-3));
while (window.GetHandle()->isOpen())
{
speed = clock.getElapsedTime().asSeconds()*70;
clock.restart();
sf::Event event;
while (window.GetHandle()->pollEvent(event))
{
//debug.Event(event, window.GetReference());
if (event.type == sf::Event::Closed) {
window.GetHandle()->close();
return EXIT_SUCCESS;
}
if (event.type == sf::Event::Resized) {
camera.forResize((float)window.GetReference().getSize().x / (float)window.GetReference().getSize().y);
window.Resize();
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) {
window.GetHandle()->close();
return EXIT_SUCCESS;
}
}
if (window.GetReference().hasFocus() && !sf::Keyboard::isKeyPressed(sf::Keyboard::LControl)) {
camera.Update(window.GetReference(),speed);
}
//.........这里部分代码省略.........
示例2: main
int main()
{
// Create the main window
int width = 600;
int height = 600;
bool wireframe = true;
sf::Texture sea; //texture object called car
sf::Texture sand; //texture object called car
sf::Texture grass; //texture object called car
sf::Texture rock; //texture object called car
sf::Texture snowrock; //texture object called car
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
sea.loadFromFile("../water.png");
sand.loadFromFile("../sand.png");
grass.loadFromFile("../grass.png");
rock.loadFromFile("../rock.png");
snowrock.loadFromFile("../snowyrock.png");
// create the window
sf::RenderWindow App(sf::VideoMode(width, height), "OpenGL", sf::Style::Default, sf::ContextSettings(24));
// Create a clock for measuring time elapsed
sf::Clock Clock;
aiVector3D position(0,10,-30);
Camera camera;
camera.Init(position); //create a camera
//prepare OpenGL surface for HSR
glClearDepth(1.f);
glClearColor(0.3f, 0.3f, 0.6f, 0.f); //background colour
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
//// Setup a perspective projection & Camera position
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat light_color[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] = { 5.0, 2.6, 0.0, 0.0 };
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color); // set color of diffuse component
glLightfv(GL_LIGHT0, GL_SPECULAR, light_color); // set color of specular component
glLightfv(GL_LIGHT0, GL_POSITION, light_position); // set position
///////////////////////////setting material
GLfloat materialAmbDiff[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // create an array of RGBA values
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialAmbDiff); // set the diffuse & ambient reflection colour for the front of faces
GLfloat materialSpecular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // create an array of RGBA values (White)
GLfloat materialShininess[] = { 128.0f }; // select value between 0-128, 128=shiniest
glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular); // set the colour of specular reflection
glMaterialfv(GL_FRONT, GL_SHININESS, materialShininess); // set shininess of the material
//set up a 3D Perspective View volume
gluPerspective(90.f, (float)width/height, 1.f, 300.0f);//fov, aspect, zNear, zFar
//load & bind the shader
sf::Shader shader;
//all the lighting & texture blending code should be put in 'fragment.glsl'
if(!shader.loadFromFile("vertex.glsl","fragment.glsl")){
exit(1);
}
shader.setParameter("sea", sea);
shader.setParameter("sand", sand);
shader.setParameter("grass", grass);
shader.setParameter("rock", rock);
shader.setParameter("snowrock", snowrock);
//Create our Terrain
Terrain terrain;
terrain.Init();
// Start game loop
while (App.isOpen())
{
// Process events
sf::Event Event;
while (App.pollEvent(Event))
{
// Close window : exit
if (Event.type == sf::Event::Closed)
App.close();
// Escape key : exit
if ((Event.type == sf::Event::KeyPressed) && (Event.key.code == sf::Keyboard::Escape))
App.close();
if ((Event.type == sf::Event::KeyPressed) && (Event.key.code == sf::Keyboard::O))
{
// select the projection matrix and clear it out
//.........这里部分代码省略.........
示例3: Crosshair
bool DuckHuntMain::Init()
{
if (!D3DApp::Init())
return false;
// Must init Effects first since InputLayouts depend on shader signatures.
Effects::InitAll(md3dDevice);
InputLayouts::InitAll(md3dDevice);
RenderStates::InitAll(md3dDevice);
mCrosshair = new Crosshair(md3dDevice);
mTexMgr.Init(md3dDevice);
DuckHuntMain::ShowCursors(false);
mSky = new Sky(md3dDevice, L"Textures/desertcube1024.dds", 5000.0f);
mSmap = new ShadowMap(md3dDevice, SMapSize, SMapSize);
Terrain::InitInfo tii;
tii.HeightMapFilename = L"Textures/myT5.raw";
tii.LayerMapFilename0 = L"Textures/grass.dds";
tii.LayerMapFilename1 = L"Textures/darkdirt.dds";
tii.LayerMapFilename2 = L"Textures/stone.dds";
tii.LayerMapFilename3 = L"Textures/lightdirt.dds";
tii.LayerMapFilename4 = L"Textures/snow.dds";
tii.BlendMapFilename = L"Textures/blend.dds";
tii.HeightScale = 50.0f;
tii.HeightmapWidth = 2049;
tii.HeightmapHeight = 2049;
tii.CellSpacing = 0.5f;
mTerrain.Init(md3dDevice, md3dImmediateContext, tii);
//Sound
result = FMOD::System_Create(&mSystem);
result = mSystem->init(32, FMOD_INIT_NORMAL, 0);
result = mSystem->createSound("Sounds/GunFire.wav", FMOD_DEFAULT, 0, &mGunFire);
result = mGunFire->setMode(FMOD_LOOP_OFF);
mCam.SetLens(0.25f*MathHelper::Pi, AspectRatio(), 1.0f, 1000.0f);
mSsao = new Ssao(md3dDevice, md3dImmediateContext, mClientWidth, mClientHeight, mCam.GetFovY(), mCam.GetFarZ());
BuildScreenQuadGeometryBuffers();
testModelDuck = new BasicModel(md3dDevice, mTexMgr, "Models\\duck.obj", L"Textures\\DUCK.jpg");
BasicModelInstance testInstanceDuck;
BasicModelInstance testInstanceDuck2;
BasicModelInstance testInstanceDuck3;
BasicModelInstance testInstanceDuck4;
testInstanceDuck.Model = testModelDuck;
testInstanceDuck2.Model = testModelDuck;
testInstanceDuck3.Model = testModelDuck;
testInstanceDuck4.Model = testModelDuck;
//Duck 1
XMMATRIX modelScale = XMMatrixScaling(1.0f, 1.0f, -1.0f);
XMMATRIX modelRot = XMMatrixRotationY(0.0f);
XMMATRIX modelOffset = XMMatrixTranslation(0.0f, 0.0f, 0.0f);
//Duck 2
XMMATRIX modelScale2 = XMMatrixScaling(2.0f, 2.0f, -1.0f);
XMMATRIX modelRot2 = XMMatrixRotationY(-1.0f);
XMMATRIX modelOffset2 = XMMatrixTranslation(1.0f, 1.0f, -1.0f);
//Duck3
XMMATRIX modelScale3 = XMMatrixScaling(1.5f, 1.5f, 1.5f);
XMMATRIX modelRot3 = XMMatrixRotationY(0.5f);
XMMATRIX modelOffset3 = XMMatrixTranslation(2.0f, 1.0f, -1.0f);
//Duck4
XMMATRIX modelScale4 = XMMatrixScaling(0.5f, 0.5f, -1.0f);
XMMATRIX modelRot4 = XMMatrixRotationY(1.0f);
XMMATRIX modelOffset4 = XMMatrixTranslation(0.5f, 1.0f, -1.0f);
//Duck 1
XMStoreFloat4x4(&testInstanceDuck.World, modelScale*modelRot*modelOffset);
mModelInstances.push_back(testInstanceDuck);
//Duck 2
XMStoreFloat4x4(&testInstanceDuck2.World, modelScale2*modelRot2*modelOffset2);
mModelInstances.push_back(testInstanceDuck2);
//Duck 3
XMStoreFloat4x4(&testInstanceDuck3.World, modelScale3*modelRot3*modelOffset3);
mModelInstances.push_back(testInstanceDuck3);
//Duck 4
XMStoreFloat4x4(&testInstanceDuck4.World, modelScale4*modelRot4*modelOffset4);
mModelInstances.push_back(testInstanceDuck4);
//create collision box
for (unsigned i = 0; i < mModelInstances.size(); i++)
{
mModelInstances[i].Model->CreateCollisionBox(mModelInstances[i].Model->BasicVertices);
}
//.........这里部分代码省略.........
示例4: WinMain
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
XEngine *engine = XEngine::GetInstance();
if( engine->Init(hInstance) == FALSE )
{
return -1;
}
Rect rec(Position(-10000.0, 10000.0), Position(10000.0, -10000.0));
TestScene *scene = new TestScene;
scene->SetTime(0);
//Scene *scene = new Scene;
scene->Init(rec);
scene->camera->MoveForwardBy(-40);
scene->camera->MoveUpBy(18);
scene->camera->Pitch(-XM_PI / 10);
Material material;
material.ambient = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
material.diffuse = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
material.specular = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
material.power = 9.0f;
//material.texture = SRVBatch::GetInstance()->LoadSRV("media/", "cup.jpg");
Particle *fire = new Particle;
fire->Init("media/","fire.png");
fire->SetPosition(0, 0, 10);
//scene->AddRenderableThing(*fire);
SkyBox *sky = new SkyBox;
//sky->Init("textures/", "skymap.dds");
sky->Init("textures/", "Above_The_Sea.dds");
//sky->Init("textures/", "desert_skymap.dds");
scene->AddSky(sky);
Terrain *terrain = new Terrain;
//terrain->Init("terrain/testHight.bmp", "terrain/", "dirt01.dds");
terrain->Init("terrain/heightmap01.bmp", "terrain/", "grass.jpg");
scene->AddTerrain(terrain);
Wall *wall = new Wall;
wall->Init(30, 30, 0.3);
wall->Pitch(XM_PI / 2);
wall->SetPosition(0, -3, 0);
//scene->AddRenderableThing(*wall);
//¿É¼ûÐÔ²âÊÔ
Wall *wall0 = new Wall;
wall0->Init(30, 30, 0.3);
wall0->Pitch(XM_PI / 2);
wall0->SetPosition(1000, -3, 0);
//scene->AddRenderableThing(*wall0);
Obj *obj = new Obj;
obj->CreateBox(1, 3, 2, material);
obj->SetPosition(5, 1, 12);
obj->Yaw(XM_PI / 3);
obj->Roll(XM_PI / 3);
obj->SetScale(1.3);
//scene->AddRenderableThing(*obj);
Cube *cube = new Cube;
cube->Init(2);
cube->Pitch(XM_PI / 3);
cube->Roll(XM_PI / 3);
cube->SetMaterial(material);
//scene->AddRenderableThing(*cube);
Ball *ball = new Ball;
ball->Init(1);
ball->SetPosition(0, 0, 6);
Obj *objInWall = new Obj;
objInWall->CreateBox(1, 1, 1, material);
objInWall->SetPosition(0, 1, 0);
ball->AddChild(objInWall);
//scene->AddRenderableThing(*ball);
Ship *ship = new Ship;
//ship->Init();
//ship->SetPosition(-10, 0, 0);
//scene->AddRenderableThing(*ship);
Model *test = new Model;
test->LoadModel("media/", "chair.obj");
test->SetScale(1.7);
test->SetPosition(-15, 0, 0);
test->Pitch(-1.2);
test->Yaw(-1.5);
//scene->AddRenderableThing(*test);
//SmileBoy *smileBoy= new SmileBoy;
//smileBoy->Init();
//smileBoy->SetHandleInput(FALSE);
//.........这里部分代码省略.........
示例5: LoadMap
void Map::LoadMap(char* fileName, ResourceManager& resMan) {
////////////////////////////////////////////////////////////////FILE I/O STUFF
std::stringstream ss;
std::ifstream file;
char lineType;
Terrain tempTerrain;
D3DVECTOR pos, corner1, corner2, size;
float rot;
int zone;
PrimStruct *tempPrim;
PrimObj tempObj;
sPoint tempSpawn;
tempObj.mat = &mat;
tempObj.Tex = resMan.loadTexture("uvtest.png",0,0,0,0,D3DFMT_UNKNOWN,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,D3DCOLOR_XRGB(255,0,255),0);
file.open(fileName);
if(file.is_open()) {
while(!file.eof()) {
lineType = ' ';
file>>lineType;
if(lineType == '#') {
//comment line
file.ignore(256,'\n');
} else if(lineType == 'f'||lineType == 'F') {
//floor
//get top left
file>>size.x;
file>>size.z;
file>>size.y;
//get bottom right
file>>pos.x;
file>>pos.y;
file>>pos.z;
//zone
file>>zone;
ss<<"Floor"<<size.x<<"x"<<size.y<<"x"<<size.z;
tempPrim = resMan.loadPrim(ss.str().c_str(),size.y,size.x,size.z);
D3DXMatrixIdentity(&tempObj.matrix);
D3DXMatrixTranslation(&tempObj.matrix,pos.x,pos.y,pos.z);
tempObj.primInfo = tempPrim;
renderInfo.push_back(tempObj);
tempTerrain.Init(pos,tempPrim,FLOOR);
AddFloor(tempTerrain);
floorZone.push_back(zone);
file.ignore();
} else if(lineType == 'w' || lineType == 'W') {
//walls
//get top left
file>>size.x;
file>>size.z;
file>>size.y;
//get bottom right
file>>pos.x;
file>>pos.y;
file>>pos.z;
//zone
file>>zone;
ss<<"Wall"<<size.x<<"x"<<size.y<<"x"<<size.z;
tempPrim = resMan.loadPrim(ss.str().c_str(),size.y,size.x,size.z);
D3DXMatrixIdentity(&tempObj.matrix);
D3DXMatrixTranslation(&tempObj.matrix,pos.x,pos.y,pos.z);
tempObj.primInfo = tempPrim;
renderInfo.push_back(tempObj);
tempTerrain.Init(pos,tempPrim,WALL);
AddWall(tempTerrain);
wallZone.push_back(zone);
file.ignore();
} else if(lineType == 's' || lineType == 'S'){
示例6: main
int main()
{
// Create the main window
bool wireFrame = false;
int width = 600, height = 600;
sf::ContextSettings Settings;
Settings.depthBits = 24; // Request a 24 bits depth buffer
Settings.stencilBits = 8; // Request a 8 bits stencil buffer
Settings.antialiasingLevel = 16; // Request 2 levels of antialiasing
sf::RenderWindow App(sf::VideoMode(width, height, 32), "SFML OpenGL" , sf::Style::Close, Settings);
// Create a clock for measuring time elapsed
sf::Clock Clock;
aiVector3D position(0, 10, -30);
Camera camera;
camera.Init(position); //create a camera
//prepare OpenGL surface for HSR
glClearDepth(1.f);
glClearColor(0.3f, 0.3f, 0.6f, 0.f); //background colour
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
//to enable texture tiling
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//// Setup a perspective projection & Camera position
glMatrixMode(GL_PROJECTION);
glEnable(GL_LIGHTING); // switch on lighting
glEnable(GL_LIGHT0); // switch on light0
GLfloat light_color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat light_position[] = { 15.0f, -20.0f, -10.0f, 0 };
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color); // set color of diffuse component
glLightfv(GL_LIGHT0, GL_SPECULAR, light_color); // set color of specular component
glLightfv(GL_LIGHT0, GL_POSITION, light_position); // set position
GLfloat materialAmbDiff[] = { 1, 1, 1, 1.0f }; // create an array of RGBA values
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialAmbDiff);
// set the diffuse & ambient reflection colour for the front of faces
GLfloat materialSpecular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // create an array of RGBA values (White)
GLfloat materialShininess[] = { 120 }; // select value between 0-128, 128=shiniest
glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular); // set the colour of specular reflection
glMaterialfv(GL_FRONT, GL_SHININESS, materialShininess); // set shininess of the material
glLoadIdentity();
//set up a 3D Perspective View volume
gluPerspective(90.f, (float)width / height, 1.f, 300.0f);//fov, aspect, zNear, zFar
//load in different textures
sf::Texture seaTexture;
seaTexture.loadFromFile("sea.png");
sf::Texture grassTexture;
grassTexture.loadFromFile("grass.png");
sf::Texture rockTexture;
rockTexture.loadFromFile("rock.png");
//load the shader
sf::Shader shader;
//all the lighting & texture blending code should be put in 'fragment.glsl'
if (!shader.loadFromFile("vertex.glsl", "fragment.glsl")){
exit(1);
}
//set textures in the shader
shader.setParameter("seaTexture", seaTexture);
shader.setParameter("grassTexture", grassTexture);
shader.setParameter("rockTexture", rockTexture);
//load the height map image
sf::Image heightMap;
heightMap.loadFromFile("heightmap.png");
//Create our Terrain
Terrain terrain;
terrain.Init(heightMap); //create from height map
shader.setParameter("heightScale", terrain.getHeightScale()); //set the height scaler in the shader
// Start game loop
while (App.isOpen())
{
// Process events
sf::Event Event;
while (App.pollEvent(Event))
//.........这里部分代码省略.........
示例7: ZeroMemory
bool Projekt::Init()
{
if (!D3D11App::Init())
return false;
// Initialize effects, input layouts and texture manager
Effects::InitAll(mDirect3D->GetDevice());
InputLayouts::InitAll(mDirect3D->GetDevice());
mTextureMgr.init(mDirect3D->GetDevice());
// Initialize wireframe render state
D3D11_RASTERIZER_DESC wireFrameDesc;
ZeroMemory(&wireFrameDesc, sizeof(D3D11_RASTERIZER_DESC));
wireFrameDesc.FillMode = D3D11_FILL_WIREFRAME;
wireFrameDesc.CullMode = D3D11_CULL_BACK;
wireFrameDesc.FrontCounterClockwise = false;
wireFrameDesc.DepthClipEnable = true;
HR(mDirect3D->GetDevice()->CreateRasterizerState(&wireFrameDesc, &WireFrameRS));
//--------------------------------------------------------
// Create sky
//--------------------------------------------------------
mSky = new Sky(mDirect3D->GetDevice(), L"Data/Textures/snowcube1024.dds", 5000.0f);
//--------------------------------------------------------
// Create terrain
//--------------------------------------------------------
// Describe terrain
Terrain::InitInfo tInitInfo;
tInitInfo.HeightMapFilename = L"Data/Textures/Heightmaps/terrain.raw";
tInitInfo.LayerMapFilename0 = L"Data/Textures/grass.dds";
tInitInfo.LayerMapFilename1 = L"Data/Textures/darkdirt.dds";
tInitInfo.LayerMapFilename2 = L"Data/Textures/stone.dds";
tInitInfo.LayerMapFilename3 = L"Data/Textures/lightdirt.dds";
tInitInfo.LayerMapFilename4 = L"Data/Textures/snow.dds";
tInitInfo.BlendMapFilename = L"Data/Textures/blend.dds";
tInitInfo.HeightScale = 50.0f;
tInitInfo.HeightmapWidth = 2049;
tInitInfo.HeightmapHeight = 2049;
tInitInfo.CellSpacing = 0.5f;
// Initialize terrain
mTerrain.Init(mDirect3D->GetDevice(), mDirect3D->GetImmediateContext(), tInitInfo);
//--------------------------------------------------------
// Particle systems
//--------------------------------------------------------
mRandomTexSRV = d3dHelper::CreateRandomTexture1DSRV(mDirect3D->GetDevice());
std::vector<std::wstring> flares;
flares.push_back(L"Data\\Textures\\flare0.dds");
mFlareTexSRV = d3dHelper::CreateTexture2DArraySRV(mDirect3D->GetDevice(), mDirect3D->GetImmediateContext(), flares);
mFire.init(mDirect3D->GetDevice(), Effects::FireFX, mFlareTexSRV, mRandomTexSRV, 500);
mFire.setEmitPos(XMFLOAT3(65.0f, 5.0f, 0.0f));
//--------------------------------------------------------
// Create shadow map
//--------------------------------------------------------
mShadowMapSize = 2048;
mShadowMap = new ShadowMap(mDirect3D->GetDevice(), mShadowMapSize, mShadowMapSize);
//--------------------------------------------------------
// Load models
//--------------------------------------------------------
mGenericModel = new GenericModel(mDirect3D->GetDevice(), mTextureMgr, "Data\\Models\\Collada\\duck.dae", L"Data\\Models\\Collada\\");
//mSkinnedModel = new GenericSkinnedModel(mDirect3D->GetDevice(), mTextureMgr, "Data\\Models\\Collada\\AnimTest\\test_Collada_DAE.dae", L"Data\\Models\\Collada\\AnimTest\\");
mPlayerModel = new GenericModel(mDirect3D->GetDevice(), mTextureMgr, "Data\\Models\\OBJ\\Cop\\cop.obj", L"Data\\Models\\OBJ\\Cop\\");
Player::InitProperties playerProp;
playerProp.PlayerID = 0;
playerProp.Nickname = "Hyzor";
playerProp.Speed = 1.0f;
playerProp.Health = 1.0f;
playerProp.Position = XMFLOAT3(0.0f, 0.0f, 0.0f);
playerProp.Scale = XMFLOAT3(1.0f, 1.0f, 1.0f);
playerProp.Angle = 0.0f;
playerProp.Model = mPlayerModel;
mPlayer.Init(playerProp);
//--------------------------------------------------------
// Create model instances
//--------------------------------------------------------
GenericModelInstance genericInstance;
genericInstance.model = mGenericModel;
// GenericSkinnedModelInstance genSkinnedInstance;
// genSkinnedInstance.model = mSkinnedModel;
// genSkinnedInstance.FinalTransforms.resize(mSkinnedModel->skinnedData.getBoneCount());
// genSkinnedInstance.ClipName = "animation";
// genSkinnedInstance.TimePos = 0.0f;
//--------------------------------------------------------
// Scale, rotate and move model instances
//.........这里部分代码省略.........