50 lines
834 B
C++
50 lines
834 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
struct Vertex
|
|
{
|
|
float pos[2];
|
|
float uv[2];
|
|
};
|
|
|
|
struct TileRect
|
|
{
|
|
float x0;
|
|
float y0;
|
|
float x1;
|
|
float y1;
|
|
};
|
|
|
|
std::vector<TileRect> makeGridTileRects(
|
|
uint32_t cols,
|
|
uint32_t rows,
|
|
float viewportWidth,
|
|
float viewportHeight,
|
|
float gapPixels,
|
|
float targetAspect);
|
|
|
|
std::vector<Vertex> makeGridLayout(
|
|
uint32_t cols,
|
|
uint32_t rows,
|
|
float viewportWidth,
|
|
float viewportHeight,
|
|
float gapPixels,
|
|
float targetAspect);
|
|
|
|
void updateGridLayout(
|
|
Vertex* vertices,
|
|
uint32_t cols,
|
|
uint32_t rows,
|
|
float viewportWidth,
|
|
float viewportHeight,
|
|
float gapPixels,
|
|
float targetAspect);
|
|
|
|
void updateUvForAspectRatio(
|
|
Vertex* vertices,
|
|
uint32_t quadIndex,
|
|
float srcAspect,
|
|
float tileAspect);
|