DirectX Graphics 레퍼런스 이펙트 레퍼런스 이펙트 포맷 핸들   [목차열람] [주소복사] [슬롯비우기]
핸들
 
Microsoft DirectX 9.0

핸들


핸들은,ID3DXEffectCompiler 또는 ID3DXEffect 를 사용해 테크닉, 패스, 코멘트, 또는 파라미터를 참조하기 위한 효율적인 수단을 제공한다. Get[Parameter|Annotation|Function|Technique|Pass][ByName|BySemantic|Element] 형식의 함수를 호출했을 때에 동적으로 생성된다.

프로그램의 실행중에, 같은 개체에 대한 핸들을 여러 차례 생성했을 경우는, 매회 같은 핸들이 반환된다. 다만, 프로그램을 여러 차례 실행하는 경우는, 핸들이 반드시 일정이 아닌 것에 주의할 필요가 있다. ID3DXEffectID3DXEffectCompiler 가 다른 인스턴스에 의해 생성된 핸들은 같지 않은 것에도 주의해야 한다.

헤더 파일을 보면 핸들 (D3DXHANDLE)은 기술적으로는 캐릭터 라인 포인터인 것을 알 수 있다. 「정수」를 참조할것.

GetParameter[ByName|Element|BySemantic]GetAnnotation[ByName] 등의 함수에 건네주는 핸들은, 다음의 3 개의 형식을 취한다.

  1. GetParameter[ByName|Element|BySemantic] 등의 함수에 의해 돌려주어진 핸들.
  2. MyVariableName,MyTechniqueName,MyArray[0] 등의 캐릭터 라인.
  3. NULL. 이것에는 4 개의 케이스가 있다.
    • 이것이 메서드의 반환값의 경우, 메서드는 핸들을 찾아낼 수가 없었다.
    • GetParameter[ByName|Element|BySemantic] 의 제 1 인수로서 NULL 핸들이 건네받았을 경우, 함수는 최상정도 파라미터를 돌려준다. 반대로, 핸들이 NULL 가 아닌 경우, 함수는, 핸들에 의해 식별되는 구조체의 멤버 또는 요소를 돌려준다.
    • ValidateTechnique 의 제 1 인수 또는 IsParameterUsed 의 제 2 인수로서 NULL 핸들을 건네주면 현재의 테크닉의 타당성 검사를 한다.
    • FindNextValidTechnique 의 제 1 인수로서 NULL 핸들을 건네주면 유효한 테크닉의 검색이 이펙트내의 최초의 테크닉으로부터 시작 된다.

퍼포먼스에 관한 힌트  애플리케이션의 최초로, 초기화 패스를 실행해 캐릭터 라인으로부터 핸들을 생성한다. 그 이후는 핸들만을 사용한다. 생성된 핸들은 아니고 캐릭터 라인을 건네주면 처리가 늦어진다.

여기에서는,Get[Parameter|Annotation|Function|Technique|Pass][ByName|BySemantic|Element] 함수를 사용해 핸들을 생성하는 예를 나타낸다.

// Gets handle of second top-level parameter handle in the effect file
h1 = GetParameter(NULL, 1);    

// Gets handle of the third struct member of MyStruct
h2 = GetParameter("MyStruct", 2); 

// Gets handle of the third array element handle of MyArray
h3 = GetParameterElement("MyArray", 2); 

// Gets handle of first member of h1 (that is, the second top-level param)
h4 = GetParameter(h1, 0);    

// Gets handle of MyStruct.Data
h5 = GetParameterByName("MyStruct", "Data");    
// or 
h6 = GetParameterByName(NULL, "MyStruct.Data");    

// Gets handle of MyStruct.Data.SubData
h7 = GetParameterByName("MyStruct.Data", "SubData"); 
// or 
h8 = GetParameter(NULL, "MyArray[2]");

// Gets handle of fifth annotation of h1 (that is, second top-level param)
h9 = GetAnnotation(h1, 4);    

// Gets handle of MyStruct's annotation, called Author
h10 = GetAnnotationByName("MyStruct", "Author");  
// or
h11 = GetParameterByName(NULL, "MyStruct@Author"); 


© 2002 Microsoft Corporation. All rights reserved.
↑TOP