How do you migrate Flexible Vertex Format Constants (or FVF codes) from DirectX 9 to Direct3D 11?
Old code:
#include <d3dx9.h>
struct Vertex {
public:
Vertex() : p(D3DXVECTOR3(0.0f, 0.0f, 0.0f)), n(D3DXVECTOR3(0.0f, 0.0f, 0.0f)), tu(0.0f), tv(0.0f) {}
Vertex(D3DXVECTOR3 p, D3DXVECTOR3 n, float tu, float tv) : p(p), n(n), tu(tu), tv(tv) {}
// Position of the vertex (in world space)
D3DXVECTOR3 p;
// Normal of this vertex
D3DXVECTOR3 n;
// Texture UV coordinates
float tu, tv;
};
// D3DFVF_XYZ: Vertex format includes the position of an untransformed vertex.
// D3DFVF_NORMAL: Vertex format includes a vertex normal vector.
// D3DFVF_TEX1: Number of texture coordinate sets for this vertex.
#define VERTEX_FVF ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
#define VERTEX_FVF_SIZE D3DXGetFVFVertexSize( VERTEX_FVF )
New code without D3DX:
#include <DirectXMath.h>
using namespace DirectX;
struct Vertex {
public:
Vertex() : p(XMFLOAT3(0.0f, 0.0f, 0.0f)), n(XMFLOAT3(0.0f, 0.0f, 0.0f)), tu(0.0f), tv(0.0f) {}
Vertex(XMFLOAT3 p, XMFLOAT3 n, float tu, float tv) : p(p), n(n), tu(tu), tv(tv) {}
// Position of the vertex (in world space)
XMFLOAT3 p;
// Normal of this vertex
XMFLOAT3 n;
// Texture UV coordinates
float tu, tv;
};
// ??
P.S.: Can someone with enough reputation points create and add a directx9
tag.