@ -133,28 +133,25 @@ MeshData::MeshData(const MeshPrimitive primitive, Containers::Array<char>&& inde
" Trade::MeshData: attribute " < < i < < " has " < < attribute . _vertexCount < < " vertices but " < < expectedAttributeVertexCount < < " expected " , ) ;
" Trade::MeshData: attribute " < < i < < " has " < < attribute . _vertexCount < < " vertices but " < < expectedAttributeVertexCount < < " expected " , ) ;
/* Check that the view fits into the provided vertex data array. For
/* Check that the view fits into the provided vertex data array. For
implementation - specific formats we don ' t know the size so use 0 to
implementation - specific formats we don ' t know the size so use 0 to
check at least partially . */
check at least partially . If the mesh has zero vertices , we don ' t
const UnsignedInt typeSize =
check anything - - accessing the memory would be invalid anyway and
isVertexFormatImplementationSpecific ( attribute . _format ) ? 0 :
enforcing this would lead to unnecessary friction with interleaved
( vertexFormatSize ( attribute . _format ) *
attributes of empty meshes . */
( attribute . _arraySize ? attribute . _arraySize : 1 ) ) ;
if ( _vertexCount ) {
if ( attribute . _isOffsetOnly ) {
const UnsignedInt typeSize =
const std : : size_t size = attribute . _data . offset + ( _vertexCount - 1 ) * attribute . _stride + typeSize ;
isVertexFormatImplementationSpecific ( attribute . _format ) ? 0 :
/* For meshes with zero vertices we don't check the pointer, since
( vertexFormatSize ( attribute . _format ) *
accessing the memory is invalid anyway and enforcing this would
( attribute . _arraySize ? attribute . _arraySize : 1 ) ) ;
lead to unnecessary friction with interleaved attributes of
if ( attribute . _isOffsetOnly ) {
empty meshes . */
const std : : size_t size = attribute . _data . offset + ( _vertexCount - 1 ) * attribute . _stride + typeSize ;
CORRADE_ASSERT ( ! _vertexCount | | size < = _vertexData . size ( ) ,
CORRADE_ASSERT ( size < = _vertexData . size ( ) ,
" Trade::MeshData: offset-only attribute " < < i < < " spans " < < size < < " bytes but passed vertexData array has only " < < _vertexData . size ( ) , ) ;
" Trade::MeshData: offset-only attribute " < < i < < " spans " < < size < < " bytes but passed vertexData array has only " < < _vertexData . size ( ) , ) ;
} else {
} else {
const void * const begin = static_cast < const char * > ( attribute . _data . pointer ) ;
const void * const begin = static_cast < const char * > ( attribute . _data . pointer ) ;
const void * const end = static_cast < const char * > ( attribute . _data . pointer ) + ( _vertexCount - 1 ) * attribute . _stride + typeSize ;
const void * const end = static_cast < const char * > ( attribute . _data . pointer ) + ( _vertexCount - 1 ) * attribute . _stride + typeSize ;
/* For meshes with zero vertices we don't check the pointer, since
CORRADE_ASSERT ( begin > = _vertexData . begin ( ) & & end < = _vertexData . end ( ) ,
accessing the memory is invalid anyway and enforcing this would
" Trade::MeshData: attribute " < < i < < " [ " < < Debug : : nospace < < begin < < Debug : : nospace < < " : " < < Debug : : nospace < < end < < Debug : : nospace < < " ] is not contained in passed vertexData array [ " < < Debug : : nospace < < static_cast < const void * > ( _vertexData . begin ( ) ) < < Debug : : nospace < < " : " < < Debug : : nospace < < static_cast < const void * > ( _vertexData . end ( ) ) < < Debug : : nospace < < " ] " , ) ;
lead to unnecessary friction with interleaved attributes of
}
empty meshes . */
CORRADE_ASSERT ( ! _vertexCount | | ( begin > = _vertexData . begin ( ) & & end < = _vertexData . end ( ) ) ,
" Trade::MeshData: attribute " < < i < < " [ " < < Debug : : nospace < < begin < < Debug : : nospace < < " : " < < Debug : : nospace < < end < < Debug : : nospace < < " ] is not contained in passed vertexData array [ " < < Debug : : nospace < < static_cast < const void * > ( _vertexData . begin ( ) ) < < Debug : : nospace < < " : " < < Debug : : nospace < < static_cast < const void * > ( _vertexData . end ( ) ) < < Debug : : nospace < < " ] " , ) ;
}
}
}
}
# endif
# endif