本文整理汇总了C++中MeshModel::drawNormals方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshModel::drawNormals方法的具体用法?C++ MeshModel::drawNormals怎么用?C++ MeshModel::drawNormals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshModel
的用法示例。
在下文中一共展示了MeshModel::drawNormals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawScene
void drawScene() {
if (g_reset) {
sceneObject.getMtrx().setAllValues(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1);
axisTransform = sceneObject.getMtrx();
g_ambientLight = 0xffffff;
g_light1.setDefaults();
g_light2.setDefaults();
g_reset = !g_reset;
}
//initial position of object
Matrix4x4 modelMtrx(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, -5, 1);
//transforming object with all required transformations
modelMtrx = sceneObject.getMtrx()*modelMtrx;
//creating a camera object
Camera cam({ 0, 0, 0, 1 }, (sceneObject.getMshMdl().getCentroid())*modelMtrx, { 0,1,0,1 });
//pointing camera at object
if (g_centerCam) {
saveCamera.setAllValues(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1);
saveCamera*=cam.getViewMtrx();
g_centerCam = false;
}
modelMtrx *= saveCamera;
//creating projection matrix and aplying it
cam.setProjectionMatrix(g_fovy, g_near, g_far, (eProjectionType)g_projectionType, 1);
//view to screen matrix
Matrix4x4 v2sMatrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, g_Swidth / 2, g_Sheight / 2, 0, 1);
Matrix4x4 projectionMtrx(cam.getProjectionMtrx()* v2sMatrix);
//creating a mesh model and apllying all the transformations
MeshModel model = sceneObject.getMshMdl();
model.transformMshMdl(modelMtrx);
if (g_mesh) {
model.transformMshMdl(projectionMtrx);
model.drawModelEdges();
}
else {
Vector4 eyePosition(g_Swidth / 2, g_Sheight / 2, 0, 1);
g_zBuffer.emptyBuffer();
Shader shader(g_shadingType);
model.material.setAll(g_ambient, g_diffuse, g_specular, g_specularExp);
shader.draw(model, g_ambientLight, g_light1, g_light2, g_zBuffer, eyePosition, projectionMtrx);
g_zBuffer.drawBuffer();
}
modelMtrx *= projectionMtrx;
//show bounding box
if (g_bbox) {
BBox box2 = box;
box2.transformBox(modelMtrx);
box2.drawBox();
}
//show normals
if (g_normals) {
model.drawNormals(g_normals_size);
}
//show coordinate systems
if (g_showCrdSystem) {
model.calcCentroid();
sceneObject.drawObjectCrdSystem(axisTransform, model.getCentroid(), g_Swidth / 2, g_Sheight / 2);
}
}