/usr/include/SurgSim/Graphics/Mesh.h is in libopensurgsim-dev 0.7.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | // This file is a part of the OpenSurgSim project.
// Copyright 2013, 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_MESH_H
#define SURGSIM_GRAPHICS_MESH_H
#include <vector>
#include "SurgSim/DataStructures/EmptyData.h"
#include "SurgSim/DataStructures/TriangleMesh.h"
#include "SurgSim/DataStructures/OptionalValue.h"
#include "SurgSim/Math/Vector.h"
namespace SurgSim
{
namespace Graphics
{
struct VertexData
{
SurgSim::DataStructures::OptionalValue<SurgSim::Math::Vector2d> texture;
SurgSim::DataStructures::OptionalValue<SurgSim::Math::Vector4d> color;
/// Equality operator.
/// \param rhs The right hand side.
/// \return true if the parameters are considered equivalent.
bool operator==(const SurgSim::Graphics::VertexData& rhs) const
{
return texture == rhs.texture &&
color == rhs.color;
}
/// Inequality operator.
/// \param rhs The right hand side.
/// \return true if the parameters are not considered equivalent.
bool operator!=(const SurgSim::Graphics::VertexData& rhs) const
{
return !((*this) == rhs);
}
};
SURGSIM_STATIC_REGISTRATION(Mesh);
class Mesh : public SurgSim::DataStructures::TriangleMesh<VertexData, SurgSim::DataStructures::EmptyData,
SurgSim::DataStructures::EmptyData>
{
public:
/// Default constructor
Mesh();
typedef TriangleMesh<VertexData, DataStructures::EmptyData, DataStructures::EmptyData> BaseType;
/// Copy constructor when the template data is a different type
/// \tparam V Type of extra data stored in each vertex
/// \tparam E Type of extra data stored in each edge
/// \tparam T Type of extra data stored in each triangle
/// \param other The mesh to be copied from. Vertex, edge and triangle data will not be copied
/// \note: Data of the input mesh, i.e. VertexDataSource, EdgeDataSource and TrianleDataSource will not be copied.
template <class V, class E, class T>
explicit Mesh(const TriangleMesh<V, E, T>& other);
/// Copy Constructor
/// \param other Constructor source
Mesh(const Mesh& other);
/// Move Constructor
/// \param other Constructor source
Mesh(Mesh&& other);
/// Copy Assignment
/// \param other Assignment source
Mesh& operator=(const Mesh& other);
/// Move Assignment
/// \param other Assignment source
Mesh& operator=(Mesh&& other);
/// Utility function to initialize a mesh with plain data,
/// \param vertices An array of vertex coordinates.
/// \param colors The colors, the number of colors can be 0 or
/// there have to be at least as many colors as vertices.
/// \param textures The textures coordinates, the number of coordinates can be 0 or
/// there have to be at least as many texture coordinates as there are vertices.
/// \param triangles The triangles, a plain array of triplets of triangle indices, the indices should be
/// points in the vertices array.
void initialize(const std::vector<SurgSim::Math::Vector3d>& vertices,
const std::vector<SurgSim::Math::Vector4d>& colors,
const std::vector<SurgSim::Math::Vector2d>& textures,
const std::vector<size_t>& triangles);
/// Increase the update count, this indicates that the mesh has been changed, if used in a mesh representation
/// the mesh representation will still only update the data members that have been marked for updating
void dirty();
/// Return the update count, please note that it will silently roll over when the range of size_t has been exceeded
size_t getUpdateCount() const;
protected:
bool doLoad(const std::string& fileName) override;
/// For checking whether the mesh has changed
size_t m_updateCount;
};
}; // Graphics
}; // SurgSim
#include "SurgSim/Graphics/Mesh-inl.h"
#endif // SURGSIM_GRAPHICS_MESH_H
|