本文整理汇总了C++中ofMesh::hasColors方法的典型用法代码示例。如果您正苦于以下问题:C++ ofMesh::hasColors方法的具体用法?C++ ofMesh::hasColors怎么用?C++ ofMesh::hasColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofMesh
的用法示例。
在下文中一共展示了ofMesh::hasColors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMesh
//--------------------------------------------------------------
void ofVbo::setMesh(const ofMesh & mesh, int usage, bool useColors, bool useTextures, bool useNormals){
if(mesh.getVertices().empty()){
ofLogWarning("ofVbo") << "setMesh(): ignoring mesh with no vertices";
return;
}
setVertexData(mesh.getVerticesPointer(),mesh.getNumVertices(),usage);
if(mesh.hasColors() && useColors){
setColorData(mesh.getColorsPointer(),mesh.getNumColors(),usage);
enableColors();
}else{
disableColors();
}
if(mesh.hasNormals() && useNormals){
setNormalData(mesh.getNormalsPointer(),mesh.getNumNormals(),usage);
enableNormals();
}else{
disableNormals();
}
if(mesh.hasTexCoords() && useTextures){
setTexCoordData(mesh.getTexCoordsPointer(),mesh.getNumTexCoords(),usage);
enableTexCoords();
}else{
disableTexCoords();
}
if(mesh.hasIndices()){
setIndexData(mesh.getIndexPointer(), mesh.getNumIndices(), usage);
enableIndices();
}else{
disableIndices();
}
}
示例2: fromMesh
void ofxMesh::fromMesh(const ofMesh & mesh){
if (mesh.hasVertices()) {
getVertices()=mesh.getVertices();
}
if (mesh.hasColors()) {
getColors()=mesh.getColors();
}
if (mesh.hasNormals()) {
getNormals()=mesh.getNormals();
}
if (mesh.hasTexCoords()) {
getTexCoords()=mesh.getTexCoords();
}
if (mesh.hasIndices()) {
getIndices()=mesh.getIndices();
}
}
示例3: polyvoxToOfMesh
void ofxPolyvox::polyvoxToOfMesh(const PolyVox::SurfaceMesh<PositionMaterialNormal>& surfaceMesh, ofMesh& polyvxToOfMesh, bool setColor){
//Convienient access to the vertices and indices
const vector<uint32_t>& vecIndices = surfaceMesh.getIndices();
const vector<PositionMaterialNormal>& vecVertices = surfaceMesh.getVertices();//surfaceMesh.getRawVertexData();
ofIndexType ofVecIndices;
const void* pIndices = static_cast<const void*>(&(vecIndices[0]));
int* indices = (int*)pIndices;
vector<int> indx;
for (int i = 0; i < surfaceMesh.getNoOfIndices(); i++ ){
indx.push_back(indices[i]);
//cout << "indices:" << indices[i] << endl;
polyvxToOfMesh.addIndex(indx[i]);
}
ofLog(OF_LOG_NOTICE, "ofMesh: number of indices is %d", polyvxToOfMesh.getNumIndices());
ofVec3f ofVecVertices;
for (int i = 0; i < surfaceMesh.getNoOfVertices(); i++ ){
PositionMaterialNormal vert0 = vecVertices[i];
ofVecVertices = ofVec3f(vert0.getPosition().getX(),vert0.getPosition().getY(),vert0.getPosition().getZ());
polyvxToOfMesh.addVertex(ofVecVertices);
}
ofLog(OF_LOG_NOTICE, "ofMesh: number of vertices is %d", polyvxToOfMesh.getNumVertices());
ofVec3f ofVecNormals;
for (int i = 0; i < surfaceMesh.getNoOfVertices(); i++ ){
PositionMaterialNormal vert0 = vecVertices[i];
ofVecNormals = ofVec3f(vert0.getNormal().getX(),vert0.getNormal().getY(),vert0.getNormal().getZ());
polyvxToOfMesh.addNormal(ofVecNormals);
}
ofLog(OF_LOG_NOTICE, "ofMesh: number of normals is %d", polyvxToOfMesh.getNumNormals());
if(setColor){
for (int i = 0; i < surfaceMesh.getNoOfVertices(); i++ ){
PositionMaterialNormal vert0 = vecVertices[i];
uint8_t material = static_cast<uint8_t>(vert0.getMaterial() + 0.5);
//cout << "material:" << int(material) << endl;
ofFloatColor colour = convertMaterialIDToColour(material);
//cout << colour << endl;
polyvxToOfMesh.addColor(colour);
bool col = polyvxToOfMesh.hasColors();
//cout << "hasColors:" << col << endl;
}
}
}