#pragma once #include "Ground.h" #include "Surface.h" #include "Structs.h" Ground::Ground(Graphics & gfx, Logger & logger) noexcept { // Init 2 surfaces Surface *yueyueSurface = new Surface(); yueyueSurface->LoadImageFromFile(gfx.getDevice(), gfx.getContext(), "resource\\img\\yueyue.jpg"); float yueyueSlot = yueyueSurface->GetCurrSlot(); Surface *ethanSurface = new Surface(); ethanSurface->LoadImageFromFile(gfx.getDevice(), gfx.getContext(), "resource\\img\\Ethan.png"); float ethanSlot = ethanSurface->GetCurrSlot(); Surface* ethanAndYueyueSurface = new Surface(); ethanAndYueyueSurface->LoadImageFromFile(gfx.getDevice(), gfx.getContext(), "resource\\img\\Ethan_and_yueyue.png"); float ethanAndYueyueSlot = ethanAndYueyueSurface->GetCurrSlot(); for (int i = 0; i < 2; i+=2 ) for (int j = 0; j < 2; j+= 2) { StructVertex vertices[24] = { // back surface // left top back { XMFLOAT3(-1.0f + i, 1.0f, -1.0f + j), XMFLOAT2(0.0f, 0.0f), yueyueSlot }, // right top back { XMFLOAT3(1.0f + i, 1.0f, -1.0f + j), XMFLOAT2(1.0f, 0.0f), yueyueSlot }, // left bottom back { XMFLOAT3(-1.0f + i, -1.0f, -1.0f + j), XMFLOAT2(0.0f, 1.0f), yueyueSlot }, // right bottom back { XMFLOAT3(1.0f + i, -1.0f, -1.0f + j), XMFLOAT2(1.0f, 1.0f), yueyueSlot }, // left surface // left top front { XMFLOAT3(-1.0f + i, 1.0f, 1.0f + j), XMFLOAT2(0.0f, 0.0f), ethanSlot }, // left top back { XMFLOAT3(-1.0f + i, 1.0f, -1.0f + j), XMFLOAT2(1.0f, 0.0f), ethanSlot }, // left bottom front { XMFLOAT3(-1.0f + i, -1.0f, 1.0f + j), XMFLOAT2(0.0f, 1.0f), ethanSlot }, // left bottom back { XMFLOAT3(-1.0f + i, -1.0f, -1.0f + j), XMFLOAT2(1.0f, 1.0f), ethanSlot }, // right surface // right top back { XMFLOAT3(1.0f + i, 1.0f, -1.0f + j), XMFLOAT2(0.0f, 0.0f), ethanSlot }, // right top front { XMFLOAT3(1.0f + i, 1.0f, 1.0f + j), XMFLOAT2(1.0f, 0.0f), ethanSlot }, // right bottom back { XMFLOAT3(1.0f + i, -1.0f, -1.0f + j), XMFLOAT2(0.0f, 1.0f), ethanSlot }, // right bottom front { XMFLOAT3(1.0f + i, -1.0f, 1.0f + j), XMFLOAT2(1.0f, 1.0f), ethanSlot }, // top surface // left top front { XMFLOAT3(-1.0f + i, 1.0f, 1.0f + j), XMFLOAT2(0.0f, 0.0f), ethanAndYueyueSlot }, // right top front { XMFLOAT3(1.0f + i, 1.0f, 1.0f + j), XMFLOAT2(1.0f, 0.0f), ethanAndYueyueSlot }, // left top back { XMFLOAT3(-1.0f + i, 1.0f, -1.0f + j), XMFLOAT2(0.0f, 1.0f), ethanAndYueyueSlot }, // right top back { XMFLOAT3(1.0f + i, 1.0f, -1.0f + j), XMFLOAT2(1.0f, 1.0f), ethanAndYueyueSlot }, // front surface // right top front { XMFLOAT3(1.0f + i, 1.0f, 1.0f + j), XMFLOAT2(0.0f, 0.0f), yueyueSlot }, // left top front { XMFLOAT3(-1.0f + i, 1.0f, 1.0f + j), XMFLOAT2(1.0f, 0.0f), yueyueSlot }, // right bottom front { XMFLOAT3(1.0f + i, -1.0f, 1.0f + j), XMFLOAT2(0.0f, 1.0f), yueyueSlot }, // left bottom front { XMFLOAT3(-1.0f + i, -1.0f, 1.0f + j), XMFLOAT2(1.0f, 1.0f), yueyueSlot }, // bottom surface // left bottom back { XMFLOAT3(-1.0f + i, -1.0f, -1.0f + j), XMFLOAT2(0.0f, 0.0f), ethanAndYueyueSlot }, // right bottom back { XMFLOAT3(1.0f + i, -1.0f, -1.0f + j), XMFLOAT2(1.0f, 0.0f), ethanAndYueyueSlot }, // left bottom front { XMFLOAT3(-1.0f + i, -1.0f, 1.0f + j), XMFLOAT2(0.0f, 1.0f), ethanAndYueyueSlot }, // right bottom front { XMFLOAT3(1.0f + i, -1.0f, 1.0f + j), XMFLOAT2(1.0f, 1.0f), ethanAndYueyueSlot }, }; shapes.push_back(std::make_unique(gfx, vertices, logger)); } };