OsgPointCloudRepresentation.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_OSGPOINTCLOUDREPRESENTATION_H
#define SURGSIM_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H
#include <osg/Array>
#include <osg/Geometry>
#include <osg/Point>
#include "SurgSim/Framework/Macros.h"
#include "SurgSim/Framework/ObjectFactory.h"
#include "SurgSim/Graphics/PointCloudRepresentation.h"
#include "SurgSim/Graphics/OsgRepresentation.h"
namespace SurgSim
{
namespace DataStructures
{
class EmptyData;
template<class Data>
class Vertices;
}
namespace Graphics
{
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#endif
SURGSIM_STATIC_REGISTRATION(OsgPointCloudRepresentation);
class OsgPointCloudRepresentation : public PointCloudRepresentation, public OsgRepresentation
{
public:
explicit OsgPointCloudRepresentation(const std::string& name);
~OsgPointCloudRepresentation();
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgPointCloudRepresentation);
std::shared_ptr<PointCloud> getVertices() const override;
void setPointSize(double val) override;
double getPointSize() const override;
void doUpdate(double dt) override;
void setColor(const SurgSim::Math::Vector4d& color) override;
SurgSim::Math::Vector4d getColor() const override;
private:
std::shared_ptr<PointCloud> m_vertices;
osg::ref_ptr<osg::Vec3Array> m_vertexData;
osg::ref_ptr<osg::Geometry> m_geometry;
osg::ref_ptr<osg::DrawArrays> m_drawArrays;
osg::ref_ptr<osg::Point> m_point;
SurgSim::Math::Vector4d m_color;
void updateGeometry(const DataStructures::VerticesPlain& vertices);
};
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}; // Graphics
}; // SurgSim
#endif // SURGSIM_GRAPHICS_OSGPOINTCLOUDREPRESENTATION_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::OsgPointCloudRepresentation
Osg point cloud representation, implementation of a PointCloudRepresenation using OSG...
Definition: OsgPointCloudRepresentation.h:48
SurgSim::Graphics::PointCloudRepresentation
Graphic representation of a point cloud, hase a very basic interface and is intentionally kept generi...
Definition: PointCloudRepresentation.h:36
PointCloudRepresentation.h
ObjectFactory.h
SurgSim::Graphics::OsgPointCloudRepresentation::m_geometry
osg::ref_ptr< osg::Geometry > m_geometry
OSG Geometry node holding the data.
Definition: OsgPointCloudRepresentation.h:81
SurgSim::Graphics::OsgPointCloudRepresentation::m_vertexData
osg::ref_ptr< osg::Vec3Array > m_vertexData
OSG vertex data for updating.
Definition: OsgPointCloudRepresentation.h:78
SurgSim::Graphics::OsgPointCloudRepresentation::m_drawArrays
osg::ref_ptr< osg::DrawArrays > m_drawArrays
OSG DrawArrays for local operations.
Definition: OsgPointCloudRepresentation.h:84
SURGSIM_CLASSNAME
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
Macros.h
SurgSim::Graphics::OsgPointCloudRepresentation::m_color
SurgSim::Math::Vector4d m_color
Color backing variable.
Definition: OsgPointCloudRepresentation.h:90
OsgRepresentation.h
SurgSim::Math::Vector4d
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:61
SurgSim::Graphics::OsgRepresentation
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:55
SurgSim::Graphics::OsgPointCloudRepresentation::m_point
osg::ref_ptr< osg::Point > m_point
OSG::Point for local operations.
Definition: OsgPointCloudRepresentation.h:87
SurgSim::DataStructures::Vertices
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:51
SurgSim::Graphics::OsgPointCloudRepresentation::m_vertices
std::shared_ptr< PointCloud > m_vertices
Local pointer to vertices with data.
Definition: OsgPointCloudRepresentation.h:75