當前位置: 首頁>>代碼示例>>C++>>正文


C++ Face函數代碼示例

本文整理匯總了C++中Face函數的典型用法代碼示例。如果您正苦於以下問題:C++ Face函數的具體用法?C++ Face怎麽用?C++ Face使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Face函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: g_assert

font_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,代碼來源:FontFactory.cpp

示例2: Mesh

SphereMesh::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,代碼來源:mesh.cpp

示例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,代碼來源:mesh.hpp

示例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,代碼來源:rasterization.hpp

示例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,代碼來源:rasterization.hpp

示例6: Tessellate

void 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,代碼來源:Tessellate.cpp

示例7: Face

void 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,代碼來源:TrianglePyramid.cpp

示例8: generate_glyph

static 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,代碼來源:verbatim_font.cpp

示例9: load

void 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,代碼來源:MeshDesc.cpp

示例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,代碼來源:Face.cpp

示例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,代碼來源:H.cpp

示例12: pango_font_description_from_string

font_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,代碼來源:FontFactory.cpp

示例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,代碼來源:Mesh.cpp

示例14: Face

Face Traversor2VF<MAP>::begin()
{
	if(m_QLT != NULL)
	{
		m_ItDarts = m_QLT->begin();
		return Face(*m_ItDarts++);
	}

	current = start ;
	return current ;
}
開發者ID:Peiffert,項目名稱:CGoGN,代碼行數:11,代碼來源:traversor2.hpp

示例15: fillHoles

void 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,代碼來源:SurfaceMesh.cpp


注:本文中的Face函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。