本文整理汇总了C++中Face函数的典型用法代码示例。如果您正苦于以下问题:C++ Face函数的具体用法?C++ Face怎么用?C++ Face使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Face函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: parseFace
void 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,代码来源:ModelLoader.cpp
示例17: LitVertex
void 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,代码来源:DebugGeometryBuilder.cpp
示例18: pango_font_description_new
font_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,代码来源:FontFactory.cpp
示例19: addData
void 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,代码来源:mesh.cpp
示例20: plafond
Object* 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,代码来源:Scene_demo.cpp
注:本文中的Face函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论