I'm following the "3D game programming with DirectX 11" book (Frank Luna) and i'm having this issue. There is no valid constructor to convert from (const float*) to DirectX::XMFLOAT4
namespace Colors {
XMGLOBALCONST XMVECTORF32 White = { 1.0f, 1.0f, 1.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Black = { 0.0f, 0.0f, 0.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Red = { 1.0f, 0.0f, 0.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Green = { 0.0f, 1.0f, 0.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Blue = { 0.0f, 0.0f, 1.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Yellow = { 1.0f, 1.0f, 0.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Cyan = { 0.0f, 1.0f, 1.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Magenta = { 1.0f, 0.0f, 1.0f, 1.0f };
XMGLOBALCONST XMVECTORF32 Silver = { 0.75f, 0.75f, 0.75f, 1.0f };
XMGLOBALCONST XMVECTORF32 LightSteelBlue = { 0.69f, 0.77f, 0.87f, 1.0f };
}
The error is here
Vertex vertices[] = {
{ XMFLOAT3(-1.0f, -1.0f, -1.0f), (const float*)&Colors::White },
{XMFLOAT3(-1.0f, +1.0f, -1.0f), (const float*)&Colors::Black },
{XMFLOAT3(+1.0f, +1.0f, -1.0f), (const float*)&Colors::Red },
{XMFLOAT3(+1.0f, -1.0f, -1.0f), (const float*)&Colors::Green},
{XMFLOAT3(-1.0f, -1.0f, +1.0f), (const float*)&Colors::Blue},
{XMFLOAT3 (-1.0f, +1.0f, +1.0f), (const float*)&Colors::Yellow},
{XMFLOAT3 (+1.0f, +1.0f, +1.0f), (const float*)&Colors::Cyan},
{XMFLOAT3 (+1.0f, -1.0f, +1.0f), (const float*)&Colors::Magenta}
};
and this is the struct Vertex
struct Vertex {
XMFLOAT3 Pos; XMFLOAT4 Color;
};