本文整理汇总了C++中ModelCreator::SetTopology方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelCreator::SetTopology方法的具体用法?C++ ModelCreator::SetTopology怎么用?C++ ModelCreator::SetTopology使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelCreator
的用法示例。
在下文中一共展示了ModelCreator::SetTopology方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void Billboard_Test::Init(Scene * scene)
{
BillboardPtr ptr = scene->AddBillboard();
Billboard * b = ptr.Get();
b->SetSize(20.0f, 20.0f);
b->UseDiffuseTexture(true);
b->SetDiffuseTexture("assets/fire.png");
StaticVert verts[4];
verts[0].pos = Vector3(-1.0f, -1.0f, 0.0f);
verts[1].pos = Vector3(-1.0f, 1.0f, 0.0f);
verts[2].pos = Vector3(1.0f, 1.0f, 0.0f);
verts[3].pos = Vector3(1.0f, -1.0f, 0.0f);
verts[0].u = 0.0f;
verts[0].v = 1.0f;
verts[1].u = 0.0f;
verts[1].v = 0.0f;
verts[2].u = 1.0f;
verts[2].v = 0.0f;
verts[3].u = 1.0f;
verts[3].v = 1.0f;
unsigned int ind[] = { 0, 1, 3, 1, 3, 2 };
ModelCreator<StaticVert> creator;
creator.StartMesh();
creator.SetTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
creator.SetDrawMethod(DM_DRAW_INDEXED);
creator.SetVertexBuffer(verts, sizeof(verts), sizeof(StaticVert));
creator.SetIndexBuffer(ind, 6);
creator.EndMesh();
StaticEntityPtr triPtr = scene->AddStaticEntity(creator, "tri");
StaticEntity * tri = triPtr.Get();
tri->Illuminate(false);
tri->SetPosition(50.0f, 0.0f, 0.0f);
tri->SetScale(20.0f, 20.0f, 2.0f);
Material * mat = tri->GetMaterial(0);
mat->UseDiffuseMap(true);
mat->SetDiffuseMap("assets/fire.png");
mat->SetEmmisivePower(1);
}
示例2: CreateLine
void Object_Picking_Test::CreateLine(Vector3 begin, Vector3 end)
{
StaticVert verts[2];
verts[0].pos = begin;
verts[1].pos = end;
ModelCreator<StaticVert> modelCreator;
modelCreator.StartMesh();
modelCreator.SetDrawMethod(DM_DRAW);
modelCreator.SetTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);
modelCreator.SetVertexBuffer(verts, sizeof(verts), sizeof(StaticVert));
modelCreator.EndMesh();
StaticEntityPtr linePtr = scene->AddStaticEntity(modelCreator, "line " + std::to_string(currentBox));
StaticEntity * line = linePtr.Get();
line->Illuminate(false);
Material * mat = line->GetMaterial(0);
mat->UseDiffuseMap(false);
mat->SetDiffuseColor(Color::Red());
currentBox++;
}
示例3: CreateBBox
StaticEntityPtr Object_Picking_Test::CreateBBox(StaticEntityPtr ptr)
{
AABB bbox = ptr.Get()->GetAABB();
Vector3 min = bbox.min;
Vector3 max = bbox.max;
StaticVert box[32];
box[0].pos = Vector3(min.x, max.y, min.z);
box[1].pos = Vector3(max.x, max.y, min.z);
box[2].pos = Vector3(max.x, max.y, min.z);
box[3].pos = Vector3(max.x, min.y, min.z);
box[4].pos = Vector3(max.x, min.y, min.z);
box[5].pos = Vector3(min.x,min.y,min.z);
box[6].pos = Vector3(min.x, min.y, min.z);
box[7].pos = Vector3(min.x, max.y, min.z);
box[8].pos = Vector3(min.x, max.y, max.z);
box[9].pos = Vector3(max.x, max.y, max.z);
box[10].pos = Vector3(max.x, max.y, max.z);
box[11].pos = Vector3(max.x, min.y, max.z);
box[12].pos = Vector3(max.x, min.y, max.z);
box[13].pos = Vector3(min.x, min.y, max.z);
box[14].pos = Vector3(min.x, min.y, max.z);
box[15].pos = Vector3(min.x, max.y, max.z);
box[16].pos = Vector3(max.x, max.y, min.z);
box[17].pos = Vector3(max.x, max.y, max.z);
box[18].pos = Vector3(max.x, max.y, max.z);
box[19].pos = Vector3(max.x, min.y, max.z);
box[20].pos = Vector3(max.x, min.y, max.z);
box[21].pos = Vector3(max.x, min.y, min.z);
box[22].pos = Vector3(max.x, min.y, min.z);
box[23].pos = Vector3(max.x, max.y, min.z);
box[24].pos = Vector3(min.x, max.y, min.z);
box[25].pos = Vector3(min.x, max.y, max.z);
box[26].pos = Vector3(min.x, max.y, max.z);
box[27].pos = Vector3(min.x, min.y, max.z);
box[28].pos = Vector3(min.x, min.y, max.z);
box[29].pos = Vector3(min.x, min.y, min.z);
box[30].pos = Vector3(min.x, min.y, min.z);
box[31].pos = Vector3(min.x, max.y, min.z);
ModelCreator<StaticVert> cr;
cr.StartMesh();
cr.SetTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
cr.SetDrawMethod(DM_DRAW);
cr.SetVertexBuffer(box, sizeof(box), sizeof(StaticVert));
cr.EndMesh();
StaticEntityPtr boxPtr = scene->AddStaticEntity(cr, "box" + std::to_string(currentBox));
StaticEntity * ent = boxPtr.Get();
Material * mat = ent->GetMaterial(0);
mat->SetDiffuseColor(Color::Blue());
currentBox++;
return boxPtr;
}