|
|
|
|
@ -28,7 +28,7 @@ namespace lunarium
|
|
|
|
|
{
|
|
|
|
|
SimpleRenderScene::SimpleRenderScene(uint32_t logCat)
|
|
|
|
|
: BaseScene(logCat), mTestMode(TestMode::Basic), mShapeMode(ShapeMode::Lines), mFrameTime(0.0), mNumFrames(0), mpTestImageLoad3(nullptr),
|
|
|
|
|
mEllipseResolution(50), mEllipseRadii{ 100.0f, 100.0f }
|
|
|
|
|
mEllipseResolution(50), mEllipseRadii{ 100.0f, 100.0f }, mTestMap({ 16, 16 })
|
|
|
|
|
{
|
|
|
|
|
srand((u32)time(0));
|
|
|
|
|
}
|
|
|
|
|
@ -182,6 +182,7 @@ namespace lunarium
|
|
|
|
|
case TestMode::Stress: RenderBatchStressTest(Core::Graphics()); break;
|
|
|
|
|
case TestMode::String: RenderStringTest(Core::Graphics()); break;
|
|
|
|
|
case TestMode::Shapes: RenderShapesTest(Core::Graphics()); break;
|
|
|
|
|
case TestMode::TileMap: RenderTileMapTest(Core::Graphics()); break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -278,19 +279,24 @@ namespace lunarium
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SimpleRenderScene::RenderTileMapTest(Renderer2D& g)
|
|
|
|
|
{
|
|
|
|
|
mTestMap.Render(&g);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
// GUI DRAWING GUI DRAWING
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
void SimpleRenderScene::DrawStatsGUI()
|
|
|
|
|
{
|
|
|
|
|
const char* mode_names[4] = { "Basic", "Stress", "String", "Shapes" };
|
|
|
|
|
const char* mode_names[5] = { "Basic", "Stress", "String", "Shapes", "TileMap"};
|
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_FirstUseEver);
|
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(400, 800));
|
|
|
|
|
ImGui::Begin("RENDER INFO");
|
|
|
|
|
ImGui::BeginChild("Scene Info", ImVec2(ImGui::GetWindowSize().x - 15, ImGui::GetFrameHeightWithSpacing() * 3.5f), true);
|
|
|
|
|
ImGui::Text("Scene Info");
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
ImGui::Combo("Scene Mode", (int*)&mTestMode, mode_names, 4);
|
|
|
|
|
ImGui::Combo("Scene Mode", (int*)&mTestMode, mode_names, 5);
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
ImGui::BeginChild("Per Frame", ImVec2(ImGui::GetWindowSize().x - 15, ImGui::GetFrameHeightWithSpacing() * 3.5f), true);
|
|
|
|
|
ImGui::Text("Per Frame");
|
|
|
|
|
@ -347,8 +353,39 @@ namespace lunarium
|
|
|
|
|
GenerateEllipses();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (mTestMode == TestMode::TileMap)
|
|
|
|
|
{
|
|
|
|
|
ImGui::Begin("TileSet View");
|
|
|
|
|
ImGui::Image((ImTextureID)mpTestImageLoad->GetGLID64(), ImVec2(mpTestImageLoad->GetWidth(), mpTestImageLoad->GetHeight()));
|
|
|
|
|
ImGui::End();
|
|
|
|
|
|
|
|
|
|
ImGui::BeginChild("TileMap Editor", ImVec2(ImGui::GetWindowSize().x - 15, ImGui::GetFrameHeightWithSpacing() * 6.5f), true, ImGuiWindowFlags_HorizontalScrollbar);
|
|
|
|
|
for (int i = 0; i < mTestMap.GetSizeInTiles().Width; i++)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < mTestMap.GetSizeInTiles().Height; j++)
|
|
|
|
|
{
|
|
|
|
|
std::string id = "##idx";
|
|
|
|
|
id += std::to_string(i);
|
|
|
|
|
id += ", ";
|
|
|
|
|
id += std::to_string(j);
|
|
|
|
|
int v[2] = { mTestMap.GetMap()[i][j].TileIndex.X, mTestMap.GetMap()[i][j].TileIndex.Y };
|
|
|
|
|
ImGui::SetNextItemWidth(65);
|
|
|
|
|
if (ImGui::InputInt2(id.c_str(), v))
|
|
|
|
|
{
|
|
|
|
|
mTestMap.SetTile(editor::TileRef {0, v[0], v[1] }, Vec2i { i, j });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (j + 1 < mTestMap.GetSizeInTiles().Height)
|
|
|
|
|
{
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
ImGui::End();
|
|
|
|
|
|
|
|
|
|
@ -411,6 +448,12 @@ namespace lunarium
|
|
|
|
|
|
|
|
|
|
mpTestImageLoad3 = Texture::Create(buffer, w, h, format);
|
|
|
|
|
delete[] buffer;
|
|
|
|
|
|
|
|
|
|
mTestSet.SetImage(mpTestImageLoad);
|
|
|
|
|
mTestSet.SetTileSize({16, 16});
|
|
|
|
|
mTestMap.AddTileSet(0, &mTestSet).LogIfFailed(mLogCat);
|
|
|
|
|
mTestMap.ResizeMap({4, 4});
|
|
|
|
|
mTestMap.ClearMap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SimpleRenderScene::GenerateLines()
|
|
|
|
|
@ -436,7 +479,6 @@ namespace lunarium
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SimpleRenderScene::GenerateEllipses()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
@ -467,8 +509,6 @@ namespace lunarium
|
|
|
|
|
mQuadColors[i].A = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SimpleRenderScene::DoFrameBufferSaveTest()
|
|
|
|
|
{
|
|
|
|
|
|