Terrain Window
This commit is contained in:
parent
9e7e33494c
commit
92ecd8e83a
@ -164,7 +164,7 @@ bool SystemClass::Frame()
|
||||
m_imguiManager->WidgetFPS();
|
||||
m_imguiManager->WidgetAddObject(m_Application);
|
||||
m_imguiManager->WidgetObjectWindow(m_Application);
|
||||
m_imguiManager->WidgetTestTerrain(m_Application);
|
||||
m_imguiManager->WidgetTerrainWindow(m_Application);
|
||||
|
||||
ImGui::End();
|
||||
|
||||
|
@ -244,7 +244,7 @@ bool ApplicationClass::Render(float rotation)
|
||||
}
|
||||
}
|
||||
|
||||
// Render terrainCube
|
||||
// Render terrainCube after all the cubes have been combined
|
||||
for (auto cube : m_terrainCubes)
|
||||
{
|
||||
cube->Render(m_Direct3D->GetDeviceContext());
|
||||
@ -263,6 +263,8 @@ bool ApplicationClass::Render(float rotation)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Present the rendered scene to the screen.
|
||||
m_Direct3D->EndScene();
|
||||
|
||||
@ -309,9 +311,7 @@ void ApplicationClass::GenerateTerrain()
|
||||
}
|
||||
}
|
||||
|
||||
// Combine all the cubes into a single model
|
||||
// TODO: Uncomment this line when you have implemented the CombineModels function in ModelClass
|
||||
//m_Model->CombineModels(m_terrainCubes);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -343,4 +343,14 @@ void ApplicationClass::DeleteCube(int index)
|
||||
delete m_cubes[index];
|
||||
m_cubes.erase(m_cubes.begin() + index);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationClass::DeleteTerrain()
|
||||
{
|
||||
for (auto cube : m_terrainCubes)
|
||||
{
|
||||
cube->Shutdown();
|
||||
delete cube;
|
||||
}
|
||||
m_terrainCubes.clear();
|
||||
}
|
@ -45,9 +45,13 @@ public:
|
||||
void AddCube();
|
||||
void DeleteCube(int index);
|
||||
int GetCubeCount() const { return m_cubes.size(); };
|
||||
int GetTerrainCubeCount() const { return m_terrainCubes.size(); };
|
||||
std::vector<Object*> GetCubes() const { return m_cubes; };
|
||||
std::vector<Object*> GetTerrainCubes() const { return m_terrainCubes; };
|
||||
|
||||
void GenerateTerrain();
|
||||
void DeleteTerrain();
|
||||
|
||||
|
||||
private:
|
||||
bool Render(float);
|
||||
@ -60,11 +64,11 @@ private:
|
||||
LightShaderClass* m_LightShader;
|
||||
LightClass* m_Light;
|
||||
float speed = 0.1f;
|
||||
std::vector<Object*> m_cubes;
|
||||
std::vector<Object*> m_terrainCubes;
|
||||
Object* m_SelectedObject;
|
||||
LightClass* m_Lights;
|
||||
int m_numLights;
|
||||
std::vector<Object*> m_cubes;
|
||||
std::vector<Object*> m_terrainCubes;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3,10 +3,14 @@ Pos=60,60
|
||||
Size=400,400
|
||||
|
||||
[Window][Khaotic Engine]
|
||||
Pos=1196,6
|
||||
Size=694,366
|
||||
Pos=586,8
|
||||
Size=694,183
|
||||
|
||||
[Window][Objects]
|
||||
Pos=11,7
|
||||
Pos=11,5
|
||||
Size=492,353
|
||||
|
||||
[Window][Terrain]
|
||||
Pos=1297,54
|
||||
Size=418,94
|
||||
|
||||
|
@ -132,12 +132,25 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void imguiManager::WidgetTestTerrain(ApplicationClass* app)
|
||||
void imguiManager::WidgetTerrainWindow(ApplicationClass* app)
|
||||
{
|
||||
ImGui::Begin("Terrain");
|
||||
|
||||
ImGui::Text("Number of terrain cubes: %d", app->GetTerrainCubeCount());
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Generate Terrain"))
|
||||
{
|
||||
app->GenerateTerrain();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Delete All Terrain Cubes"))
|
||||
{
|
||||
app->DeleteTerrain();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
@ -25,9 +25,9 @@ public:
|
||||
void WidgetButton();
|
||||
void WidgetFPS();
|
||||
void WidgetAddObject(ApplicationClass* app);
|
||||
void WidgetTestTerrain(ApplicationClass* app);
|
||||
|
||||
void WidgetObjectWindow(ApplicationClass* app);
|
||||
void WidgetTerrainWindow(ApplicationClass* app);
|
||||
|
||||
private:
|
||||
ImGuiIO* io;
|
||||
|
@ -23,7 +23,7 @@ using namespace std;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class ModelClass
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
|
||||
struct VertexType
|
||||
{
|
||||
@ -65,10 +65,11 @@ private:
|
||||
|
||||
private:
|
||||
ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
|
||||
int m_vertexCount, m_indexCount;
|
||||
TextureClass* m_Texture;
|
||||
|
||||
protected:
|
||||
ModelType* m_model;
|
||||
int m_vertexCount, m_indexCount;
|
||||
};
|
||||
|
||||
#endif
|
@ -36,4 +36,5 @@ private:
|
||||
XMMATRIX m_translateMatrix;
|
||||
XMMATRIX m_srMatrix;
|
||||
XMMATRIX m_worldMatrix;
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user