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


C++ VertexElement::type方法代码示例

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


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

示例1: push_back

bool VertexDeclaration::push_back(const VertexElement& element)
{
	if (has(element.usage())) return false;

	_usageMask = _usageMask | vertexAttributeUsageMask(element.usage());
	
	_totalSize += vertexAttributeTypeSize(element.type());
	_list.push_back(element);

	if (_interleaved)
	{
		for (auto& i : _list)
			i.setStride(static_cast<int>(_totalSize));
	}

	return true;
}
开发者ID:celesius,项目名称:et-engine,代码行数:17,代码来源:vertexdeclaration.cpp

示例2:

bool
VertexElement::operator != (const VertexElement &src) const
{
    if (_usageIndex != src.usageIndex())
        return true;
    if (_usage != src.usage())
        return true;
    if (_method != src.method())
        return true;
    if (_type != src.type())
        return true;
    if (_offset != src.offset())
        return true;
    if (_stream != src.stream())
        return true;

    return false;
}
开发者ID:EiffelOberon,项目名称:IBLBaker,代码行数:18,代码来源:IblVertexElement.cpp

示例3: LOG

void*
StreamedMesh::internalStreamPtr()
{    
    if (vertexBufferSize() == 0)
    {
        LOG ("Error, internal vertex buffer size is 0");
        return 0;
    }

    if (!_vertexBufferCpuMemory)
    {
        _vertexBufferCpuMemory = (float*)malloc(sizeof(float)*vertexBufferSize());
    }

    // stash the buffer and put it in an array
    std::map <uint32_t, float*> streamMap;

    for (auto it = _vertexStreams.begin();
        it != _vertexStreams.end();
        it++)
    {
        streamMap.insert (std::make_pair(it->first, it->second->stream()));
    }

    const std::vector <VertexElement>& declaration = _vertexDeclaration->getDeclaration();
    float* vb = (float*)_vertexBufferCpuMemory;

    for (uint32_t i = 0; i < vertexCount(); i++)
    {    
        for (uint32_t j = 0; j < declaration.size()-1; j++)
        {
            VertexElement element = declaration[j];
            VertexStream* stream = 0;
            if (findStream (stream, element))
            {
                uint32_t streamId = VertexStream::id(*stream);
                auto streamIt =  streamMap.find(streamId);

                if (streamIt != streamMap.end() &&
                    streamIt->second)
                {
                    for (uint32_t k = 0; k < stream->stride(); k++)
                    {
                        *vb++ = streamIt->second[k];
                    }
                    streamIt->second += stream->stride();
                }
                else
                {
                    uint32_t stride = IVertexDeclaration::elementToSize(element.type());
                    for (uint32_t k = 0; k < stride; stride++)
                    {
                        *vb++ = 0;
                    }
                }
            }
            else
            {
                // can't find a stream for this element.
                // warn user, and 0 the buffer for the stride size
                uint32_t stride = IVertexDeclaration::elementToSize(element.type());
                for (uint32_t k = 0; k < stride; stride++)
                {
                    *vb++ = 0;
                }
            }
        }
    }

    return _vertexBufferCpuMemory;
}
开发者ID:EiffelOberon,项目名称:IBLBaker,代码行数:71,代码来源:IblStreamedMesh.cpp


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