##

EditorMaterialSwitcher.hh
Go to the documentation of this file.
/*
* Copyright (C) 2015 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 GAZEBO_GUI_MODEL_EDITORMATERIALSWITCHER_HH_
#define GAZEBO_GUI_MODEL_EDITORMATERIALSWITCHER_HH_
#include <string>
#include "gazebo/rendering/ogre_gazebo.h"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace gui
{
// forward declarations
class EditorMaterialListener;
class EditorRenderTargetListener;
// typedefs that are used only in this class
using EditorRenderTargetListenerPtr =
std::shared_ptr<EditorRenderTargetListener>;
using EditorMaterialListenerPtr =
std::shared_ptr<EditorMaterialListener>;
class GZ_GUI_VISIBLE EditorMaterialSwitcher
{
public: explicit EditorMaterialSwitcher(
const rendering::CameraPtr &_camera);
public: ~EditorMaterialSwitcher() = default;
public: void SetMaterialScheme(const std::string &_scheme);
public: std::string MaterialScheme() const;
private: EditorRenderTargetListenerPtr renderTargetListener;
private: EditorMaterialListenerPtr materialListener;
private: rendering::CameraPtr camera;
private: std::string originalMaterialScheme;
private: std::string materialScheme;
};
class EditorRenderTargetListener : public Ogre::RenderTargetListener
{
public: explicit EditorRenderTargetListener(
const EditorMaterialListenerPtr &_switcher);
public: ~EditorRenderTargetListener() = default;
public: virtual void preRenderTargetUpdate(
const Ogre::RenderTargetEvent &_evt);
public: virtual void postRenderTargetUpdate(
const Ogre::RenderTargetEvent &_evt);
private: EditorMaterialListenerPtr materialListener;
};
class EditorMaterialListener : public Ogre::MaterialManager::Listener
{
public: explicit EditorMaterialListener(
const rendering::CameraPtr &_camera);
public: ~EditorMaterialListener() = default;
public: virtual Ogre::Technique *handleSchemeNotFound(
uint16_t _schemeIndex, const Ogre::String &_schemeName,
Ogre::Material *_originalMaterial, uint16_t _lodIndex,
const Ogre::Renderable *_rend);
private: rendering::CameraPtr camera;
};
}
}
#endif
gazebo::gui::EditorMaterialListener::~EditorMaterialListener
~EditorMaterialListener()=default
Destructor.
gazebo::gui::EditorMaterialListenerPtr
std::shared_ptr< EditorMaterialListener > EditorMaterialListenerPtr
Definition: EditorMaterialSwitcher.hh:37
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
system.hh
gazebo::gui::EditorRenderTargetListener::~EditorRenderTargetListener
~EditorRenderTargetListener()=default
Destructor.
gazebo::gui::EditorMaterialListener::handleSchemeNotFound
virtual Ogre::Technique * handleSchemeNotFound(uint16_t _schemeIndex, const Ogre::String &_schemeName, Ogre::Material *_originalMaterial, uint16_t _lodIndex, const Ogre::Renderable *_rend)
Ogre callback that is used to specify the material to use when the requested scheme is not found.
gazebo::gui::EditorRenderTargetListener
Ogre render target listener.
Definition: EditorMaterialSwitcher.hh:82
gazebo::gui::EditorMaterialListener
Ogre material listener.
Definition: EditorMaterialSwitcher.hh:111
gazebo::gui::EditorMaterialSwitcher::MaterialScheme
std::string MaterialScheme() const
Get the material scheme applied to the models in the editor.
gazebo::gui::EditorRenderTargetListener::EditorRenderTargetListener
EditorRenderTargetListener(const EditorMaterialListenerPtr &_switcher)
Constructor.
gazebo::gui::EditorMaterialListener::EditorMaterialListener
EditorMaterialListener(const rendering::CameraPtr &_camera)
Constructor.
gazebo::gui::EditorMaterialSwitcher::SetMaterialScheme
void SetMaterialScheme(const std::string &_scheme)
Set the material scheme that will be applied to the models in the editor.
ogre_gazebo.h
gazebo::gui::EditorMaterialSwitcher
Material switcher for the model editor used to toggle the material of the model.
Definition: EditorMaterialSwitcher.hh:42
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::EditorMaterialSwitcher::EditorMaterialSwitcher
EditorMaterialSwitcher(const rendering::CameraPtr &_camera)
Constructor.
gazebo::gui::EditorMaterialSwitcher::~EditorMaterialSwitcher
~EditorMaterialSwitcher()=default
Destructor.
gazebo::rendering::CameraPtr
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:90
gazebo::gui::EditorRenderTargetListenerPtr
std::shared_ptr< EditorRenderTargetListener > EditorRenderTargetListenerPtr
Definition: EditorMaterialSwitcher.hh:35
gazebo::gui::EditorRenderTargetListener::preRenderTargetUpdate
virtual void preRenderTargetUpdate(const Ogre::RenderTargetEvent &_evt)
Ogre's pre-render update callback.
gazebo::gui::EditorRenderTargetListener::postRenderTargetUpdate
virtual void postRenderTargetUpdate(const Ogre::RenderTargetEvent &_evt)
Ogre's post-render update callback.