Patch - Improves code and UI for better engine stability - V14.5.30
Addresses minor issues across the engine to improve stability and UI. - Updates ImGui window size for better rendering - Adds macro for boolean returns (R_TRUE and R_FALSE) - Adds missing includes and removes unused code - Updates shader code to use the new macros and improve readability
This commit is contained in:
@@ -48,9 +48,9 @@ public:
|
||||
* @return True if initialization was successful, false otherwise.
|
||||
*/
|
||||
bool InitializeWithModel(std::shared_ptr<model_class> model) {
|
||||
if (!model) return false;
|
||||
if (!model) R_FALSE
|
||||
m_model = model;
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,14 +73,14 @@ public:
|
||||
// Cr<43>er un nouveau mod<6F>le
|
||||
auto new_model = std::make_shared<model_class>();
|
||||
if (!new_model->Initialize(device, deviceContext, const_cast<char*>(modelFilename), textureContainer)) {
|
||||
return false;
|
||||
R_FALSE
|
||||
}
|
||||
g_model_cache[filename] = new_model;
|
||||
m_model = new_model;
|
||||
}
|
||||
|
||||
m_modelFilePath = modelFilename;
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,13 +101,13 @@ public:
|
||||
ID3D11ShaderResourceView* texture = nullptr;
|
||||
result = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
|
||||
if (FAILED(result)) {
|
||||
return false;
|
||||
R_FALSE
|
||||
}
|
||||
texturesContainer.AssignTexture(texturesContainer, texture, texturePath, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,12 +245,12 @@ public:
|
||||
std::string type;
|
||||
|
||||
if (!std::getline(ss, type, ':') || type != "RenderComponent")
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
std::string token;
|
||||
|
||||
if (!std::getline(ss, token, ':') || token != "HasModel")
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
int diffuse_count = 0, normal_count = 0, specular_count = 0, alpha_count = 0;
|
||||
|
||||
@@ -258,14 +258,14 @@ public:
|
||||
|
||||
auto read_count = [&](int& count) -> bool {
|
||||
if (!std::getline(ss, token, ':'))
|
||||
return false;
|
||||
R_FALSE
|
||||
try {
|
||||
count = std::stoi(token);
|
||||
}
|
||||
catch (...) {
|
||||
return false;
|
||||
R_FALSE
|
||||
}
|
||||
return true;
|
||||
R_TRUE
|
||||
};
|
||||
|
||||
auto clean_token = [](std::string& str) {
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
auto read_paths = [&](int count, std::vector<std::wstring>& paths) -> bool {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (!std::getline(ss, token, ':'))
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
clean_token(token);
|
||||
|
||||
@@ -287,20 +287,20 @@ public:
|
||||
LOG_INFO("Loaded path: " + std::string(token.begin(), token.end()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
R_TRUE
|
||||
};
|
||||
|
||||
if (!read_count(diffuse_count)) return false;
|
||||
if (!read_paths(diffuse_count, paths_diffuse)) return false;
|
||||
if (!read_count(diffuse_count)) R_FALSE
|
||||
if (!read_paths(diffuse_count, paths_diffuse)) R_FALSE
|
||||
|
||||
if (!read_count(normal_count)) return false;
|
||||
if (!read_paths(normal_count, paths_normal)) return false;
|
||||
if (!read_count(normal_count)) R_FALSE
|
||||
if (!read_paths(normal_count, paths_normal)) R_FALSE
|
||||
|
||||
if (!read_count(specular_count)) return false;
|
||||
if (!read_paths(specular_count, paths_specular)) return false;
|
||||
if (!read_count(specular_count)) R_FALSE
|
||||
if (!read_paths(specular_count, paths_specular)) R_FALSE
|
||||
|
||||
if (!read_count(alpha_count)) return false;
|
||||
if (!read_paths(alpha_count, paths_alpha)) return false;
|
||||
if (!read_count(alpha_count)) R_FALSE
|
||||
if (!read_paths(alpha_count, paths_alpha)) R_FALSE
|
||||
|
||||
// Lib<69>rer textures existantes
|
||||
for (auto& tex : texture_container_buffer.diffuse) if (tex) { tex->Release(); tex = nullptr; }
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
texture_container_buffer.specularPaths = std::move(paths_specular);
|
||||
texture_container_buffer.alphaPaths = std::move(paths_alpha);
|
||||
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user