Khaotic Engine Reborn
|
Public Member Functions | |
RenderComponent () | |
void | Initialize () override |
void | Update (float deltaTime) override |
bool | InitializeWithModel (std::shared_ptr< model_class > model) |
bool | InitializeFromFile (ID3D11Device *device, ID3D11DeviceContext *deviceContext, const char *modelFilename, TextureContainer &textureContainer) |
bool | LoadTexturesFromPath (std::vector< std::wstring > &texturePaths, TextureContainer &texturesContainer, ID3D11Device *device, ID3D11DeviceContext *deviceContext) |
std::shared_ptr< model_class > | GetModel () const |
void | SetModel (std::shared_ptr< model_class > model) |
const std::string & | GetModelFilePath () const |
void | SetModelFilePath (const std::string &path) |
bool | IsVisible () const |
void | SetVisible (bool visible) |
ID3D11ShaderResourceView * | GetTexture (TextureType type, int index=0) |
int | GetIndexCount () const |
void | Render (ID3D11DeviceContext *deviceContext) |
![]() | |
Component (const Component &)=delete | |
Component & | operator= (const Component &)=delete |
Component (Component &&)=default | |
Component & | operator= (Component &&)=default |
Definition at line 29 of file render_component.h.
|
inline |
Builder for the RenderComponent class.
Definition at line 34 of file render_component.h.
|
inline |
Get the number of vertices in the model. This method retrieves the vertex count from the model.
Definition at line 174 of file render_component.h.
|
inline |
Get the model associated with this RenderComponent.
Definition at line 113 of file render_component.h.
|
inline |
Get the file path of the model associated with this RenderComponent.
Definition at line 125 of file render_component.h.
|
inline |
Get a texture of a specific type by index. This method retrieves the texture from the model based on the specified type and index.
type | The type of texture to retrieve (Diffuse, Normal, Specular, Alpha). |
index | The index of the texture to retrieve (default is 0). |
Definition at line 152 of file render_component.h.
|
inlineoverridevirtual |
Virtual function to initialize the component.
Reimplemented from ecs::Component.
Definition at line 37 of file render_component.h.
|
inline |
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.
device | The Direct3D device used for rendering. |
deviceContext | The Direct3D device context used for rendering. |
modelFilename | The path to the model file to load. |
textureContainer | The container for textures used by the model. |
Definition at line 61 of file render_component.h.
|
inline |
Initialize the RenderComponent with a model. This method allows the component to be initialized with an existing model instance.
model | A shared pointer to the model_class instance to use. |
Definition at line 46 of file render_component.h.
|
inline |
Check if the model is currently visible.
Definition at line 137 of file render_component.h.
|
inline |
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.
texturePaths | A vector of file paths to the textures to load. |
texturesContainer | The container where the loaded textures will be stored. |
device | The Direct3D device used for rendering. |
deviceContext | The Direct3D device context used for rendering. |
Definition at line 91 of file render_component.h.
|
inline |
Render the model using the provided device context. This method calls the Render method of the model if it is initialized and visible.
deviceContext | The Direct3D device context used for rendering. |
Definition at line 183 of file render_component.h.
|
inline |
Set the model for this RenderComponent. This method allows the component to be set with an existing model instance.
model | A shared pointer to the model_class instance to set. |
Definition at line 119 of file render_component.h.
|
inline |
Set the file path of the model for this RenderComponent. This method allows the component to be set with a specific model file path.
path | The file path to set as a string. |
Definition at line 131 of file render_component.h.
|
inline |
Set the visibility of the model. This method allows the component to control whether the model should be rendered or not.
visible | True to make the model visible, false to hide it. |
Definition at line 143 of file render_component.h.
|
inlineoverridevirtual |
Virtual function to update the component.
deltaTime | Time since the last update. |
Reimplemented from ecs::Component.
Definition at line 38 of file render_component.h.