|
|
|
|
@ -682,28 +682,28 @@ class MAGNUM_EXPORT Mesh: public AbstractObject {
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* Computing stride of interleaved vertex attributes */ |
|
|
|
|
template<UnsignedInt location, class T, class ...U> inline static GLsizei strideOfInterleaved(const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) { |
|
|
|
|
template<UnsignedInt location, class T, class ...U> static GLsizei strideOfInterleaved(const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) { |
|
|
|
|
return attribute.vectorSize()*AbstractShaderProgram::Attribute<location, T>::VectorCount + strideOfInterleaved(attributes...); |
|
|
|
|
} |
|
|
|
|
template<class ...T> inline static GLsizei strideOfInterleaved(GLintptr gap, const T&... attributes) { |
|
|
|
|
template<class ...T> static GLsizei strideOfInterleaved(GLintptr gap, const T&... attributes) { |
|
|
|
|
return gap + strideOfInterleaved(attributes...); |
|
|
|
|
} |
|
|
|
|
inline static GLsizei strideOfInterleaved() { return 0; } |
|
|
|
|
static GLsizei strideOfInterleaved() { return 0; } |
|
|
|
|
|
|
|
|
|
/* Adding interleaved vertex attributes */ |
|
|
|
|
template<UnsignedInt location, class T, class ...U> inline void addVertexBufferInternal(Buffer& buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) { |
|
|
|
|
template<UnsignedInt location, class T, class ...U> void addVertexBufferInternal(Buffer& buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) { |
|
|
|
|
addVertexAttribute(buffer, attribute, offset, stride); |
|
|
|
|
|
|
|
|
|
/* Add size of this attribute to offset for next attribute */ |
|
|
|
|
addVertexBufferInternal(buffer, offset+attribute.vectorSize()*AbstractShaderProgram::Attribute<location, T>::VectorCount, stride, attributes...); |
|
|
|
|
} |
|
|
|
|
template<class ...T> inline void addVertexBufferInternal(Buffer& buffer, GLintptr offset, GLsizei stride, GLintptr gap, const T&... attributes) { |
|
|
|
|
template<class ...T> void addVertexBufferInternal(Buffer& buffer, GLintptr offset, GLsizei stride, GLintptr gap, const T&... attributes) { |
|
|
|
|
/* Add the gap to offset for next attribute */ |
|
|
|
|
addVertexBufferInternal(buffer, offset+gap, stride, attributes...); |
|
|
|
|
} |
|
|
|
|
inline void addVertexBufferInternal(Buffer&, GLsizei, GLintptr) {} |
|
|
|
|
void addVertexBufferInternal(Buffer&, GLsizei, GLintptr) {} |
|
|
|
|
|
|
|
|
|
template<UnsignedInt location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, Float>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { |
|
|
|
|
template<UnsignedInt location, class T> void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, Float>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { |
|
|
|
|
for(UnsignedInt i = 0; i != AbstractShaderProgram::Attribute<location, T>::VectorCount; ++i) |
|
|
|
|
attributePointerInternal(Attribute{ |
|
|
|
|
&buffer, |
|
|
|
|
@ -717,7 +717,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
|
template<UnsignedInt location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_integral<typename Implementation::Attribute<T>::Type>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { |
|
|
|
|
template<UnsignedInt location, class T> void addVertexAttribute(typename std::enable_if<std::is_integral<typename Implementation::Attribute<T>::Type>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { |
|
|
|
|
attributePointerInternal(IntegerAttribute{ |
|
|
|
|
&buffer, |
|
|
|
|
location, |
|
|
|
|
@ -729,7 +729,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
template<UnsignedInt location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, Double>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { |
|
|
|
|
template<UnsignedInt location, class T> void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, Double>::value, Buffer&>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { |
|
|
|
|
for(UnsignedInt i = 0; i != AbstractShaderProgram::Attribute<location, T>::VectorCount; ++i) |
|
|
|
|
attributePointerInternal(LongAttribute{ |
|
|
|
|
&buffer, |
|
|
|
|
|