本文整理汇总了C++中ModelNode::setMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::setMesh方法的具体用法?C++ ModelNode::setMesh怎么用?C++ ModelNode::setMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::setMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}else if(argMatch(argv[i], "VolumeForces")){
output[outputLength++] = VOLUME_FORCES;
}else if(argMatch(argv[i], "NetForces")){
output[outputLength++] = NET_FORCES;
}else if(argMatch(argv[i], "Points")){
output[outputLength++] = POINTS;
}
} while(lastChar(argv[i]) == ',');
}
}
Mesh* mesh;
switch(meshType){
case TETRAHEDRON:
mesh = new TetrahedronMesh(ceil(sqrt(idealTriangleCount/4.0)));
break;
case ICOSAHEDRON:
if(idealTriangleCount <= 100){
meshFile = "models/icosa1.obj";
}else if(idealTriangleCount <= 1000){
meshFile = "models/icosa2.obj";
}else if(idealTriangleCount <= 10000){
meshFile = "models/icosa3.obj";
}else if(idealTriangleCount <= 100000){
meshFile = "models/icosa4.obj";
}else{
meshFile = "models/icosa5.obj";
}
mesh = new ExternalMesh(meshFile);
break;
default:
mesh = new ExternalMesh(meshFile);
break;
}
// visualization only applies to GPU calculation, so:
if(visualization){
SceneManager manager(&device);
CameraNode camera(&device, width, height);
camera.getTransform().setTranslation(20.0f, 20.0f, 20.0f);
manager.addNode(&camera);
ModelNode mn;
//mn.getTransform().setScale(0.025f, 0.025f, 0.025f);
mn.getTransform().setScale(scale, scale, scale);
mn.getTransform().setTranslation(0.0f, 0.0f, 0.0f);
mn.setMesh(mesh);
manager.addNode(&mn);
ShaderProgram geometryProgram;
Shader geometryVertexShader("shaders/geometry_pass.vert", VERTEX);
Shader geometryFragShader("shaders/geometry_pass.frag", FRAGMENT);
geometryProgram.attachShader(&geometryVertexShader);
geometryProgram.attachShader(&geometryFragShader);
geometryProgram.link();
manager.setGeometryProgram(&geometryProgram);
GPUEvolver evolver(mesh, 10);
while (device.run()) {
evolver.update();
evolver.synchronizeToMesh();
manager.drawAll();
device.endScene();
}
} else {
if (gpu) {
GPUEvolver evolver(mesh, 10);
evolver.setOutputFormat(output, outputLength);
std::clock_t start;
start = std::clock();
for(int i=0; i < iterations; i++){
evolver.update();
evolver.outputData();
}
if (timing){
std::cout << "Time: " << (std::clock() - start) / (double)(CLOCKS_PER_SEC / 1000) << " ms" << std::endl;
}
} else {
CPUEvolver evolver(mesh, 10);
evolver.setOutputFormat(output, outputLength);
std::clock_t start;
start = std::clock();
for(int i=0; i < iterations; i++){
evolver.update();
evolver.outputData();
}
if (timing){
std::cout << "Time: " << (std::clock() - start) / (double)(CLOCKS_PER_SEC / 1000) << " ms" << std::endl;
}
}
}
return 0;
}