@ -346,57 +346,31 @@ class MAGNUM_TRADE_EXPORT MeshAttributeData {
* @ param name Attribute name
* @ param format Vertex format
* @ param data Attribute data
*
* Expects that @ p data stride is large enough to fit @ p type and that
* @ p type corresponds to @ p name .
*/
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , const Containers : : StridedArrayView1D < const void > & data ) noexcept : MeshAttributeData { name , format , 0 , data } { }
/**
* @ brief Type - erased constructor for an array attribute
* @ param name Attribute name
* @ param format Vertex format
* @ param arraySize Array size
* @ param data Attribute data
* @ param arraySize Array size . Use @ cpp 0 @ ce for non - array
* attributes .
*
* Expects that @ p data stride is large enough to fit all @ p arraySize
* items of @ p type , @ p type corresponds to @ p name and @ p arraySize is
* zero for builtin attributes . Passing @ cpp 0 @ ce to @ p arraySize is
* equivalent to calling the above overload .
* zero for builtin attributes .
*/
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , UnsignedShort arraySize , const Containers : : StridedArrayView1D < const void > & data ) noexcept ;
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , const Containers : : StridedArrayView1D < const void > & data , UnsignedShort arraySize = 0 ) noexcept ;
/**
* @ brief Constructor
* @ param name Attribute name
* @ param format Vertex format
* @ param data Attribute data
*
* Expects that the second dimension of @ p data is contiguous and its
* size matches @ p type ; and that @ p type corresponds to @ p name .
*/
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , const Containers : : StridedArrayView2D < const char > & data ) noexcept : MeshAttributeData { name , format , 0 , data } { }
/** @overload */
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , std : : nullptr_t ) noexcept : MeshAttributeData { name , format , 0 , nullptr , nullptr } { }
/**
* @ brief Construct an array attribute
* @ param name Attribute name
* @ param format Vertex format
* @ param arraySize Array size
* @ param data Attribute data
* @ param arraySize Array size . Use @ cpp 0 @ ce for non - array
* attributes .
*
* Expects that the second dimension of @ p data is contiguous and its
* size matches @ p type and @ p arraSize , that @ p type corresponds to
* @ p name and @ p arraySize is zero for builtin attributes . Passing
* @ cpp 0 @ ce to @ p arraySize is equivalent to calling the above
* overload .
* @ p name and @ p arraySize is zero for builtin attributes .
*/
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , UnsignedShort arraySize , const Containers : : StridedArrayView2D < const char > & data ) noexcept ;
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , const Containers : : StridedArrayView2D < const char > & data , UnsignedShort arraySize = 0 ) noexcept ;
/** @overload */
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , UnsignedShort arraySize , std : : nullptr_t ) noexcept : MeshAttributeData { name , format , arraySize , nullptr , nullptr } { }
explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , std : : nullptr_t , UnsignedShort arraySize = 0 ) noexcept : MeshAttributeData { nullptr , name , format , nullptr , arraySize } { }
/**
* @ brief Constructor
@ -404,7 +378,7 @@ class MAGNUM_TRADE_EXPORT MeshAttributeData {
* @ param data Attribute data
*
* Detects @ ref VertexFormat based on @ p T and calls
* @ ref MeshAttributeData ( MeshAttribute , VertexFormat , const Containers : : StridedArrayView1D < const void > & ) .
* @ ref MeshAttributeData ( MeshAttribute , VertexFormat , const Containers : : StridedArrayView1D < const void > & , UnsignedShort ) .
* For most types known by Magnum , the detected @ ref VertexFormat is of
* the same name as the type ( so e . g . @ ref Magnum : : Vector3ui " Vector3ui "
* gets recognized as @ ref VertexFormat : : Vector3ui ) , with the
@ -446,7 +420,7 @@ class MAGNUM_TRADE_EXPORT MeshAttributeData {
* @ param data Attribute data
*
* Detects @ ref VertexFormat based on @ p T and calls
* @ ref MeshAttributeData ( MeshAttribute , VertexFormat , UnsignedShort , const Containers : : StridedArrayView1D < const void > & )
* @ ref MeshAttributeData ( MeshAttribute , VertexFormat , const Containers : : StridedArrayView1D < const void > & , UnsignedShort )
* with the second dimension size passed to @ p arraySize . Expects that
* the second dimension is contiguous . At the moment only custom
* attributes can be arrays , which means this function can ' t be used
@ -478,7 +452,7 @@ class MAGNUM_TRADE_EXPORT MeshAttributeData {
*
* Note that due to the @ cpp constexpr @ ce nature of this constructor ,
* no @ p format / @ p arraySize checks against @ p stride can be done .
* You ' re encouraged to use the @ ref MeshAttributeData ( MeshAttribute , VertexFormat , const Containers : : StridedArrayView1D < const void > & )
* You ' re encouraged to use the @ ref MeshAttributeData ( MeshAttribute , VertexFormat , const Containers : : StridedArrayView1D < const void > & , UnsignedShort )
* constructor if you want additional safeguards .
* @ see @ ref isOffsetOnly ( ) , @ ref arraySize ( ) ,
* @ ref data ( Containers : : ArrayView < const void > ) const
@ -570,7 +544,8 @@ class MAGNUM_TRADE_EXPORT MeshAttributeData {
private :
friend MeshData ;
constexpr explicit MeshAttributeData ( MeshAttribute name , VertexFormat format , UnsignedShort arraySize , const Containers : : StridedArrayView1D < const void > & data , std : : nullptr_t ) noexcept ;
/* nullptr first, to avoid accidental matches as much as possible */
constexpr explicit MeshAttributeData ( std : : nullptr_t , MeshAttribute name , VertexFormat format , const Containers : : StridedArrayView1D < const void > & data , UnsignedShort arraySize ) noexcept ;
VertexFormat _format ;
MeshAttribute _name ;
@ -2086,7 +2061,7 @@ namespace Implementation {
# endif
}
constexpr MeshAttributeData : : MeshAttributeData ( const MeshAttribute name , const VertexFormat format , const UnsignedShort arraySize , const Containers : : StridedArrayView1D < const void > & data , std : : nullptr_t ) noexcept :
constexpr MeshAttributeData : : MeshAttributeData ( std : : nullptr_t , const MeshAttribute name , const VertexFormat format , const Containers : : StridedArrayView1D < const void > & data , const UnsignedShort arraySize ) noexcept :
_format { ( CORRADE_CONSTEXPR_ASSERT ( ! arraySize | | ! isVertexFormatImplementationSpecific ( format ) ,
" Trade::MeshAttributeData: array attributes can't have an implementation-specific format " ) , format ) } ,
_name { ( CORRADE_CONSTEXPR_ASSERT ( Implementation : : isVertexFormatCompatibleWithAttribute ( name , format ) ,
@ -2114,9 +2089,9 @@ constexpr MeshAttributeData::MeshAttributeData(const MeshAttribute name, const V
" Trade::MeshAttributeData: " < < name < < " can't be an array attribute " ) , arraySize ) } ,
_data { offset } { }
template < class T > constexpr MeshAttributeData : : MeshAttributeData ( MeshAttribute name , const Containers : : StridedArrayView1D < T > & data ) noexcept : MeshAttributeData { name , Implementation : : vertexFormatFor < typename std : : remove_const < T > : : type > ( ) , 0 , data , nullptr } { }
template < class T > constexpr MeshAttributeData : : MeshAttributeData ( MeshAttribute name , const Containers : : StridedArrayView1D < T > & data ) noexcept : MeshAttributeData { nullptr , n ame , Implementation : : vertexFormatFor < typename std : : remove_const < T > : : type > ( ) , data , 0 } { }
template < class T > constexpr MeshAttributeData : : MeshAttributeData ( MeshAttribute name , const Containers : : StridedArrayView2D < T > & data ) noexcept : MeshAttributeData { name , Implementation : : vertexFormatFor < typename std : : remove_const < T > : : type > ( ) , UnsignedShort ( data . size ( ) [ 1 ] ) , Containers : : StridedArrayView1D < const void > { { data . data ( ) , ~ std : : size_t { } } , data . size ( ) [ 0 ] , data . stride ( ) [ 0 ] } , ( CORRADE_CONSTEXPR_ASSERT ( data . strid e( ) [ 1 ] = = sizeof ( T ) , " Trade::MeshAttributeData: second view dimension is not contiguous " ) , nullptr ) } { }
template < class T > constexpr MeshAttributeData : : MeshAttributeData ( MeshAttribute name , const Containers : : StridedArrayView2D < T > & data ) noexcept : MeshAttributeData { ( CORRADE_CONSTEXPR_ASSERT ( data . stride ( ) [ 1 ] = = sizeof ( T ) , " Trade::MeshAttributeData: second view dimension is not contiguous " ) , nullptr ) , name , Implementation : : vertexFormatFor < typename std : : remove_const < T > : : type > ( ) , Containers : : StridedArrayView1D < const void > { { data . data ( ) , ~ std : : size_t { } } , data . size ( ) [ 0 ] , data . stride ( ) [ 0 ] } , UnsignedShort ( data . siz e( ) [ 1 ] ) } { }
template < class T > Containers : : ArrayView < const T > MeshData : : indices ( ) const {
CORRADE_ASSERT ( isIndexed ( ) ,