Skip to content

Commit

Permalink
Fix heightmap errors
Browse files Browse the repository at this point in the history
Add missing listener redirections

Signed-off-by: Matias N. Goldberg <[email protected]>
  • Loading branch information
darksylinc committed Mar 5, 2022
1 parent 9630aa7 commit 345336f
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ogre2/src/Ogre2IgnHlmsPbsPrivate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,39 @@ namespace Ogre
this->customizations.push_back(terraShadows);
}

/////////////////////////////////////////////////
uint16 Ogre2IgnHlmsPbs::getNumExtraPassTextures(
const HlmsPropertyVec &_properties, bool _casterPass) const
{
uint16 numExtraTextures = 0u;

// Allow additional listener-only customizations to inject their stuff
for (Ogre::HlmsListener *listener : this->customizations)
{
numExtraTextures +=
listener->getNumExtraPassTextures(_properties, _casterPass);
}

return numExtraTextures;
}

/////////////////////////////////////////////////
void Ogre2IgnHlmsPbs::propertiesMergedPreGenerationStep(
Hlms *_hlms, const HlmsCache &_passCache,
const HlmsPropertyVec &_renderableCacheProperties,
const PiecesMap _renderableCachePieces[NumShaderTypes],
const HlmsPropertyVec &_properties,
const QueuedRenderable &_queuedRenderable)
{
// Allow additional listener-only customizations to inject their stuff
for (Ogre::HlmsListener *listener : this->customizations)
{
listener->propertiesMergedPreGenerationStep(
_hlms, _passCache, _renderableCacheProperties, _renderableCachePieces,
_properties, _queuedRenderable);
}
}

/////////////////////////////////////////////////
void Ogre2IgnHlmsPbs::preparePassHash(const CompositorShadowNode *_shadowNode,
bool _casterPass, bool _dualParaboloid,
Expand Down
28 changes: 28 additions & 0 deletions ogre2/src/Ogre2IgnHlmsPbsPrivate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,34 @@ namespace Ogre
/// \brief Destructor. Virtual to silence warnings
public: virtual ~Ogre2IgnHlmsPbs() override = default;

/// \brief Override so listeners can inform Hlms the number of
/// extra textures they need to make room for.
///
/// \remarks We cannot read 'this' state. All state data
/// must come from _properties. Otherwise we can't use
/// HlmsDiskCache
///
/// \param[in] _properties Properties to read state from
/// \param[in] _casterPass Whether this is a caster pass
public: virtual uint16 getNumExtraPassTextures(
const HlmsPropertyVec &_properties, bool _casterPass) const override;

/// \brief Override so listeners can set extra properties after
/// a renderable is assigned an HlmsDatablock
///
/// \param[in, out] _hlms Hlms to modify
/// \param[in] _passCache Current properties at pass level
/// \param[in] _renderableCacheProperties properties at renderable level
/// \param[in] _renderableCachePieces Custom pieces for this renderable
/// \param[in] _properties Properties defined so far (amalgamated)
/// \param[in] _queuedRenderable Renderable being affected
public: virtual void propertiesMergedPreGenerationStep(
Hlms *_hlms, const HlmsCache &_passCache,
const HlmsPropertyVec &_renderableCacheProperties,
const PiecesMap _renderableCachePieces[NumShaderTypes],
const HlmsPropertyVec &_properties,
const QueuedRenderable &_queuedRenderable);

// Documentation inherited
public: using HlmsPbs::preparePassHash;

Expand Down
33 changes: 33 additions & 0 deletions ogre2/src/Ogre2IgnHlmsTerraPrivate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,39 @@ namespace Ogre
this->customizations.push_back(_sphericalClipMinDistance);
}

/////////////////////////////////////////////////
uint16 Ogre2IgnHlmsTerra::getNumExtraPassTextures(
const HlmsPropertyVec &_properties, bool _casterPass) const
{
uint16 numExtraTextures = 0u;

// Allow additional listener-only customizations to inject their stuff
for (Ogre::HlmsListener *listener : this->customizations)
{
numExtraTextures +=
listener->getNumExtraPassTextures(_properties, _casterPass);
}

return numExtraTextures;
}

/////////////////////////////////////////////////
void Ogre2IgnHlmsTerra::propertiesMergedPreGenerationStep(
Hlms *_hlms, const HlmsCache &_passCache,
const HlmsPropertyVec &_renderableCacheProperties,
const PiecesMap _renderableCachePieces[NumShaderTypes],
const HlmsPropertyVec &_properties,
const QueuedRenderable &_queuedRenderable)
{
// Allow additional listener-only customizations to inject their stuff
for (Ogre::HlmsListener *listener : this->customizations)
{
listener->propertiesMergedPreGenerationStep(
_hlms, _passCache, _renderableCacheProperties, _renderableCachePieces,
_properties, _queuedRenderable);
}
}

/////////////////////////////////////////////////
void Ogre2IgnHlmsTerra::preparePassHash(
const CompositorShadowNode *_shadowNode, bool _casterPass,
Expand Down
28 changes: 28 additions & 0 deletions ogre2/src/Ogre2IgnHlmsTerraPrivate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,34 @@ namespace Ogre
/// \brief Destructor. Virtual to silence warnings
public: virtual ~Ogre2IgnHlmsTerra() override = default;

/// \brief Override so listeners can inform Hlms the number of
/// extra textures they need to make room for.
///
/// \remarks We cannot read 'this' state. All state data
/// must come from _properties. Otherwise we can't use
/// HlmsDiskCache
///
/// \param[in] _properties Properties to read state from
/// \param[in] _casterPass Whether this is a caster pass
public: virtual uint16 getNumExtraPassTextures(
const HlmsPropertyVec &_properties, bool _casterPass) const override;

/// \brief Override so listeners can set extra properties after
/// a renderable is assigned an HlmsDatablock
///
/// \param[in, out] _hlms Hlms to modify
/// \param[in] _passCache Current properties at pass level
/// \param[in] _renderableCacheProperties properties at renderable level
/// \param[in] _renderableCachePieces Custom pieces for this renderable
/// \param[in] _properties Properties defined so far (amalgamated)
/// \param[in] _queuedRenderable Renderable being affected
public: virtual void propertiesMergedPreGenerationStep(
Hlms *_hlms, const HlmsCache &_passCache,
const HlmsPropertyVec &_renderableCacheProperties,
const PiecesMap _renderableCachePieces[NumShaderTypes],
const HlmsPropertyVec &_properties,
const QueuedRenderable &_queuedRenderable);

// Documentation inherited
public: using HlmsTerra::preparePassHash;

Expand Down
33 changes: 33 additions & 0 deletions ogre2/src/Ogre2IgnHlmsUnlitPrivate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,39 @@ namespace Ogre
this->customizations.push_back(_sphericalClipMinDistance);
}

/////////////////////////////////////////////////
uint16 Ogre2IgnHlmsUnlit::getNumExtraPassTextures(
const HlmsPropertyVec &_properties, bool _casterPass) const
{
uint16 numExtraTextures = 0u;

// Allow additional listener-only customizations to inject their stuff
for (Ogre::HlmsListener *listener : this->customizations)
{
numExtraTextures +=
listener->getNumExtraPassTextures(_properties, _casterPass);
}

return numExtraTextures;
}

/////////////////////////////////////////////////
void Ogre2IgnHlmsUnlit::propertiesMergedPreGenerationStep(
Hlms *_hlms, const HlmsCache &_passCache,
const HlmsPropertyVec &_renderableCacheProperties,
const PiecesMap _renderableCachePieces[NumShaderTypes],
const HlmsPropertyVec &_properties,
const QueuedRenderable &_queuedRenderable)
{
// Allow additional listener-only customizations to inject their stuff
for (Ogre::HlmsListener *listener : this->customizations)
{
listener->propertiesMergedPreGenerationStep(
_hlms, _passCache, _renderableCacheProperties, _renderableCachePieces,
_properties, _queuedRenderable);
}
}

/////////////////////////////////////////////////
void Ogre2IgnHlmsUnlit::preparePassHash(
const CompositorShadowNode *_shadowNode, bool _casterPass,
Expand Down
28 changes: 28 additions & 0 deletions ogre2/src/Ogre2IgnHlmsUnlitPrivate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,34 @@ namespace Ogre
/// \brief Destructor. Virtual to silence warnings
public: virtual ~Ogre2IgnHlmsUnlit() override = default;

/// \brief Override so listeners can inform Hlms the number of
/// extra textures they need to make room for.
///
/// \remarks We cannot read 'this' state. All state data
/// must come from _properties. Otherwise we can't use
/// HlmsDiskCache
///
/// \param[in] _properties Properties to read state from
/// \param[in] _casterPass Whether this is a caster pass
public: virtual uint16 getNumExtraPassTextures(
const HlmsPropertyVec &_properties, bool _casterPass) const override;

/// \brief Override so listeners can set extra properties after
/// a renderable is assigned an HlmsDatablock
///
/// \param[in, out] _hlms Hlms to modify
/// \param[in] _passCache Current properties at pass level
/// \param[in] _renderableCacheProperties properties at renderable level
/// \param[in] _renderableCachePieces Custom pieces for this renderable
/// \param[in] _properties Properties defined so far (amalgamated)
/// \param[in] _queuedRenderable Renderable being affected
public: virtual void propertiesMergedPreGenerationStep(
Hlms *_hlms, const HlmsCache &_passCache,
const HlmsPropertyVec &_renderableCacheProperties,
const PiecesMap _renderableCachePieces[NumShaderTypes],
const HlmsPropertyVec &_properties,
const QueuedRenderable &_queuedRenderable);

// Documentation inherited
public: using HlmsUnlit::preparePassHash;

Expand Down

0 comments on commit 345336f

Please sign in to comment.