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, ...@@ -25,13 +25,17 @@ Pyramid::Pyramid( Graphics& gfx,std::mt19937& rng,
std::array<char,4> color; std::array<char,4> color;
char padding; char padding;
}; };
auto model = Cone::MakeTesselatedIndependentFaces<Vertex>( tdist( rng ) ); const auto tesselation = tdist( rng );
// set vertex colors for mesh auto model = Cone::MakeTesselatedIndependentFaces<Vertex>( tesselation );
// set vertex colors for mesh (tip red blending to blue base)
for( auto& v : model.vertices ) 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 // squash mesh a bit in the z direction
model.Transform( dx::XMMatrixScaling( 1.0f,1.0f,0.7f ) ); model.Transform( dx::XMMatrixScaling( 1.0f,1.0f,0.7f ) );
// add normals // add normals
...@@ -56,6 +60,14 @@ Pyramid::Pyramid( Graphics& gfx,std::mt19937& rng, ...@@ -56,6 +60,14 @@ Pyramid::Pyramid( Graphics& gfx,std::mt19937& rng,
AddStaticBind( std::make_unique<InputLayout>( gfx,ied,pvsbc ) ); AddStaticBind( std::make_unique<InputLayout>( gfx,ied,pvsbc ) );
AddStaticBind( std::make_unique<Topology>( gfx,D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST ) ); 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 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