本文整理汇总了C++中Boss::getMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ Boss::getMesh方法的具体用法?C++ Boss::getMesh怎么用?C++ Boss::getMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boss
的用法示例。
在下文中一共展示了Boss::getMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeLighting
/// Computes lighting for the entire scene
void computeLighting()
{
for (auto &ridge : mountains)
{
for (int i=0; i < ridge.meshVertices.size(); i = i+3)
{
// Compute for our (single) light
Vec3Df vertexpos = Vec3Df(ridge.meshVertices[i],
ridge.meshVertices[i+1],
ridge.meshVertices[i+2]);
Vec3Df normal = Vec3Df(ridge.meshNormals[i],
ridge.meshNormals[i+1],
ridge.meshNormals[i+2]);
Vec3Df lighting = computeLighting(vertexpos, normal, DIFFUSE_LIGHTING);
// Pass computed values to Ridge
ridge.meshColors[i] = lighting[0];
ridge.meshColors[i+1] = lighting[1];
ridge.meshColors[i+2] = lighting[2];
}
}
if (toggleBoss) {
std::vector<Vertex> vertices = boss.getMesh().vertices;
std::vector<Vec3Df> meshColors = std::vector<Vec3Df>(vertices.size());
auto rotMat = matrixMultiplication(
rotateMatrixY(boss.angleHeadY*M_PI / 180),
rotateMatrixX(boss.angleHeadZ*M_PI / 180)
);
for (int i = 0; i < vertices.size(); i++)
{
// Compute for our (single) light
Vertex vertex = vertices[i];
Vec3Df vec = vertex.p;
vec = calculateMatrix(rotMat, vec);
vec = vec + boss.translation;
vec = vec * boss.scale;
vec = vec + boss.position;
Vec3Df nor = vertex.n;
nor = calculateMatrix(rotMat, nor);
nor = nor + boss.translation;
nor = nor * boss.scale;
nor = nor + boss.position;
Vec3Df lighting = computeLighting(vec, nor, PHONG_LIGHTNING);
meshColors[i] = lighting;
}
boss.getMesh().meshColor = meshColors;
}
}