本文整理汇总了C++中MeshData::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshData::SetName方法的具体用法?C++ MeshData::SetName怎么用?C++ MeshData::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshData
的用法示例。
在下文中一共展示了MeshData::SetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CreateDiamond(
MeshData& Diamond)
{
Diamond.SetName("Diamond");
AttribData<vec3> Vertices; Vertices.Resize(6);
Vertices.Set(0, vec3( 0.0f, 0.5f, 0.0f ));
Vertices.Set(1, vec3( 0.5f, 0.0f, 0.0f ));
Vertices.Set(2, vec3( 0.0f, 0.0f,-0.5f ));
Vertices.Set(3, vec3(-0.5f, 0.0f, 0.0f ));
Vertices.Set(4, vec3( 0.0f, 0.0f, 0.5f ));
Vertices.Set(5, vec3( 0.0f,-0.5f, 0.0f ));
AttribData<vec3> Normals; Normals.Resize(6);
Normals.Set(0, vec3( 0.0f, 1.0f, 0.0f ));
Normals.Set(1, vec3( 1.0f, 0.0f, 0.0f ));
Normals.Set(2, vec3( 0.0f, 0.0f,-1.0f ));
Normals.Set(3, vec3(-1.0f, 0.0f, 0.0f ));
Normals.Set(4, vec3( 0.0f, 0.0f, 1.0f ));
Normals.Set(5, vec3( 0.0f,-1.0f, 0.0f ));
AttribData<vec2> TexCoords; TexCoords.Resize(6);
TexCoords.Set(0, vec2(0.5f, 1.0f) );
TexCoords.Set(1, vec2(0.0f, 0.5f) );
TexCoords.Set(2, vec2(0.25f, 0.5f) );
TexCoords.Set(3, vec2(0.5f, 0.5f) );
TexCoords.Set(4, vec2(0.75f, 0.5f) );
TexCoords.Set(5, vec2(0.5f, 0.0f) );
AttribData<GLFace16> Faces; Faces.Resize(8);
Faces.Set(0, GLFace16(0, 1, 2) );
Faces.Set(1, GLFace16(0, 2, 3) );
Faces.Set(2, GLFace16(0, 3, 4) );
Faces.Set(3, GLFace16(0, 4, 1) );
Faces.Set(4, GLFace16(5, 2, 1) );
Faces.Set(5, GLFace16(5, 3, 2) );
Faces.Set(6, GLFace16(5, 4, 3) );
Faces.Set(7, GLFace16(5, 1, 4) );
Polygons Polylist1;
Polylist1.SetMaterial(0);
Polylist1.SetFaces(Faces);
AttribData<poly> Polygons;
Polygons.Resize(1);
Polygons.Set(0, Polylist1);
Diamond.SetName("DiamondMesh");
Diamond.SetVertexArray(Vertices);
Diamond.SetUVArray(TexCoords);
Diamond.GenerateNormals(false);
Diamond.GenerateTangents();
Diamond.SetPolygonList(Polygons);
}
示例2: EndEdit
void DataListCtrl::EndEdit(bool update)
{
if (!m_rename_text->IsShown())
return;
if (update)
{
wxString new_name = m_rename_text->GetValue();
long item = GetNextItem(-1,
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
DataManager* mgr = vr_frame?vr_frame->GetDataManager():0;
if (item != -1 && mgr)
{
wxString name = GetText(item, 1);
if (new_name != name)
{
wxString new_name2 = new_name;
for (int i=1; mgr->CheckNames(new_name2); i++)
new_name2 = new_name+wxString::Format("_%d", i);
if (GetItemText(item) == "Volume")
{
VolumeData* vd = mgr->GetVolumeData(name);
if (vd)
vd->SetName(new_name2);
}
else if (GetItemText(item) == "Mesh")
{
MeshData* md = mgr->GetMeshData(name);
if (md)
md->SetName(new_name2);
}
else if (GetItemText(item) == "Annotations")
{
Annotations* ann = mgr->GetAnnotations(name);
if (ann)
ann->SetName(new_name2);
}
//update ui
SetText(item, 1, new_name2);
vr_frame->UpdateTree();
}
}
}
m_rename_text->Hide();
}
示例3: CreateScreen
void CreateScreen(
ModelData& ScreenMesh)
{
MeshData Screen;
AttribData<vec3> Screen_vert;
Screen_vert.Resize(4);
Screen_vert.Set(0, vec3(-1.0f, 1.0f, 1.0f)); // lu-corner
Screen_vert.Set(1, vec3( 1.0f, 1.0f, 1.0f)); // ru-corner
Screen_vert.Set(2, vec3(-1.0f, -1.0f, 1.0f)); // bl-corner
Screen_vert.Set(3, vec3( 1.0f, -1.0f, 1.0f)); // br-corner
AttribData<vec2> Screen_UVs;
Screen_UVs.Resize(4);
Screen_UVs.Set(0, vec2(0.0f, 0.0f));
Screen_UVs.Set(1, vec2(0.0f, 1.0f));
Screen_UVs.Set(2, vec2(1.0f, 0.0f));
Screen_UVs.Set(3, vec2(1.0f, 1.0f));
AttribData<GLFace16> Screen_face;
Screen_face.Resize(2);
Screen_face.Set(0, GLFace16(0, 1, 2));
Screen_face.Set(1, GLFace16(1, 3, 2));
Polygons polys;
polys.SetFaces(Screen_face);
polys.SetMaterial(0);
AttribData<Polygons> polygons;
polygons.Resize(1);
polygons.Set(0, polys);
Screen.SetName("Screen");
Screen.SetVertexArray(Screen_vert);
Screen.SetUVArray(Screen_UVs);
Screen.SetPolygonList(polygons);
Screen.GenerateNormals(false);
Screen.GenerateTangents();
MaterialData Screen_mat;
Screen_mat.MaterialType = HasRenderedTexture;
Library<MaterialData> lib_mat;
lib_mat.Resize(1);
lib_mat.Set(0, Screen_mat);
Library<MeshData> lib_mesh;
lib_mesh.Resize(1);
lib_mesh.Set(0, Screen);
ScreenMesh.SetMeshData(lib_mesh);
ScreenMesh.SetMaterialData(lib_mat);
}