Representation.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2016, SimQuest Solutions Inc.
//
// 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 SURGSIM_GRAPHICS_REPRESENTATION_H
#define SURGSIM_GRAPHICS_REPRESENTATION_H
#include "SurgSim/Framework/Representation.h"
#include "SurgSim/Math/RigidTransform.h"
#include <unordered_set>
namespace SurgSim
{
namespace Graphics
{
class Manager;
class Material;
class Representation : public SurgSim::Framework::Representation
{
public:
static const std::string DefaultGroupName;
static const std::string DefaultHudGroupName;
explicit Representation(const std::string& name);
virtual ~Representation();
virtual bool setMaterial(std::shared_ptr<SurgSim::Framework::Component> material) = 0;
virtual std::shared_ptr<Material> getMaterial() const = 0;
virtual void clearMaterial() = 0;
virtual void setDrawAsWireFrame(bool val) = 0;
virtual bool getDrawAsWireFrame() const = 0;
virtual void setGenerateTangents(bool value) = 0;
virtual bool isGeneratingTangents() const = 0;
virtual void update(double dt) = 0;
virtual bool addGroupReference(const std::string& name);
void addGroupReferences(const std::vector<std::string>& groups);
void setGroupReferences(const std::vector<std::string>& groups);
void setGroupReference(const std::string& group);
std::vector<std::string> getGroupReferences() const;
bool removeGroupReference(const std::string& group);
void clearGroupReferences();
private:
std::unordered_set<std::string> m_groups;
bool checkAwake(const std::string& functionName);
};
}; // namespace Graphics
}; // namespace SurgSim
#endif // SURGSIM_GRAPHICS_REPRESENTATION_H
SurgSim::Graphics::Representation::~Representation
virtual ~Representation()
Destructor.
Definition: Representation.cpp:120
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::Representation::Representation
Representation(const std::string &name)
Constructor.
Definition: Representation.cpp:30
SurgSim::Graphics::Representation::m_groups
std::unordered_set< std::string > m_groups
List of groups that this representation would like to be added.
Definition: Representation.h:118
SurgSim::Graphics::Representation::setGroupReference
void setGroupReference(const std::string &group)
Helper functions, this clears all the references and sets, only the reference given in the parameter...
Definition: Representation.cpp:100
SurgSim::Graphics::Representation::clearGroupReferences
void clearGroupReferences()
Clear all the Group references.
Definition: Representation.cpp:82
SurgSim::Graphics::Representation::checkAwake
bool checkAwake(const std::string &functionName)
Check if the representation is awake and print a warning message if it is.
Definition: Representation.cpp:109
SurgSim::Graphics::Representation::getMaterial
virtual std::shared_ptr< Material > getMaterial() const =0
Gets the material that defines the visual appearance of the representation.
SurgSim::Graphics::Representation::DefaultHudGroupName
static const std::string DefaultHudGroupName
Definition: Representation.h:44
Representation.h
SurgSim::Graphics::Representation::setDrawAsWireFrame
virtual void setDrawAsWireFrame(bool val)=0
Sets the representation to render as a wire frame.
SurgSim::Graphics::Representation::getDrawAsWireFrame
virtual bool getDrawAsWireFrame() const =0
Return if the representation is rendered as a wire frame.
SurgSim::Graphics::Representation
Base graphics representation class, which defines the interface that all graphics representations mus...
Definition: Representation.h:39
SurgSim::Graphics::Representation::getGroupReferences
std::vector< std::string > getGroupReferences() const
Gets group references.
Definition: Representation.cpp:77
RigidTransform.h
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
SurgSim::Graphics::Representation::setGenerateTangents
virtual void setGenerateTangents(bool value)=0
Enable or disable the generation of tangents.
SurgSim::Graphics::Representation::addGroupReferences
void addGroupReferences(const std::vector< std::string > &groups)
Adds a list of group references.
Definition: Representation.cpp:54
SurgSim::Graphics::Representation::setMaterial
virtual bool setMaterial(std::shared_ptr< SurgSim::Framework::Component > material)=0
Sets the material that defines the visual appearance of the representation.
SurgSim::Graphics::Representation::DefaultGroupName
static const std::string DefaultGroupName
Definition: Representation.h:43
SurgSim::Graphics::Representation::update
virtual void update(double dt)=0
Updates the representation.
SurgSim::Graphics::Representation::addGroupReference
virtual bool addGroupReference(const std::string &name)
Add a reference to a group, this will eventual add this representation to the group with the the same...
Definition: Representation.cpp:43
SurgSim::Framework::Representation
Representations are manifestations of a SceneElement.
Definition: Representation.h:33
SurgSim::Graphics::Representation::clearMaterial
virtual void clearMaterial()=0
Removes the material from the representation.
SurgSim::Graphics::Representation::isGeneratingTangents
virtual bool isGeneratingTangents() const =0
SurgSim::Graphics::Representation::setGroupReferences
void setGroupReferences(const std::vector< std::string > &groups)
Sets the list of group references.
Definition: Representation.cpp:65
SurgSim::Graphics::Representation::removeGroupReference
bool removeGroupReference(const std::string &group)
Function to remove an unwanted reference.
Definition: Representation.cpp:90