updated examples that are first_triangle.cpp and second_triangle.cpp

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-05-08 09:50:45 +08:00
parent 958183bb29
commit c8cbf020eb
3 changed files with 13 additions and 6 deletions

View File

@ -98,7 +98,12 @@ private:
bool InitAutoMaterial()
{
AutoDelete<MaterialCreateInfo> mci=mtl::CreateVertexColor2D(mtl::CoordinateSystem2D::NDC);
mtl::Material2DConfig cfg;
cfg.coordinate_system=mtl::CoordinateSystem2D::NDC;
cfg.local_to_world=false;
AutoDelete<MaterialCreateInfo> mci=mtl::CreateVertexColor2D(&cfg);
material_instance=db->CreateMaterialInstance(mci,&vil_config);

View File

@ -45,15 +45,17 @@ private:
bool InitMaterial()
{
AutoDelete<MaterialCreateInfo> mci;
mtl::Material2DConfig cfg;
#ifdef USE_ZERO2ONE_COORD
mci=mtl::CreateVertexColor2D(mtl::CoordinateSystem2D::ZeroToOne);
cfg.coordinate_system=mtl::CoordinateSystem2D::ZeroToOne;
#else
mci=mtl::CreateVertexColor2D(mtl::CoordinateSystem2D::Ortho);
cfg.coordinate_system=mtl::CoordinateSystem2D::Ortho;
#endif//USE_ZERO2ONE_COORD
//material_instance=db->CreateMaterialInstance(OS_TEXT("res/material/VertexColor2D"));
cfg.local_to_world=false;
AutoDelete<MaterialCreateInfo> mci=mtl::CreateVertexColor2D(&cfg);
material_instance=db->CreateMaterialInstance(mci);

View File

@ -205,7 +205,7 @@ public:
cb->BindDescriptorSets(ri);
cb->BindVBO(ri);
if (vid->index_buffer)
if (vid->index_buffer->buffer)
cb->DrawIndexed(vid->index_buffer->buffer->GetCount());
else
cb->Draw(vid->vertex_count);