3일차 헤더관련 and DX11Utils.h/cpp

엔진 2016. 8. 23. 16:43

DX11.h (DX11 인터페이스 전방선언) 은 다른 클래스 헤더파일에 포함

DXUtils.h DX11.h와 (IncludeDX11.h를 포함하고있다.) cpp 파일에 포함

IncludeDX11.h (DX11을 포함하고 IncludeWindows.h(windows.h를 포함하고있다.)를와  d3d11.h를 포함하고있다.)

그리고 이런 문구가 적혀있다.

    // include windows in a controlled manner (before d3d11 includes it!)

    // (try to limit including DX11.h to just this place)


DXUtils.h


여긴 템플릿 특수화로 D3DTypeInfo를 알 수 있는 템플릿들이 있다.

(리소스의 타입을 알수있는것 같다.)



그리곤 ExtractResource( 뷰들을 통해서 리소스를 얻는다. )


QueryInterfaceCast

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    templatetypename DestinationType, typename SourceType > // DestinationType의 intrusive_ptr을 반환하는 함수
        intrusive_ptr<DestinationType> QueryInterfaceCast(SourceType * sourceObject)
    {
        void * result = NULL; //DestinationType의 반환값을 넣을 void포인터
        HRESULT status = sourceObject->QueryInterface(__uuidof(DestinationType), &result);
        if (status != S_OK) { //
            if (result) ((DestinationType*)result)->Release(); // Query에 실패하면 Release 혹은 아무것도 없는 포인터 반환
            return intrusive_ptr<DestinationType>();
        }
        // return moveptr((DestinationType*)result);    (problem with multiple copies of intrusive_ptr)
        return intrusive_ptr<DestinationType>((DestinationType*)result, false/*take new reference*/);
    }
 
    template <typename DestinationType, typename SourceType>
        intrusive_ptr<DestinationType> QueryInterfaceCast(intrusive_ptr<SourceType>& sourceObject)
    {
        void * result = NULL;
        HRESULT status = sourceObject->QueryInterface(__uuidof(DestinationType), &result);
        if (status != S_OK) {
            if (result) ((DestinationType*)result)->Release();
            return intrusive_ptr<DestinationType>();
        }
        // return moveptr((DestinationType*)result);    (problem with multiple copies of intrusive_ptr)
        return intrusive_ptr<DestinationType>((DestinationType*)result, false);
    }



'엔진' 카테고리의 다른 글

Fbx logic tutorial  (0) 2017.09.15
DX9와 DX11의 차이  (0) 2016.08.19
2일차 XLE 분석 및 구현 (160822)  (0) 2016.08.16
XLE 분석 ( FlexBegin / FlexEnd )  (0) 2016.03.02
조사해야될거  (0) 2016.03.01
posted by 알쿠미