-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previous PR #752 added LensFlarePass to ogre2. This PR adds LensFlarePass to ogre1. This includes LensFlarePass support for ogre1's WideAngleCamera. WideAngleCamera had to be modified a little to support RenderPass at all. In theory the gaussian filter pass should also work with WideAngleCamera but I did not test it. It also implements OgreWideAngleCamera::Copy so that integration tests can function (Ogre2WideAngleCamera::Copy had already been implemented). OgreRayQuery also had to be modified to support OgreWideAngleCamera; since LensFlares need ray queries for occlusion support. Additionally I add RemoveAllRenderPasses since I noticed a lot of RenderPasses didn't get to properly deinitialize. Though it didn't seem like much harm was being done because currently all RenderPasses are very simple. Signed-off-by: Matias N. Goldberg <[email protected]>
- Loading branch information
1 parent
93090c5
commit 73a4ff4
Showing
43 changed files
with
1,748 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (C) 2022 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
#ifndef GZ_RENDERING_OGRE_OGRELENSFLAREPASS_HH_ | ||
#define GZ_RENDERING_OGRE_OGRELENSFLAREPASS_HH_ | ||
|
||
#include <memory> | ||
|
||
#include <gz/utils/ImplPtr.hh> | ||
|
||
#include "gz/math/Vector3.hh" | ||
|
||
#include "gz/rendering/base/BaseLensFlarePass.hh" | ||
#include "gz/rendering/ogre/Export.hh" | ||
#include "gz/rendering/ogre/OgreRenderPass.hh" | ||
|
||
namespace gz | ||
{ | ||
namespace rendering | ||
{ | ||
inline namespace GZ_RENDERING_VERSION_NAMESPACE { | ||
|
||
/// \brief Ogre Implementation of a Lens Flare render pass. | ||
class GZ_RENDERING_OGRE_VISIBLE OgreLensFlarePass : | ||
public BaseLensFlarePass<OgreRenderPass> | ||
{ | ||
/// \brief Constructor | ||
public: OgreLensFlarePass(); | ||
|
||
/// \brief Destructor | ||
public: ~OgreLensFlarePass() override; | ||
|
||
// Documentation inherited | ||
public: void Init(ScenePtr _scene) override; | ||
|
||
// Documentation inherited | ||
public: void Destroy() override; | ||
|
||
// Documentation inherited | ||
public: void CreateRenderPass() override; | ||
|
||
// Documentation inherited | ||
public: void PreRender(const CameraPtr &_camera) override; | ||
|
||
// Documentation inherited | ||
public: void PostRender() override; | ||
|
||
// Documentation inherited | ||
public: void SetScale(double _scale) override; | ||
|
||
// Documentation inherited | ||
public: double Scale() const override; | ||
|
||
// Documentation inherited | ||
public: void SetColor(const math::Vector3d &_color) override; | ||
|
||
// Documentation inherited | ||
public: const math::Vector3d &Color() const override; | ||
|
||
// Documentation inherited | ||
public: void SetOcclusionSteps(uint32_t _occlusionSteps) override; | ||
|
||
// Documentation inherited | ||
public: uint32_t OcclusionSteps() const override; | ||
|
||
/// \brief Check to see if the lens flare is occluded and return a scaling | ||
/// factor that is proportional to the lens flare's visibility | ||
/// \remark OgreLensFlarePass::PreRender must have been called first. | ||
/// \param[in] _imgPos light pos in clip space | ||
/// \param[in] _faceIdx Face idx in range [0; 6) | ||
/// See RayQuery::SetFromCamera for what each value means | ||
/// This value is ignored if the camera is not WideAngleCamera | ||
private: double OcclusionScale(const math::Vector3d &_imgPos, | ||
uint32_t _faceIdx); | ||
|
||
/// \cond warning | ||
/// \brief Private data pointer | ||
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr) | ||
/// \endcond | ||
|
||
private: friend class OgreLensFlareCompositorListenerPrivate; | ||
}; | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.