remove unnecessary uv_min and uv_max from tile_info
This commit is contained in:
parent
382ef67895
commit
db55a510a6
16
src/main.cpp
16
src/main.cpp
@ -184,9 +184,6 @@ static PerFrame per_frame = {};
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Uint16 type;
|
Uint16 type;
|
||||||
const char *asset_path;
|
const char *asset_path;
|
||||||
|
|
||||||
V2 uv_min;
|
|
||||||
V2 uv_max;
|
|
||||||
} TileInfo;
|
} TileInfo;
|
||||||
|
|
||||||
static TileInfo tile_infos[] = {
|
static TileInfo tile_infos[] = {
|
||||||
@ -1223,10 +1220,7 @@ bool recreate_tile_textures() {
|
|||||||
SDL_assert_always(width == TILE_SIZE);
|
SDL_assert_always(width == TILE_SIZE);
|
||||||
SDL_assert_always(height == TILE_SIZE);
|
SDL_assert_always(height == TILE_SIZE);
|
||||||
|
|
||||||
tile_infos[i].uv_min = V2_(0, 0);
|
cpu_tile_infos_buffer[i] = V4_(0, 0, 1, 1);
|
||||||
tile_infos[i].uv_max = V2_(1, 1);
|
|
||||||
|
|
||||||
cpu_tile_infos_buffer[i] = V4_(tile_infos[i].uv_min, tile_infos[i].uv_max);
|
|
||||||
|
|
||||||
memmove((char *)transfer_data + i * width * height * 4, data, width * height * 4);
|
memmove((char *)transfer_data + i * width * height * 4, data, width * height * 4);
|
||||||
stbi_image_free(data);
|
stbi_image_free(data);
|
||||||
@ -1581,8 +1575,8 @@ int main(int argc, char **argv) {
|
|||||||
for (int i = 0; i < SDL_arraysize(tile_infos); i++) {
|
for (int i = 0; i < SDL_arraysize(tile_infos); i++) {
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
|
|
||||||
ImVec2 uv0 = ImVec2(tile_infos[i].uv_min.x, tile_infos[i].uv_min.y);
|
ImVec2 uv0 = ImVec2(0, 0);
|
||||||
ImVec2 uv1 = ImVec2(tile_infos[i].uv_max.x, tile_infos[i].uv_max.y);
|
ImVec2 uv1 = ImVec2(1, 1);
|
||||||
|
|
||||||
float available = ImGui::GetContentRegionAvail().x - ImGui::GetItemRectMax().x;
|
float available = ImGui::GetContentRegionAvail().x - ImGui::GetItemRectMax().x;
|
||||||
if (available >= 32)
|
if (available >= 32)
|
||||||
@ -1597,8 +1591,8 @@ int main(int argc, char **argv) {
|
|||||||
if (selected_tile != -1) {
|
if (selected_tile != -1) {
|
||||||
ImGui::Text("Rotation:");
|
ImGui::Text("Rotation:");
|
||||||
|
|
||||||
ImVec2 uv0 = ImVec2(tile_infos[selected_tile].uv_min.x, tile_infos[selected_tile].uv_min.y);
|
ImVec2 uv0 = ImVec2(0, 0);
|
||||||
ImVec2 uv1 = ImVec2(tile_infos[selected_tile].uv_max.x, tile_infos[selected_tile].uv_max.y);
|
ImVec2 uv1 = ImVec2(1, 1);
|
||||||
|
|
||||||
if (SelectableTile("##None", selected_rotation == 0, &tile_atlas_texture_binding, selected_tile, ImVec2(32, 32), uv0, uv1, 0))
|
if (SelectableTile("##None", selected_rotation == 0, &tile_atlas_texture_binding, selected_tile, ImVec2(32, 32), uv0, uv1, 0))
|
||||||
selected_rotation = 0;
|
selected_rotation = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user