• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ vesSharedPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: if

bool vesMaterial::addAttribute(vesSharedPtr<vesMaterialAttribute> attribute)
{
  if (!attribute) {
    return false;
  }

  if (attribute->type()    != vesMaterialAttribute::Texture &&
      attribute->binding() == vesMaterialAttribute::BindAll) {

    // Shader is a special attribute.
    if (attribute->type() == vesMaterialAttribute::Shader) {
      return this->setShaderProgram(std::tr1::static_pointer_cast<vesShaderProgram>(attribute));
    }

    // Everything else.
    return this->m_internal->addAttribute(
      this->m_internal->m_attributes, attribute);
  }
  else  if(attribute->type() == vesMaterialAttribute::Texture) {
    vesSharedPtr<vesTexture> texture = std::tr1::static_pointer_cast<vesTexture>(attribute);

    // Cache last texture so that we can release graphics resources on it.
    this->m_internal->m_textureAttributes[texture->textureUnit()] = texture;

    return true;
  }
  else if(attribute->binding() == vesMaterialAttribute::BindMinimal)
  {
    return this->m_internal->addAttribute(
      this->m_internal->m_minimalAttributes, attribute);
  }

  return false;
}
开发者ID:151706061,项目名称:ves,代码行数:34,代码来源:vesMaterial.cpp


示例2: sourceData

void vesKiwiDataConversionTools::GenericConvertTriangles(vtkPolyData* input,
  vesSharedPtr<vesGeometryData> output)
{
  vesSourceDataP3N3f::Ptr sourceData (new vesSourceDataP3N3f());

  double inPoint[3];
  for (int i = 0; i < input->GetNumberOfPoints(); ++i){
    input->GetPoint(i, inPoint);

    vesVertexDataP3N3f vertexData;
    vertexData.m_position = vesVector3f(inPoint[0], inPoint[1], inPoint[2]);
    sourceData->pushBack(vertexData);
  }

  // copy triangles in place to ves structure
  vtkCellArray* polys = input->GetPolys();
  vtkIdType num;
  vtkIdType* vertices;

  vesSharedPtr< vesIndices<T> > indicesObj =
    std::tr1::static_pointer_cast< vesIndices<T> >
    (output->triangles()->getVesIndices());

  typename vesIndices<T>::Indices* triangleIndices
    = indicesObj->indices();

  triangleIndices->clear();
  triangleIndices->resize(polys->GetNumberOfCells());

  T* outIndex = &triangleIndices->front();
  for (int i = 0; i < polys->GetNumberOfCells(); ++i)
  {
    // there are 4 elements for each triangle cell in the array (count, i1, i2, i3)
    polys->GetCell(4*i, num, vertices);
    *outIndex++ = vertices[0];
    *outIndex++ = vertices[1];
    *outIndex++ = vertices[2];
  }

  if (input->GetPointData()->GetNormals())
  {
    vtkDataArray* normals = input->GetPointData()->GetNormals();
    for (int i = 0; i < input->GetNumberOfPoints(); ++i)
    {
      sourceData->arrayReference()[i].m_normal[0] = normals->GetTuple(i)[0];
      sourceData->arrayReference()[i].m_normal[1] = normals->GetTuple(i)[1];
      sourceData->arrayReference()[i].m_normal[2] = normals->GetTuple(i)[2];
    }
  }
  else
  {
    output->computeNormals<T>();
  }

  output->computeBounds();
  output->addSource(sourceData);
}
开发者ID:HephaestusVision,项目名称:midas-kiwi,代码行数:57,代码来源:vesKiwiDataConversionTools.cpp


示例3: drawPrimitive

void vesMapper::drawPrimitive(const vesRenderState &renderState,
                              vesSharedPtr<vesPrimitive> primitive)
{
  // Send the primitive type information out
  renderState.m_material->bindRenderData(
    renderState, vesRenderData(primitive->primitiveType(), this->pointSize(), this->lineWidth()));

  glDrawElements(primitive->primitiveType(), primitive->numberOfIndices(),
                 primitive->indicesValueType(),  (void*)0);
}
开发者ID:FredChamp,项目名称:simple-VES,代码行数:10,代码来源:vesMapper.cpp


示例4: addShader

bool vesShaderProgram::addShader(vesSharedPtr<vesShader> shader)
{
    if (!shader)
        return false;

    std::vector< vesSharedPtr<vesShader> >::iterator itr
        = this->m_internal->m_shaders.begin();

    // \todo: Memory management.
    for (; itr != this->m_internal->m_shaders.end(); ++itr) {

        if (shader == *itr)
            return false;

        if ((*itr)->shaderType() == shader->shaderType()) {
            this->m_internal->m_shaders.erase(itr);
            break;
        }
    }

    this->m_internal->m_shaders.push_back(shader);

    // shader->addProgramReference(this);

    this->setDirtyStateOn();

    return true;
}
开发者ID:zenotech,项目名称:zViz,代码行数:28,代码来源:vesShaderProgram.cpp


示例5: SetTextureData

//----------------------------------------------------------------------------
void vesKiwiDataConversionTools::SetTextureData(vtkUnsignedCharArray* pixels,
  vesSharedPtr<vesTexture> texture, int width, int height)
{
  assert(texture);
  vesImage::Ptr image = vesKiwiDataConversionTools::ImageFromPixels(pixels, width, height);
  texture->setImage(image);
}
开发者ID:HephaestusVision,项目名称:midas-kiwi,代码行数:8,代码来源:vesKiwiDataConversionTools.cpp


示例6: SetVertexColors

//----------------------------------------------------------------------------
void vesKiwiDataConversionTools::SetVertexColors(vtkDataArray* scalars,
  vtkScalarsToColors* scalarsToColors, vesSharedPtr<vesGeometryData> geometryData)
{
  if (geometryData) {
    vesSourceData::Ptr colorSourceData = ConvertScalarsToColors(scalars, scalarsToColors);
    if (colorSourceData) {
      geometryData->addSource(colorSourceData);
    }
  }
}
开发者ID:FredChamp,项目名称:simple-VES,代码行数:11,代码来源:vesKiwiDataConversionTools.cpp


示例7: SetTextureCoordinates

//----------------------------------------------------------------------------
void vesKiwiDataConversionTools::SetTextureCoordinates(vtkDataArray* tcoords,
  vesSharedPtr<vesGeometryData> geometryData)
{
  if (geometryData) {
    vesSourceDataT2f::Ptr tcoordSourceData = ConvertTCoords(tcoords);
    if (tcoordSourceData) {
      geometryData->addSource(tcoordSourceData);
    }
  }
}
开发者ID:FredChamp,项目名称:simple-VES,代码行数:11,代码来源:vesKiwiDataConversionTools.cpp


示例8: assert

void vesMapper::drawPoints(const vesRenderState &renderState,
                           vesSharedPtr<vesPrimitive> points)
{
  assert(this->m_geometryData);

  if(points->size())
  {
    // Draw using indices
    this->drawPrimitive(renderState, points);
  }
  else
  {
    vesSharedPtr<vesSourceData> data =
        m_geometryData->sourceData(vesVertexAttributeKeys::Position);
    // Send the primitive type information out
    renderState.m_material->bindRenderData(
      renderState, vesRenderData(vesPrimitiveRenderType::Points, this->pointSize(), this->lineWidth()));
    glDrawArrays(points->primitiveType(), 0, data->sizeOfArray());
  }
}
开发者ID:FredChamp,项目名称:simple-VES,代码行数:20,代码来源:vesMapper.cpp


示例9:

bool vesMaterial::vesInternal::addAttribute(
  Attributes &attributes,
  vesSharedPtr<vesMaterialAttribute> attribute)
{
  if (!attribute) {
    return false;
  }

  vesInternal::Attributes::iterator itr =
    attributes.find(attribute->type());

  if (itr == attributes.end() || ( (itr->second) != attribute )) {

    attributes[attribute->type()] = attribute;

    return true;
  }

  return false;
}
开发者ID:151706061,项目名称:ves,代码行数:20,代码来源:vesMaterial.cpp


示例10: setShaderProgram

bool vesMaterial::setShaderProgram(vesSharedPtr<vesShaderProgram> shaderProgram)
{
  if (!shaderProgram || shaderProgram == this->m_shaderProgram) {
    return false;
  }

  this->m_shaderProgram = shaderProgram;
  this->m_internal->m_attributes[shaderProgram->type()] =
    this->m_shaderProgram;

  return true;
}
开发者ID:151706061,项目名称:ves,代码行数:12,代码来源:vesMaterial.cpp


示例11: drawTriangles

void vesMapper::drawTriangles(const vesRenderState &renderState,
                              vesSharedPtr<vesPrimitive> triangles)
{
  assert(this->m_geometryData);

  const unsigned int numberOfIndices
    = triangles->numberOfIndices();

  unsigned int drawnIndices = 0;

  while (drawnIndices < numberOfIndices) {
    int numberOfIndicesToDraw = numberOfIndices - drawnIndices;

    if (numberOfIndicesToDraw > this->m_maximumTriangleIndicesPerDraw) {
      numberOfIndicesToDraw = this->m_maximumTriangleIndicesPerDraw;
    }

    uintptr_t offset = 0;

    // Send the primitive type information out
    renderState.m_material->bindRenderData(
      renderState, vesRenderData(triangles->primitiveType(), this->pointSize(), this->lineWidth()));

    if (!this->m_enableWireframe) {
      offset = triangles->sizeOfDataType() * drawnIndices;

      glDrawElements(triangles->primitiveType(), numberOfIndicesToDraw,
                     triangles->indicesValueType(), (void*)offset);
    }
    else {
      for(int i = 0; i < numberOfIndicesToDraw; i += 3)
      {
          offset = triangles->sizeOfDataType() * i + triangles->sizeOfDataType()
                   * drawnIndices;
          glDrawElements(GL_LINE_LOOP, 3,
                         triangles->indicesValueType(), (void*)offset);
      }
    }

    drawnIndices += numberOfIndicesToDraw;
  }
}
开发者ID:FredChamp,项目名称:simple-VES,代码行数:42,代码来源:vesMapper.cpp


示例12: removeChild

bool vesGroupNode::removeChild(vesSharedPtr<vesNode> child)
{
  if (!child) {
    return false;
  }

  // \note:No check if the child really existed. This is for performance
  // reasons.

  // \note: Ensure that parent of this node is "this" group node.
  if (child->parent() == this) {

    this->m_children.remove(child);

    this->setBoundsDirty(true);

    return true;
  }

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


示例13: SetTextureCoordinates

//----------------------------------------------------------------------------
void vesKiwiDataConversionTools::SetTextureCoordinates(vtkDataArray* tcoords,
  vesSharedPtr<vesGeometryData> geometryData)
{
  assert(tcoords);
  assert(tcoords->GetNumberOfComponents() == 2);
  assert(geometryData);

  const size_t nTuples = tcoords->GetNumberOfTuples();

  vesSourceDataT2f::Ptr texCoordSourceData (new vesSourceDataT2f());

  for (size_t i = 0; i < nTuples; ++i)
    {
    double* values = tcoords->GetTuple(i);
    vesVertexDataT2f textureCoordinate;
    textureCoordinate.m_textureCoordinate = vesVector2f(values[0], values[1]);
    texCoordSourceData->pushBack(textureCoordinate);
    }

  geometryData->addSource(texCoordSourceData);
}
开发者ID:HephaestusVision,项目名称:midas-kiwi,代码行数:22,代码来源:vesKiwiDataConversionTools.cpp


示例14: SetVertexColors

//----------------------------------------------------------------------------
void vesKiwiDataConversionTools::SetVertexColors(
  vtkUnsignedCharArray* colors, vesSharedPtr<vesGeometryData> geometryData)
{
  assert(geometryData);
  assert(colors);
  assert(colors->GetNumberOfComponents() == 3);

  unsigned char rgb[3];
  const size_t nTuples = colors->GetNumberOfTuples();

  vesSourceDataC3f::Ptr colorSourceData (new vesSourceDataC3f());
  for (size_t i = 0; i < nTuples; ++i)
    {
    colors->GetTupleValue(i, rgb);
    vesVertexDataC3f color;
    color.m_color = vesVector3f(rgb[0]/255.0, rgb[1]/255.0, rgb[2]/255.0);
    colorSourceData->pushBack(color);
    }

  geometryData->addSource(colorSourceData);
}
开发者ID:HephaestusVision,项目名称:midas-kiwi,代码行数:22,代码来源:vesKiwiDataConversionTools.cpp


示例15: addChild

bool vesGroupNode::addChild(vesSharedPtr<vesNode> child)
{
  if (!child) {
    return false;
  }

  Children::iterator itr = this->m_children.begin();

  for (; itr != this->m_children.end(); ++itr) {
    if ( (*itr) == child ) {
      return false;
    }
  }

  child->setParent(this);

  this->m_children.push_back(child);

  this->setBoundsDirty(true);

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


示例16: addSelfToRenderer

//----------------------------------------------------------------------------
void vesKiwiPolyDataRepresentation::addSelfToRenderer(
  vesSharedPtr<vesRenderer> renderer)
{
  assert(renderer);
  renderer->addActor(this->Internal->Actor);
}
开发者ID:151706061,项目名称:ves,代码行数:7,代码来源:vesKiwiPolyDataRepresentation.cpp


示例17: removeSelfFromRenderer

//----------------------------------------------------------------------------
void vesKiwiPolyDataRepresentation::removeSelfFromRenderer(
  vesSharedPtr<vesRenderer> renderer)
{
  assert(renderer);
  renderer->removeActor(this->Internal->Actor);
}
开发者ID:151706061,项目名称:ves,代码行数:7,代码来源:vesKiwiPolyDataRepresentation.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ vfsStream类代码示例发布时间:2022-05-31
下一篇:
C++ vertex_type类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap