本文整理汇总了C++中SkyBox::GetTopology方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyBox::GetTopology方法的具体用法?C++ SkyBox::GetTopology怎么用?C++ SkyBox::GetTopology使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkyBox
的用法示例。
在下文中一共展示了SkyBox::GetTopology方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateSkyBox
void DxManager::CreateSkyBox(string texture)
{
if(this->skybox)
delete this->skybox;
SkyBox* sb = new SkyBox(this->camera->getPosition(), 10, 10);
MeshStrip* strip = sb->GetStrips()->get(0);
// Create the desc for the buffer
BUFFER_INIT_DESC BufferDesc;
BufferDesc.ElementSize = sizeof(Vertex);
BufferDesc.InitData = strip->getVerts();
BufferDesc.NumElements = strip->getNrOfVerts();
BufferDesc.Type = VERTEX_BUFFER;
BufferDesc.Usage = BUFFER_DEFAULT;
// Create the buffer
Buffer* VertexBuffer = new Buffer();
if(FAILED(VertexBuffer->Init(this->Dx_Device, this->Dx_DeviceContext, BufferDesc)))
MaloW::Debug("Failed to init skybox");
BUFFER_INIT_DESC indiceBufferDesc;
indiceBufferDesc.ElementSize = sizeof(int);
indiceBufferDesc.InitData = strip->getIndicies();
indiceBufferDesc.NumElements = strip->getNrOfIndicies();
indiceBufferDesc.Type = INDEX_BUFFER;
indiceBufferDesc.Usage = BUFFER_DEFAULT;
Buffer* IndexBuffer = new Buffer();
if(FAILED(IndexBuffer->Init(this->Dx_Device, this->Dx_DeviceContext, indiceBufferDesc)))
MaloW::Debug("Failed to init skybox");
D3DX11_IMAGE_LOAD_INFO loadSMInfo;
loadSMInfo.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
ID3D11Texture2D* SMTexture = 0;
D3DX11CreateTextureFromFile(this->Dx_Device, texture.c_str(),
&loadSMInfo, 0, (ID3D11Resource**)&SMTexture, 0);
D3D11_TEXTURE2D_DESC SMTextureDesc;
SMTexture->GetDesc(&SMTextureDesc);
D3D11_SHADER_RESOURCE_VIEW_DESC SMViewDesc;
SMViewDesc.Format = SMTextureDesc.Format;
SMViewDesc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURECUBE;
SMViewDesc.TextureCube.MipLevels = SMTextureDesc.MipLevels;
SMViewDesc.TextureCube.MostDetailedMip = 0;
ID3D11ShaderResourceView* text;
this->Dx_Device->CreateShaderResourceView(SMTexture, &SMViewDesc, &text);
SMTexture->Release();
Object3D* ro = new Object3D(VertexBuffer, IndexBuffer, text, sb->GetTopology());
strip->SetRenderObject(ro);
this->skybox = sb;
}