зеркало из https://github.com/microsoft/DirectXTK.git
Updated for type aliases
Родитель
a15f1f25c5
Коммит
03f00f0693
|
@ -54,7 +54,13 @@ For exception safety, the factory functions return a ``std::unique_ptr``.
|
|||
|
||||
* **CreateTorus**( deviceContext, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32): Creates a [torus](http://en.wikipedia.org/wiki/Torus) of given diameter, thickness, and tessellation factor.
|
||||
|
||||
> Note that ``GeometricPrimitive::VertexType`` is an alias for [[VertexPositionNormalTexture|VertexTypes]]
|
||||
# Type aliases
|
||||
|
||||
* **GeometricPrimitive::VertexType** is an alias for [[VertexPositionNormalTexture|VertexTypes]]
|
||||
|
||||
* **GeometricPrimitive::VertexCollection** is an alias for ``std::vector<VertexType>``.
|
||||
|
||||
* **GeometricPrimitive::IndexCollection** is an alias for ``std::vector<uint16_t>``.
|
||||
|
||||
# Simple drawing
|
||||
Simple solid shape drawing:
|
||||
|
@ -161,8 +167,8 @@ shape->Draw(world, view, projection, Colors::White, catTexture, false, [=]
|
|||
There are equivalent static methods for each of the factory methods that return the vertex and index buffer data as ``std::vector``. These values can be modified, and then used to create a customized geometric primitive or drawn through some other mechanism.
|
||||
|
||||
```cpp
|
||||
std::vector<VertexPositionNormalTexture> vertices;
|
||||
std::vector<uint16_t> indices;
|
||||
GeometricPrimitive::VertexCollection vertices;
|
||||
GeometricPrimitive::IndexCollection indices;
|
||||
GeometricPrimitive::CreateBox( vertices, indices,
|
||||
XMFLOAT3(1.f/2.f, 2.f/2.f, 3.f/2.f) );
|
||||
|
||||
|
@ -253,11 +259,11 @@ std::unique_ptr<DirectX::CommonStates> states;
|
|||
|
||||
```cpp
|
||||
// Create shape data
|
||||
std::vector<VertexPositionNormalTexture> vertices;
|
||||
std::vector<uint16_t> indices;
|
||||
GeometricPrimitive::VertexCollection vertices;
|
||||
GeometricPrimitive::IndexCollection indices;
|
||||
GeometricPrimitive::CreateSphere(vertices, indices);
|
||||
|
||||
std::vector<VertexPositionColor> newVerts;
|
||||
GeometricPrimitive::VertexCollection newVerts;
|
||||
newVerts.reserve(vertices.size());
|
||||
for (auto it : vertices)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,10 @@ Note that Model uses a collection of ``std::shared_ptr`` instances to ModelMesh
|
|||
# Initialization
|
||||
ModelMesh instances are typically created by a Model loader along with the ModelMeshPart instances that make up the mesh.
|
||||
|
||||
# Type alias
|
||||
|
||||
**ModelMesh::Collection** is an alias for ``std::vector<std::shared_ptr<ModelMesh>>``.
|
||||
|
||||
# Simple drawing
|
||||
Use the ``Model::Draw`` function which will call **ModelMesh::Draw** on all the meshes it contains. See [[Model]] for an example.
|
||||
|
||||
|
|
|
@ -10,6 +10,12 @@ This class is part of the [[Model]] hierarchy. The purpose of this class is to b
|
|||
# Initialization
|
||||
ModelMeshPart instances are typically created by a Model loader along with the ModelMesh instances that contain the submeshes.
|
||||
|
||||
# Type aliases
|
||||
|
||||
* **ModelMeshPart::Collection** is an alias for ``std::vector<std::unique_ptr<ModelMeshPart>>``.
|
||||
|
||||
* **ModelMeshPart::InputLayoutCollection** is an alias for ``std::vector<D3D11_INPUT_ELEMENT_DESC>``.
|
||||
|
||||
# Data
|
||||
All members of ModelMeshPart are public to facilitate writing custom model loaders and sophisticated rendering solutions. Care should be taken whenever modifying any of these elements as they have interdependencies, and can ultimately be referenced by numerous instances of Model via shared ModelMesh instances.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче