Ejemplo n.º 1
0
const wchar_t* ImplAAFTypeDefExtEnum::elementName(OMUInt32 index) const
{
  TRACE("ImplAAFTypeDefExtEnum::elementName");
  PRECONDITION( "Valid index", index < elementCount() );


  // Get the element names buffer and the number of characters in the buffer
  const wchar_t* namesBuffer =
    reinterpret_cast<const wchar_t*>(_ElementNames.bits());
  const size_t namesBufferSize = _ElementNames.bitsSize() / sizeof(wchar_t);

  // Allocate an array that will contain the pointers to the element names
  const size_t nameCount =
      ImplAAFTypeDef::stringArrayStringCount( namesBuffer, namesBufferSize );
  ASSERT( "Valid name count", nameCount == elementCount() );
  const wchar_t** names = new const wchar_t*[ nameCount ];

  // Get the pointers to the element names
  ImplAAFTypeDef::getStringArrayStrings( namesBuffer,
                                         namesBufferSize,
                                         names,
                                         nameCount );

  // The reguested element name
  const wchar_t* result = names[index];

  delete[] names;
  names = 0;


  POSTCONDITION( "Valid result", result != 0 );
  return result;
}
Ejemplo n.º 2
0
Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize)
    : type(type), precision(precision), name(name), arraySize(arraySize)
{
    int bytes = gl::UniformInternalSize(type) * elementCount();
    data = new unsigned char[bytes];
    memset(data, 0, bytes);
    dirty = true;

    psRegisterIndex = -1;
    vsRegisterIndex = -1;
    registerCount = VariableRowCount(type) * elementCount();
}
Ejemplo n.º 3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RigFemPart::findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices) const
{
    if (m_elementSearchTree.isNull())
    {
        // build tree

        size_t elmCount = elementCount();

        std::vector<cvf::BoundingBox> cellBoundingBoxes;
        cellBoundingBoxes.resize(elmCount);

        for (size_t elmIdx = 0; elmIdx < elmCount; ++elmIdx)
        {
            const int* cellIndices = connectivities(elmIdx);
            cvf::BoundingBox& cellBB = cellBoundingBoxes[elmIdx];
            cellBB.add(m_nodes.coordinates[cellIndices[0]]);
            cellBB.add(m_nodes.coordinates[cellIndices[1]]);
            cellBB.add(m_nodes.coordinates[cellIndices[2]]);
            cellBB.add(m_nodes.coordinates[cellIndices[3]]);
            cellBB.add(m_nodes.coordinates[cellIndices[4]]);
            cellBB.add(m_nodes.coordinates[cellIndices[5]]);
            cellBB.add(m_nodes.coordinates[cellIndices[6]]);
            cellBB.add(m_nodes.coordinates[cellIndices[7]]);
        }

        m_elementSearchTree = new cvf::BoundingBoxTree;
        m_elementSearchTree->buildTreeFromBoundingBoxes(cellBoundingBoxes, NULL);
    }

    m_elementSearchTree->findIntersections(inputBB, elementIndices);
}
void CSenLayeredXmlProperties::ElementsL(RPointerArray<CSenElement>& aProps) const
    {
    if ( ipChildProperties )
        {
        ipChildProperties->ElementsL(aProps);
        }
            
    RPointerArray<CSenElement>& elements = ipFragment->AsElement().ElementsL();
    TInt elementCount(elements.Count());
    TInt propsCount(0);
    TBool found;
    for (TInt i=0; i<elementCount; i++)
        {
        found = EFalse;
        propsCount = aProps.Count();
        for (TInt j=0; j<propsCount; j++)
            {
             if ( elements[i]->LocalName() == aProps[j]->LocalName() )
                {
                found = ETrue;
                break;
                }
            }
        if ( !found )
            {
#ifdef EKA2
            aProps.AppendL(elements[i]);
#else
            User::LeaveIfError(aProps.Append(elements[i]));
#endif
            }
        }
    }
void
for_each_host(TInView aInView, TFunctor aOperator, TPolicy aPolicy)
{
	for (int i = 0; i < elementCount(aInView); ++i) {
		aOperator(linear_access(aInView, i));
	}
}
Ejemplo n.º 6
0
void CSketcherDoc::Serialize(CArchive& ar)
{
    if (ar.IsStoring()) {
        ar << m_Color                      // Store the current color
           << static_cast<int>(m_Element)  // the current element type as an integer
           << m_PenWidth                   // and the current pen width
           << m_DocSize;                   // and the current document size

        ar << m_ElementList.size();        // Store the number of elements in the list

        // Now store the elements from the list
        for (auto iter =  m_ElementList.begin() ; iter != m_ElementList.end() ; ++iter)
            ar << *iter;                     // Store the element
    } else {
        int elementType(0);                // Stores element type
        ar >> m_Color                      // Retrieve the current color
           >> elementType                  // the current element type as an integer
           >> m_PenWidth                   // and the current pen width
           >> m_DocSize;                   // and the current document size

        m_Element = static_cast<ElementType>(elementType);

        size_t elementCount(0);            // Count of number of elements
        CElement* pElement(nullptr);       // Element pointer
        ar >> elementCount;                // retrieve the element count
        // Now retrieve all the elements and store in the list
        for (size_t i = 0 ; i < elementCount ; ++i) {
            ar >> pElement;
            m_ElementList.push_back(pElement);
        }
    }
}
Ejemplo n.º 7
0
void DrawExecution::drawElements() const
{
    gl::glBindVertexArray(m_drawImpl.glVertexArray);
    gl::glDrawElements(m_drawImpl.state.rasterizerState().primitive(),
                       elementCount(),
                       elementType(),
                       nullptr);
}
Ejemplo n.º 8
0
XmlElement *
XmlElement::elementAt( int index ) const
{
  if ( index < 0  ||  index >= elementCount() )
    throw std::invalid_argument( "XmlElement::elementAt(), out of range index" );

  return m_elements[ index ];
}
void
for_each_position_host(TInView aInView, TFunctor aOperator, TPolicy aPolicy)
{
	for (int i = 0; i < elementCount(aInView); ++i) {
		auto index = index_from_linear_access_index(aInView, i);
		aOperator(aInView[index], index);
	}
}
Ejemplo n.º 10
0
OMUniqueObjectIdentification
ImplAAFTypeDefExtEnum::elementValue( aafUInt32 index ) const
{
  TRACE("ImplAAFTypeDefExtEnum::elementValue");
  PRECONDITION("Valid index", index < elementCount());

  const aafUID_t& value = _ElementValues.getAt(index);
  const OMObjectIdentification& result =
      *reinterpret_cast<const OMObjectIdentification*>(&value);

  return result;
}
Ejemplo n.º 11
0
/******************************************************************************
* Renders the geometry as triangle mesh with normals.
******************************************************************************/
void OpenGLArrowPrimitive::renderWithNormals(ViewportSceneRenderer* renderer)
{
	QOpenGLShaderProgram* shader = renderer->isPicking() ? _pickingShader : _shader;
	if(!shader->bind())
		throw Exception(QStringLiteral("Failed to bind OpenGL shader."));

	glEnable(GL_CULL_FACE);
	glCullFace(GL_BACK);

	shader->setUniformValue("modelview_projection_matrix", (QMatrix4x4)(renderer->projParams().projectionMatrix * renderer->modelViewTM()));
	if(!renderer->isPicking())
		shader->setUniformValue("normal_matrix", (QMatrix3x3)(renderer->modelViewTM().linear().inverse().transposed()));

	GLint pickingBaseID;
	if(renderer->isPicking()) {
		pickingBaseID = renderer->registerSubObjectIDs(elementCount());
		renderer->activateVertexIDs(shader, _chunkSize * _verticesPerElement, true);
	}

	for(int chunkIndex = 0; chunkIndex < _verticesWithNormals.size(); chunkIndex++, pickingBaseID += _chunkSize) {
		int chunkStart = chunkIndex * _chunkSize;
		int chunkSize = std::min(_elementCount - chunkStart, _chunkSize);

		if(renderer->isPicking())
			shader->setUniformValue("pickingBaseID", pickingBaseID);

		_verticesWithNormals[chunkIndex].bindPositions(renderer, shader, offsetof(VertexWithNormal, pos));
		if(!renderer->isPicking()) {
			_verticesWithNormals[chunkIndex].bindNormals(renderer, shader, offsetof(VertexWithNormal, normal));
			_verticesWithNormals[chunkIndex].bindColors(renderer, shader, 4, offsetof(VertexWithNormal, color));
		}

		int stripPrimitivesPerElement = _stripPrimitiveVertexCounts.size() / _chunkSize;
		int stripVerticesPerElement = std::accumulate(_stripPrimitiveVertexCounts.begin(), _stripPrimitiveVertexCounts.begin() + stripPrimitivesPerElement, 0);
		OVITO_CHECK_OPENGL(shader->setUniformValue("verticesPerElement", (GLint)stripVerticesPerElement));
		OVITO_CHECK_OPENGL(renderer->glMultiDrawArrays(GL_TRIANGLE_STRIP, _stripPrimitiveVertexStarts.data(), _stripPrimitiveVertexCounts.data(), stripPrimitivesPerElement * chunkSize));

		int fanPrimitivesPerElement = _fanPrimitiveVertexCounts.size() / _chunkSize;
		int fanVerticesPerElement = std::accumulate(_fanPrimitiveVertexCounts.begin(), _fanPrimitiveVertexCounts.begin() + fanPrimitivesPerElement, 0);
		OVITO_CHECK_OPENGL(shader->setUniformValue("verticesPerElement", (GLint)fanVerticesPerElement));
		OVITO_CHECK_OPENGL(renderer->glMultiDrawArrays(GL_TRIANGLE_FAN, _fanPrimitiveVertexStarts.data(), _fanPrimitiveVertexCounts.data(), fanPrimitivesPerElement * chunkSize));

		_verticesWithNormals[chunkIndex].detachPositions(renderer, shader);
		if(!renderer->isPicking()) {
			_verticesWithNormals[chunkIndex].detachNormals(renderer, shader);
			_verticesWithNormals[chunkIndex].detachColors(renderer, shader);
		}
	}
	if(renderer->isPicking())
		renderer->deactivateVertexIDs(shader, true);

	shader->release();
}
Ejemplo n.º 12
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
float RigFemPart::characteristicElementSize()
{
    if (m_characteristicElementSize != std::numeric_limits<float>::infinity()) return m_characteristicElementSize;

    // take 100 elements 
    float elmIdxJump = elementCount() / 100.0f;
    int elmIdxIncrement = elmIdxJump < 1 ? 1: (int) elmIdxJump;
    int elmsToAverageCount = 0;
    float sumMaxEdgeLength = 0;
    for (int elmIdx = 0; elmIdx < elementCount(); elmIdx += elmIdxIncrement)
    {
        RigElementType eType = this->elementType(elmIdx);

        if (eType == HEX8 || eType == HEX8P)
        {
            const int* elmentConn = this->connectivities(elmIdx);
            cvf::Vec3f nodePos0 = this->nodes().coordinates[elmentConn[0]];
            cvf::Vec3f nodePos1 = this->nodes().coordinates[elmentConn[1]];
            cvf::Vec3f nodePos3 = this->nodes().coordinates[elmentConn[3]];
            cvf::Vec3f nodePos4 = this->nodes().coordinates[elmentConn[4]];

            float l1 = (nodePos1-nodePos0).length();
            float l3 = (nodePos3-nodePos0).length();
            float l4 = (nodePos4-nodePos0).length();

            float maxLength = l1 > l3 ? l1: l3;
            maxLength = maxLength > l4 ? maxLength: l4;

            sumMaxEdgeLength += maxLength;
            ++elmsToAverageCount;
        }
    }

    CVF_ASSERT(elmsToAverageCount);

    m_characteristicElementSize = sumMaxEdgeLength/elmsToAverageCount;

    return m_characteristicElementSize;
}
Ejemplo n.º 13
0
THtmlElement &THtmlParser::insertNewElement(int parent, int index)
{
    if (elementCount() > 1 && last().isEmpty()) {
        // Re-use element
        changeParent(lastIndex(), parent, index);
    } else {
        elements.resize(elements.size() + 1);
        last().parent = parent;
        if (index >= 0 && index < elements[parent].children.count()) {
            elements[parent].children.insert(index, lastIndex());
        } else {
            elements[parent].children.append(lastIndex());
        }
    }
    return last();
}
Ejemplo n.º 14
0
float HdfDataset::readFloat() const
{
  if ( elementCount() != 1 )
  {
    MDAL::debug( "Not scalar!" );
    return 0;
  }

  float value;
  herr_t status = H5Dread( d->id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value );
  if ( status < 0 )
  {
    MDAL::debug( "Failed to read data!" );
    return 0;
  }
  return value;
}
Ejemplo n.º 15
0
std::string HdfDataset::readString() const
{
  if ( elementCount() != 1 )
  {
    MDAL::debug( "Not scalar!" );
    return std::string();
  }

  char name[HDF_MAX_NAME];
  hid_t datatype = H5Tcopy( H5T_C_S1 );
  H5Tset_size( datatype, HDF_MAX_NAME );
  herr_t status = H5Dread( d->id, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, name );
  if ( status < 0 )
  {
    MDAL::debug( "Failed to read data!" );
    return std::string();
  }
  H5Tclose( datatype );
  return std::string( name );
}
Ejemplo n.º 16
0
void THtmlParser::merge(const THtmlParser &other)
{
    if (elementCount() <= 1 || other.elementCount() <= 1 || at(1).tag != other.at(1).tag) {
        return;
    }
    
    // Adds attributes
    for (int i = 0; i < other.at(1).attributes.count(); ++i) {
        const QPair<QString, QString> &p = other.at(1).attributes[i];
        at(1).setAttribute(p.first, THttpUtility::trimmedQuotes(p.second));
    }

    if (!other.at(1).text.isEmpty()
        || (at(1).children.isEmpty() && !other.at(1).children.isEmpty())) {
        at(1).text = other.at(1).text;
    }

    // Merges the elements
    for (int i = 0; i < other.at(1).children.count(); ++i) {
        prepend(1, other.mid(other.at(1).children[i]));
    }
}
Ejemplo n.º 17
0
QString ArrayPin::toString() const
{
	return( QString( "<p>Type: %1</p><p>Count: %2</p><p>Size: %3</p><p>Total Size: %4</p>" ).arg( QString( QMetaType::typeName( type() ) ) ).arg( count() ).arg( elementCount() ).arg( byteCount() ) );
}
void CSenLayeredXmlProperties::WriteToL(RWriteStream& aWriteStream)
    {
    // Find out whether we should declare the namespace
    TPtrC8 nsPrefix = ipFragment->NsPrefix();

    // Element name
    aWriteStream.WriteL(KSenLessThan);
    if ( nsPrefix.Length() > 0 )
        {
        aWriteStream.WriteL(nsPrefix);
        aWriteStream.WriteL(KSenColon);
        }
    aWriteStream.WriteL(ipFragment->AsElement().LocalName());

    RPointerArray<CSenBaseAttribute>& attrs = ipFragment->AsElement().AttributesL();
    RPointerArray<CSenNamespace>& namespaces = ipFragment->AsElement().NamespacesL();
    if ( ( attrs.Count() > 0 ) || ( namespaces.Count() > 0 ) )
        {
        CSenNamespace* ns = NULL;
        TInt count = namespaces.Count();
        for (TInt i=0; i < count; i++)
            {
            ns = (namespaces)[i];
            if (ns)
                {
                aWriteStream.WriteL(KSenSpaceXmlns);
                if (ns->Prefix().Length() > 0)
                    {
                    aWriteStream.WriteL(KSenColon);
                    aWriteStream.WriteL(ns->Prefix());
                    }
                aWriteStream.WriteL(KSenEqualsDblQuot);
                aWriteStream.WriteL(ns->URI());
                aWriteStream.WriteL(KSenDblQuot);
                }
            }
        count = attrs.Count();
        for (TInt j = 0; j < count; j++)
            {
            aWriteStream.WriteL(KSenSpace);
            aWriteStream.WriteL((attrs)[j]->Name());
            aWriteStream.WriteL(KSenEqualsDblQuot);
            aWriteStream.WriteL((attrs)[j]->Value());
            aWriteStream.WriteL(KSenDblQuot);
            }
        }
        
    // Elements and content
    RPointerArray<CSenElement> elements;
    ElementsL(elements);
    if ( (elements.Count() > 0) || ipFragment->AsElement().HasContent() )
        {
        aWriteStream.WriteL(KSenGreaterThan);

        // Body
        TInt elementCount(elements.Count());
        for (TInt k=0; k<elementCount; k++)
            {
            elements[k]->WriteAsXMLToL(aWriteStream);
            }        
        aWriteStream.WriteL(ipFragment->AsElement().Content());

        // Closing element
        aWriteStream.WriteL(KSenLessThanSlash);
        if (nsPrefix.Length() > 0)
            {
            aWriteStream.WriteL(nsPrefix);
            aWriteStream.WriteL(KSenColon);
            }
        aWriteStream.WriteL(ipFragment->AsElement().LocalName());
        aWriteStream.WriteL(KSenGreaterThan);
        }
    else
        {
        aWriteStream.WriteL(KSenSlashGreaterThan);
        }
    elements.Close();
    }
Ejemplo n.º 19
0
bool
ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log) const
{
    if (!prev) {
        nsPrintfCString error("Passed in NULL prev ShaderValidator.");
        *out_log = error;
        return false;
    }

    {
        const std::vector<sh::Uniform>* vertPtr = ShGetUniforms(prev->mHandle);
        const std::vector<sh::Uniform>* fragPtr = ShGetUniforms(mHandle);
        if (!vertPtr || !fragPtr) {
            nsPrintfCString error("Could not create uniform list.");
            *out_log = error;
            return false;
        }

        for (auto itrFrag = fragPtr->begin(); itrFrag != fragPtr->end(); ++itrFrag) {
            for (auto itrVert = vertPtr->begin(); itrVert != vertPtr->end(); ++itrVert) {
                if (itrVert->name != itrFrag->name)
                    continue;

                if (!itrVert->isSameUniformAtLinkTime(*itrFrag)) {
                    nsPrintfCString error("Uniform `%s`is not linkable between"
                                          " attached shaders.",
                                          itrFrag->name.c_str());
                    *out_log = error;
                    return false;
                }

                break;
            }
        }
    }
    {
        const std::vector<sh::Varying>* vertPtr = ShGetVaryings(prev->mHandle);
        const std::vector<sh::Varying>* fragPtr = ShGetVaryings(mHandle);
        if (!vertPtr || !fragPtr) {
            nsPrintfCString error("Could not create varying list.");
            *out_log = error;
            return false;
        }

        nsTArray<ShVariableInfo> staticUseVaryingList;

        for (auto itrFrag = fragPtr->begin(); itrFrag != fragPtr->end(); ++itrFrag) {
            const ShVariableInfo varInfo = { itrFrag->type,
                                             (int)itrFrag->elementCount() };

            static const char prefix[] = "gl_";
            if (StartsWith(itrFrag->name, prefix)) {
                if (itrFrag->staticUse)
                    staticUseVaryingList.AppendElement(varInfo);

                continue;
            }

            bool definedInVertShader = false;
            bool staticVertUse = false;

            for (auto itrVert = vertPtr->begin(); itrVert != vertPtr->end(); ++itrVert) {
                if (itrVert->name != itrFrag->name)
                    continue;

                if (!itrVert->isSameVaryingAtLinkTime(*itrFrag)) {
                    nsPrintfCString error("Varying `%s`is not linkable between"
                                          " attached shaders.",
                                          itrFrag->name.c_str());
                    *out_log = error;
                    return false;
                }

                definedInVertShader = true;
                staticVertUse = itrVert->staticUse;
                break;
            }

            if (!definedInVertShader && itrFrag->staticUse) {
                nsPrintfCString error("Varying `%s` has static-use in the frag"
                                      " shader, but is undeclared in the vert"
                                      " shader.", itrFrag->name.c_str());
                *out_log = error;
                return false;
            }

            if (staticVertUse && itrFrag->staticUse)
                staticUseVaryingList.AppendElement(varInfo);
        }

        if (!ShCheckVariablesWithinPackingLimits(mMaxVaryingVectors,
                                                 staticUseVaryingList.Elements(),
                                                 staticUseVaryingList.Length()))
        {
            *out_log = "Statically used varyings do not fit within packing limits. (see"
                       " GLSL ES Specification 1.0.17, p111)";
            return false;
        }
    }

    return true;
}
Ejemplo n.º 20
0
/******************************************************************************
* Renders the geometry as with extra information passed to the vertex shader.
******************************************************************************/
void OpenGLArrowPrimitive::renderWithElementInfo(ViewportSceneRenderer* renderer)
{
	QOpenGLShaderProgram* shader = renderer->isPicking() ? _pickingShader : _shader;
	if(!shader)
		return;
	if(!shader->bind())
		throw Exception(QStringLiteral("Failed to bind OpenGL shader."));

	glEnable(GL_CULL_FACE);
	glCullFace(GL_BACK);

	shader->setUniformValue("modelview_matrix",
			(QMatrix4x4)renderer->modelViewTM());
	shader->setUniformValue("modelview_uniform_scale", (float)pow(std::abs(renderer->modelViewTM().determinant()), (FloatType(1.0/3.0))));
	shader->setUniformValue("modelview_projection_matrix",
			(QMatrix4x4)(renderer->projParams().projectionMatrix * renderer->modelViewTM()));
	shader->setUniformValue("projection_matrix", (QMatrix4x4)renderer->projParams().projectionMatrix);
	shader->setUniformValue("inverse_projection_matrix", (QMatrix4x4)renderer->projParams().inverseProjectionMatrix);
	shader->setUniformValue("is_perspective", renderer->projParams().isPerspective);

	AffineTransformation viewModelTM = renderer->modelViewTM().inverse();
	Vector3 eye_pos = viewModelTM.translation();
	shader->setUniformValue("eye_pos", eye_pos.x(), eye_pos.y(), eye_pos.z());
	Vector3 viewDir = viewModelTM * Vector3(0,0,1);
	shader->setUniformValue("parallel_view_dir", viewDir.x(), viewDir.y(), viewDir.z());

	GLint viewportCoords[4];
	glGetIntegerv(GL_VIEWPORT, viewportCoords);
	shader->setUniformValue("viewport_origin", (float)viewportCoords[0], (float)viewportCoords[1]);
	shader->setUniformValue("inverse_viewport_size", 2.0f / (float)viewportCoords[2], 2.0f / (float)viewportCoords[3]);

	GLint pickingBaseID;
	if(renderer->isPicking()) {
		pickingBaseID = renderer->registerSubObjectIDs(elementCount());
		renderer->activateVertexIDs(shader, _chunkSize * _verticesPerElement, true);
		OVITO_CHECK_OPENGL(shader->setUniformValue("verticesPerElement", (GLint)_verticesPerElement));
	}

	for(int chunkIndex = 0; chunkIndex < _verticesWithElementInfo.size(); chunkIndex++, pickingBaseID += _chunkSize) {
		int chunkStart = chunkIndex * _chunkSize;
		int chunkSize = std::min(_elementCount - chunkStart, _chunkSize);

		if(renderer->isPicking())
			shader->setUniformValue("pickingBaseID", pickingBaseID);

		_verticesWithElementInfo[chunkIndex].bindPositions(renderer, shader, offsetof(VertexWithElementInfo, pos));
		_verticesWithElementInfo[chunkIndex].bind(renderer, shader, "cylinder_base", GL_FLOAT, offsetof(VertexWithElementInfo, base), 3, sizeof(VertexWithElementInfo));
		_verticesWithElementInfo[chunkIndex].bind(renderer, shader, "cylinder_axis", GL_FLOAT, offsetof(VertexWithElementInfo, dir), 3, sizeof(VertexWithElementInfo));
		_verticesWithElementInfo[chunkIndex].bind(renderer, shader, "cylinder_radius", GL_FLOAT, offsetof(VertexWithElementInfo, radius), 1, sizeof(VertexWithElementInfo));
		if(!renderer->isPicking())
			_verticesWithElementInfo[chunkIndex].bindColors(renderer, shader, 4, offsetof(VertexWithElementInfo, color));

		if(_usingGeometryShader && (shadingMode() == FlatShading || renderingQuality() == HighQuality)) {
			OVITO_CHECK_OPENGL(glDrawArrays(GL_POINTS, 0, chunkSize));
		}
		else {
			int stripPrimitivesPerElement = _stripPrimitiveVertexCounts.size() / _chunkSize;
			OVITO_CHECK_OPENGL(renderer->glMultiDrawArrays(GL_TRIANGLE_STRIP, _stripPrimitiveVertexStarts.data(), _stripPrimitiveVertexCounts.data(), stripPrimitivesPerElement * chunkSize));

			int fanPrimitivesPerElement = _fanPrimitiveVertexCounts.size() / _chunkSize;
			OVITO_CHECK_OPENGL(renderer->glMultiDrawArrays(GL_TRIANGLE_FAN, _fanPrimitiveVertexStarts.data(), _fanPrimitiveVertexCounts.data(), fanPrimitivesPerElement * chunkSize));
		}

		_verticesWithElementInfo[chunkIndex].detachPositions(renderer, shader);
		_verticesWithElementInfo[chunkIndex].detach(renderer, shader, "cylinder_base");
		_verticesWithElementInfo[chunkIndex].detach(renderer, shader, "cylinder_axis");
		_verticesWithElementInfo[chunkIndex].detach(renderer, shader, "cylinder_radius");
		if(!renderer->isPicking())
			_verticesWithElementInfo[chunkIndex].detachColors(renderer, shader);
	}
	shader->enableAttributeArray("cylinder_base");
	shader->enableAttributeArray("cylinder_axis");
	shader->enableAttributeArray("cylinder_radius");

	if(renderer->isPicking())
		renderer->deactivateVertexIDs(shader, true);

	shader->release();
}
TInt CSenLayeredXmlProperties::AllPropertiesByTypeL(const TDesC8& aType,
                                                    RPointerArray<MSenProperty>& aArray)
    {
    TInt retVal(KErrNotFound);
    if ( ipChildProperties )
        {
        retVal = ipChildProperties->AllPropertiesByTypeL(aType, aArray);
        }

    CSenElement& element = ipFragment->AsElement();
    RPointerArray<CSenElement>& elements = element.ElementsL();
    TInt elementCount(elements.Count());
    TInt propsCount(0);
    TBool found(EFalse);
    for (TInt i=0; i<elementCount; i++)
        {
        CSenElement* pElement = elements[i];
        found = EFalse;

        // Go through properties which are already added into returned array.
        // => If property is already in the array
        //    it won't be added into array for the second time.
        propsCount = aArray.Count();
        for (TInt j=0; j<propsCount; j++)
            {
             MSenProperty* pProperty = aArray[j];
             if ( pElement->LocalName() == pProperty->Name() )
                {
                found = ETrue;
                break;
                }
            }
        
        if ( !found )
            {
            const TDesC8* propertyType =
                        pElement->AttrValue(KSenTypeAttributeName);

            if ( propertyType )
                {
                if ( *propertyType == aType )
                    {
#ifdef EKA2
                    CSenPropertiesElement* pPropElement
                        = (CSenPropertiesElement*)pElement;
                    aArray.AppendL(pPropElement);
#else
                    CSenPropertiesElement* pPropElement
                        = (CSenPropertiesElement*)pElement;
			        User::LeaveIfError(aArray.Append(pPropElement));
#endif
                    }
                }
            }
        }

    if ( aArray.Count() > 0 )
        {
        retVal=KErrNone;
        }
        
    return retVal;
    }