本文整理汇总了C++中Appearance::SetTextureRV方法的典型用法代码示例。如果您正苦于以下问题:C++ Appearance::SetTextureRV方法的具体用法?C++ Appearance::SetTextureRV怎么用?C++ Appearance::SetTextureRV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Appearance
的用法示例。
在下文中一共展示了Appearance::SetTextureRV方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialise
HRESULT Application::Initialise(HINSTANCE hInstance, int nCmdShow)
{
if (FAILED(InitWindow(hInstance, nCmdShow)))
{
return E_FAIL;
}
RECT rc;
GetClientRect(_hWnd, &rc);
_WindowWidth = rc.right - rc.left;
_WindowHeight = rc.bottom - rc.top;
if (FAILED(InitDevice()))
{
Cleanup();
return E_FAIL;
}
CreateDDSTextureFromFile(_pd3dDevice, L"Resources\\stone.dds", nullptr, &_pTextureRV);
CreateDDSTextureFromFile(_pd3dDevice, L"Resources\\floor.dds", nullptr, &_pGroundTextureRV);
objMeshData = OBJLoader::Load("sphere.obj", _pd3dDevice);
// Setup Camera
XMFLOAT3 eye = XMFLOAT3(0.0f, 2.0f, -1.0f);
XMFLOAT3 at = XMFLOAT3(0.0f, 2.0f, 0.0f);
XMFLOAT3 up = XMFLOAT3(0.0f, 1.0f, 0.0f);
_camera = new Camera(eye, at, up, (float)_renderWidth, (float)_renderHeight, 0.01f, 200.0f);
// Setup the scene's light
basicLight.AmbientLight = XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f);
basicLight.DiffuseLight = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
basicLight.SpecularLight = XMFLOAT4(0.8f, 0.8f, 0.8f, 1.0f);
basicLight.SpecularPower = 20.0f;
basicLight.LightVecW = XMFLOAT3(0.0f, 1.0f, -1.0f);
Geometry cubeGeometry;
cubeGeometry.indexBuffer = _pIndexBuffer;
cubeGeometry.vertexBuffer = _pVertexBuffer;
cubeGeometry.numberOfIndices = 36;
cubeGeometry.vertexBufferOffset = 0;
cubeGeometry.vertexBufferStride = sizeof(SimpleVertex);
Geometry planeGeometry;
planeGeometry.indexBuffer = _pPlaneIndexBuffer;
planeGeometry.vertexBuffer = _pPlaneVertexBuffer;
planeGeometry.numberOfIndices = 6;
planeGeometry.vertexBufferOffset = 0;
planeGeometry.vertexBufferStride = sizeof(SimpleVertex);
Geometry sphereGeometry;
sphereGeometry.indexBuffer = objMeshData.IndexBuffer;
sphereGeometry.vertexBuffer = objMeshData.VertexBuffer;
sphereGeometry.numberOfIndices = objMeshData.IndexCount;
sphereGeometry.vertexBufferOffset = objMeshData.VBOffset;
sphereGeometry.vertexBufferStride = objMeshData.VBStride;
Material shinyMaterial;
shinyMaterial.ambient = XMFLOAT4(0.3f, 0.3f, 0.3f, 1.0f);
shinyMaterial.diffuse = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
shinyMaterial.specular = XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f);
shinyMaterial.specularPower = 10.0f;
Material noSpecMaterial;
noSpecMaterial.ambient = XMFLOAT4(0.1f, 0.1f, 0.1f, 1.0f);
noSpecMaterial.diffuse = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
noSpecMaterial.specular = XMFLOAT4(0.0f, 0.0f, 0.0f, 0.0f);
noSpecMaterial.specularPower = 0.0f;
Appearance * floorAppearance = new Appearance(planeGeometry, noSpecMaterial);
floorAppearance->SetTextureRV(_pGroundTextureRV);
Appearance * crateAppearance = new Appearance(cubeGeometry, shinyMaterial);
crateAppearance->SetTextureRV(_pTextureRV);
Appearance * sphereAppearance = new Appearance(sphereGeometry, shinyMaterial);
sphereAppearance->SetTextureRV(_pTextureRV);
Transform * floorTransform = new Transform();
floorTransform->SetPosition(0.0f, 0.0f, 0.0f);
floorTransform->SetScale(15.0f, 15.0f, 15.0f);
floorTransform->SetRotation(XMConvertToRadians(90.0f), 0.0f, 0.0f);
Transform * sphereTransform = new Transform();
sphereTransform->SetPosition(0.0f, 1.0f, 0.0f);
ParticleModel * particleModel = new ParticleModel(floorTransform, false, XMFLOAT3(0.0f, 0.0f, 0.0f), XMFLOAT3(0.0f, 0.0f, 0.0f));
GameObject * gameObject = new GameObject("Floor", floorAppearance, floorTransform, particleModel);
_gameObjects.push_back(gameObject);
for (auto i = 0; i < 5; i++)
{
Transform * cubeTransform = new Transform();
cubeTransform->SetScale(0.5f, 0.5f, 0.5f);
cubeTransform->SetPosition(-4.0f + (i * 2.0f), 0.5f, 10.0f);
//.........这里部分代码省略.........