Small cleanup
This commit is contained in:
5
project/src/Buffers/DX11Viewport.cpp
Normal file
5
project/src/Buffers/DX11Viewport.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// Created by Bram on 16/01/2025.
|
||||
//
|
||||
|
||||
#include "DX11Viewport.h"
|
||||
51
project/src/Buffers/DX11Viewport.h
Normal file
51
project/src/Buffers/DX11Viewport.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef GP1_DIRECTX_DX11VIEWPORT_H
|
||||
#define GP1_DIRECTX_DX11VIEWPORT_H
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
class DX11Viewport
|
||||
{
|
||||
public:
|
||||
DX11Viewport(float width, float height, float topLeftX = 0.0f, float topLeftY = 0.0f, float minDepth = 0.0f, float maxDepth = 1.0f)
|
||||
{
|
||||
viewport.Width = width;
|
||||
viewport.Height = height;
|
||||
viewport.TopLeftX = topLeftX;
|
||||
viewport.TopLeftY = topLeftY;
|
||||
viewport.MinDepth = minDepth;
|
||||
viewport.MaxDepth = maxDepth;
|
||||
}
|
||||
|
||||
void Apply(ID3D11DeviceContext* context)
|
||||
{
|
||||
if (context)
|
||||
{
|
||||
context->RSSetViewports(1, &viewport);
|
||||
}
|
||||
}
|
||||
|
||||
void SetDimensions(float width, float height)
|
||||
{
|
||||
viewport.Width = width;
|
||||
viewport.Height = height;
|
||||
}
|
||||
|
||||
void SetPosition(float topLeftX, float topLeftY)
|
||||
{
|
||||
viewport.TopLeftX = topLeftX;
|
||||
viewport.TopLeftY = topLeftY;
|
||||
}
|
||||
|
||||
void SetDepthRange(float minDepth, float maxDepth)
|
||||
{
|
||||
viewport.MinDepth = minDepth;
|
||||
viewport.MaxDepth = maxDepth;
|
||||
}
|
||||
|
||||
const D3D11_VIEWPORT& GetViewport() const { return viewport; }
|
||||
|
||||
private:
|
||||
D3D11_VIEWPORT viewport;
|
||||
};
|
||||
|
||||
#endif //GP1_DIRECTX_DX11VIEWPORT_H
|
||||
@@ -9,7 +9,6 @@ public:
|
||||
SamplerState(ID3D11Device* device);
|
||||
~SamplerState();
|
||||
|
||||
|
||||
bool Initialize();
|
||||
ID3D11SamplerState* GetSamplerState() const { return m_samplerState; }
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user