当前位置: 首页>>代码示例>>C++>>正文


C++ Patch类代码示例

本文整理汇总了C++中Patch的典型用法代码示例。如果您正苦于以下问题:C++ Patch类的具体用法?C++ Patch怎么用?C++ Patch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Patch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

void PatchGroup::read(Xml& xml)
      {
      for (;;) {
            Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            switch (token) {
                  case Xml::Error:
                  case Xml::End:
                        return;
                  case Xml::TagStart:
                        if (tag == "Patch") {
                              Patch* patch = new Patch;
                              patch->read(xml);
                              patches.push_back(patch);
                              }
                        else
                              xml.unknown("PatchGroup");
                        break;
                  case Xml::Attribut:
                        if (tag == "name")
                              name = xml.s2();
                        break;
                  case Xml::TagEnd:
                        if (tag == "PatchGroup")
                              return;
                  default:
                        break;
                  }
            }
      }
开发者ID:UIKit0,项目名称:muse,代码行数:30,代码来源:minstrument.cpp

示例2: get_ctrl_patch

int
NPRPen::tap_cb(CGESTUREptr& gest, DrawState*&)
{
   cerr << "NPRPen::tap_cb" << endl;

   Bface *f = VisRefImage::Intersect(gest->center());
   Patch* p = get_ctrl_patch(f);
   if (!(f && p)) {
      if (_curr_npr_tex)
         deselect_current_texture();
      return 0;
   }

   // Set the selected face's patch to using NPRTexture
   // It might already be doing this, but who cares!
   p->set_texture(NPRTexture::static_name());

   GTexture* cur_texture = p->cur_tex();
   NPRTexture* nt = dynamic_cast<NPRTexture*>(cur_texture);
   if (nt == nullptr)
      return 0; //Shouldn't happen

   if (_curr_npr_tex)
      {
         if (_curr_npr_tex != nt)
            {
               deselect_current_texture();
               select_current_texture(nt);
            }
      }
   else
      select_current_texture(nt);

   return 0;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:35,代码来源:npr_pen.cpp

示例3: TEST

TEST(PatchTest, set_oscillator)
{
  Patch patch;
  SineWaveOscillator osc;
  patch.set_oscillator(&osc);
  ASSERT_TRUE(patch.oscillator() == &osc);
}
开发者ID:iwadon,项目名称:junk,代码行数:7,代码来源:patch_test.cpp

示例4: Init

void Landscape::Init(float **hMap)
{
    if ( hMap == NULL ) {
        std::cerr<<"Landscape Init NULL pointer"<<std::endl;
    }
    Patch *patch;

    heightMap = new float*[MAP_SIZE+1];
    for ( int i=0;i < MAP_SIZE+1;i++) {
        heightMap[i] = new float[MAP_SIZE+1];
    }
    for ( int i=0; i < MAP_SIZE ; i++) {
        for ( int j = 0;j < MAP_SIZE ;j++) {
            heightMap[i][j] = hMap[i][j];
        }
        heightMap[i][MAP_SIZE] = hMap[i][MAP_SIZE -1 ];
        heightMap[MAP_SIZE][i] = hMap[MAP_SIZE-1][i];
    }

    for ( int Y=0; Y < NUM_PATCHES_PER_SIDE; Y++) {
        for ( int X=0; X < NUM_PATCHES_PER_SIDE; X++ ) {
            patch = &(m_Patches[Y][X]);
            patch->Init(X*(PATCH_SIZE), Y*(PATCH_SIZE), heightMap );
            sorted_distance.push_back(patch);
        }
    }
}
开发者ID:JakubVojvoda,项目名称:terrain-generation,代码行数:27,代码来源:landscape.cpp

示例5: bezpatchinterp

// given a control patch and (u,v) values, find 
// the surface point and normal
Point Bezier::bezpatchinterp(Patch patch, float u, float v, Point &n) {
	Point p;
	Point dPdu;
	Point dPdv;
	Point trash;
	std::vector<Point> vcurve(4);
	std::vector<Point> ucurve(4);

	bool horizontal = true;
	bool vertical = false;

	// build control points for a Bezier curve in v
	vcurve[0] = bezcurveinterp(patch.getCurve(0, horizontal), u, trash);
	vcurve[1] = bezcurveinterp(patch.getCurve(1, horizontal), u, trash);
	vcurve[2] = bezcurveinterp(patch.getCurve(2, horizontal), u, trash);
	vcurve[3] = bezcurveinterp(patch.getCurve(3, horizontal), u, trash);
	// build control points for a Bezier curve in u
	ucurve[0] = bezcurveinterp(patch.getCurve(0, vertical), v, trash);
	ucurve[1] = bezcurveinterp(patch.getCurve(1, vertical), v, trash);
	ucurve[2] = bezcurveinterp(patch.getCurve(2, vertical), v, trash);
	ucurve[3] = bezcurveinterp(patch.getCurve(3, vertical), v, trash);
	// evaluate surface and derivative for u and v
	p = bezcurveinterp(vcurve, v, dPdv);
	p = bezcurveinterp(ucurve, u, dPdu);
	// take cross product of partials to find normal
	n = crossP(dPdu, dPdv);
	n = n / n.length();
	Point n2 = crossP(dPdv, dPdu);
	n2 = n2 / n2.length();
	p.saveNormal(n, n2);
	return p;
}
开发者ID:trineth,项目名称:bezierProject,代码行数:34,代码来源:bezier.cpp

示例6: assertion

void peanoclaw::interSubgridCommunication::GridLevelTransfer::vetoCoarseningIfNecessary (
  Patch&                               patch,
  peanoclaw::Vertex * const            fineGridVertices,
  const peano::grid::VertexEnumerator& fineGridVerticesEnumerator
) {
  assertion(!patch.isLeaf());

  if(tarch::la::smaller(patch.getTimeIntervals().getTimestepSize(), 0.0)) {
    assertion(!patch.isLeaf());
    bool patchBlocksErasing = false;
    for( int i = 0; i < TWO_POWER_D; i++ ) {
      peanoclaw::Vertex& vertex = fineGridVertices[fineGridVerticesEnumerator(i)];
      if(vertex.shouldErase()) {
        patchBlocksErasing = true;
      }
      vertex.setSubcellEraseVeto(i);
    }

    if(patchBlocksErasing) {
      patch.getTimeIntervals().setFineGridsSynchronize(true);
    }
  } else {
    patch.getTimeIntervals().setFineGridsSynchronize(false);
  }
}
开发者ID:unterweg,项目名称:peanoclaw,代码行数:25,代码来源:GridLevelTransfer.cpp

示例7: closePatch

void PdBase::closePatch(Patch& patch) {
	if(!patch.isValid()) {
		return;
	}
	libpd_closefile(patch.handle());
	patch.clear();
}	
开发者ID:senemezgi,项目名称:ofxPd,代码行数:7,代码来源:PdBase.cpp

示例8: SetNextTriNode

void Landscape::Reset()
{
    Patch *patch;

    SetNextTriNode(0);

    for ( int Y=0; Y < NUM_PATCHES_PER_SIDE; Y++ ) {
        for ( int X=0; X < NUM_PATCHES_PER_SIDE; X++) {
            patch = &(m_Patches[Y][X]);
            patch->Reset();

            if ( X > 0 )
                patch->GetBaseLeft()->LeftNeighbor = m_Patches[Y][X-1].GetBaseRight();
            else
                patch->GetBaseLeft()->LeftNeighbor = NULL;
            if ( X < (NUM_PATCHES_PER_SIDE-1) )
                patch->GetBaseRight()->LeftNeighbor = m_Patches[Y][X+1].GetBaseLeft();
            else
                patch->GetBaseRight()->LeftNeighbor = NULL;

            if ( Y > 0 )
                patch->GetBaseLeft()->RightNeighbor = m_Patches[Y-1][X].GetBaseRight();
            else
                patch->GetBaseLeft()->RightNeighbor = NULL;

            if ( Y < (NUM_PATCHES_PER_SIDE-1) )
                patch->GetBaseRight()->RightNeighbor = m_Patches[Y+1][X].GetBaseLeft();
            else
                patch->GetBaseRight()->RightNeighbor = NULL;
        }
    }
}
开发者ID:JakubVojvoda,项目名称:terrain-generation,代码行数:32,代码来源:landscape.cpp

示例9:

//Patch::Patch(const Eigen::Vector3d& p,const Eigen::Vector3d& n,const unsigned int& nIm,
//      const Eigen::Vector3i& inds)
//  : point_(p),normal_(n),nImgs_(nIm),inds_(inds)
//  {}
Patch::Patch(const Patch& p)
  : point_(p.getPoint()),
    pointInd_(p.getPointInd()),
    normal_(p.getNormal()),
    nImgs_(p.getNImages()),
    inds_(p.getInds())
  {}
开发者ID:dgoldberg92,项目名称:urban_texturing,代码行数:11,代码来源:patch.cpp

示例10: coarsen

void LMarkerCoarsen::coarsen(Patch<NDIM>& coarse,
                             const Patch<NDIM>& fine,
                             const int dst_component,
                             const int src_component,
                             const Box<NDIM>& coarse_box,
                             const IntVector<NDIM>& ratio) const
{
    Pointer<LMarkerSetData> dst_mark_data = coarse.getPatchData(dst_component);
    Pointer<LMarkerSetData> src_mark_data = fine.getPatchData(src_component);

    const Box<NDIM> fine_box = Box<NDIM>::refine(coarse_box, ratio);
    for (LMarkerSetData::SetIterator it(*src_mark_data); it; it++)
    {
        const Index<NDIM>& fine_i = it.getIndex();
        const Index<NDIM> coarse_i = coarsen_index(fine_i, ratio);
        if (fine_box.contains(fine_i) && coarse_box.contains(coarse_i))
        {
            const LMarkerSet& fine_mark_set = it();
            if (!dst_mark_data->isElement(coarse_i))
            {
                dst_mark_data->appendItemPointer(coarse_i, new LMarkerSet());
            }
            LMarkerSet& coarse_mark_set = *(dst_mark_data->getItem(coarse_i));
            coarse_mark_set.insert(
                coarse_mark_set.end(), fine_mark_set.begin(), fine_mark_set.end());
        }
    }
    return;
} // coarsen
开发者ID:BijanZarif,项目名称:IBAMR,代码行数:29,代码来源:LMarkerCoarsen.cpp

示例11: createPatch

Transform* PatchSet::createPatch(const std::string& filename, PatchOptions* poptions)
{
    Patch* patch = new Patch;
    patch->setPatchSet(this);
    Vec2d ll, ur;
    poptions->getPatchExtents(ll, ur);
    Vec2d range = (ur - ll);
    ref_ptr<Patch::Data> data = new Patch::Data;
    int patchDim = _resolution + 1;
    Vec3Array* verts = new Vec3Array(patchDim * patchDim);
    for (int j = 0; j < patchDim; ++j)
        for (int i = 0; i < patchDim; ++i)
            (*verts)[patchDim * j + i]
                = Vec3((ll.x() + i * range.x()
                        / static_cast<float>(_resolution)) * 81920.0,
                       (ll.y() + j * range.y()
                        / static_cast<float>(_resolution)) * 81920.0,
                       0.0);
    data->vertexData.array = verts;
    data->vertexData.binding = Geometry::BIND_PER_VERTEX;
    Vec3Array* norms = new Vec3Array(1);
    (*norms)[0] = Vec3d(0.0, 0.0, 1.0);
    data->normalData.array = norms;
    data->normalData.binding = Geometry::BIND_OVERALL;
    Vec4Array* colors = new Vec4Array(1);
    (*colors)[0] = Vec4(1.0, 1.0, 1.0, 1.0);
    data->colorData.array = colors;
    data->colorData.binding = Geometry::BIND_OVERALL;
    patch->setData(data);
    MatrixTransform* transform = new MatrixTransform;
    transform->addChild(patch);
    return transform;
}
开发者ID:2php,项目名称:osgearth,代码行数:33,代码来源:PatchSet.cpp

示例12: description

const Patch* PatchCache::get(const AssetAtlas::Entry* entry,
        const uint32_t bitmapWidth, const uint32_t bitmapHeight,
        const float pixelWidth, const float pixelHeight, const Res_png_9patch* patch) {

    const PatchDescription description(bitmapWidth, bitmapHeight, pixelWidth, pixelHeight, patch);
    const Patch* mesh = mCache.get(description);

    if (!mesh) {
        Patch* newMesh = new Patch();
        TextureVertex* vertices;

        if (entry) {
            // An atlas entry has a UV mapper
            vertices = newMesh->createMesh(bitmapWidth, bitmapHeight,
                    pixelWidth, pixelHeight, entry->uvMapper, patch);
        } else {
            vertices = newMesh->createMesh(bitmapWidth, bitmapHeight,
                    pixelWidth, pixelHeight, patch);
        }

        if (vertices) {
            setupMesh(newMesh, vertices);
        }

#if DEBUG_PATCHES
        if (g_HWUI_debug_patches) dumpFreeBlocks("Adding patch");
#endif

        mCache.put(description, newMesh);
        return newMesh;
    }

    return mesh;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例13:

void CartCellRobinPhysBdryOp::fillGhostCellValuesCodim2(
    const int patch_data_idx,
    const Array<BoundaryBox<NDIM> >& physical_codim2_boxes,
    const IntVector<NDIM>& ghost_width_to_fill,
    const Patch<NDIM>& patch,
    const bool adjoint_op)
{
    const int n_physical_codim2_boxes = physical_codim2_boxes.size();
    if (n_physical_codim2_boxes == 0) return;

    const Box<NDIM>& patch_box = patch.getBox();
    Pointer<CartesianPatchGeometry<NDIM> > pgeom = patch.getPatchGeometry();
    Pointer<CellData<NDIM, double> > patch_data = patch.getPatchData(patch_data_idx);
    const int patch_data_depth = patch_data->getDepth();
    const int patch_data_gcw = (patch_data->getGhostCellWidth()).max();
#if !defined(NDEBUG)
    if (patch_data_gcw != (patch_data->getGhostCellWidth()).min())
    {
        TBOX_ERROR(
            "CartCellRobinPhysBdryOp::fillGhostCellValuesCodim2():\n"
            "  patch data for patch data index "
            << patch_data_idx << " does not have uniform ghost cell widths." << std::endl);
    }
#endif
    const IntVector<NDIM> gcw_to_fill =
        IntVector<NDIM>::min(patch_data->getGhostCellWidth(), ghost_width_to_fill);

    for (int n = 0; n < n_physical_codim2_boxes; ++n)
    {
        const BoundaryBox<NDIM>& bdry_box = physical_codim2_boxes[n];
        const unsigned int location_index = bdry_box.getLocationIndex();
        const Box<NDIM> bc_fill_box =
            pgeom->getBoundaryFillBox(bdry_box, patch_box, gcw_to_fill);
        for (int d = 0; d < patch_data_depth; ++d)
        {
            CC_ROBIN_PHYS_BDRY_OP_2_FC(patch_data->getPointer(d),
                                       patch_data_gcw,
                                       location_index,
                                       patch_box.lower(0),
                                       patch_box.upper(0),
                                       patch_box.lower(1),
                                       patch_box.upper(1),
#if (NDIM == 3)
                                       patch_box.lower(2),
                                       patch_box.upper(2),
#endif
                                       bc_fill_box.lower(0),
                                       bc_fill_box.upper(0),
                                       bc_fill_box.lower(1),
                                       bc_fill_box.upper(1),
#if (NDIM == 3)
                                       bc_fill_box.lower(2),
                                       bc_fill_box.upper(2),
#endif
                                       adjoint_op ? 1 : 0);
        }
    }
    return;
} // fillGhostCellValuesCodim2
开发者ID:BijanZarif,项目名称:IBAMR,代码行数:59,代码来源:CartCellRobinPhysBdryOp.cpp

示例14: set_name

SKY_BOX::SKY_BOX()
{
   set_name("Skybox"); 

   // for debugging
//   set_color(Color::blue);

   // build the skybox mesh:
   LMESHptr sky_mesh = make_shared<LMESH>();
   Patch* p = nullptr;
   //sky_mesh->Sphere();

   sky_mesh->UV_BOX(p);

   p->set_sps_regularity(8.0);
   p-> set_do_lod(false);

    //sky_mesh->Cube();
   //sky_mesh->Icosahedron();


  //sky_mesh->read_file(**(Config::JOT_ROOT()+"/../models/simple/sphere.sm"));
   //sky_mesh->read_file(**(Config::JOT_ROOT()+"/../models/simple/sphere-no-uvs.sm"));
   //sky_mesh->read_file(**(Config::JOT_ROOT()+"/../models/simple/icosahedron.sm"));
  // sky_mesh->update_subdivision(3);

 

   //flip normals
   const double RADIUS =1000;

   Wvec d = Wpt::Origin()-sky_mesh->get_bb().center();
   sky_mesh->transform(Wtransf::scaling(RADIUS)*
                       Wtransf::translation(d),MOD());
   //sky_mesh->reverse();
 

   // TODO : make it use skybox texture for the reference image
   //        and proxy surface for the main draw
   
   //Skybox renders in default style now
   //skybox texture only draws the gradient
   //Translation bug fixed for the 10th time he he

   //the skybox GEOM contains a bode with the sphere geometry
   set_body(sky_mesh); 

   //world creation 
   if (_sky_instance)
      err_msg("SKY_BOX::SKY_BOX: warning: instance exists");
   _sky_instance = this;
   
   atexit(SKY_BOX::clean_on_exit);

   WORLD::create(_sky_instance, false);
   WORLD::undisplay(_sky_instance, false);//otherwise it starts up visible
   if (Config::get_var_bool("SHOW_SKYBOX",false))
      show();
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:59,代码来源:sky_box.cpp

示例15: applyPatches

 void IRGenerator::applyPatches(char* pcode)
 {
    for ( std::size_t index = 0; index < mPatches.size(); ++index )
    {
       Patch* ppatch = mPatches[index];
       ppatch->apply(pcode);
    }
 }
开发者ID:crafter2d,项目名称:crafter2d,代码行数:8,代码来源:irgenerator.cpp


注:本文中的Patch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。