本文整理汇总了C++中RenderObject::GetMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderObject::GetMesh方法的具体用法?C++ RenderObject::GetMesh怎么用?C++ RenderObject::GetMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderObject
的用法示例。
在下文中一共展示了RenderObject::GetMesh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Node
//----------------------------------------------------------------------------
Node* Sample5::CreateCube(Bool useTexture, Bool useNormals,
Bool useVertexColor, ColorRGBA vertexColor)
{
RenderObject* pCube = StandardMesh::CreateCube24(useVertexColor ? 4 : 0,
useTexture ? 1 : 0, useNormals);
VertexBuffer* const pVBuffer = pCube->GetMesh()->GetVertexBuffer();
for (UInt i = 0; i < pVBuffer->GetQuantity(); i++)
{
if (useVertexColor)
{
if (pVBuffer->Position3(i).Z() > 0)
{
pVBuffer->Color4(i) = vertexColor;
}
else
{
pVBuffer->Color4(i) = vertexColor * 0.5F;
}
}
}
pCube->GetMesh()->GenerateNormals();
if (useTexture)
{
Material* pMaterial = WIRE_NEW Material;
pMaterial->AddTexture(CreateTexture(), Material::BM_MODULATE);
pCube->SetMaterial(pMaterial);
}
Node* pCubeNode = WIRE_NEW Node(pCube);
return pCubeNode;
}
示例2: CreateTexture
//----------------------------------------------------------------------------
RenderObject* Sample5::CreatePlane()
{
const UInt tileXCount = 30;
const UInt tileYCount = 20;
const Float xSizeTotal = 12.0F;
const Float ySizeTotal = 8.0F;
RenderObject* pPlane = StandardMesh::CreatePlane(tileXCount, tileYCount,
xSizeTotal, ySizeTotal, 0, 1, true);
pPlane->GetMesh()->GenerateNormals();
Texture2D* pTexture = CreateTexture();
pTexture->SetWrapType(0, Texture2D::WT_REPEAT);
pTexture->SetWrapType(1, Texture2D::WT_REPEAT);
Material* pMaterial = WIRE_NEW Material;
pMaterial->AddTexture(pTexture, Material::BM_MODULATE);
pPlane->SetMaterial(pMaterial);
// attach a material state and a light to the plane geometry directly
StateMaterial* pStateMaterial = WIRE_NEW StateMaterial;
pStateMaterial->Ambient = ColorRGBA(1, 1, 1, 1);
pPlane->GetStates()[State::MATERIAL] = pStateMaterial;
mspSpotLight = WIRE_NEW Light(Light::LT_SPOT);
mspSpotLight->Position = Vector3F(0, 0, 10);
mspSpotLight->Direction = Vector3F(0, 0, -1);
mspSpotLight->Angle = 0.5F;
mspSpotLight->Ambient = ColorRGB(0.2F, 0.2F, 0.2F);
return pPlane;
}