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


C++ ObjectPtr::ReferencesObject方法代码示例

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


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

示例1:

bool Helium::Material::LoadPersistentResourceObject( Reflect::ObjectPtr &_object )
{
    HELIUM_ASSERT(_object.ReferencesObject());
    if (!_object.ReferencesObject())
    {
        return false;
    }

    _object->CopyTo(&m_persistentResourceData);

    return true;
}
开发者ID:foolhuang,项目名称:Helium,代码行数:12,代码来源:Material.cpp

示例2: MemorySet

bool Helium::Font::LoadPersistentResourceObject( Reflect::ObjectPtr &_object )
{
    HELIUM_ASSERT(_object.ReferencesObject());
    if (!_object.ReferencesObject())
    {
        return false;
    }

    _object->CopyTo(&m_persistentResourceData);

    uint_fast32_t characterCount = static_cast<uint_fast32_t>(m_persistentResourceData.m_characters.GetSize());
    uint_fast8_t textureCount = m_persistentResourceData.m_textureCount;

    delete [] m_persistentResourceData.m_pspTextures;
    m_persistentResourceData.m_pspTextures = NULL;

    delete [] m_persistentResourceData.m_pTextureLoadIds;
    m_persistentResourceData.m_pTextureLoadIds = NULL;

    if( textureCount != 0 )
    {
        m_persistentResourceData.m_pspTextures = new RTexture2dPtr [ textureCount ];
        HELIUM_ASSERT( m_persistentResourceData.m_pspTextures );

        if( m_persistentResourceData.m_pspTextures )
        {
            m_persistentResourceData.m_pTextureLoadIds = new size_t [ textureCount ];
            HELIUM_ASSERT( m_persistentResourceData.m_pTextureLoadIds );

            if( m_persistentResourceData.m_pTextureLoadIds )
            {
                MemorySet(
                    m_persistentResourceData.m_pTextureLoadIds,
                    0xff,
                    static_cast< size_t >( textureCount ) * sizeof( m_persistentResourceData.m_pTextureLoadIds[ 0 ] ) );
            }
            else
            {
                delete [] m_persistentResourceData.m_pspTextures;
                m_persistentResourceData.m_pspTextures = NULL;
            }
        }

        if( !m_persistentResourceData.m_pspTextures )
        {
            m_persistentResourceData.m_textureCount = 0;
        }
    }

    return true;
}
开发者ID:kevindqc,项目名称:Helium,代码行数:51,代码来源:Font.cpp

示例3:

bool Helium::Mesh::LoadPersistentResourceObject( Reflect::ObjectPtr &_object )
{    
    m_spVertexBuffer.Release();
    m_spIndexBuffer.Release();

    HELIUM_ASSERT(_object.ReferencesObject());
    if (!_object.ReferencesObject())
    {
        return false;
    }

    _object->CopyTo(&m_persistentResourceData);

    return true;
}
开发者ID:kevindqc,项目名称:Helium,代码行数:15,代码来源:Mesh.cpp

示例4: OnRemove

///////////////////////////////////////////////////////////////////////////////
// Callback for when the remove button is pressed.  If there are any items 
// selected in the list control, they will be removed from the list.
// 
void ReflectStlSetInterpreter::OnRemove( const ButtonClickedArgs& args )
{
    Reflect::ObjectPtr clientData = args.m_Control->GetClientData();
    if ( clientData.ReferencesObject() && clientData->IsClass( Reflect::GetClass<ClientData>() ) )
    {
        ClientData* data = static_cast< ClientData* >( clientData.Ptr() );
        List* list = static_cast< List* >( data->GetControl() );
        const std::set< size_t >& selectedItemIndices = list->a_SelectedItemIndices.Get();
        if ( !selectedItemIndices.empty() )
        {
            // for each item in the array to remove (by index)
            std::set< size_t >::const_reverse_iterator itr = selectedItemIndices.rbegin();
            std::set< size_t >::const_reverse_iterator end = selectedItemIndices.rend();
            for ( ; itr != end; ++itr )
            {
                // for each array in the selection set (the objects the array data is connected to)
                std::vector< DataPtr >::const_iterator serItr = m_Datas.begin();
                std::vector< DataPtr >::const_iterator serEnd = m_Datas.end();
                for ( ; serItr != serEnd; ++serItr )
                {
                    Reflect::StlSetData* setData = Reflect::AssertCast<Reflect::StlSetData>(*serItr);
                    std::vector< DataPtr > items;
                    setData->GetItems( items );
                    setData->RemoveItem( items[ *itr ] );
                }
            }

            list->a_SelectedItemIndices.Set( std::set< size_t > () );

            args.m_Control->GetCanvas()->Read();
        }
    }
}
开发者ID:foolhuang,项目名称:Helium,代码行数:37,代码来源:ReflectStlSetInterpreter.cpp

示例5: OnMoveDown

void ReflectStlVectorInterpreter::OnMoveDown( const ButtonClickedArgs& args )
{
    Reflect::ObjectPtr clientData = args.m_Control->GetClientData();
    if ( clientData.ReferencesObject() && clientData->IsClass( Reflect::GetClass<ClientData>() ) )
    {
        ClientData* data = static_cast< ClientData* >( clientData.Ptr() );
        List* list = static_cast< List* >( data->GetControl() );
        std::set< size_t > selectedItemIndices = list->a_SelectedItemIndices.Get();
        if ( !selectedItemIndices.empty() )
        {
            // for each array in the selection set (the objects the array data is connected to)
            std::vector< DataPtr >::const_iterator serItr = m_Datas.begin();
            std::vector< DataPtr >::const_iterator serEnd = m_Datas.end();
            for ( ; serItr != serEnd; ++serItr )
            {
                Reflect::StlVectorData* arrayData = Reflect::AssertCast<Reflect::StlVectorData>(*serItr);

                arrayData->MoveDown( selectedItemIndices );
            }

            list->a_SelectedItemIndices.Set( selectedItemIndices );

            args.m_Control->GetCanvas()->Read();
        }
    }
}
开发者ID:foolhuang,项目名称:Helium,代码行数:26,代码来源:ReflectStlVectorInterpreter.cpp

示例6: CanAdd

///////////////////////////////////////////////////////////////////////////////
// Returns true if the specified item can be added to the array.  This is 
// determined by checking to make sure that the item derived from the common
// base class that was specified earlier.
// 
bool ClipboardElementArray::CanAdd( const Reflect::ObjectPtr& item ) const
{
    if ( !item.ReferencesObject() )
    {
        return false;
    }

    return item->IsA( GetCommonBaseClass() );
}
开发者ID:HeliumProject,项目名称:Helium,代码行数:14,代码来源:ClipboardElementArray.cpp

示例7: OnAdd

///////////////////////////////////////////////////////////////////////////////
// Callback for when the add button is pressed.  Displays a dialog that lets
// you enter a new key-value pair.  If you enter a key that already exists in
// the list, you will be asked if you want to replace it or not.
// 
void ReflectStlSetInterpreter::OnAdd( const ButtonClickedArgs& args )
{
    Reflect::ObjectPtr clientData = args.m_Control->GetClientData();
    if ( clientData.ReferencesObject() && clientData->IsClass( Reflect::GetClass<ClientData>() ) )
    {
        ClientData* data = static_cast< ClientData* >( clientData.Ptr() );
        List* list = static_cast< List* >( data->GetControl() );
        list->e_AddItem.Raise( AddItemArgs() );
        args.m_Control->GetCanvas()->Read();
    }
}
开发者ID:foolhuang,项目名称:Helium,代码行数:16,代码来源:ReflectStlSetInterpreter.cpp

示例8: CacheResource


//.........这里部分代码省略.........
                    continue;
                }

                ShaderVariantPtr spVariant;
                while( !pShader->TryFinishLoadVariant( variantLoadId, spVariant ) )
                {
                }

                ShaderVariant* pVariant = spVariant;
                if( !pVariant )
                {
                    continue;
                }

                const Resource::PreprocessedData& rVariantData = pVariant->GetPreprocessedData(
                    static_cast< Cache::EPlatform >( platformIndex ) );
                HELIUM_ASSERT( rVariantData.bLoaded );

                const DynamicArray< DynamicArray< uint8_t > >& rVariantSubDataBuffers = rVariantData.subDataBuffers;
                size_t variantSubDataCount = rVariantSubDataBuffers.GetSize();
                HELIUM_ASSERT( variantSubDataCount != 0 );
                HELIUM_ASSERT( variantSubDataCount % shaderProfileCount == 0 );
                size_t systemOptionSetCount = variantSubDataCount / shaderProfileCount;

                for( size_t profileIndex = 0; profileIndex < shaderProfileCount; ++profileIndex )
                {
                    // Get the first option set of each profile
                    const DynamicArray< uint8_t >& rVariantSubData =
                        rVariantSubDataBuffers[ profileIndex * systemOptionSetCount ];

                    Reflect::ObjectPtr variantSubDataObjectPtr = 
                        Cache::ReadCacheObjectFromBuffer(rVariantSubData);

                    if (!variantSubDataObjectPtr.ReferencesObject())
                    {
                        HELIUM_TRACE(
                            TraceLevels::Error,
                            "MaterialResourceHandler: A shader variant subdata could not be read. (Option Set: %d Profile: %d)",
                            0,
                            profileIndex );

                        failedToWriteASubdata = true;
                    }
                    else if (!variantSubDataObjectPtr->IsA(Reflect::GetMetaClass<CompiledShaderData>()))
                    {
                        HELIUM_TRACE(
                            TraceLevels::Error,
                            "MaterialResourceHandler: A shader variant subdata was of an unexpected type. (Option Set: %d Profile: %d)\n",
                            0,
                            profileIndex );

                        failedToWriteASubdata = true;

                    }
                    else
                    {
                        CompiledShaderData &csd = *Reflect::AssertCast<CompiledShaderData>(variantSubDataObjectPtr.Get());
                        

                        size_t bufferCount = csd.constantBuffers.GetSize();
                        for( size_t bufferIndex = 0; bufferIndex < bufferCount; ++bufferIndex )
                        {
                            const ShaderConstantBufferInfo& rBufferInfo = csd.constantBuffers[ bufferIndex ];
                            if( rBufferInfo.name != parameterConstantBufferName )
                            {
                                continue;
开发者ID:HeliumProject,项目名称:Helium,代码行数:67,代码来源:MaterialResourceHandler.cpp


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