Minor - Implémente le rendu des ombres - V14.6.0
Ajoute la possibilité de rendre une shadow map pour les objets de la scène. Supprime la dépendance de la texture du depth shader et ajoute une option pour caster les ombres sur les RenderComponents. Modifie la taille de la fenêtre dans l'imgui.ini
This commit is contained in:
@@ -224,6 +224,7 @@ public:
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "RenderComponent:HasModel:"
|
||||
<< is_shadow_caster_ << ":"
|
||||
<< diffuse_count << ":" << diffuse_paths_ << ":"
|
||||
<< normal_count << ":" << normal_paths_ << ":"
|
||||
<< specular_count << ":" << specular_paths_ << ":"
|
||||
@@ -252,6 +253,9 @@ public:
|
||||
if (!std::getline(ss, token, ':') || token != "HasModel")
|
||||
R_FALSE
|
||||
|
||||
std::getline(ss,token, ':');
|
||||
is_shadow_caster_ = std::stoi(token);
|
||||
|
||||
int diffuse_count = 0, normal_count = 0, specular_count = 0, alpha_count = 0;
|
||||
|
||||
std::vector<std::wstring> paths_diffuse, paths_normal, paths_specular, paths_alpha;
|
||||
@@ -328,6 +332,7 @@ public:
|
||||
*/
|
||||
void OnImGuiRender() override {
|
||||
ImGui::Checkbox("Visible", &m_isVisible);
|
||||
C_BOX("Is shadow caster" , &is_shadow_caster_);
|
||||
ImGui::Text("Model File Path: %s", m_modelFilePath.c_str());
|
||||
if (m_model) {
|
||||
ImGui::Text("Index Count: %d", m_model->GetIndexCount());
|
||||
@@ -453,6 +458,17 @@ public:
|
||||
void SetTextureContainer(const TextureContainer& texContainer) { texture_container_buffer = texContainer; }
|
||||
const TextureContainer& GetTextureContainerBuffer() const { return texture_container_buffer; }
|
||||
|
||||
/**
|
||||
* Get whether the model casts shadows.
|
||||
* @return True if the model casts shadows, false otherwise.
|
||||
*/
|
||||
bool IsShadowCaster() const { return is_shadow_caster_; }
|
||||
/**
|
||||
* Set whether the model casts shadows.
|
||||
* @param isCaster True to make the model cast shadows, false otherwise.
|
||||
*/
|
||||
void SetShadowCaster(bool isCaster) { is_shadow_caster_ = isCaster; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<model_class> m_model;
|
||||
std::string m_modelFilePath;
|
||||
@@ -460,6 +476,7 @@ private:
|
||||
ID3D11Device* device;
|
||||
ID3D11DeviceContext* context;
|
||||
TextureContainer texture_container_buffer;
|
||||
bool is_shadow_caster_ = true;
|
||||
};
|
||||
|
||||
} // namespace ecs
|
||||
|
||||
Reference in New Issue
Block a user