Minor - Start the Doxygen doc - V12.8.0

This commit is contained in:
2025-07-28 15:26:10 +02:00
parent 2c005592f0
commit 9431552316
445 changed files with 100476 additions and 72 deletions

View File

@@ -7,35 +7,57 @@
#include <WICTextureLoader.h>
// D<>claration externe de la variable globale d<>finie dans application_class.h
/**
* Declaration of the global model cache externe variable from application_class.h .
* This variable is used to cache models loaded from files to avoid reloading them multiple times.
*/
extern std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
namespace ecs {
enum class TextureType
{
Diffuse,
Normal,
Specular,
Alpha,
Reflection
};
/**
* Enum for different types of textures used in rendering.
*/
enum class TextureType
{
Diffuse,
Normal,
Specular,
Alpha,
Reflection
};
class RenderComponent : public Component {
public:
/**
* Builder for the RenderComponent class.
*/
RenderComponent() : m_model(nullptr), m_isVisible(true) {}
~RenderComponent() = default;
void Initialize() override {}
void Update(float deltaTime) override {}
// Initialisation avec un mod<6F>le existant
/**
* Initialize the RenderComponent with a model.
* This method allows the component to be initialized with an existing model instance.
* @param model A shared pointer to the model_class instance to use.
* @return True if initialization was successful, false otherwise.
*/
bool InitializeWithModel(std::shared_ptr<model_class> model) {
if (!model) return false;
m_model = model;
return true;
}
// Initialisation avec un chemin de fichier
/**
* Initialize the RenderComponent from a model file.
* This method checks if the model is already cached; if not, it loads the model from the specified file.
* @param device The Direct3D device used for rendering.
* @param deviceContext The Direct3D device context used for rendering.
* @param modelFilename The path to the model file to load.
* @param textureContainer The container for textures used by the model.
* @return True if initialization was successful, false otherwise.
*/
bool InitializeFromFile(ID3D11Device* device, ID3D11DeviceContext* deviceContext,
const char* modelFilename, TextureContainer& textureContainer) {
// V<>rifier si le mod<6F>le existe d<>j<EFBFBD> dans le cache
@@ -57,7 +79,15 @@ public:
return true;
}
// Charger des textures depuis un chemin
/**
* Load textures from a list of file paths into the texture container.
* This method uses DirectX's WIC texture loader to load textures from the specified paths.
* @param texturePaths A vector of file paths to the textures to load.
* @param texturesContainer The container where the loaded textures will be stored.
* @param device The Direct3D device used for rendering.
* @param deviceContext The Direct3D device context used for rendering.
* @return True if all textures were loaded successfully, false otherwise.
*/
bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,
ID3D11Device* device, ID3D11DeviceContext* deviceContext) {
HRESULT result;
@@ -76,17 +106,49 @@ public:
return true;
}
// Getters et setters
/**
* Get the model associated with this RenderComponent.
* @return A shared pointer to the model_class instance.
*/
std::shared_ptr<model_class> GetModel() const { return m_model; }
/**
* Set the model for this RenderComponent.
* This method allows the component to be set with an existing model instance.
* @param model A shared pointer to the model_class instance to set.
*/
void SetModel(std::shared_ptr<model_class> model) { m_model = model; }
/**
* Get the file path of the model associated with this RenderComponent.
* @return The file path as a string.
*/
const std::string& GetModelFilePath() const { return m_modelFilePath; }
/**
* Set the file path of the model for this RenderComponent.
* This method allows the component to be set with a specific model file path.
* @param path The file path to set as a string.
*/
void SetModelFilePath(const std::string& path) { m_modelFilePath = path; }
/**
* Check if the model is currently visible.
* @return True if the model is visible, false otherwise.
*/
bool IsVisible() const { return m_isVisible; }
/**
* Set the visibility of the model.
* This method allows the component to control whether the model should be rendered or not.
* @param visible True to make the model visible, false to hide it.
*/
void SetVisible(bool visible) { m_isVisible = visible; }
// Acc<63>s aux textures
/**
* Get a texture of a specific type by index.
* This method retrieves the texture from the model based on the specified type and index.
* @param type The type of texture to retrieve (Diffuse, Normal, Specular, Alpha).
* @param index The index of the texture to retrieve (default is 0).
* @return A pointer to the ID3D11ShaderResourceView of the texture, or nullptr if not found.
*/
ID3D11ShaderResourceView* GetTexture(TextureType type, int index = 0) {
if (!m_model) return nullptr;
@@ -104,11 +166,20 @@ public:
}
}
// Pour le rendu
/**
* Get the number of vertices in the model.
* This method retrieves the vertex count from the model.
* @return The number of vertices as an integer.
*/
int GetIndexCount() const {
return m_model ? m_model->GetIndexCount() : 0;
}
/**
* Render the model using the provided device context.
* This method calls the Render method of the model if it is initialized and visible.
* @param deviceContext The Direct3D device context used for rendering.
*/
void Render(ID3D11DeviceContext* deviceContext) {
if (m_model && m_isVisible) {
m_model->Render(deviceContext);