本文整理汇总了C++中Sky::SetMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ Sky::SetMaterial方法的具体用法?C++ Sky::SetMaterial怎么用?C++ Sky::SetMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sky
的用法示例。
在下文中一共展示了Sky::SetMaterial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadAssets
void Simulation::LoadAssets()
{
ID3D11SamplerState* wrapSampler;
D3D11_SAMPLER_DESC wsd;
ZeroMemory(&wsd, sizeof(D3D11_SAMPLER_DESC));
wsd.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
wsd.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
wsd.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
wsd.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
wsd.MaxAnisotropy = 0;
wsd.ComparisonFunc = D3D11_COMPARISON_NEVER;
wsd.MinLOD = 0;
wsd.MaxLOD = 0;
wsd.MipLODBias = 0;
dev->CreateSamplerState(&wsd, &wrapSampler);
Material* heightmap = new Material(L"Textures/grass.png", wrapSampler, dev);
heightmap->LoadShader(L"Heightmap.cso", Vert, dev);
heightmap->LoadShader(L"TexturedDiffuse.cso", Pixel, dev);
Material* waterMat = new Material(L"Textures/water.png", wrapSampler, dev);
waterMat->LoadShader(L"WaterVertex.cso", Vert, dev);
waterMat->LoadShader(L"WaterPixel.cso", Pixel, dev);
MeshData skySphere;
MeshGenerator::CreateSphere(1000.0, 2, skySphere);
Mesh* skySphereMesh = new Mesh(skySphere, dev);
Sky* sky = new Sky(skySphereMesh, dev);
sky->LoadCubeMap(L"Textures/oceansky.dds", dev);
sky->SetMaterial(L"SkyVertex.cso", L"SkyPixel.cso", wrapSampler, dev);
objects.push_back(sky);
Terrain* terrain = new Terrain(500.0f, 500.0f, 500, 500, heightmap, L"Textures/heightmap.png", dev);
terrain->LoadNormalMap(L"Textures/normalmap2.png", dev);
terrain->SetBufferData(100.0, dev);
terrain->SetTextures(L"Textures/sand.png", L"Textures/grass.png", L"Textures/cliff.png",dev);
objects.push_back(terrain);
Terrain* water = new Terrain(500.0f, 500.0f, 500, 500, waterMat, L"Textures/waterHeightMap.png", dev);
water->LoadNormalMap(L"Textures/waterNormalMap.png", dev);
water->SetBufferData(5.0, 0.0, 0.0, dev);
water->SetPosition(XMFLOAT3(0, 27.0, 0));
objects.push_back(water);
}