Fbx logic tutorial

엔진 2017. 9. 15. 01:54

ImportExport의 ImportExport() 함수는 파일 변환의 메인 로직을 포함한다.


ImportExport()의 순서


* 프로그램에게서 다음의 매계변수를 받는다.

- import될 파일의 경로와 이름

- export될 파일의 경로와 이름

- export될 파일의 포멧


* SDK manager 오브젝트를 만들고 다른 FBX 오브젝트들이 사용하는 메모리를 관리한다.


* import 파일의 데이터를 hold하기 위해서 Scene오브젝트를 만든다.


* import파일의 데이터를 scene에 load한다.


* scene의 데이터를 export file에 저장한다.


* SDK manager를 비롯한 SDK와 관련된 FBX object등을 릴리즈한다.


SceneTreeView의 로직

* user

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

3일차 헤더관련 and DX11Utils.h/cpp  (0) 2016.08.23
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 알쿠미

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 알쿠미

DX9와 DX11의 차이

엔진 2016. 8. 19. 15:48

DX9와 달리 DX11은 Device와 DeviceContext로 나누어져 있음


Device는 주로 resource 생성을 담당

- thread-safe

DeviceContext는 주로 rendering 을 담당

- thread-unsafe


* constant buffer 

cbuffer 키워드 안에 변수를 묶어서 정의

CreateBuffer로 constant buffer용 버퍼 생성

UpdateSubresource(Map)로 버퍼의 내용을 update

 - 이때 update를 하면 cbuffer의 내용 전부를 덮어씌운다.

( 그렇기 때문에 변수를 나누어서 cbuffer을 만들고 필요한 부분만 update를 효율적으로 하는게 중요하다.)


XXSetconstantBuffers로 레지스터에 바인드

 - VSSetConstantBuffers, PSsetConstantBuffer 등


VertextInputLayout - 버텍스 버퍼에 대한 정보를 GPU에 알려주기 위해서 사용한다.

CreateInputLayout을 이용해서 생성할 때 vertex shader와 매칭이 이루어지는데 

D3D11_INPUT_ELEMENT_DESC와 vertex shader semantic과 일치하면 success 불일치 하면 fail.


Shader reflection?

vertex shader를 reflection하여 semantic과 일치하는 VertexInputLayout을 미리생성

Shader semantic 기준으로 VertexInputLayout를 생성


MultiThread

immedidate context 

rendering 명령을 실행하는 오브젝트

1개만 생성가능 thread unsafe


deferred context

각 thread에서 모든 rendering 명령의 실행이 끝난 후에 FinishCommandList를 호출하여 command list를 얻어옴. 이후 command list를 immediate context 에서 실행


1. 생성

ID3D11DeviceContext* pImmediateContext;

ID3D11DeviceContext* pDeferredContext;


pDevice->CreateDeferredContext( 0, &pDeferredContext );


2. 각 Thread 마지막에 실행

pDeferredContext->FinishCommandList( FALSE, &pCommandList );


3. pImmediateContext->ExecuteCommandList( pCommandList, FALSE );




[참고]

http://www.slideshare.net/ssuserf07a43/kgc2014-dx9dx11-41292758?from_m_app=android

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

Fbx logic tutorial  (0) 2017.09.15
3일차 헤더관련 and DX11Utils.h/cpp  (0) 2016.08.23
2일차 XLE 분석 및 구현 (160822)  (0) 2016.08.16
XLE 분석 ( FlexBegin / FlexEnd )  (0) 2016.03.02
조사해야될거  (0) 2016.03.01
posted by 알쿠미

2일차 XLE 분석 및 구현 (160822)

엔진 2016. 8. 16. 21:05

ObjectFactory로 D3D관련 객체를 만든다.

이렇게 하면 디버깅과 프로파일링 하기 편하다고 한다.


XLE에서 CommandList는 noncopyable과 RefCountedObject를 상속받고있다.

일단 나중에 CommandList를 구현할때쯤 RefCountedObject를 다시보고 참고해야겠다.


enum class {

};


형에 안전성을 가지고 있고 클래스로 덮혀있어서 이름이 겹치지 않는다.


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

Fbx logic tutorial  (0) 2017.09.15
3일차 헤더관련 and DX11Utils.h/cpp  (0) 2016.08.23
DX9와 DX11의 차이  (0) 2016.08.19
XLE 분석 ( FlexBegin / FlexEnd )  (0) 2016.03.02
조사해야될거  (0) 2016.03.01
posted by 알쿠미

XLE 분석 ( FlexBegin / FlexEnd )

엔진 2016. 3. 2. 16:26


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

Fbx logic tutorial  (0) 2017.09.15
3일차 헤더관련 and DX11Utils.h/cpp  (0) 2016.08.23
DX9와 DX11의 차이  (0) 2016.08.19
2일차 XLE 분석 및 구현 (160822)  (0) 2016.08.16
조사해야될거  (0) 2016.03.01
posted by 알쿠미

조사해야될거

엔진 2016. 3. 1. 18:19

uuid , GUID , __declspec(좀더 자세히), 

std::numeric_limits - 계산가능한 변수들의 정보를 반환하는 거


template<typename Type>

    inline void DeleteAndClear(Type*& ptr)

    {

        delete ptr;

        ptr = nullptr;

    }


template<typename Type>

    inline void ReleaseAndClear(Type*& ptr)

    {

        if (ptr) {

            ptr->Release();

            ptr = nullptr;

        }

    }


template<typename Type>

    inline void DeleteArrayAndClear(Type*& ptr)

    {

        delete ptr;

        ptr = nullptr;

    }

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

Fbx logic tutorial  (0) 2017.09.15
3일차 헤더관련 and DX11Utils.h/cpp  (0) 2016.08.23
DX9와 DX11의 차이  (0) 2016.08.19
2일차 XLE 분석 및 구현 (160822)  (0) 2016.08.16
XLE 분석 ( FlexBegin / FlexEnd )  (0) 2016.03.02
posted by 알쿠미