Minor Update - Fix Warning + Add texture in the object inspector
Feat : + Show the texture of the object in the Object Window Fix : - No warning for now...
This commit is contained in:
parent
01acf46db8
commit
ca82f37127
@ -108,7 +108,7 @@ void PositionClass::TurnRight(bool keydown)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PositionClass::TurnMouse(float deltaX, float deltaY, bool rightMouseDown)
|
void PositionClass::TurnMouse(int deltaX, int deltaY, bool rightMouseDown)
|
||||||
{
|
{
|
||||||
float speed = 0.1f;
|
float speed = 0.1f;
|
||||||
// The turning speed is proportional to the horizontal mouse movement
|
// The turning speed is proportional to the horizontal mouse movement
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
void TurnLeft(bool);
|
void TurnLeft(bool);
|
||||||
void TurnRight(bool);
|
void TurnRight(bool);
|
||||||
void TurnMouse(float, float, bool);
|
void TurnMouse(int, int, bool);
|
||||||
void MoveCamera(bool, bool, bool, bool, bool, bool);
|
void MoveCamera(bool, bool, bool, bool, bool, bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -251,7 +251,10 @@ LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam
|
|||||||
{
|
{
|
||||||
return DefWindowProc(hwnd, umsg, wparam, lparam);
|
return DefWindowProc(hwnd, umsg, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight)
|
void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight)
|
||||||
|
@ -43,7 +43,6 @@ ApplicationClass::~ApplicationClass()
|
|||||||
bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||||
{
|
{
|
||||||
char mouseString1[32], mouseString2[32], mouseString3[32];
|
char mouseString1[32], mouseString2[32], mouseString3[32];
|
||||||
char testString1[32], testString2[32], testString3[32];
|
|
||||||
char modelFilename[128], textureFilename1[128], textureFilename2[128], textureFilename3[128], renderString[32];
|
char modelFilename[128], textureFilename1[128], textureFilename2[128], textureFilename3[128], renderString[32];
|
||||||
char bitmapFilename[128];
|
char bitmapFilename[128];
|
||||||
char spriteFilename[128];
|
char spriteFilename[128];
|
||||||
@ -598,12 +597,12 @@ bool ApplicationClass::Frame(InputClass* Input)
|
|||||||
|
|
||||||
currentMouseX = mouseX;
|
currentMouseX = mouseX;
|
||||||
|
|
||||||
float deltaX = currentMouseX - lastMouseX; // Calculez le d<>placement de la souris
|
int deltaX = currentMouseX - lastMouseX; // Calculez le d<>placement de la souris
|
||||||
lastMouseX = currentMouseX; // Mettez <20> jour la derni<6E>re position de la souris pour la prochaine image
|
lastMouseX = currentMouseX; // Mettez <20> jour la derni<6E>re position de la souris pour la prochaine image
|
||||||
|
|
||||||
currentMouseY = mouseY;
|
currentMouseY = mouseY;
|
||||||
|
|
||||||
float deltaY = currentMouseY - lastMouseY; // Calculez le d<>placement de la souris
|
int deltaY = currentMouseY - lastMouseY; // Calculez le d<>placement de la souris
|
||||||
lastMouseY = currentMouseY; // Mettez <20> jour la derni<6E>re position de la souris pour la prochaine image
|
lastMouseY = currentMouseY; // Mettez <20> jour la derni<6E>re position de la souris pour la prochaine image
|
||||||
|
|
||||||
// Set the frame time for calculating the updated position.
|
// Set the frame time for calculating the updated position.
|
||||||
@ -1080,7 +1079,7 @@ void ApplicationClass::GenerateTerrain()
|
|||||||
char textureFilename3[128];
|
char textureFilename3[128];
|
||||||
|
|
||||||
XMMATRIX scaleMatrix;
|
XMMATRIX scaleMatrix;
|
||||||
int scaleX, scaleY, scaleZ;
|
float scaleX, scaleY, scaleZ;
|
||||||
|
|
||||||
scaleX = 10.0f;
|
scaleX = 10.0f;
|
||||||
scaleY = 1.0f;
|
scaleY = 1.0f;
|
||||||
@ -1231,6 +1230,13 @@ bool ApplicationClass::UpdateMouseStrings(int mouseX, int mouseY, bool mouseDown
|
|||||||
|
|
||||||
// Update the sentence vertex buffer with the new string information.
|
// Update the sentence vertex buffer with the new string information.
|
||||||
result = m_MouseStrings[2].UpdateText(m_Direct3D->GetDeviceContext(), m_Font, finalString, 10, 100, 1.0f, 1.0f, 1.0f);
|
result = m_MouseStrings[2].UpdateText(m_Direct3D->GetDeviceContext(), m_Font, finalString, 10, 100, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplicationClass::UpdateFps()
|
bool ApplicationClass::UpdateFps()
|
||||||
|
@ -68,8 +68,8 @@ public:
|
|||||||
|
|
||||||
void AddCube();
|
void AddCube();
|
||||||
void DeleteKobject(int index);
|
void DeleteKobject(int index);
|
||||||
int GetCubeCount() const { return m_cubes.size(); };
|
size_t GetCubeCount() const { return m_cubes.size(); };
|
||||||
int GetTerrainCubeCount() const { return m_terrainChunk.size(); };
|
size_t GetTerrainCubeCount() const { return m_terrainChunk.size(); };
|
||||||
std::vector<Object*> GetCubes() const { return m_cubes; };
|
std::vector<Object*> GetCubes() const { return m_cubes; };
|
||||||
std::vector<Object*> GetTerrainCubes() const { return m_terrainChunk; };
|
std::vector<Object*> GetTerrainCubes() const { return m_terrainChunk; };
|
||||||
std::vector<Object*> GetKobjects() const { return m_object; };
|
std::vector<Object*> GetKobjects() const { return m_object; };
|
||||||
@ -113,7 +113,7 @@ private :
|
|||||||
XMMATRIX m_baseViewMatrix;
|
XMMATRIX m_baseViewMatrix;
|
||||||
RenderTextureClass* m_RenderTexture;
|
RenderTextureClass* m_RenderTexture;
|
||||||
DisplayPlaneClass* m_DisplayPlane;
|
DisplayPlaneClass* m_DisplayPlane;
|
||||||
float m_screenWidth, m_screenHeight;
|
int m_screenWidth, m_screenHeight;
|
||||||
CameraClass* m_Camera;
|
CameraClass* m_Camera;
|
||||||
PositionClass* m_Position;
|
PositionClass* m_Position;
|
||||||
FrustumClass* m_Frustum;
|
FrustumClass* m_Frustum;
|
||||||
|
@ -7,7 +7,7 @@ Pos=260,25
|
|||||||
Size=694,210
|
Size=694,210
|
||||||
|
|
||||||
[Window][Objects]
|
[Window][Objects]
|
||||||
Pos=1348,34
|
Pos=994,39
|
||||||
Size=492,353
|
Size=492,353
|
||||||
|
|
||||||
[Window][Terrain]
|
[Window][Terrain]
|
||||||
|
@ -106,6 +106,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
|||||||
{
|
{
|
||||||
ImGui::Begin("Objects", &showObjectWindow);
|
ImGui::Begin("Objects", &showObjectWindow);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
int count = 0;
|
||||||
for (auto& object : app->GetKobjects())
|
for (auto& object : app->GetKobjects())
|
||||||
{
|
{
|
||||||
std::string headerName = object->GetName() + " " + std::to_string(index);
|
std::string headerName = object->GetName() + " " + std::to_string(index);
|
||||||
@ -139,6 +140,21 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
|||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// Texture
|
||||||
|
std::string textureLabel = "Texture##" + std::to_string(index);
|
||||||
|
ID3D11ShaderResourceView* texture = object->GetTexture(0);
|
||||||
|
if (texture != nullptr)
|
||||||
|
{
|
||||||
|
if (ImGui::ImageButton((ImTextureID)texture, ImVec2(64, 64)))
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::Text("Texture count: %d", count);
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
// Delete button
|
// Delete button
|
||||||
std::string deleteLabel = "Delete##" + std::to_string(index);
|
std::string deleteLabel = "Delete##" + std::to_string(index);
|
||||||
if (ImGui::Button(deleteLabel.c_str()))
|
if (ImGui::Button(deleteLabel.c_str()))
|
||||||
|
@ -20,7 +20,6 @@ TextureClass::~TextureClass()
|
|||||||
bool TextureClass::Initialize(ID3D11Device * device, ID3D11DeviceContext * deviceContext, char* filename)
|
bool TextureClass::Initialize(ID3D11Device * device, ID3D11DeviceContext * deviceContext, char* filename)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
int height, width;
|
|
||||||
D3D11_TEXTURE2D_DESC textureDesc;
|
D3D11_TEXTURE2D_DESC textureDesc;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
unsigned int rowPitch;
|
unsigned int rowPitch;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user