这篇教程C++ Face函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Face函数的典型用法代码示例。如果您正苦于以下问题:C++ Face函数的具体用法?C++ Face怎么用?C++ Face使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Face函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: g_assertfont_instance* font_factory::FaceFromStyle(SPStyle const *style){ font_instance *font = NULL; g_assert(style); if (style) { // First try to use the font specification if it is set if (style->font_specification.set && style->font_specification.value && *style->font_specification.value) { font = FaceFromFontSpecification(style->font_specification.value); } // If that failed, try using the CSS information in the style if (!font) { font = Face(style->font_family.value, font_style_to_pos(*style)); // That was a hatchet job... so we need to check if this font exists!! Glib::ustring fontSpec = font_factory::Default()->ConstructFontSpecification(font); Glib::ustring newFontSpec = FontSpecificationBestMatch( fontSpec ); if( fontSpec != newFontSpec ) { font->Unref(); font = FaceFromFontSpecification( newFontSpec.c_str() ); } } } return font;}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:33,
示例2: MeshSphereMesh::SphereMesh(const Vector& radius, int stacks, int slices) : Mesh(GL_TRIANGLE_STRIP, true){ for (int stackNumber = 0; stackNumber <= stacks; ++stackNumber) { for (int sliceNumber = 0; sliceNumber <= slices; ++sliceNumber) { float theta = stackNumber * M_PI / stacks; float phi = sliceNumber * 2 * M_PI / slices + M_PI_2; float sinTheta = std::sin(theta); float sinPhi = std::sin(phi); float cosTheta = std::cos(theta); float cosPhi = std::cos(phi); float s = static_cast<float>(sliceNumber)/static_cast<float>(slices); float t = 1.0f-static_cast<float>(stackNumber)/static_cast<float>(stacks); m_faces.push_back(Face(UV(s, t), Vector(cosPhi * sinTheta, sinPhi * sinTheta, cosTheta), radius * Vector(cosPhi * sinTheta, sinPhi * sinTheta, cosTheta)) ); } } for (int stackNumber = 0; stackNumber < stacks; ++stackNumber) { for (int sliceNumber = 0; sliceNumber <= slices; ++sliceNumber) { m_indices.push_back( stackNumber*(slices+1) + sliceNumber); m_indices.push_back( (stackNumber+1)*(slices+1) + sliceNumber); } } init();}
开发者ID:mmozeiko,项目名称:Squares3D-iPad,代码行数:34,
示例3: loadMeshObject void loadMeshObject(const std::string& filename, MeshObject& mo) { std::vector<tinyobj::shape_t> shapes; std::vector<tinyobj::material_t> materials; std::string err = tinyobj::LoadObj(shapes, materials, filename.c_str()); if (!err.empty()) { std::cerr << err << std::endl; exit(1); } assert(shapes.size() == 1 ? true : ("obj should be only one shape" && false)); tinyobj::mesh_t& mesh = shapes[0].mesh; assert((mesh.positions.size() % 3) == 0); assert((mesh.normals.size() % 3) == 0); assert((mesh.indices.size() % 3) == 0); VerticesArray& vts = mo.getVertices(); NormalsArray& nls = mo.getNormals(); FacesArray& fs = mo.getFaces(); for (size_t v = 0; v < mesh.positions.size() / 3; v++) vts.push_back(VertexType(mesh.positions[3*v+0], mesh.positions[3*v+1], mesh.positions[3*v+2])); for (size_t n = 0; n < mesh.normals.size() / 3; n++) nls.push_back(NormalType(mesh.normals[3*n+0], mesh.normals[3*n+1], mesh.normals[3*n+2])); for (size_t f = 0; f < mesh.indices.size() / 3; f++) fs.push_back(Face(mesh.indices[3*f+0], mesh.indices[3*f+1], mesh.indices[3*f+2])); }
开发者ID:LegendGraphics,项目名称:regmm,代码行数:32,
示例4: CullFaceMode /** * @glsymbols * @glfunref{Get} * @gldefref{CULL_FACE_MODE} */ static Face CullFaceMode(void) { GLint result; OGLPLUS_GLFUNC(GetIntegerv)(GL_CULL_FACE_MODE, &result); OGLPLUS_VERIFY_SIMPLE(GetIntegerv); return Face(result); }
开发者ID:xubingyue,项目名称:oglplus,代码行数:12,
示例5: CullFaceMode /** * @glsymbols * @glfunref{Get} * @gldefref{CULL_FACE_MODE} */ static Face CullFaceMode(void) { GLint result; OGLPLUS_GLFUNC(GetIntegerv)(GL_CULL_FACE_MODE, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return Face(result); }
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:12,
示例6: Tessellatevoid Tessellate( NodeVector & vecNodes, FaceVector & vecFaces) { int nInitialNodeListSize = vecNodes.size(); // Create centerpoint nodes for (int i = 0; i < vecFaces.size(); i++) { InsertQuadNodeCenter( vecNodes, vecNodes[vecFaces[i][0]], vecNodes[vecFaces[i][1]], vecNodes[vecFaces[i][2]], vecNodes[vecFaces[i][3]]); } // Construct tesselation SegmentMap mapSegment; ConstructSegmentMap(vecFaces, mapSegment, -1); vecFaces.clear(); SegmentMapIterator iter = mapSegment.begin(); for (; iter != mapSegment.end(); iter++) { Face faceNew = Face( iter->first[1], nInitialNodeListSize + iter->second[0], iter->first[0], nInitialNodeListSize + iter->second[1]); vecFaces.push_back(faceNew); }}
开发者ID:ClimateGlobalChange,项目名称:squadgen,代码行数:34,
示例7: Facevoid TrianglePyramid::_init(){ //0 vecs.push_back(ofVec3f( 0, 1, 0)); //1 vecs.push_back(ofVec3f( -.5, 0, -.4)); //2 vecs.push_back(ofVec3f( .5, 0, -.4)); //3 vecs.push_back(ofVec3f( 0, 0, .6)); //zero indices.push_back(Index<int>(0, 1, 2)); //first indices.push_back(Index<int>(1, 3, 2)); //second indices.push_back(Index<int>(0, 2, 3)); //third indices.push_back(Index<int>(1, 0, 3)); for (int i=0; i<indices.size(); ++i){ // to do //cout << indices[i].elem0 << ", " << indices[i].elem1 << ", " << indices[i].elem2 << endl; faces.push_back( Face(&vecs[indices[i].elem0], &vecs[indices[i].elem1], &vecs[indices[i].elem2]) ); } setScale(ofVec3f(100.0, 100.0, 100.0));}
开发者ID:dtwaddle,项目名称:CSE1342F14,代码行数:30,
示例8: generate_glyphstatic CompiledMesh* generate_glyph(VertexBuffer * vertex_buffer, unsigned c){ Mesh msh; const float SCALE = 0.365f; font_data::glyph_record const & r = font_data::glyph_records[c]; for(unsigned i = 0; i<r.v_count; ++i) { float x = r.vertices[i*2+0] * SCALE; float y = r.vertices[i*2+1] * SCALE; msh.addVertex(Vector3(x,y,0)); } for(unsigned i = 0; i<r.i_count/3; ++i) { unsigned i0 = r.indices[i*3+0]; unsigned i1 = r.indices[i*3+1]; unsigned i2 = r.indices[i*3+2]; msh.addFace(Face(i0, i1, i2, Color(255, 0, 0, 255))); } return msh.insert(vertex_buffer, 0.0f);}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2015-04_64k-intro_junamatkailuintro,代码行数:25,
示例9: loadvoid MeshDesc::load(Serializer& serializer){ std::string tmpStr; serializer.loadString(m_name); m_isSkin = serializer.loadBool(); unsigned int count = serializer.loadInt(); for (unsigned int i = 0; i < count; ++i) { serializer.loadString(tmpStr); m_materials.push_back(tmpStr); } count = serializer.loadInt(); for (unsigned int i = 0; i < count; ++i) { m_vertices.push_back(LitVertex()); m_vertices.back().load(serializer); } count = serializer.loadInt(); for (unsigned int i = 0; i < count; ++i) { m_faces.push_back(Face()); m_faces.back().load(serializer); } count = serializer.loadInt(); for (unsigned int i = 0; i < count; ++i) { BonesInfluenceDefinition& influencingBones = m_bonesInfluencingAttribute[i]; unsigned int namesCount = serializer.loadInt(); for (unsigned int j = 0; j < namesCount; ++j) { serializer.loadString(tmpStr); influencingBones.push_back(tmpStr); } } count = serializer.loadInt(); for (unsigned int i = 0; i < count; ++i) { m_skinBones.push_back(SkinBoneDefinition()); m_skinBones.back().load(serializer); } serializer.loadMatrix(m_localMtx); count = serializer.loadInt(); for (unsigned int i = 0; i < count; ++i) { MeshDesc* newChild = new MeshDesc(); m_children.push_back(newChild); newChild->load(serializer); newChild->m_parent = this; }}
开发者ID:dabroz,项目名称:Tamy,代码行数:59,
示例10: Face/* 1.26 ClipEar implements the Clipping-Ear-Algorithm. It finds an "Ear" in this Face, clips it and returns it as separate face. Note that the original Face is modified by this method! It is mainly used to implement evaporisation of faces */Face Face::ClipEar() { Face ret; if (v.size() <= 3) { // Nothing to do if this Face consists only of three points return Face(v); } else { Pt a, b, c; unsigned int n = v.size(); // Go through the corner-points, which are sorted counter-clockwise for (unsigned int i = 0; i < n; i++) { // Take the next three points a = v[(i + 0) % n].s; b = v[(i + 1) % n].s; c = v[(i + 2) % n].s; if (Pt::sign(a, b, c) < 0) { // If the third point c is right of the segment (a b), then // the three points don't form an "Ear" continue; } // Otherwise check, if any point is inside the triangle (a b c) bool inside = false; for (unsigned int j = 0; j < (n - 3); j++) { Pt x = v[(i + j + 3) % n].s; inside = Pt::insideTriangle(a, b, c, x) && !(a == x) && !(b == x) && !(c == x); if (inside) { // If a point inside was found, we haven't found an ear. break; } } if (!inside) { // No point was inside, so build the Ear-Face in "ret", ret.AddSeg(v[i + 0]); ret.AddSeg(v[(i + 1)%n]); Seg nw(v[(i + 1)%n].e, v[i + 0].s); ret.AddSeg(nw); // remove the Face-Segment (a b), v.erase(v.begin() + i); // and finally replace the segment (b c) by (a c) v[i].s = nw.e; v[i].e = nw.s; hullSeg.valid = 0; return ret; } } } DEBUG(2, "No ear found on face " << ToString()); // If we are here it means we haven't found an ear. This shouldn't happen. // One reason could be that the face wasn't valid in the first place. return ret;}
开发者ID:awarematics,项目名称:SECONDO,代码行数:66,
示例11: pushface void pushface(const int &a, const int &b, const int &c) { nFace++; tmp[nFace] = Face(a, b, c); tmp[nFace].isOnConvex = true; whe[a][b] = nFace; whe[b][c] = nFace; whe[c][a] = nFace; }
开发者ID:PrayStarJirachi,项目名称:Exercise-Code,代码行数:8,
示例12: pango_font_description_from_stringfont_instance *font_factory::FaceFromDescr(char const *family, char const *style){ PangoFontDescription *temp_descr = pango_font_description_from_string(style); pango_font_description_set_family(temp_descr,family); font_instance *res = Face(temp_descr); pango_font_description_free(temp_descr); return res;}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:8,
示例13: Face_JATTA_EXPORT Jatta::Assimp::Face* Jatta::Assimp::Mesh::GetFaces() const{ Face* faces = new Face[mesh->mNumFaces]; for (unsigned int i = 0; i < mesh->mNumFaces; i++) { faces[i] = Face(&mesh->mFaces[i]); } return faces;}
开发者ID:JoshuaBrookover,项目名称:Jatta,代码行数:10,
示例14: FaceFace Traversor2VF<MAP>::begin(){ if(m_QLT != NULL) { m_ItDarts = m_QLT->begin(); return Face(*m_ItDarts++); } current = start ; return current ;}
开发者ID:Peiffert,项目名称:CGoGN,代码行数:11,
示例15: fillHolesvoid fillHoles(SurfaceMesh &mesh){ std::vector<std::vector<SurfaceMesh::SimplexID<2>>> holeList; surfacemesh_detail::findHoles(mesh, holeList); for(auto& holeEdges : holeList){ std::vector<SurfaceMesh::SimplexID<1>> sortedVertices; surfacemesh_detail::edgeRingToVertices(mesh, holeEdges, std::back_inserter(sortedVertices)); surfacemesh_detail::triangulateHole(mesh, sortedVertices, Face(), holeEdges); }}
开发者ID:ctlee,项目名称:gamer,代码行数:11,
示例16: parseFacevoid ModelLoader::parseFace(char *line){ faces.push_back(Face()); //add a new face to list of faces //if the .obj file does not include texture coordinates, store vertex and normal indexes for the face if(sscanf(line, "f %d//%d %d//%d %d//%d", &faces.back().v1, &faces.back().vn1, &faces.back().v2, &faces.back().vn2, &faces.back().v3, &faces.back().vn3) <= 1) { //if the .obj file includes texture coordinates, store vertex, normal and textel indexes sscanf(line, "f %d/%d/%d %d/%d/%d %d/%d/%d", &faces.back().v1, &faces.back().vt1, &faces.back().vn1, &faces.back().v2, &faces.back().vt2, &faces.back().vn2, &faces.back().v3, &faces.back().vt3, &faces.back().vn3); }}
开发者ID:NadiaSummers,项目名称:BodySnatcher,代码行数:11,
示例17: LitVertexvoid DebugGeometryBuilder::addCone( const FastFloat& baseSize, const Vector& start, const Vector& end, std::vector< LitVertex >& outVertices, std::vector< Face >& outFaces ){ // calculate additional vectors needed for cuboid construction Vector dir; dir.setSub( end, start ); dir.normalize(); Vector perpVec1, perpVec2; VectorUtil::calculatePerpendicularVector( dir, perpVec1 ); perpVec1.normalize(); perpVec2.setCross( dir, perpVec1 ); perpVec1.mul( baseSize ); perpVec2.mul( baseSize ); // calculate the vertices and outFaces uint firstVtxIdx = outVertices.size(); uint firstFaceIdx = outFaces.size(); for( uint i = 0; i < 5; ++i ) { outVertices.push_back( LitVertex() ); } for( uint i = 0; i < 6; ++i ) { outFaces.push_back( Face() ); } Vector tmpVec; { perpVec1.mul( Float_6 ); perpVec2.mul( Float_6 ); tmpVec.setAdd( start, perpVec1 ); tmpVec.sub( perpVec2 ); tmpVec.store( outVertices[firstVtxIdx + 0].m_coords ); tmpVec.setSub( start, perpVec1 ); tmpVec.sub( perpVec2 ); tmpVec.store( outVertices[firstVtxIdx + 1].m_coords ); tmpVec.setAdd( start, perpVec1 ); tmpVec.add( perpVec2 ); tmpVec.store( outVertices[firstVtxIdx + 2].m_coords ); tmpVec.setSub( start, perpVec1 ); tmpVec.add( perpVec2 ); tmpVec.store( outVertices[firstVtxIdx + 3].m_coords ); FastFloat tipSizeMultiplier; tipSizeMultiplier.setFromFloat( 12 ); tipSizeMultiplier.mul( baseSize ); tmpVec.setMulAdd( dir, tipSizeMultiplier, end ); tmpVec.store( outVertices[firstVtxIdx + 4].m_coords ); // cone bottom outFaces[firstFaceIdx + 0].idx[0] = firstVtxIdx + 0; outFaces[firstFaceIdx + 0].idx[1] = firstVtxIdx + 1; outFaces[firstFaceIdx + 0].idx[2] = firstVtxIdx + 2; outFaces[firstFaceIdx + 1].idx[0] = firstVtxIdx + 1; outFaces[firstFaceIdx + 1].idx[1] = firstVtxIdx + 3; outFaces[firstFaceIdx + 1].idx[2] = firstVtxIdx + 2; // cone top outFaces[firstFaceIdx + 2].idx[0] = firstVtxIdx + 0; outFaces[firstFaceIdx + 2].idx[1] = firstVtxIdx + 4; outFaces[firstFaceIdx + 2].idx[2] = firstVtxIdx + 1; outFaces[firstFaceIdx + 3].idx[0] = firstVtxIdx + 1; outFaces[firstFaceIdx + 3].idx[1] = firstVtxIdx + 4; outFaces[firstFaceIdx + 3].idx[2] = firstVtxIdx + 3; outFaces[firstFaceIdx + 4].idx[0] = firstVtxIdx + 3; outFaces[firstFaceIdx + 4].idx[1] = firstVtxIdx + 4; outFaces[firstFaceIdx + 4].idx[2] = firstVtxIdx + 2; outFaces[firstFaceIdx + 5].idx[0] = firstVtxIdx + 2; outFaces[firstFaceIdx + 5].idx[1] = firstVtxIdx + 4; outFaces[firstFaceIdx + 5].idx[2] = firstVtxIdx + 0; }}
开发者ID:chenwenbin928,项目名称:tamy,代码行数:54,
示例18: pango_font_description_newfont_instance *font_factory::Face(char const *family, int variant, int style, int weight, int stretch, int /*size*/, int /*spacing*/){ PangoFontDescription *temp_descr = pango_font_description_new(); pango_font_description_set_family(temp_descr,family); pango_font_description_set_weight(temp_descr,(PangoWeight)weight); pango_font_description_set_stretch(temp_descr,(PangoStretch)stretch); pango_font_description_set_style(temp_descr,(PangoStyle)style); pango_font_description_set_variant(temp_descr,(PangoVariant)variant); font_instance *res = Face(temp_descr); pango_font_description_free(temp_descr); return res;}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:12,
示例19: addDatavoid Mesh::addData(std::vector<glm::vec3> vertices, std::vector<Face> faces) { int offset = this->vertices.size(); // copy all vertex coordinates. for (int i = 0; i < vertices.size(); ++i) { this->vertices.push_back(vertices[i]); } for (int i = 0; i < faces.size(); ++i) { this->faces.push_back(Face(faces[i].x + offset, faces[i].y + offset, faces[i].z + offset)); }}
开发者ID:emiax,项目名称:pink-fluid,代码行数:12,
示例20: plafondObject* plafond(){ Texture* t = TextureMgr::getTextureMgr()->getTexture("../../src/img/interieur.bmp"); Container* c = new Container(); Mesh* m; m = new Mesh(); m->setTexture(t); m->addVertex(new Vertex(-22.0F,-35.0F,25.0F,0,0,glm::vec3(0,0,-1))); m->addVertex(new Vertex(26.0F,-35.0F,25.0F,0,1,glm::vec3(0,0,-1))); m->addVertex(new Vertex(26.0F,18.0F,25.0F,1,0,glm::vec3(0,0,-1))); m->addVertex(new Vertex(-22.0F,18.0F,25.0F,1,1,glm::vec3(0,0,-1))); m->addFace(Face(0,1,2)); m->addFace(Face(0,2,3)); c->addObject(m); c->addObject(lustre(glm::vec3(0.0,10.0,22.75))); c->addObject(lustre(glm::vec3(0.0,-25.0,22.75))); c->addObject(lustre(glm::vec3(0.0,-7.5,22.75))); return c;}
开发者ID:Agamand,项目名称:3D_Engine,代码行数:21,
示例21: SurfaceMeshModelSurfaceMeshModel* SegMeshLoader::extractSegMesh( QString gid ){ SurfaceMeshModel* subMesh = new SurfaceMeshModel(gid + ".obj", gid); QVector<int> part = groupFaces[gid]; // vertex set from face QSet<int> vertSet; foreach(int fidx, part) { Surface_mesh::Vertex_around_face_circulator vit = entireMesh->vertices(Face(fidx)),vend=vit; do{ vertSet.insert(Vertex(vit).idx()); } while(++vit != vend); }
开发者ID:BigkoalaZhu,项目名称:StBl,代码行数:13,
示例22: warning// Stand outside target within `distance` unitsvoid AGameObject::RecomputePathTo( AGameObject* target, float fallbackDistance ){ // Sends ME to * which is fallbackDistance units from target. // fallbackDistance // ME * <-- target // if( !target ) { warning( FS( "%s has a NULL AttackTarget", *GetName() ) ); return; } // Depending on the target type, the point to move to may be the 'roid ro some other special point on the model FVector targetPos = target->Pos; if( AGoldmine* goldmine = Cast<AGoldmine>( target ) ) { // Switch pos to entry point of mine when a mine is the target. targetPos = goldmine->GetEntryPoint(); // Not sure about float level of goldmine.. so that doesn't matter, // equate the Z of the goldmine with CURRENT UNIT POSITION Z // so diff in Z doesn't mean no entry. targetPos.Z = Pos.Z; fallbackDistance = 0.f; // Overlap the goldmine's entry pt to enter. } // len // Pos <---------- targetPos // *<-- targetPos FVector targetToMe = Pos - targetPos; float len = targetToMe.Size(); // len // Pos <- targetPos // *<-- targetPos if( len < fallbackDistance ) { // Within fallbackDistance, so face only (no movement) Face( targetPos ); } else if( len ) // If there is a distance to travel { // Normalize targetToMe /= len; // Set the fallback distance to being size of bounding radius of other unit SetDestination( targetPos + targetToMe*(fallbackDistance*.997f) ); } else { // I'm already there }}
开发者ID:superwills,项目名称:Wryv,代码行数:51,
示例23: AddFaceint Polyhedra :: AddFace (int pi1, int pi2, int pi3, int inputnum){ (*testout) << "polyhedra, add face " << pi1 << ", " << pi2 << ", " << pi3 << endl; if(pi1 == pi2 || pi2 == pi3 || pi3 == pi1) { ostringstream msg; msg << "Illegal point numbers for polyhedron face: " << pi1+1 << ", " << pi2+1 << ", " << pi3+1; throw NgException(msg.str()); } faces.Append (Face (pi1, pi2, pi3, points, inputnum)); Point<3> p1 = points[pi1]; Point<3> p2 = points[pi2]; Point<3> p3 = points[pi3]; Vec<3> v1 = p2 - p1; Vec<3> v2 = p3 - p1; Vec<3> n = Cross (v1, v2); n.Normalize(); Plane pl (p1, n);// int inverse;// int identicto = -1;// for (int i = 0; i < planes.Size(); i++)// if (pl.IsIdentic (*planes[i], inverse, 1e-9*max3(v1.Length(),v2.Length(),Dist(p2,p3))))// {// if (!inverse)// identicto = i;// }// // cout << "is identic = " << identicto << endl;// identicto = -1; // changed April 10, JS// if (identicto != -1)// faces.Last().planenr = identicto;// else { planes.Append (new Plane (p1, n)); surfaceactive.Append (1); surfaceids.Append (0); faces.Last().planenr = planes.Size()-1; }// (*testout) << "is plane nr " << faces.Last().planenr << endl; return faces.Size();}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:49,
示例24: addQuad void addQuad(Geometry * geom, Vector2 const& topLeft, Vector2 const& bottomRight, Vector2 const& uvTopLeft, Vector2 const& uvBottomRight, Color const& color) { uint16_t index = geom->vertices.size(); float x0 = topLeft.x; float x1 = bottomRight.x; float y0 = topLeft.y; float y1 = bottomRight.y; float u0 = uvTopLeft.x; float u1 = uvBottomRight.x; float v0 = uvTopLeft.y; float v1 = uvBottomRight.y; geom->vertices.push_back(Vector3(x0, y0, 0)); geom->vertices.push_back(Vector3(x0, y1, 0)); geom->vertices.push_back(Vector3(x1, y1, 0)); geom->vertices.push_back(Vector3(x1, y0, 0)); geom->texCoord0.push_back(Vector2(u0, v0)); geom->texCoord0.push_back(Vector2(u0, v1)); geom->texCoord0.push_back(Vector2(u1, v1)); geom->texCoord0.push_back(Vector2(u1, v0)); geom->colors.push_back(color); geom->colors.push_back(color); geom->colors.push_back(color); geom->colors.push_back(color); geom->faces.push_back(Face(index + 0, index + 1, index + 2)); geom->faces.push_back(Face(index + 2, index + 3, index + 0)); geom->verticesNeedUpdate = true; geom->colorsNeedUpdate = true; geom->texCoord0NeedUpdate = true; geom->elementsNeedUpdate = true; }
开发者ID:wibbe,项目名称:three-cpp,代码行数:36,
示例25: addBox void addBox(Geometry * geom, Matrix4 const& transform, Vector3 const& size, Color const& color) { Matrix4 normalMat = transform.inverse().transpose(); for (int i = 0; i < 6; ++i) { Vector3 normal = dirs[i]; Vector3 up = std::abs(dot(normal, Vector3(0, 1, 0))) > 0.9f ? Vector3(0, 0, 1) : Vector3(0, 1, 0); Vector3 side = cross(normal, up) * size * 0.5f; up = up * size * 0.5f; Vector3 pos = normal * size * 0.5f; uint16_t indexStart = geom->vertices.size(); geom->vertices.push_back(transform * (pos + side + up)); geom->vertices.push_back(transform * (pos + side - up)); geom->vertices.push_back(transform * (pos - side - up)); geom->vertices.push_back(transform * (pos - side + up)); geom->normals.push_back(normalMat * normal); geom->normals.push_back(normalMat * normal); geom->normals.push_back(normalMat * normal); geom->normals.push_back(normalMat * normal); geom->colors.push_back(color); geom->colors.push_back(color); geom->colors.push_back(color); geom->colors.push_back(color); geom->texCoord0.push_back(Vector2(1, 1)); geom->texCoord0.push_back(Vector2(1, 0)); geom->texCoord0.push_back(Vector2(0, 0)); geom->texCoord0.push_back(Vector2(0, 1)); geom->faces.push_back(Face(indexStart + 0, indexStart + 1, indexStart + 2)); geom->faces.push_back(Face(indexStart + 2, indexStart + 3, indexStart + 0)); } }
开发者ID:wibbe,项目名称:three-cpp,代码行数:36,
示例26: FaceR3Mesh::~R3Mesh(void){ // Delete faces for (int i = 0; i < NFaces(); i++) { R3MeshFace *f = Face(i); delete f; } // Delete vertices for (int i = 0; i < NVertices(); i++) { R3MeshVertex *v = Vertex(i); delete v; }}
开发者ID:JasonAltschuler,项目名称:WorldWarQ,代码行数:15,
注:本文中的Face函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Factor函数代码示例 C++ F_SET函数代码示例 |