
유니티 GameView와 SceneView로 나뉜 해당 이미지 뷰를 ImGUI를 통해 재현하고 싶었습니다.

※ 추후 play pause 단계 추가 예정
// 의사 코드는 좌우로 나뉘는 viewport을 생성하는 코드입니다. void SetViewPorts(Vec2 vPos,Vec2 vScale) { D3D11_VIED3D11_VIEWPORT vDesc = {}; vDesc.MinDepth = 0; vDesc.MaxDepth = 1.f; vDesc.TopLeftX = vPos.x; vDesc.TopLeftY = vPos.y; vDesc.Width = vScale.x; vDesc.Height = vScale.y; DEVICE_CONTEXT->RSSetViewports(1,&Desc); } void Render() { SetViewPorts(Vec2(0.f,0.f),Vec2(resolution.x/2.f,resolution.y/2.f)); -> 왼쪽에 그려질 물체들에 대한 렌더(VSset->PSset->DrawCall) SetViewPorts(Vec2(resolution.x/2.f,0.f),Vec2(resolution.x/2.f,resolution.y/2.f)); -> 오른쪽에 그려질 물체들에 대한 렌더(VSset->PSset->DrawCall) swapchain->present(0,0); }
void ImGui::Image(ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col);
- user_texture_id : image method을 통해 바인딩해줄 image 객체를 넣어줘여하는 파라미터입니다.
※ DirectX기준으로 texture image을 바인딩 해주는 shaderresrouceview을 사용합니다.
DirectX 기준이 아닌 다른 graphic library 기준을 보고싶다면 아래 링크를 참고하길 바랍니다.
imgui - image method examples- image_size : 해당 imgui를 통해 보여질 image을 말합니다.
- uv0 : 해당 image(uv)좌표의 시작점(LeftTop)
- uv1 : 해당 image(uv)좌표의 끝점(RightBottom)
