F16 rendering
This commit is contained in:
parent
c895c266fb
commit
477b7dd087
5 changed files with 120 additions and 79 deletions
|
|
@ -42,9 +42,9 @@ export namespace Crafter {
|
|||
Buffer
|
||||
};
|
||||
|
||||
template<std::uint8_t Alignment = 0>
|
||||
template<typename T, std::uint8_t Alignment = 0>
|
||||
struct RenderElement2DScalingOwning {
|
||||
std::vector<Vector<std::uint8_t, 4, Alignment>> scalingBuffer;
|
||||
std::vector<Vector<T, 4, Alignment>> scalingBuffer;
|
||||
std::uint32_t bufferWidth;
|
||||
std::uint32_t bufferHeight;
|
||||
RenderElement2DScalingOwning() = default;
|
||||
|
|
@ -53,13 +53,13 @@ export namespace Crafter {
|
|||
}
|
||||
};
|
||||
|
||||
template<std::uint8_t Alignment = 0>
|
||||
template<typename T, std::uint8_t Alignment = 0>
|
||||
struct RenderElement2DScalingNonOwning {
|
||||
Vector<std::uint8_t, 4, Alignment>* scalingBuffer;
|
||||
Vector<T, 4, Alignment>* scalingBuffer;
|
||||
std::uint32_t bufferWidth;
|
||||
std::uint32_t bufferHeight;
|
||||
RenderElement2DScalingNonOwning() = default;
|
||||
RenderElement2DScalingNonOwning(Vector<std::uint8_t, 4, Alignment>* scalingBuffer, std::uint32_t bufferWidth, std::uint32_t bufferHeight) : scalingBuffer(scalingBuffer), bufferWidth(bufferWidth), bufferHeight(bufferHeight) {
|
||||
RenderElement2DScalingNonOwning(Vector<T, 4, Alignment>* scalingBuffer, std::uint32_t bufferWidth, std::uint32_t bufferHeight) : scalingBuffer(scalingBuffer), bufferWidth(bufferWidth), bufferHeight(bufferHeight) {
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -76,13 +76,13 @@ export namespace Crafter {
|
|||
struct EmptyScalingBase {};
|
||||
struct EmptyRotatingBase {};
|
||||
|
||||
template<bool Scaling, bool Owning, std::uint8_t Alignment = 0>
|
||||
template<typename T, bool Scaling, bool Owning, std::uint8_t Alignment = 0>
|
||||
using ScalingBase =
|
||||
std::conditional_t<
|
||||
Scaling,
|
||||
std::conditional_t<Owning,
|
||||
RenderElement2DScalingOwning<Alignment>,
|
||||
RenderElement2DScalingNonOwning<Alignment>>,
|
||||
RenderElement2DScalingOwning<T, Alignment>,
|
||||
RenderElement2DScalingNonOwning<T, Alignment>>,
|
||||
EmptyScalingBase
|
||||
>;
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ export namespace Crafter {
|
|||
redraw[i] = true;
|
||||
}
|
||||
}
|
||||
void CopyNearestNeighbor(Vector<std::uint8_t, 4>* dst, std::uint16_t dstSizeX, std::uint16_t dstScaledSizeX, std::uint16_t dstScaledSizeY, std::uint16_t offsetX, std::uint16_t offsetY) {
|
||||
void CopyNearestNeighbor(Vector<T, 4>* dst, std::uint16_t dstSizeX, std::uint16_t dstScaledSizeX, std::uint16_t dstScaledSizeY, std::uint16_t offsetX, std::uint16_t offsetY) {
|
||||
for (std::uint16_t y = 0; y < dstScaledSizeY; y++) {
|
||||
std::uint16_t srcY = y * scaled.size.y / dstScaledSizeY;
|
||||
std::uint16_t dstY = y + offsetY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue