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


C++ MeshPtr类代码示例

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


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

示例1: getResourceFullPath

bool Sample_MeshLod::getResourceFullPath(MeshPtr& mesh, String& outPath)
{
    ResourceGroupManager& resourceGroupMgr = ResourceGroupManager::getSingleton();
    String group = mesh->getGroup();
    String name = mesh->getName();
    Ogre::FileInfo* info = NULL;
    FileInfoListPtr locPtr = resourceGroupMgr.listResourceFileInfo(group);
    FileInfoList::iterator it, itEnd;
    it = locPtr->begin();
    itEnd = locPtr->end();
    for (; it != itEnd; it++) {
        if (stricmp(name.c_str(), it->filename.c_str()) == 0) {
            info = &*it;
            break;
        }
    }
    if(!info) {
        outPath = name;
        return false;
    }
    outPath = info->archive->getName();
    if (outPath[outPath .size()-1] != '/' && outPath[outPath .size()-1] != '\\') {
        outPath += '/';
    }
    outPath += info->path;
    if (outPath[outPath .size()-1] != '/' && outPath[outPath .size()-1] != '\\') {
        outPath += '/';
    }
    outPath += info->filename;

    return (info->archive->getType() == "FileSystem");
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:32,代码来源:MeshLod.cpp

示例2: CreateCornellBox

    MeshNode* SceneCreator::CreateCornellBox() {
        MeshPtr box = MeshCreator::CreateCube(10, 1, Vector<3,float>(1.0f, 1.0f, 1.0f), true);
        
        IDataBlockPtr color = Float4DataBlockPtr(new DataBlock<4, float>(box->GetGeometrySet()->GetSize()));
        for (unsigned int i = 0; i < color->GetSize(); ++i)
            color->SetElement(i, Vector<4, float>(1.0, 1.0, 1.0, 1.0));
        
        box->GetGeometrySet()->AddAttributeList("color", color);

        IDataBlockPtr colors = box->GetGeometrySet()->GetColors();
        Vector<4,float> red(1.0f, 0.0f, 0.0f, 1.0f);
        colors->SetElement(8, red);
        colors->SetElement(9, red);
        colors->SetElement(10, red);
        colors->SetElement(11, red);
        Vector<4,float> blue(0.0f, 0.0f, 0.8f, 1.0f);
        colors->SetElement(12, blue);
        colors->SetElement(13, blue);
        colors->SetElement(14, blue);
        colors->SetElement(15, blue);
        // Vector<4,float> transparent(0.0f, 0.0f, 0.8f, 0.0f);
        // colors->SetElement(16, transparent);
        // colors->SetElement(17, transparent);
        // colors->SetElement(18, transparent);
        // colors->SetElement(19, transparent);
        
        return new MeshNode(box);
    }
开发者ID:OpenEngineDK,项目名称:projects-RayTracing,代码行数:28,代码来源:SceneCreator.cpp

示例3: stream

void ClippingConverter::convert(const QByteArray &clippingData, const QString &directory)
{
    QDataStream stream(clippingData);
    stream.setFloatingPointPrecision(QDataStream::SinglePrecision);
    stream.setByteOrder(QDataStream::LittleEndian);

    QString newDirectory = directory;

    newDirectory.replace('\\', '/');
    if (!newDirectory.endsWith('/'))
        newDirectory.append('/');

    int objectCount, instanceCount;
    stream >> objectCount >> instanceCount;

    for (int i = 0; i < objectCount; ++i) {
        MeshPtr mesh = importObject(stream);

        // Serialize to a temporary file, then read it in again
        QTemporaryFile tempFile;
        if (!tempFile.open()) {
            qWarning("Unable to open the temporary %s file.", qPrintable(tempFile.fileName()));
            continue;
        }

        d->ogre->meshSerializer->exportMesh(mesh.getPointer(), tempFile.fileName().toStdString());

        QByteArray meshData = tempFile.readAll();
        QString meshFilename = QString("%1clipping/mesh-%2.mesh").arg(newDirectory).arg(i+1);

        d->output->writeFile(meshFilename, meshData);
    }

    QByteArray instances;

    instances.append("[");

    for (int i = 0; i < instanceCount; ++i) {
        QVector4D position;
        int index;

        stream >> position >> index;

        QString line = QString("{\"position\":[%1,%2,%3],\"file\":\"%5mesh-%4.mesh\"}")
                .arg(position.x())
                .arg(position.y())
                .arg(position.z())
                .arg(index+1)
                .arg(newDirectory);
        if (i > 0)
            instances.append(",");
        instances.append(line.toAscii());

    }

    instances.append("]");

    d->output->writeFile(newDirectory + "clipping.json", instances);

}
开发者ID:GrognardsFromHell,项目名称:EvilTemple-Native,代码行数:60,代码来源:clippingconverter.cpp

示例4: InvDtFunction

TimeIntegrator::TimeIntegrator(BFPtr steadyJacobian, SteadyResidual &steadyResidual, MeshPtr mesh,
                               BCPtr bc, IPPtr ip, map<int, TFunctionPtr<double>> initialCondition, bool nonlinear) :
  _steadyJacobian(steadyJacobian), _steadyResidual(steadyResidual), _bc(bc), _nonlinear(nonlinear)
{
  _t = 0;
  _dt = 1e-3;
  _timestep = 0;
  _nlTolerance = 1e-6;
  _nlIterationMax = 20;
  _commRank = Teuchos::GlobalMPISession::getRank();

  _rhs = RHS::rhs();
  _solution = Teuchos::rcp( new TSolution<double>(mesh, _bc, _rhs, ip) );

  BCPtr nullBC = Teuchos::rcp((BC*)NULL);
  RHSPtr nullRHS = Teuchos::rcp((RHS*)NULL);
  IPPtr nullIP = Teuchos::rcp((IP*)NULL);
  _prevTimeSolution = Teuchos::rcp(new TSolution<double>(mesh, nullBC, nullRHS, nullIP) );
  _prevTimeSolution->projectOntoMesh(initialCondition);
  if (_nonlinear)
  {
    _prevNLSolution = Teuchos::rcp(new TSolution<double>(mesh, nullBC, nullRHS, nullIP) );
    _prevNLSolution->setSolution(_prevTimeSolution);
  }

  _invDt = Teuchos::rcp( new InvDtFunction(_dt) );

  mesh->registerSolution(_prevTimeSolution);
  mesh->registerSolution(_prevNLSolution);

  if (_nonlinear)
  {
    _rhs->addTerm( -_steadyResidual.createResidual(_prevNLSolution, false) );
  }
}
开发者ID:CamelliaDPG,项目名称:Camellia,代码行数:35,代码来源:TimeIntegrator.cpp

示例5: values

  void values(FieldContainer<double> &values, BasisCachePtr basisCache)
  {
    int numCells = values.dimension(0);
    int numPoints = values.dimension(1);

    MeshPtr mesh = basisCache->mesh();
    vector<int> cellIDs = basisCache->cellIDs();

    double tol=1e-14;
    for (int cellIndex=0; cellIndex<numCells; cellIndex++)
    {
      double h = 1.0;
      if (_spatialCoord==0)
      {
        h = mesh->getCellXSize(cellIDs[cellIndex]);
      }
      else if (_spatialCoord==1)
      {
        h = mesh->getCellYSize(cellIDs[cellIndex]);
      }
      for (int ptIndex=0; ptIndex<numPoints; ptIndex++)
      {
        values(cellIndex,ptIndex) = sqrt(h);
      }
    }
  }
开发者ID:CamelliaDPG,项目名称:Camellia,代码行数:26,代码来源:SimpleTest.cpp

示例6: createSphere

void GeomUtils::createSphere(  const String& strName
							 , const float radius
							 , const int nRings, const int nSegments
							 , bool bNormals
							 , bool bTexCoords)
{
	MeshPtr pSphere = MeshManager::getSingleton().createManual(strName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
	SubMesh *pSphereVertex = pSphere->createSubMesh();
	pSphere->sharedVertexData = new VertexData();

	createSphere(pSphere->sharedVertexData, pSphereVertex->indexData
		, radius
		, nRings, nSegments
		, bNormals // need normals
		, bTexCoords // need texture co-ordinates
		);

	// Generate face list
	pSphereVertex->useSharedVertices = true;

	// the original code was missing this line:
	pSphere->_setBounds( AxisAlignedBox( Vector3(-radius, -radius, -radius), Vector3(radius, radius, radius) ), false );
	pSphere->_setBoundingSphereRadius(radius);
	// this line makes clear the mesh is loaded (avoids memory leaks)
	pSphere->load();
}
开发者ID:151706061,项目名称:MEPP,代码行数:26,代码来源:GeomUtils.cpp

示例7: OGRE_EXCEPT

//-----------------------------------------------------------------------
PatchMeshPtr MeshManager::createBezierPatch(const String& name, const String& groupName,
        void* controlPointBuffer, VertexDeclaration *declaration,
        size_t width, size_t height,
        size_t uMaxSubdivisionLevel, size_t vMaxSubdivisionLevel,
        PatchSurface::VisibleSide visibleSide,
        HardwareBuffer::Usage vbUsage, HardwareBuffer::Usage ibUsage,
        bool vbUseShadow, bool ibUseShadow)
{
    if (width < 3 || height < 3)
    {
        OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
                    "Bezier patch require at least 3x3 control points",
                    "MeshManager::createBezierPatch");
    }

    MeshPtr pMesh = getByName(name);
    if (!pMesh.isNull())
    {
        OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM, "A mesh called " + name +
                    " already exists!", "MeshManager::createBezierPatch");
    }
    PatchMesh* pm = OGRE_NEW PatchMesh(this, name, getNextHandle(), groupName);
    pm->define(controlPointBuffer, declaration, width, height,
               uMaxSubdivisionLevel, vMaxSubdivisionLevel, visibleSide, vbUsage, ibUsage,
               vbUseShadow, ibUseShadow);
    pm->load();
    ResourcePtr res(pm);
    addImpl(res);

    return res.staticCast<PatchMesh>();
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:32,代码来源:OgreMeshManager.cpp

示例8: createManual

//-----------------------------------------------------------------------
MeshPtr MeshManager::createPlane( const String& name, const String& groupName,
                                  const Plane& plane, Real width, Real height, int xsegments, int ysegments,
                                  bool normals, unsigned short numTexCoordSets, Real xTile, Real yTile, const Vector3& upVector,
                                  HardwareBuffer::Usage vertexBufferUsage, HardwareBuffer::Usage indexBufferUsage,
                                  bool vertexShadowBuffer, bool indexShadowBuffer)
{
    // Create manual mesh which calls back self to load
    MeshPtr pMesh = createManual(name, groupName, this);
    // Planes can never be manifold
    pMesh->setAutoBuildEdgeLists(false);
    // store parameters
    MeshBuildParams params;
    params.type = MBT_PLANE;
    params.plane = plane;
    params.width = width;
    params.height = height;
    params.xsegments = xsegments;
    params.ysegments = ysegments;
    params.normals = normals;
    params.numTexCoordSets = numTexCoordSets;
    params.xTile = xTile;
    params.yTile = yTile;
    params.upVector = upVector;
    params.vertexBufferUsage = vertexBufferUsage;
    params.indexBufferUsage = indexBufferUsage;
    params.vertexShadowBuffer = vertexShadowBuffer;
    params.indexShadowBuffer = indexShadowBuffer;
    mMeshBuildParams[pMesh.getPointer()] = params;

    // to preserve previous behaviour, load immediately
    pMesh->load();

    return pMesh;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:35,代码来源:OgreMeshManager.cpp

示例9: addMesh

    //------------------------------------------------------------------------------------------------
    void StaticMeshToShapeConverter::addMesh(const MeshPtr &mesh, const Matrix4 &transform)
    {
        // Each entity added need to reset size and radius
        // next time getRadius and getSize are asked, they're computed.
        mBounds  = Ogre::Vector3(-1,-1,-1);
        mBoundRadius = -1;

        //_entity = entity;
        //_node = (SceneNode*)(_entity->getParentNode());
        mTransform = transform;

        if (mesh->hasSkeleton ())
            Ogre::LogManager::getSingleton().logMessage("MeshToShapeConverter::addMesh : Mesh " + mesh->getName () + " as skeleton but added to trimesh non animated");

        if (mesh->sharedVertexData)
        {
            VertexIndexToShape::addStaticVertexData (mesh->sharedVertexData);
        }

        for(unsigned int i = 0;i < mesh->getNumSubMeshes();++i)
        {
            SubMesh *sub_mesh = mesh->getSubMesh(i);

            if (!sub_mesh->useSharedVertices)
            {
                VertexIndexToShape::addIndexData(sub_mesh->indexData, mVertexCount);
                VertexIndexToShape::addStaticVertexData (sub_mesh->vertexData);
            }
            else
            {
                VertexIndexToShape::addIndexData (sub_mesh->indexData);
            }

        }
    }
开发者ID:AlfredBroda,项目名称:openmw,代码行数:36,代码来源:BtOgre.cpp

示例10: if

void
pcl::ihs::Integration::age (const MeshPtr& mesh, const bool cleanup) const
{
  for (unsigned int i=0; i<mesh->sizeVertices (); ++i)
  {
    PointIHS& pt = mesh->getVertexDataCloud () [i];
    if (pt.age < max_age_)
    {
      // Point survives
      ++(pt.age);
    }
    else if (pt.age == max_age_) // Judgement Day
    {
      if (pcl::ihs::countDirections (pt.directions) < min_directions_)
      {
        // Point dies (no need to transform it)
        mesh->deleteVertex (VertexIndex (i));
      }
      else
      {
        // Point becomes immortal
        pt.age = std::numeric_limits <unsigned int>::max ();
      }
    }
  }

  if (cleanup)
  {
    mesh->cleanUp ();
  }
}
开发者ID:tfili,项目名称:pcl,代码行数:31,代码来源:integration.cpp

示例11: getMeshStatistics

    //-----------------------------------------------------------------------
    void
    MeshInformer::getMeshTriangles(const MeshPtr& mesh,
                                   std::vector<Vector3>& vertices,
                                   std::vector<size_t>& indices,
                                   std::vector<size_t>* indexOffsets)
    {
        size_t numVertices = 0, numIndices = 0;
        getMeshStatistics(mesh, numVertices, numIndices);

        size_t vertex_offset = vertices.size();
        size_t index_offset = indices.size();

        vertices.resize(vertex_offset + numVertices);
        indices.resize(index_offset + numIndices);

        Vector3* pVertices = &vertices[0];
        size_t* pIndices = &indices[0];
        size_t shared_vertex_offset = vertex_offset;
        bool added_shared_vertex = false;

        size_t numSubMeshes = mesh->getNumSubMeshes();
        for (size_t i = 0; i < numSubMeshes; ++i)
        {
            SubMesh* subMesh = mesh->getSubMesh(i);

            if (indexOffsets)
            {
                indexOffsets->push_back(index_offset);
            }

            if (subMesh->operationType == RenderOperation::OT_TRIANGLE_LIST ||
                subMesh->operationType == RenderOperation::OT_TRIANGLE_STRIP ||
                subMesh->operationType == RenderOperation::OT_TRIANGLE_FAN)
            {
                size_t current_vertex_offset;
                if (subMesh->useSharedVertices)
                {
                    if (!added_shared_vertex)
                    {
                        size_t vertexCount = getVertices(pVertices + vertex_offset, subMesh->parent->sharedVertexData);
                        shared_vertex_offset = vertex_offset;
                        vertex_offset += vertexCount;
                        added_shared_vertex = true;
                    }

                    current_vertex_offset = shared_vertex_offset;
                }
                else
                {
                    size_t vertexCount = getVertices(pVertices + vertex_offset, subMesh->vertexData);
                    current_vertex_offset = vertex_offset;
                    vertex_offset += vertexCount;
                }

                size_t index_count = getTriangles(pIndices + index_offset, subMesh->indexData, current_vertex_offset, subMesh->operationType);
                index_offset += index_count;
            }
        }
    }
开发者ID:gitrider,项目名称:wxsj2,代码行数:60,代码来源:FairyMeshInformer.cpp

示例12: getMesh

MeshPtr ResourceStorage::getMesh(const std::wstring& path)
{
    MeshPtr mesh = getResource<Mesh>(path);
    if (mesh.isNull()) {
        mesh = loadMesh(path);
    }

    return mesh;
}
开发者ID:von6yka,项目名称:Arcanoid-3D,代码行数:9,代码来源:ResourceStorage.cpp

示例13: throw

void SthenoCore::createLocalServiceReplica(
        UUIDPtr& sid,
        ServiceParamsPtr& params,
        ServiceAbstractPtr& sPtr) throw (RuntimeException&, ServiceException&) {
    if (!isValid()) {
        throw RuntimeException(RuntimeException::INVALID_RUNTIME);
    }
    FaultTolerancePtr ftToleranceSvc;
    try {
        m_overlay->getFaultTolerance(ftToleranceSvc);
    } catch (OverlayException& ex) {
        throw RuntimeException(RuntimeException::INVALID_OVERLAY);
    }
    UUIDPtr iid(UUID::generateUUID());
    createServiceInstance(sid, iid, sPtr);
    //QoSResources* qos = sPtr->calculateQoSResources(params);    

    printf("INFO: createLocalServiceReplica() - SID=%s before open service!\n", sid->toString().c_str());
    QoSManagerInterface* qosManager = 0;
    if (m_reservationFlag) {
        UUIDPtr serviceCgroupUUID(UUID::generateUUID());
        String path = "service_" + sid->toString() + "_" + serviceCgroupUUID->toString();

        qosManager = m_serviceQosManager->createSubDomainQoSManager(path, 200, m_runtimePeriod);
        //String ftPath = "/FT";
        String ftPath = Cgroup::getSep();
        ftPath += "FT";
        //HierarchicalPath::appendPaths(path, "/FT");
        QoSManagerInterface* qosFTManager = 0;
        qosFTManager = qosManager->createSubDomainQoSManager(ftPath, 100, m_runtimePeriod);

        String servicePath = Cgroup::getSep();
        servicePath += "service";
        //HierarchicalPath::appendPaths(path, "/service");
        QoSManagerInterface* qosServiceManager = 0;
        qosServiceManager = qosManager->createSubDomainQoSManager(servicePath, 100, m_runtimePeriod);

        //String path = "service_" + sid->toString() + "_" + serviceCgroupUUID->toString();
        //qosManager = m_serviceQosManager->createSubDomainQoSManager(path, 10000, QoSManagerInterface::DEFAULT_PERIOD);
    }
    sPtr->open(params, ServiceAbstract::FT_REPLICA, qosManager);
    printf("INFO: createLocalServiceReplica() SID=%s after open service!\n", sid->toString().c_str());

    ServiceInstanceInfoPtr info;
    //UUIDPtr iid = sPtr->getIID();
    this->getInstanceOfService(sid, iid, info);
    MeshPtr meshPtr;
    try {
        getOverlay()->getMesh(meshPtr);
    } catch (OverlayException& ex) {
        throw RuntimeException(RuntimeException::INVALID_OVERLAY);
    }
    meshPtr->onServiceCreation(info);

}
开发者ID:edenduthie,项目名称:rtft1,代码行数:55,代码来源:SthenoCore.cpp

示例14: extractSkeletonData

//-----------------------------------------------------------------------
bool HardwareSkinningFactory::extractSkeletonData(const Entity* pEntity, size_t subEntityIndex, ushort& boneCount, ushort& weightCount)
{
    bool isValidData = false;
    boneCount = 0;
    weightCount = 0;

    //Check if we have pose animation which the HS sub render state does not 
    //know how to handle
    bool hasVertexAnim = pEntity->getMesh()->hasVertexAnimation();

    //gather data on the skeleton
    if (!hasVertexAnim && pEntity->hasSkeleton())
    {
        //get weights count
        MeshPtr pMesh = pEntity->getMesh();

        RenderOperation ro;
        SubMesh* pSubMesh = pMesh->getSubMesh(subEntityIndex);
        pSubMesh->_getRenderOperation(ro,0);

        //get the largest bone assignment
        boneCount = ushort(std::max(pMesh->sharedBlendIndexToBoneIndexMap.size(), pSubMesh->blendIndexToBoneIndexMap.size()));
            
        //go over vertex deceleration 
        //check that they have blend indices and blend weights
        const VertexElement* pDeclWeights = ro.vertexData->vertexDeclaration->findElementBySemantic(VES_BLEND_WEIGHTS,0);
        const VertexElement* pDeclIndexes = ro.vertexData->vertexDeclaration->findElementBySemantic(VES_BLEND_INDICES,0);
        if ((pDeclWeights != NULL) && (pDeclIndexes != NULL))
        {
            isValidData = true;
            switch (pDeclWeights->getType())
            {
            case VET_FLOAT1:
                weightCount = 1;
                break;
            case VET_USHORT2_NORM:
            case VET_FLOAT2:
                weightCount = 2;
                break;
            case VET_FLOAT3:
                weightCount = 3;
                break;
            case VET_USHORT4_NORM:
            case VET_UBYTE4_NORM:
            case VET_FLOAT4:
                weightCount = 4;
                break;
            default:
                isValidData = false;
                break;
            }
        }
    }
    return isValidData;
}
开发者ID:terakuran,项目名称:ogre,代码行数:56,代码来源:OgreShaderExHardwareSkinning.cpp

示例15: createOrRetrieve

    //-----------------------------------------------------------------------
    MeshPtr MeshManager::load( const String& filename, const String& groupName, 
		HardwareBuffer::Usage vertexBufferUsage, 
		HardwareBuffer::Usage indexBufferUsage, 
		bool vertexBufferShadowed, bool indexBufferShadowed)
    {
		MeshPtr pMesh = createOrRetrieve(filename,groupName,false,0,0,
                                         vertexBufferUsage,indexBufferUsage,
                                         vertexBufferShadowed,indexBufferShadowed).first.staticCast<Mesh>();
		pMesh->load();
        return pMesh;
    }
开发者ID:Bewolf2,项目名称:LearningGameAI,代码行数:12,代码来源:OgreMeshManager.cpp


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