Added EffectFactory method EnableLighting

This commit is contained in:
Chuck Walbourn 2022-11-05 01:07:48 -07:00
Родитель 0d9a1f09f0
Коммит acb881220d
2 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -871,6 +871,8 @@ namespace DirectX
void __cdecl SetSharing(bool enabled) noexcept;
void __cdecl EnableLighting(bool enabled) noexcept;
void __cdecl EnablePerPixelLighting(bool enabled) noexcept;
void __cdecl EnableNormalMapEffect(bool enabled) noexcept;

Просмотреть файл

@ -63,6 +63,7 @@ public:
, mSamplerDescriptors(nullptr)
, mSharing(true)
, mUseNormalMapEffect(true)
, mEnableLighting(true)
, mEnablePerPixelLighting(true)
, mEnableFog(false)
, mEnableInstancing(false)
@ -89,6 +90,7 @@ public:
bool mSharing;
bool mUseNormalMapEffect;
bool mEnableLighting;
bool mEnablePerPixelLighting;
bool mEnableFog;
bool mEnableInstancing;
@ -336,7 +338,7 @@ std::shared_ptr<IEffect> EffectFactory::Impl::CreateEffect(
else if (info.enableNormalMaps && mUseNormalMapEffect)
{
// NormalMapEffect
int effectflags = EffectFlags::None;
int effectflags = EffectFlags::PerPixelLighting;
if (mEnableFog)
{
@ -408,7 +410,12 @@ std::shared_ptr<IEffect> EffectFactory::Impl::CreateEffect(
else
{
// set effect flags for creation
int effectflags = (mEnablePerPixelLighting) ? EffectFlags::PerPixelLighting : EffectFlags::Lighting;
int effectflags = EffectFlags::None;
if (mEnableLighting)
{
effectflags = (mEnablePerPixelLighting) ? EffectFlags::PerPixelLighting : EffectFlags::Lighting;
}
if (mEnableFog)
{
@ -556,6 +563,11 @@ void EffectFactory::SetSharing(bool enabled) noexcept
pImpl->mSharing = enabled;
}
void EffectFactory::EnableLighting(bool enabled) noexcept
{
pImpl->mEnableLighting = enabled;
}
void EffectFactory::EnablePerPixelLighting(bool enabled) noexcept
{
pImpl->mEnablePerPixelLighting = enabled;