Commit 85e7ba5b authored by chili's avatar chili
Browse files

fix dat pyramid boi (needed a ps cbuf)

parent e16cbfd1
......@@ -25,13 +25,17 @@ Pyramid::Pyramid( Graphics& gfx,std::mt19937& rng,
std::array<char,4> color;
char padding;
};
auto model = Cone::MakeTesselatedIndependentFaces<Vertex>( tdist( rng ) );
// set vertex colors for mesh
const auto tesselation = tdist( rng );
auto model = Cone::MakeTesselatedIndependentFaces<Vertex>( tesselation );
// set vertex colors for mesh (tip red blending to blue base)
for( auto& v : model.vertices )
{
v.color = { (char)40,(char)40,(char)255 };
v.color = { (char)10,(char)10,(char)255 };
}
for( int i = 0; i < tesselation; i++ )
{
model.vertices[i * 3].color = { (char)255,(char)10,(char)10 };
}
model.vertices.front().color = { (char)255,(char)20,(char)20 }; // very first vertex is the cone tip
// squash mesh a bit in the z direction
model.Transform( dx::XMMatrixScaling( 1.0f,1.0f,0.7f ) );
// add normals
......@@ -56,6 +60,14 @@ Pyramid::Pyramid( Graphics& gfx,std::mt19937& rng,
AddStaticBind( std::make_unique<InputLayout>( gfx,ied,pvsbc ) );
AddStaticBind( std::make_unique<Topology>( gfx,D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST ) );
struct PSMaterialConstant
{
float specularIntensity = 0.6f;
float specularPower = 30.0f;
float padding[2];
} colorConst;
AddStaticBind( std::make_unique<PixelConstantBuffer<PSMaterialConstant>>( gfx,colorConst,1u ) );
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment