本文整理汇总了C++中Polygons::SetMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ Polygons::SetMaterial方法的具体用法?C++ Polygons::SetMaterial怎么用?C++ Polygons::SetMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygons
的用法示例。
在下文中一共展示了Polygons::SetMaterial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CreatePatch(
MeshData& Mesh)
{
Mesh.SetName("Patch");
AttribData<vec3> aVertex;// = MeshArray.SetVertexArray();
aVertex.Resize(4);
aVertex.Set(0, vec3(-10.0f, 0.0f,-10.0f));
aVertex.Set(1, vec3(-10.0f, 0.0f, 10.0f));
aVertex.Set(2, vec3( 10.0f, 0.0f,-10.0f));
aVertex.Set(3, vec3( 10.0f, 0.0f, 10.0f));
Mesh.SetVertexArray(aVertex);
AttribData<vec2> aTexCoords;// = MeshArray.SetUVArray();
aTexCoords.Resize(4);
aTexCoords.Set(0, glm::vec2( 0.0f, 0.0f));
aTexCoords.Set(1, glm::vec2( 0.0f, 1.0f));
aTexCoords.Set(2, glm::vec2( 1.0f, 0.0f));
aTexCoords.Set(3, glm::vec2( 1.0f, 1.0f));
Mesh.SetUVArray(aTexCoords);
AttribData<vec3> aNormal;// = MeshArray.SetNormalArray();
aNormal.Resize(4);
aNormal.Set(0, vec3(0.0f, 1.0f, 0.0f));
aNormal.Set(1, vec3(0.0f, 1.0f, 0.0f));
aNormal.Set(2, vec3(0.0f, 1.0f, 0.0f));
aNormal.Set(3, vec3(0.0f, 1.0f, 0.0f));
Mesh.SetNormalArray(aNormal);
AttribData<vec3> aTangent;// = MeshArray.SetTangentArray();
aTangent.Resize(4);
aTangent.Set(0, vec3(1.0f, 0.0f, 0.0f));
aTangent.Set(1, vec3(1.0f, 0.0f, 0.0f));
aTangent.Set(2, vec3(1.0f, 0.0f, 0.0f));
aTangent.Set(3, vec3(1.0f, 0.0f, 0.0f));
Mesh.SetTangentArray(aTangent.GetBufferPointer(), aTangent.Size());
AttribData<vec3> aBitangent;// = MeshArray.SetBitangentArray();
aBitangent.Resize(4);
aBitangent.Set(0, vec3(0.0f, 0.0f, 1.0f));
aBitangent.Set(1, vec3(0.0f, 0.0f, 1.0f));
aBitangent.Set(2, vec3(0.0f, 0.0f, 1.0f));
aBitangent.Set(3, vec3(0.0f, 0.0f, 1.0f));
Mesh.SetBitangentArray(aBitangent);
AttribData<Polygons> aFaces;// = MeshArray.SetPolygonArray();
Polygons polys;
polys.SetMaterial(0);
polys.SetFaces().Resize(2);
polys.SetFaces().Set(0, GLFace16(0, 1, 2));
polys.SetFaces().Set(1, GLFace16(0, 2, 3));
aFaces.Resize(1);
aFaces.Set(0, polys);
Mesh.SetPolygonList(aFaces);
}
示例2: 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);
}