#pragma once #include "Triangle.h" #include "Bindable.h" #include "VertexBuffer.h" Triangle::Triangle(Graphics& gfx, float** position, float r, float g, float b) : r(r), g(g), b(b), position(position) { const std::vector vertices = { { position[0][0], position[0][1], position[0][2] }, { position[1][0], position[1][1], position[1][2] }, { position[2][0], position[2][1], position[2][2] } }; AddBind(std::make_unique(gfx, vertices)); /* auto pvs = std::make_unique(gfx, L"VertexShader.cso"); auto pvsbc = pvs->GetBytecode(); AddBind(std::move(pvs)); AddBind(std::make_unique(gfx, L"PixelShader.cso")); const std::vector indices = { 0,2,1, 2,3,1, 1,3,5, 3,7,5, 2,6,3, 3,6,7, 4,5,7, 4,7,6, 0,4,2, 2,4,6, 0,1,4, 1,5,4 }; AddIndexBuffer(std::make_unique(gfx, indices)); struct ConstantBuffer2 { struct { float r; float g; float b; float a; } face_colors[6]; }; const ConstantBuffer2 cb2 = { { { 1.0f,0.0f,1.0f }, { 1.0f,0.0f,0.0f }, { 0.0f,1.0f,0.0f }, { 0.0f,0.0f,1.0f }, { 1.0f,1.0f,0.0f }, { 0.0f,1.0f,1.0f }, } }; AddBind(std::make_unique>(gfx, cb2)); const std::vector ied = { { "Position",0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0 }, }; AddBind(std::make_unique(gfx, ied, pvsbc)); AddBind(std::make_unique(gfx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST)); AddBind(std::make_unique(gfx, *this)); */ } /* void Box::Update(float dt) noexcept { roll += droll * dt; pitch += dpitch * dt; yaw += dyaw * dt; theta += dtheta * dt; phi += dphi * dt; chi += dchi * dt; } DirectX::XMMATRIX Box::GetTransformXM() const noexcept { return DirectX::XMMatrixRotationRollPitchYaw(pitch, yaw, roll) * DirectX::XMMatrixTranslation(r, 0.0f, 0.0f) * DirectX::XMMatrixRotationRollPitchYaw(theta, phi, chi) * DirectX::XMMatrixTranslation(0.0f, 0.0f, 20.0f); } */