반응형

IDirect3DDevice9::SetScissorRect
Sets the scissor rectangle.

HRESULT SetScissorRect(
  CONST RECT * pRect
);
Parameters
pRect
[in] Pointer to a RECT structure that defines the rendering area within the render target if scissor test is enabled. This parameter may not be NULL.
Return Values
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.

Remarks
The scissor rectangle is used as a rectangular clipping region.

See Rectangles for further information on the use of rectangles in DirectX.

Requirements
Header: Declared in D3d9.h.

 

 

void Render()

{

    Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0);
    Device->BeginScene();

 

    // 영역을 지정 한다.
    RECT rect;


    rect.left = 0;
    rect.top = 0;
    rect.right = 400;
    rect.bottom = 400;

 

    // 위에서 영역을 지정 했으면 아래 붉은색의 코드를 넣으면 지정한 영역에만 랜더링 된다.

    Device->SetRenderState( D3DRS_SCISSORTESTENABLE, TRUE );
    Device->SetScissorRect( &rect );

 

    // 아래 for 문은 x 파일을 랜더링 하는 코드이다.

    for( int i = 0; i < Mtrls.size(); i++ )
    {
       Device->SetMaterial( &Mtrls[i] );
       Device->SetTexture( 0, Textures[i] );
       Mesh->DrawSubset( i );
    }

 

    Device->SetRenderState( D3DRS_SCISSORTESTENABLE, FALSE );

 

    Device->EndScene();

}

반응형

+ Recent posts