-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeshObject.cpp
More file actions
35 lines (28 loc) · 1.09 KB
/
MeshObject.cpp
File metadata and controls
35 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//// PARTICULAR PURPOSE.
////
//// Copyright (c) Microsoft Corporation. All rights reserved
#include "pch.h"
#include "MeshObject.h"
#include "DirectXSample.h"
#include "ConstantBuffers.h"
using namespace Microsoft::WRL;
using namespace DirectX;
MeshObject::MeshObject():
m_vertexCount(0),
m_indexCount(0)
{
}
//--------------------------------------------------------------------------------
void MeshObject::Render(_In_ ID3D11DeviceContext *context)
{
uint32 stride = sizeof(PNTVertex);
uint32 offset = 0;
context->IASetVertexBuffers(0, 1, m_vertexBuffer.GetAddressOf(), &stride, &offset);
context->IASetIndexBuffer(m_indexBuffer.Get(), DXGI_FORMAT_R16_UINT, 0);
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
context->DrawIndexed(m_indexCount, 0, 0);
}
//--------------------------------------------------------------------------------