From ea57d1ab9d21b213f0e8f76af7a215aa83046b48 Mon Sep 17 00:00:00 2001 From: CatChow0 Date: Wed, 3 Apr 2024 12:46:49 +0200 Subject: [PATCH] Render terrain ok --- enginecustom/applicationclass.cpp | 11 +++++------ enginecustom/applicationclass.h | 1 - enginecustom/modelclass.cpp | 2 +- enginecustom/textureclass.cpp | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/enginecustom/applicationclass.cpp b/enginecustom/applicationclass.cpp index 16cc6b9..a1e2946 100644 --- a/enginecustom/applicationclass.cpp +++ b/enginecustom/applicationclass.cpp @@ -57,6 +57,8 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd) return false; } + GenerateTerrain(); + // Create the camera object. m_Camera = new CameraClass; if (!m_Camera) @@ -690,21 +692,18 @@ int ApplicationClass::GetScreenHeight() const void ApplicationClass::GenerateTerrain() { - // Set the file name of the model. char modelFilename[128]; - // Set the name of the texture file that we will be loading. char textureFilename[128]; char textureFilename2[128]; - - // check if a chunk file already exists + // Set the file name of the model. strcpy_s(modelFilename, "plane.txt"); strcpy_s(textureFilename, "stone01.tga"); strcpy_s(textureFilename2, "moss01.tga"); // for loop to generate terrain chunks for a 10x10 grid - for (int i = -10; i < 10; i++) + for (int i = -5; i < 5; i++) { - for (int j = -10; j < 10; j++) + for (int j = -5; j < 5; j++) { Object* newTerrain = new Object(); newTerrain->Initialize(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), modelFilename, textureFilename, textureFilename2); diff --git a/enginecustom/applicationclass.h b/enginecustom/applicationclass.h index 4665024..c3cf504 100644 --- a/enginecustom/applicationclass.h +++ b/enginecustom/applicationclass.h @@ -61,7 +61,6 @@ public: void GenerateTerrain(); void DeleteTerrain(); - private: bool Render(float, float, float, float); diff --git a/enginecustom/modelclass.cpp b/enginecustom/modelclass.cpp index 8cc6963..6b34ba3 100644 --- a/enginecustom/modelclass.cpp +++ b/enginecustom/modelclass.cpp @@ -19,7 +19,7 @@ ModelClass::~ModelClass() { } -bool ModelClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* modelFilename, char* textureFilename1, char* textureFilename2) +bool ModelClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, const char* modelFilename, const char* textureFilename1, const char* textureFilename2) { bool result; diff --git a/enginecustom/textureclass.cpp b/enginecustom/textureclass.cpp index e863139..2007e4a 100644 --- a/enginecustom/textureclass.cpp +++ b/enginecustom/textureclass.cpp @@ -17,7 +17,7 @@ TextureClass::~TextureClass() { } -bool TextureClass::Initialize(ID3D11Device * device, ID3D11DeviceContext * deviceContext, char* filename) +bool TextureClass::Initialize(ID3D11Device * device, ID3D11DeviceContext * deviceContext,const char* filename) { bool result; int height, width;