Direct3D Sample Encapsulation problem

Discussion in 'ASP .Net' started by Jack, Nov 14, 2005.

  1. Jack

    Jack Guest

    This sample comes from CMultiAnim sample application found in DXSDK



    HRESULT CMyView::InitDeviceObjects()
    {
    CMultiAnimAllocateHierarchy AH;
    AH.SetMA(&m_Lorry);
    m_Lorry.Setup (m_pd3dDevice, m_strMeshFileNameOperator,
    m_strMeshFileNameOperator, &AH); <- Don't worry about the third parameters
    (fx) I have commented it out already



    vector< CObjects* >::iterator itCurCP, itEndCP = m_v_pLorry.end();
    for( itCurCP = m_v_pLorry.begin(); itCurCP != itEndCP; ++ itCurCP )
    {
    ( * itCurCP )->RestoreDeviceObjects( m_pd3dDevice );
    }

    // If there is no instance, make sure we have at least one.
    if( m_v_pLorry.size() == 0 )
    {
    COperator * pTiny = new COperator;
    if( pTiny == NULL )
    return E_OUTOFMEMORY;

    HRESULT hr = pTiny->Setup( & m_Lorry, & m_v_pLorry, & m_DSound,
    0.f );
    }


    return S_OK;
    }


    I encap'd CLorry into CObjects, CObjects is a generic parent class which is
    now "assumed" to be allowed to act everything the mesh likes,
    CLorry inherits from it. During Compilation, the following error occurred,
    MyApp error C2440: 'initializing' : cannot convert from
    'std::vector<_Ty,_Ax>::iterator' to
    'std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>'
    with
    [
    _Ty=CLorry *,
    _Ax=std::allocator<CLorry *>
    ]
    and
    [
    _Ty=std::vector<CObjects *,std::allocator<CObjects
    *>>::value_type,
    _Diff=std::vector<CObjects *,std::allocator<CObjects
    *>>::difference_type,
    _Pointer=std::vector<CObjects *,std::allocator<CObjects
    *>>::_Tptr,
    _Reference=std::vector<CObjects *,std::allocator<CObjects
    *>>::reference,
    _Pointer2=std::vector<CObjects *,std::allocator<CObjects
    *>>::_Tptr,
    _Reference2=std::vector<CObjects *,std::allocator<CObjects
    *>>::reference
    ]
    No constructor could take the source type, or constructor overload
    resolution was ambiguous

    Seems nasty, but I don't know how to cope with these. The compiler version
    is .NET 2002 Any hint is appreciated....
    Thanks
    Jack
     
    Jack, Nov 14, 2005
    #1
    1. Advertising

  2. Jack

    Jack Guest

    wrong group sorry

    "Jack" <> ¼¶¼g©ó¶l¥ó·s»D:...
    > This sample comes from CMultiAnim sample application found in DXSDK
    >
    >
    >
    > HRESULT CMyView::InitDeviceObjects()
    > {
    > CMultiAnimAllocateHierarchy AH;
    > AH.SetMA(&m_Lorry);
    > m_Lorry.Setup (m_pd3dDevice, m_strMeshFileNameOperator,
    > m_strMeshFileNameOperator, &AH); <- Don't worry about the third parameters
    > (fx) I have commented it out already
    >
    >
    >
    > vector< CObjects* >::iterator itCurCP, itEndCP = m_v_pLorry.end();
    > for( itCurCP = m_v_pLorry.begin(); itCurCP != itEndCP; ++ itCurCP )
    > {
    > ( * itCurCP )->RestoreDeviceObjects( m_pd3dDevice );
    > }
    >
    > // If there is no instance, make sure we have at least one.
    > if( m_v_pLorry.size() == 0 )
    > {
    > COperator * pTiny = new COperator;
    > if( pTiny == NULL )
    > return E_OUTOFMEMORY;
    >
    > HRESULT hr = pTiny->Setup( & m_Lorry, & m_v_pLorry, & m_DSound,
    > 0.f );
    > }
    >
    >
    > return S_OK;
    > }
    >
    >
    > I encap'd CLorry into CObjects, CObjects is a generic parent class which
    > is now "assumed" to be allowed to act everything the mesh likes,
    > CLorry inherits from it. During Compilation, the following error occurred,
    > MyApp error C2440: 'initializing' : cannot convert from
    > 'std::vector<_Ty,_Ax>::iterator' to
    > 'std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>'
    > with
    > [
    > _Ty=CLorry *,
    > _Ax=std::allocator<CLorry *>
    > ]
    > and
    > [
    > _Ty=std::vector<CObjects *,std::allocator<CObjects
    > *>>::value_type,
    > _Diff=std::vector<CObjects *,std::allocator<CObjects
    > *>>::difference_type,
    > _Pointer=std::vector<CObjects *,std::allocator<CObjects
    > *>>::_Tptr,
    > _Reference=std::vector<CObjects *,std::allocator<CObjects
    > *>>::reference,
    > _Pointer2=std::vector<CObjects *,std::allocator<CObjects
    > *>>::_Tptr,
    > _Reference2=std::vector<CObjects *,std::allocator<CObjects
    > *>>::reference
    > ]
    > No constructor could take the source type, or constructor overload
    > resolution was ambiguous
    >
    > Seems nasty, but I don't know how to cope with these. The compiler version
    > is .NET 2002 Any hint is appreciated....
    > Thanks
    > Jack
    >
    >
     
    Jack, Nov 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jake
    Replies:
    0
    Views:
    563
  2. Brij
    Replies:
    1
    Views:
    2,504
    Sudsy
    Dec 7, 2004
  3. Serdar C.

    direct3d and the web?

    Serdar C., Dec 28, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    177
    Guest
    Dec 30, 2003
  4. Replies:
    1
    Views:
    219
    Steve
    Jan 23, 2009
  5. Tim Chase
    Replies:
    0
    Views:
    76
    Tim Chase
    Feb 16, 2014
Loading...

Share This Page