Skip to content

Commit

Permalink
Merge pull request #595 from dlyr/geom-quad-mesh
Browse files Browse the repository at this point in the history
First step of QuadMesh 
Remaining steps: #589
  • Loading branch information
nmellado authored Jul 23, 2020
2 parents 5ffea81 + bde3a17 commit e511722
Show file tree
Hide file tree
Showing 31 changed files with 665 additions and 347 deletions.
1 change: 1 addition & 0 deletions cmake/filelistEngine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ set( engine_headers

set( engine_inlines
Component/Component.inl
Component/GeometryComponent.inl
Entity/Entity.inl
ItemModel/ItemEntry.inl
Managers/ComponentMessenger/ComponentMessenger.inl
Expand Down
10 changes: 8 additions & 2 deletions doc/developer/mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See inheritance diagram of Ra::Core::Geometry::AbstractGeometry :
- Ra::Core::Geometry::IndexedPointCloud *
- Ra::Core::Geometry::LineMesh *
- Ra::Core::Geometry::TriangleMesh *
- Ra::Core::Geometry::PolyMesh *

2. Ra::Core::Geometry::TopologicalMesh, which is an half-edge data structure.
A converter allows to go back and forth to `TriangleMesh`
Expand All @@ -32,6 +33,7 @@ See inheritance digram of Ra::Engine::AttribArrayDisplayable
- Ra::Engine::IndexedAttribArrayDisplayable
- Ra::Engine::LineMesh *
- Ra::Engine::Mesh *
- Ra::Engine::PolyMesh *

`*` : the starred classes are the one you want to instanciate, the other are more for code factoring or abstraction.

Expand Down Expand Up @@ -74,6 +76,9 @@ In order to copy some/all of the attributes, the dedicated methods must be used.
Attribute writes must be with "lock" to ensure data syncronisation.
Utility methods are provided for position and normals :

- Ra::Core::Geometry::IndexedGeometry::setIndices
- Ra::Core::Geometry::IndexedGeometry::getIndicesWithLock
- Ra::Core::Geometry::IndexedGeometry::indicesUnlock
- Ra::Core::Geometry::AttribArrayGeometry::setVertices
- Ra::Core::Geometry::AttribArrayGeometry::verticesWithLock
- Ra::Core::Geometry::AttribArrayGeometry::verticesUnlock
Expand Down Expand Up @@ -105,8 +110,9 @@ normals.push_back( {0, 0, 1} );
m.setVertices( std::move( vertices ) );
m.setNormals( std::move( normals ) );
m.m_indices.push_back( {0, 1, 2} );
m.setIndices( {0, 1, 2} );
auto handle1 = m.addAttrib<Vector3>( "vector3_attrib" );
auto& attrib1 = m.getAttrib( handle1 );
auto& buf = attrib1.getDataWithLock();
Expand Down
14 changes: 8 additions & 6 deletions scripts/install-scripts-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ if file_or_link "${ROOT}/.git/hooks/pre-commit" ; then
else
echo "pre-commit hook already present, please remove .git/hooks/pre-commit";
fi
if file_or_link "${ROOT}/.clang-format" ; then
echo "create symlink for clang-format style file";
ln -rs "${ROOT}/scripts/clang-format" "${ROOT}/.clang-format"
else
echo "clang-format link already present, please remove .clang-format";
fi

# now .clang-format is in git repo for auto formatiing
#if file_or_link "${ROOT}/.clang-format" ; then
# echo "create symlink for clang-format style file";
# ln -rs "${ROOT}/scripts/clang-format" "${ROOT}/.clang-format"
#else
# echo "clang-format link already present, please remove .clang-format";
#fi
13 changes: 8 additions & 5 deletions src/Core/Asset/GeometryData.inl
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ namespace internal {

template <typename InContainer, typename OutContainer>
inline void copyData( const InContainer& input, OutContainer& output ) {
std::transform(
std::begin( input ), std::end( input ), std::back_inserter( output ), [
]( const typename InContainer::value_type& v ) -> typename OutContainer::value_type {
return v.template cast<Scalar>();
} );
using OutValueType = typename OutContainer::value_type;
using OutScalarType = typename OutValueType::Scalar;
std::transform( std::begin( input ),
std::end( input ),
std::back_inserter( output ),
[]( const typename InContainer::value_type& v ) -> OutValueType {
return v.template cast<OutScalarType>();
} );
}

} // namespace internal
Expand Down
Loading

0 comments on commit e511722

Please sign in to comment.