本文整理匯總了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;
}
示例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();
}
示例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]));
}
示例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);
}
示例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);
}
示例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);
}
}
示例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));
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例14: Face
Face Traversor2VF<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return Face(*m_ItDarts++);
}
current = start ;
return current ;
}
示例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);
}
}