本文整理汇总了C++中ofMesh::setFromTriangles方法的典型用法代码示例。如果您正苦于以下问题:C++ ofMesh::setFromTriangles方法的具体用法?C++ ofMesh::setFromTriangles怎么用?C++ ofMesh::setFromTriangles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofMesh
的用法示例。
在下文中一共展示了ofMesh::setFromTriangles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
//--------------------------------------------------------------
void ofApp::setup(){
beat.load("sound/heartbeat.mp3");
mizukusa.load("mizukusa.png");
// for that purpose:
fftSmoothed = new float[8192];
for (int i = 0; i < 8192; i++){
fftSmoothed[i] = 0;
}
nBandsToGet = 128;
ofSetFrameRate(60);
model.loadModel("untitled.obj");
ofEnableLighting();
ofEnableAlphaBlending();
material.setShininess(255);
material.setDiffuseColor(ofColor(255,255,255));
material.setSpecularColor(ofColor(255,255,0));
material.setAmbientColor(ofColor(255,0,0));
mesh = model.getMesh(0);
for (int i=0; i < model.getMeshCount();i++){
heart.push_back(model.getMesh(i));
}
pointLight2.setDiffuseColor( ofFloatColor(.85, .0, .0) );
pointLight2.setSpecularColor( ofFloatColor(1.f, 1.f, 0.6f));
pointLight.setDiffuseColor( ofFloatColor(.85, .0, .0) );
pointLight.setSpecularColor( ofFloatColor(1.f, 1.f, 0.6f));
//
mesh.setMode(OF_PRIMITIVE_TRIANGLES);
vector<ofMeshFace> triangles = mesh.getUniqueFaces();
mesh.setFromTriangles(triangles,true);
for(int i=0; i < model.getMeshCount();i++){
//heart[i].setMode(OF_PRIMITIVE_TRIANGLES);
vector<ofMeshFace> triangles = heart[i].getUniqueFaces();
heart[i].setFromTriangles(triangles,true);
}
//clone object
heart_ = heart;
ofSetBackgroundColor(0);
cam.setDistance(500.0f);
heart_vertices= heart[0].getVertices();
for(int i=0; i < 3;i++){
for(int j=0; j < heart[i].getNumVertices(); j+=10){
//heart[i].setVertex(j,heart_[i].getVertex(j)*(ofNoise(ofGetFrameNum()/100.0f,j)*0.1+1));
ofVec3f v = heart[i].getVertex(j);
vector <int> list;
for(int k=0; k < heart[i].getNumVertices(); k++){
if(v.distance(heart[i].getVertex(k))<0.1){
list.push_back(k);
}
}
nearest.push_back(list);
}
}
myFbo.allocate(ofGetWidth(),ofGetHeight());
myGlitch.setup(&myFbo);
beat.play();
for(int i=0; i <6;i++){
noises.push_back(0.0);
}
for(int i=0; i<IMG_SIZE; i++){
ofImage img;
img.load("img"+ofToString(i)+".png");
images.push_back(img);
}
}