summaryrefslogtreecommitdiffstats
path: root/src/threed/arrays
diff options
context:
space:
mode:
Diffstat (limited to 'src/threed/arrays')
-rw-r--r--src/threed/arrays/arrays.pri28
-rw-r--r--src/threed/arrays/qarray.cpp1022
-rw-r--r--src/threed/arrays/qarray.h1209
-rw-r--r--src/threed/arrays/qcolor4ub.cpp319
-rw-r--r--src/threed/arrays/qcolor4ub.h216
-rw-r--r--src/threed/arrays/qcustomdataarray.cpp909
-rw-r--r--src/threed/arrays/qcustomdataarray.h421
-rw-r--r--src/threed/arrays/qglattributedescription.cpp188
-rw-r--r--src/threed/arrays/qglattributedescription.h149
-rw-r--r--src/threed/arrays/qglattributeset.cpp207
-rw-r--r--src/threed/arrays/qglattributeset.h138
-rw-r--r--src/threed/arrays/qglattributevalue.cpp276
-rw-r--r--src/threed/arrays/qglattributevalue.h207
-rw-r--r--src/threed/arrays/qglindexbuffer.cpp777
-rw-r--r--src/threed/arrays/qglindexbuffer.h108
-rw-r--r--src/threed/arrays/qglvertexbundle.cpp495
-rw-r--r--src/threed/arrays/qglvertexbundle.h111
-rw-r--r--src/threed/arrays/qglvertexbundle_p.h216
-rw-r--r--src/threed/arrays/qvector2darray.cpp275
-rw-r--r--src/threed/arrays/qvector2darray.h124
-rw-r--r--src/threed/arrays/qvector3darray.cpp257
-rw-r--r--src/threed/arrays/qvector3darray.h116
-rw-r--r--src/threed/arrays/qvector4darray.cpp257
-rw-r--r--src/threed/arrays/qvector4darray.h118
24 files changed, 0 insertions, 8143 deletions
diff --git a/src/threed/arrays/arrays.pri b/src/threed/arrays/arrays.pri
deleted file mode 100644
index 978f252d..00000000
--- a/src/threed/arrays/arrays.pri
+++ /dev/null
@@ -1,28 +0,0 @@
-INCLUDEPATH += $$PWD
-VPATH += $$PWD
-HEADERS += \
- arrays/qglattributedescription.h \
- arrays/qglattributeset.h \
- arrays/qglattributevalue.h \
- arrays/qglindexbuffer.h \
- arrays/qglvertexbundle.h \
- arrays/qarray.h \
- arrays/qcolor4ub.h \
- arrays/qcustomdataarray.h \
- arrays/qvector2darray.h \
- arrays/qvector3darray.h \
- arrays/qvector4darray.h
-SOURCES += \
- qglattributedescription.cpp \
- qglattributeset.cpp \
- qglattributevalue.cpp \
- qglindexbuffer.cpp \
- qglvertexbundle.cpp \
- qarray.cpp \
- qcolor4ub.cpp \
- qcustomdataarray.cpp \
- qvector2darray.cpp \
- qvector3darray.cpp \
- qvector4darray.cpp
-PRIVATE_HEADERS += \
- qglvertexbundle_p.h
diff --git a/src/threed/arrays/qarray.cpp b/src/threed/arrays/qarray.cpp
deleted file mode 100644
index e9267ae3..00000000
--- a/src/threed/arrays/qarray.cpp
+++ /dev/null
@@ -1,1022 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qarray.h"
-#include <limits.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QArray
- \brief The QArray class is a template class that provides a dynamic array of simple types.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- QArray is similar to QVector except that it has much less overhead
- when constructing large arrays by appending individual elements
- one by one.
-
- QArray instances have a preallocated data area for quickly
- building small arrays on the stack without malloc overhead.
- Once the array grows beyond the preallocated size, it is copied
- to the heap. The size of the preallocated area, which defaults to 8,
- can be specified with the second template parameter:
-
- \code
- QArray<QVector3D, 32> array;
- \endcode
-
- QArray uses implicit sharing and copy-on-write semantics to support
- passing large arrays around an application with little overhead.
-
- QArray is heavily optimized for copy-on-write and the case of
- constructing an array by calling append(). It has a slight
- performance penalty for random access using the non-const
- version of operator[]().
-*/
-
-/*!
- \fn QArray::QArray()
-
- Constructs an empty array.
-
- \sa reserve()
-*/
-
-/*!
- \fn QArray::QArray(int size, const T &value)
-
- Constructs an array of \a size elements, all initialized
- to \a value.
-
- \sa fill()
-*/
-
-/*!
- \fn QArray::QArray(int size)
-
- Constructs an array of \a size elements, all initialized
- to their default-constructed values.
-*/
-
-/*!
- \fn QArray::QArray(const T *values, int size)
-
- Constructs an array of \a size elements, initialized
- from \a values.
-*/
-
-/*!
- \fn QArray::QArray(const QArray<T, PreallocSize> &other)
-
- Constructs a copy of \a other.
-
- \sa operator=()
-*/
-
-/*!
- \fn QArray::~QArray()
-
- Destroys the array.
-*/
-
-/*!
- \fn QArray<T, PreallocSize> &QArray::operator=(const QArray<T, PreallocSize> &other)
-
- Assigns \a other to this array and returns a reference
- to this array.
-*/
-
-/*!
- \fn int QArray::size() const
-
- Returns the number of elements in this array.
-
- \sa resize(), capacity(), isEmpty()
-*/
-
-/*!
- \fn int QArray::count() const
- \overload
-
- Same as size(), provided for convenience.
-*/
-
-/*!
- \fn int QArray::capacity() const
-
- Returns the number of elements that can be stored in this
- array before reallocation.
-
- \sa reserve(), size()
-*/
-
-/*!
- \fn bool QArray::isEmpty() const
-
- Returns true if this array is empty; false otherwise.
-
- \sa size(), clear()
-*/
-
-/*!
- \fn bool QArray::isDetached() const
- \internal
-
- Returns true if this array has definitely been detached from all
- other shared copies of the data; false otherwise.
-
- It is possible for this function to return false if the
- array was previously shared but no longer is. It is thus
- an indication that a detach() will probably be required.
-
- This function can be used to determine if functions that
- write to this array such as append(), replace(),
- and data(), will need to make a copy.
-
- Raw data arrays that are created with fromRawData() are
- never detached.
-
- \sa detach()
-*/
-
-/*!
- \fn void QArray::detach()
- \internal
-
- Detaches this array from all other shared copies of the data.
-
- \sa isDetached()
-*/
-
-/*!
- \fn void QArray::clear()
-
- Clears all elements from this array and sets the size to zero.
-
- This function will deallocate any memory that is used on the heap
- to store the array's elements. To reuse the same memory
- as before, call resize() with an argument of zero.
-
- \sa resize(), isEmpty()
-*/
-
-/*!
- \fn const T &QArray::at(int index) const
-
- Returns the item at position \a index in the array.
-
- \a index must be a valid index position in the array (i.e., 0 <= \a
- index < size()).
-
- \sa operator[](), constData(), value()
-*/
-
-/*!
- \fn T &QArray::operator[](int index)
-
- Returns the item at position \a index as a modifiable reference.
-
- \a index must be a valid index position in the vector (i.e., 0 <= \a index
- < size()).
-
- Note that using non-const operators can cause QArray
- to do a deep copy.
-
- \sa at(), value()
-*/
-
-/*!
- \fn const T &QArray::operator[](int index) const
-
- \overload
-
- Same as at(\a index).
-*/
-
-/*!
- \fn T QArray::value(int index) const
-
- Returns the value at position \a index in the vector.
-
- If the \a index is out of bounds, the function returns
- a default-constructed value. If you are certain that
- \a index is within bounds, you can use at() instead,
- which is slightly faster.
-
- \sa at(), operator[]()
-*/
-
-/*!
- \fn T QArray::value(int index, const T &defaultValue) const
- \overload
-
- If the \a index is out of bounds, the function returns
- \a defaultValue.
-*/
-
-/*!
- \fn T *QArray::extend(int size)
-
- Extends this array by \a size elements and returns a pointer
- to the storage, which is not initialized. The pointer is only
- valid until the array is reallocated or destroyed.
-
- The append() or resize() functions are recommended if T is a
- complex type, with extend() only used for simple types.
- Because the storage is not initialized, the caller should use
- the in-place new operator to set elements:
-
- \code
- QArray<QRegExp> array;
- QRegExp *space = array.extend(1);
- new (space) QRegExp(QLatin1String("exp"));
- \endcode
-
- \sa append(), resize()
-*/
-
-/*!
- \fn void QArray::append(const T &value)
-
- Appends \a value to this array.
-
- \sa prepend(), insert()
-*/
-
-/*!
- \fn void QArray::append(const T &value1, const T &value2)
-
- \overload
-
- Appends \a value1 and \a value2 to this array.
-*/
-
-/*!
- \fn void QArray::append(const T &value1, const T &value2, const T &value3)
-
- \overload
-
- Appends \a value1, \a value2, and \a value3 to this array.
-*/
-
-/*!
- \fn void QArray::append(const T &value1, const T &value2, const T &value3, const T &value4)
-
- \overload
-
- Appends \a value1, \a value2, \a value3, and \a value4 to this array.
-*/
-
-/*!
- \fn void QArray::append(const T *values, int count)
-
- Appends the \a count elements of \a values to this array.
-*/
-
-/*!
- \fn void QArray::append(const QArray<T, PreallocSize> &other)
-
- Appends the elements of \a other to this array.
-*/
-
-/*!
- \fn void QArray::prepend(const T &value)
-
- Prepends \a value to this array.
-
- \sa append(), insert()
-*/
-
-/*!
- \fn void QArray::insert(int index, const T &value)
-
- Inserts \a value at position \a index in this array.
- If \a index is 0, then \a value is prepended to the array.
- If \a index is size(), then \a value is appended to the array.
-
- \sa append(), prepend()
-*/
-
-/*!
- \fn void QArray::insert(int index, int count, const T &value)
- \overload
-
- Inserts \a count copies of \a value at position \a index
- in this array.
-*/
-
-/*!
- \fn QArray::iterator QArray::insert(iterator before, int count, const T &value)
-
- Inserts \a count copies of \a value in front of the item
- pointed to by the iterator \a before. Returns an iterator
- pointing at the first of the inserted items.
-*/
-
-/*!
- \fn QArray::iterator QArray::insert(iterator before, const T &value)
- \overload
-
- Inserts \a value in front of the item pointed to by the
- iterator \a before. Returns an iterator pointing at the
- inserted item.
-*/
-
-/*!
- \fn void QArray::replace(int index, const T &value)
-
- Replaces the element at \a index with \a value.
-
- \sa operator[](), remove()
-*/
-
-/*!
- \fn void QArray::replace(int index, const T *values, int count)
- \overload
-
- Replaces the \a count elements of this array with the
- contents of \a values, starting at \a index.
-
- If (\a index + \a count) is larger than the current size of this
- array, the array will be extended to that size.
-
- \sa append()
-*/
-
-/*!
- \fn void QArray::remove(int index)
-
- \overload
-
- Removes the element at position \a index in this array.
-*/
-
-/*!
- \fn void QArray::remove(int index, int count)
-
- Removes the \a count elements starting at position \a index
- in this array. If \a index or \a count is out of range,
- the set of removed elements will be truncated to those that
- are in range.
-*/
-
-/*!
- \fn QArray::iterator QArray::erase(iterator begin, iterator end)
- \overload
-
- Removes all the items from \a begin up to (but not including) \a
- end. Returns an iterator to the same item that \a end referred to
- before the call.
-*/
-
-/*!
- \fn QArray::iterator QArray::erase(iterator pos)
-
- Removes the item pointed to by the iterator \a pos from the
- vector, and returns an iterator to the next item in the vector
- (which may be end()).
-
- \sa insert(), remove()
-*/
-
-/*!
- \fn void QArray::removeFirst()
-
- Removes the first element from this array. Does nothing if
- the array is empty.
-
- \sa remove(), removeLast()
-*/
-
-/*!
- \fn void QArray::removeLast()
-
- Removes the last element from this array. Does nothing if
- the array is empty.
-
- \sa remove(), removeFirst()
-*/
-
-/*!
- \fn int QArray::indexOf(const T &value, int from) const
-
- Returns the index position of the first occurrence of
- \a value in the array, searching forward from index
- position \a from. Returns -1 if no item matched.
-
- If \a from is negative, then it indicates an index position
- relative to the end of the array, -1 being the last index
- position.
-
- This function requires the value type T to have an implementation
- of \c operator==().
-
- \sa lastIndexOf(), contains()
-*/
-
-/*!
- \fn int QArray::lastIndexOf(const T &value, int from) const
-
- Returns the index position of the last occurrence of
- \a value in the array, searching backward from index
- position \a from. Returns -1 if no item matched.
-
- If \a from is negative, then it indicates an index position
- relative to the end of the array, -1 being the last index
- position. The default for \a from is -1.
-
- This function requires the value type T to have an implementation
- of \c operator==().
-
- \sa indexOf(), contains()
-*/
-
-/*!
- \fn bool QArray::contains(const T &value) const
-
- Returns true if the array contains an occurrence of \a value;
- false otherwise.
-
- This function requires the value type T to have an implementation
- of \c operator==().
-
- \sa indexOf(), count()
-*/
-
-/*!
- \fn int QArray::count(const T &value) const
-
- Returns the number of occurrences of \a value in the array.
-
- This function requires the value type T to have an implementation
- of \c operator==().
-
- \sa contains(), indexOf()
-*/
-
-/*!
- \fn void QArray::resize(int size)
-
- Sets the size of the array to \a size. If \a size is greater
- than the current size, elements are added to the end and are
- initialized to a default-constructed value. If \a size is less
- than the current size, elements are removed from the end.
-
- \sa size(), reserve(), squeeze()
-*/
-
-/*!
- \fn void QArray::reserve(int size)
-
- Increases the capacity of this array to reserve space for
- at least \a size elements. If the capacity is already larger
- than \a size, this function does nothing; in particular, it does
- not remove elements from the array like resize() does.
-
- This function can be useful when you know how roughly many elements
- will be appended ahead of time. Reserving the space once can avoid
- unnecessary realloc operations later.
-
- \sa capacity(), resize(), squeeze()
-*/
-
-/*!
- \fn void QArray::squeeze()
-
- Releases any memory not required to store the array's elements
- by reducing its capacity() to size().
-
- This function is intended for reclaiming memory in an
- array that is being used over and over with different contents.
- As elements are added to an array, it will be constantly
- expanded in size. This function can realloc the array
- to a smaller size to reclaim unused memory.
-
- \sa reserve(), capacity()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> &QArray::fill(const T &value, int size)
-
- Assigns \a value to all items in the array. If \a size is
- different from -1 (the default), the array is resized to
- \a size beforehand. Returns a reference to the array.
-
- \sa resize()
-*/
-
-/*!
- \fn void QArray::reverse()
-
- Reverses the order of this array in place.
-
- \sa reversed()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> QArray::reversed() const
-
- Returns a copy of this array with elements in the reverse order.
-
- \sa reverse()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> QArray::mid(int index, int length) const
-
- Returns an array containing the \a length elements of
- this array, starting at \a index. If \a length is less
- than zero, or extends further than the end of the array, then all
- elements extending from \a index to the end of the array will be
- included in the return value.
-
- \sa left(), right()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> QArray::left(int length) const;
-
- Returns an array containing the first \a length
- elements of this array. If \a length is less than zero,
- or greater than size(), then all elements in this array will
- be included in the return value.
-
- \sa mid(), right()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> QArray::right(int length) const;
-
- Returns an array containing the last \a length
- elements of this array. If \a length is less than zero,
- or greater than size(), then all elements in this array
- will be included in the return value.
-
- \sa mid(), left()
-*/
-
-/*!
- \fn T *QArray::data()
-
- Returns a pointer to the data stored in the array. The pointer
- can be used to access and modify the items in the array.
-
- The pointer remains valid as long as the array isn't
- reallocated.
-
- This function is mostly useful to pass an array to a function
- that accepts a plain C++ array. It may make a deep copy of the
- array's elements if the array is implicitly shared.
-
- \sa constData(), operator[]()
-*/
-
-/*!
- \fn const T *QArray::data() const
-
- \overload
-*/
-
-/*!
- \fn const T *QArray::constData() const
-
- Returns a const pointer to the data stored in the array.
- The pointer can be used to access the items in the array.
- The pointer remains valid as long as the array isn't
- reallocated.
-
- This function is mostly useful to pass an array to a function
- that accepts a plain C++ array.
-
- \sa data(), operator[]()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> QArray::fromRawData(const T *data, int size)
-
- Returns an array consisting of the \a size elements from \a data.
-
- This function takes a reference to \a data, but does not copy
- the elements until the array is modified. The memory at \a data
- must remain valid until the returned array is destroyed
- or modified.
-
- Use append() instead of fromRawData() to force a copy to be made
- of the elements at \a data when the array is created:
-
- \code
- // Makes a copy of the data immediately.
- QArray<float> array;
- array.append(data, size);
-
- // Does not make a copy of the data until the array is modified.
- QArray<float> array;
- array = QArray<float>::fromRawData(data, size);
- \endcode
-
- \sa fromWritableRawData(), append()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> QArray::fromWritableRawData(T *data, int size)
-
- Returns an array consisting of the \a size elements from \a data.
-
- This function takes a reference to \a data, but does not copy
- the elements until the array is reallocated to a larger size.
- The memory at \a data must remain valid until the returned
- array is destroyed or reallocated.
-
- The elements of \a data will be modified in-place. This differs
- from fromRawData() which will make a copy of the elements
- of \a data when the array is modified.
-
- If the returned array is resized to less than \a size,
- then a copy will not be made, and append() can be used to
- append new items up to \a size. Further calls to append()
- after \a size will force the array to be reallocated.
-
- If the returned array is resized to more than \a size,
- then a copy of the data will be made and further modifications
- will not affect the elements at \a data.
-
- \sa fromRawData()
-*/
-
-/*!
- \fn bool QArray::operator==(const QArray<T, PreallocSize> &other) const
-
- Returns true if \a other is equal to this array; otherwise
- returns false.
-
- Two arrays are considered equal if they contain the same values
- in the same order.
-
- This function requires the value type to have an implementation
- of \c operator==().
-
- \sa operator!=()
-*/
-
-/*!
- \fn bool QArray::operator!=(const QArray<T, PreallocSize> &other) const
-
- Returns true if \a other is not equal to this array; otherwise
- returns false.
-
- Two arrays are considered equal if they contain the same values
- in the same order.
-
- This function requires the value type to have an implementation
- of \c operator==().
-
- \sa operator==()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> &QArray::operator+=(const T &value)
-
- \overload
-
- Appends \a value to this array and returns a reference to
- this array.
-
- \sa operator<<(), append()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> &QArray::operator+=(const QArray<T, PreallocSize> &other)
-
- Appends the elements of the \a other array to this array
- and returns a reference to this array.
-
- \sa operator<<(), append()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> &QArray::operator<<(const T &value)
-
- \overload
-
- Appends \a value to this array and returns a reference to
- this array.
-
- \sa operator+=(), append()
-*/
-
-/*!
- \fn QArray<T, PreallocSize> &QArray::operator<<(const QArray<T, PreallocSize> &other)
-
- Appends the elements of the \a other array to this array
- and returns a reference to this array.
-
- \sa operator+=(), append()
-*/
-
-/*!
- \typedef QArray::iterator
-
- The QArray::iterator typedef provides an STL-style non-const
- iterator for QArray. The iterator is simply a typedef
- for "T *" (pointer to T).
-
- \sa QArray::begin(), QArray::const_iterator
-*/
-
-/*!
- \typedef QArray::const_iterator
-
- The QArray::iterator typedef provides an STL-style const
- iterator for QArray. The iterator is simply a typedef
- for "const T *" (pointer to const T).
-
- \sa QArray::constBegin(), QArray::iterator
-*/
-
-/*!
- \typedef QArray::Iterator
-
- Qt-style synonym for QArray::iterator.
-*/
-
-/*!
- \typedef QArray::ConstIterator
-
- Qt-style synonym for QArray::const_iterator.
-*/
-
-/*!
- \typedef QArray::const_pointer
-
- Typedef for const T *. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QArray::const_reference
-
- Typedef for T &. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QArray::difference_type
-
- Typedef for ptrdiff_t. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QArray::pointer
-
- Typedef for T *. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QArray::reference
-
- Typedef for T &. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QArray::size_type
-
- Typedef for int. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QArray::value_type
-
- Typedef for T. Provided for STL compatibility.
-*/
-
-/*!
- \fn QArray::iterator QArray::begin()
-
- Returns an STL-style iterator pointing to the first item
- in the array.
-
- \sa end(), constBegin(), QArray::iterator
-*/
-
-/*!
- \fn QArray::const_iterator QArray::begin() const
- \overload
-*/
-
-/*!
- \fn QArray::const_iterator QArray::constBegin() const
-
- Returns a const STL-style iterator pointing to the first item
- in the array.
-
- \sa constEnd(), begin(), QArray::const_iterator
-*/
-
-/*!
- \fn QArray::iterator QArray::end()
-
- Returns an STL-style iterator pointing to the imaginary item
- after the last item in the array.
-
- \sa begin(), constEnd(), QArray::iterator
-*/
-
-/*!
- \fn QArray::const_iterator QArray::end() const
- \overload
-*/
-
-/*!
- \fn QArray::const_iterator QArray::constEnd() const
-
- Returns a const STL-style iterator pointing to the imaginary item
- after the last item in the array.
-
- \sa constBegin(), end(), QArray::const_iterator
-*/
-
-/*!
- \fn T &QArray::first()
-
- Returns a reference to the first item in the array. This
- function assumes that the array isn't empty.
-
- \sa last(), isEmpty()
-*/
-
-/*!
- \fn const T &QArray::first() const
- \overload
-*/
-
-/*!
- \fn T &QArray::last()
-
- Returns a reference to the last item in the array. This function
- assumes that the array isn't empty.
-
- \sa first(), isEmpty()
-*/
-
-/*!
- \fn const T &QArray::last() const
- \overload
-*/
-
-/*!
- \fn bool QArray::startsWith(const T &value) const
-
- Returns true if this array is not empty and its first
- item is equal to \a value; otherwise returns false.
-
- \sa isEmpty(), first()
-*/
-
-/*!
- \fn bool QArray::endsWith(const T &value) const
-
- Returns true if this array is not empty and its last
- item is equal to \a value; otherwise returns false.
-
- \sa isEmpty(), last()
-*/
-
-/*!
- \fn void QArray::push_back(const T &value)
-
- This function is provided for STL compatibility. It is equivalent
- to append(\a value).
-*/
-
-/*!
- \fn void QArray::push_front(const T &value)
-
- This function is provided for STL compatibility. It is equivalent
- to prepend(\a value).
-*/
-
-/*!
- \fn void QArray::pop_front()
-
- This function is provided for STL compatibility. It is equivalent
- to removeFirst().
-*/
-
-/*!
- \fn void QArray::pop_back()
-
- This function is provided for STL compatibility. It is equivalent
- to removeLast().
-*/
-
-/*!
- \fn QArray::reference QArray::front()
-
- This function is provided for STL compatibility. It is equivalent
- to first().
-*/
-
-/*!
- \fn QArray::const_reference QArray::front() const
- \overload
-*/
-
-/*!
- \fn QArray::reference QArray::back()
-
- This function is provided for STL compatibility. It is equivalent
- to last().
-*/
-
-/*!
- \fn QArray::const_reference QArray::back() const
- \overload
-*/
-
-/*!
- \fn bool QArray::empty() const
-
- This function is provided for STL compatibility. It is equivalent
- to isEmpty(), returning true if the array is empty; otherwise
- returns false.
-*/
-
-#ifndef QT_NO_DATASTREAM
-
-/*!
- \fn QDataStream& operator<<(QDataStream& stream, const QArray<T, PreallocSize>& array)
- \relates QArray
-
- Writes \a array to the given \a stream and returns a reference
- to the \a stream.
-*/
-
-/*!
- \fn QDataStream& operator>>(QDataStream& stream, QArray<T, PreallocSize>& array)
- \relates QArray
-
- Reads \a array from the given \a stream and returns a reference
- to the \a stream.
-*/
-
-#endif
-
-int qArrayAllocMore(int alloc, int extra, int sizeOfT)
-{
- if (alloc == 0 && extra == 0)
- return 0;
- const int page = 1 << 12;
- int nalloc;
- alloc += extra;
- alloc *= sizeOfT;
- // don't do anything if the loop will overflow signed int.
- if (alloc >= INT_MAX/2)
- return INT_MAX / sizeOfT;
- nalloc = (alloc < page) ? 64 : page;
- while (nalloc < alloc) {
- if (nalloc <= 0)
- return INT_MAX / sizeOfT;
- nalloc *= 2;
- }
- return nalloc / sizeOfT;
-}
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qarray.h b/src/threed/arrays/qarray.h
deleted file mode 100644
index ed6e32f5..00000000
--- a/src/threed/arrays/qarray.h
+++ /dev/null
@@ -1,1209 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QARRAY_H
-#define QARRAY_H
-
-#include <QtCore/qglobal.h>
-#include <QtCore/qatomic.h>
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-#include <string.h>
-#include <new>
-
-#include "qt3dglobal.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-#if defined(Q_DECL_ALIGN) && defined(Q_ALIGNOF)
-
-#if defined(Q_CC_GNU) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
- typedef char __attribute__((__may_alias__)) QArrayAlignedChar;
-#else
- typedef char QArrayAlignedChar;
-#endif
-
-template <typename T, int PreallocSize, size_t AlignT>
-struct QArrayAlignedPrealloc;
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 1>
-{
- QArrayAlignedChar Q_DECL_ALIGN(1) data[sizeof(T) * PreallocSize];
-};
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 2>
-{
- QArrayAlignedChar Q_DECL_ALIGN(2) data[sizeof(T) * PreallocSize];
-};
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 4>
-{
- QArrayAlignedChar Q_DECL_ALIGN(4) data[sizeof(T) * PreallocSize];
-};
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 8>
-{
- QArrayAlignedChar Q_DECL_ALIGN(8) data[sizeof(T) * PreallocSize];
-};
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 16>
-{
- QArrayAlignedChar Q_DECL_ALIGN(16) data[sizeof(T) * PreallocSize];
-};
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 32>
-{
- QArrayAlignedChar Q_DECL_ALIGN(32) data[sizeof(T) * PreallocSize];
-};
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 64>
-{
- QArrayAlignedChar Q_DECL_ALIGN(64) data[sizeof(T) * PreallocSize];
-};
-template <typename T, int PreallocSize>
-struct QArrayAlignedPrealloc<T, PreallocSize, 128>
-{
- QArrayAlignedChar Q_DECL_ALIGN(128) data[sizeof(T) * PreallocSize];
-};
-
-#else
-
-template <typename T, int PreallocSize, size_t AlignT>
-union QArrayAlignedPrealloc
-{
- char data[sizeof(T) * PreallocSize];
- qint64 q_for_alignment_1;
- double q_for_alignment_2;
-};
-
-#endif
-
-template <typename T, int PreallocSize>
-class QArrayData
-{
-public:
-#if defined(Q_ALIGNOF)
- QArrayAlignedPrealloc<T, PreallocSize, Q_ALIGNOF(T)> m_prealloc;
-#else
- QArrayAlignedPrealloc<T, PreallocSize, sizeof(T)> m_prealloc;
-#endif
-
- inline T *prealloc()
- {
- return reinterpret_cast<T *>(m_prealloc.data);
- }
-
- inline bool isPrealloc(const T *start) const
- {
- return start == reinterpret_cast<const T *>(m_prealloc.data);
- }
-};
-
-template <typename T>
-class QArrayData<T, 0>
-{
-public:
-
- inline T *prealloc() { return 0; }
-
- inline bool isPrealloc(const T *start) const
- {
- Q_UNUSED(start);
- return false;
- }
-};
-
-template <typename T, int PreallocSize = 8>
-class QArray : private QArrayData<T, PreallocSize>
-{
-public:
- QArray();
- explicit QArray(int size);
- QArray(int size, const T &value);
- QArray(const T *values, int size);
- QArray(const QArray<T, PreallocSize> &other);
- ~QArray();
-
- typedef T *iterator;
- typedef const T *const_iterator;
-
- QArray<T, PreallocSize> &operator=
- (const QArray<T, PreallocSize> &other);
-
- int size() const;
- int count() const;
- int capacity() const;
-
- bool isEmpty() const;
-
- bool isDetached() const;
- void detach();
-
- void clear();
-
- const T &at(int index) const;
- const T &operator[](int index) const;
- T &operator[](int index);
-
- T value(int index) const;
- T value(int index, const T &defaultValue) const;
-
- T *extend(int size);
-
- void append(const T &value);
- void append(const T &value1, const T &value2);
- void append(const T &value1, const T &value2, const T &value3);
- void append(const T &value1, const T &value2, const T &value3, const T &value4);
- void append(const T *values, int count);
- void append(const QArray<T, PreallocSize> &other);
-
- void prepend(const T &value);
-
- void insert(int index, const T &value);
- void insert(int index, int count, const T &value);
- iterator insert(iterator before, int count, const T &value);
- iterator insert(iterator before, const T &value);
-
- void replace(int index, const T &value);
- void replace(int index, const T *values, int count);
-
- void remove(int index);
- void remove(int index, int count);
- void removeFirst() { remove(0); }
- void removeLast() { remove(size() - 1); }
-
- iterator erase(iterator begin, iterator end);
- iterator erase(iterator pos);
-
- int indexOf(const T &value, int from = 0) const;
- int lastIndexOf(const T &value, int from = -1) const;
- bool contains(const T &value) const;
- int count(const T &value) const;
-
- void resize(int size);
- void reserve(int size);
- void squeeze();
-
- QArray<T, PreallocSize> &fill(const T &value, int size = -1);
-
- void reverse();
- QArray<T, PreallocSize> reversed() const;
-
- QArray<T, PreallocSize> mid(int index, int length = -1) const;
- QArray<T, PreallocSize> left(int length) const;
- QArray<T, PreallocSize> right(int length) const;
-
- T *data();
- const T *data() const;
- const T *constData() const;
-
- static QArray<T, PreallocSize> fromRawData(const T *data, int size);
- static QArray<T, PreallocSize> fromWritableRawData(T *data, int size);
-
- bool operator==(const QArray<T, PreallocSize> &other) const;
- bool operator!=(const QArray<T, PreallocSize> &other) const;
-
- QArray<T, PreallocSize> &operator+=(const T &value);
- QArray<T, PreallocSize> &operator+=(const QArray<T, PreallocSize> &other);
- QArray<T, PreallocSize> &operator<<(const T &value);
- QArray<T, PreallocSize> &operator<<(const QArray<T, PreallocSize> &other);
-
- typedef iterator Iterator;
- typedef const_iterator ConstIterator;
- typedef T value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type &reference;
- typedef const value_type &const_reference;
- typedef ptrdiff_t difference_type;
- typedef int size_type;
-
- inline iterator begin() { return data(); }
- inline const_iterator begin() const { return constData(); }
- inline const_iterator constBegin() const { return constData(); }
- inline iterator end() { return data() + size(); }
- inline const_iterator end() const { return constData() + size(); }
- inline const_iterator constEnd() const { return constData() + size(); }
-
- inline T &first() { Q_ASSERT(!isEmpty()); return *begin(); }
- inline const T &first() const { Q_ASSERT(!isEmpty()); return *begin(); }
- inline T &last() { Q_ASSERT(!isEmpty()); return *(end()-1); }
- inline const T &last() const { Q_ASSERT(!isEmpty()); return *(end()-1); }
- inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; }
- inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; }
-
- inline void push_back(const T &value) { append(value); }
- inline void push_front(const T &value) { prepend(value); }
- inline void pop_back() { Q_ASSERT(!isEmpty()); removeLast(); }
- inline void pop_front() { Q_ASSERT(!isEmpty()); removeFirst(); }
- inline bool empty() const { return isEmpty(); }
- inline reference front() { return first(); }
- inline const_reference front() const { return first(); }
- inline reference back() { return last(); }
- inline const_reference back() const { return last(); }
-
-private:
- struct Data
- {
- QBasicAtomicInt ref;
- int capacity;
- T array[1];
- };
-
- // Invariants:
- // 1. If the data is not shared, then the usual condition is
- // for m_limit >= m_end.
- // 2. If the data is shared, then m_limit == m_start.
- // This triggers the range check in append() to call grow(),
- // which will copy-on-write. It also triggers the detach
- // check in data() and operator[] to cause a copy-on-write.
- // 3. If the data is not shared, but previously was, then
- // m_limit == m_start. This will trigger grow() or
- // detach(), which may then notice that it doesn't have to
- // copy-on-write. In that case, m_limit is set back
- // to m_start + m_data->capacity.
- // 4. If m_data is null, then m_start is either the same as
- // m_prealloc, or it points at raw data (const or non-const).
- // 5. If the array contains const raw data, then m_limit will
- // be set to m_start to force copy-on-write.
- T *m_start;
- T *m_end;
- mutable T *m_limit;
- Data *m_data;
-
- inline void initPrealloc()
- {
- m_end = m_start = QArrayData<T, PreallocSize>::prealloc();
- m_limit = m_start + PreallocSize;
- }
-
- QArray(const T *data, int size, bool isWritable);
-
- void free(T *data, int count);
- void release();
- void copyReplace(T *dst, const T *src, int count);
- Data *copyData(const T *src, int size, int capacity);
- void reallocate(int capacity);
- void detach_helper();
- void assign(const QArray<T, PreallocSize> &other);
- void grow(int needed);
- void setSize(int size);
-};
-
-int Q_QT3D_EXPORT qArrayAllocMore(int alloc, int extra, int sizeOfT);
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::free(T *data, int count)
-{
- while (count-- > 0) {
- data->~T();
- ++data;
- }
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::release()
-{
- if (m_data) {
- if (!m_data->ref.deref()) {
- if (QTypeInfo<T>::isComplex)
- free(m_start, m_end - m_start);
- qFree(m_data);
- }
- } else if (this->isPrealloc(m_start)) {
- if (QTypeInfo<T>::isComplex)
- free(m_start, m_end - m_start);
- }
-}
-
-// Copy values to initialized memory, replacing previous values.
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::copyReplace(T *dst, const T *src, int count)
-{
- if (!QTypeInfo<T>::isStatic) {
- ::memmove(dst, src, count * sizeof(T));
- } else {
- while (count-- > 0)
- *dst++ = *src++;
- }
-}
-
-// Make a copy of m_data, while remaining exception-safe.
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE Q_TYPENAME QArray<T, PreallocSize>::Data *QArray<T, PreallocSize>::copyData(const T *src, int size, int capacity)
-{
- Data *data = reinterpret_cast<Data *>
- (qMalloc(sizeof(Data) + sizeof(T) * (capacity - 1)));
- Q_CHECK_PTR(data);
- data->ref = 1;
- data->capacity = capacity;
- T *dst = data->array;
- int copied = 0;
- QT_TRY {
- while (copied < size) {
- new (dst) T(*src++);
- ++dst;
- ++copied;
- }
- } QT_CATCH(...) {
- while (copied-- > 0)
- (--dst)->~T();
- qFree(data);
- QT_RETHROW;
- }
- return data;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::reallocate(int capacity)
-{
- int size = m_end - m_start;
- if (!QTypeInfo<T>::isStatic) {
- Data *data = reinterpret_cast<Data *>
- (qRealloc(m_data, sizeof(Data) + sizeof(T) * (capacity - 1)));
- Q_CHECK_PTR(data);
- data->capacity = capacity;
- m_data = data;
- } else {
- Data *data = copyData(m_data->array, size, capacity);
- free(m_data->array, size);
- qFree(m_data);
- m_data = data;
- }
- m_start = m_data->array;
- m_end = m_start + size;
- m_limit = m_start + capacity;
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::detach_helper()
-{
- // If the reference count is 1, then the array may have been
- // copied and then the copy released. So just reset the limit.
- if (m_data && m_data->ref == 1) {
- m_limit = m_start + m_data->capacity;
- return;
- }
-
- // Allocate a new block on the heap and copy the data across.
- int size = m_end - m_start;
- int capacity = qArrayAllocMore(size, 0, sizeof(T));
- m_data = copyData(m_start, size, capacity);
-
- // Update the start/end/append pointers for faster updates.
- m_start = m_data->array;
- m_end = m_start + size;
- m_limit = m_start + capacity;
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::assign(const QArray<T, PreallocSize> &other)
-{
- if (other.m_data) {
- m_start = other.m_start;
- m_end = other.m_end;
- m_data = other.m_data;
- m_data->ref.ref();
-
- // We set the append limit of both objects to m_start, which forces
- // the next append() or data() in either object to copy-on-write.
- other.m_limit = m_limit = m_start;
- } else if (other.isPrealloc(other.m_start)) {
- // Make a deep copy of preallocated data.
- initPrealloc();
- m_data = 0;
- append(other.constData(), other.size());
- } else {
- // Shallow copy of raw data.
- m_start = other.m_start;
- m_end = other.m_end;
- m_limit = other.m_limit;
- m_data = 0;
- }
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::grow(int needed)
-{
- int size = m_end - m_start;
- int capacity = qArrayAllocMore(size, needed, sizeof(T));
- if (!m_data || m_data->ref != 1) {
- // Copy preallocated, raw, or shared data and expand the capacity.
- Data *data = copyData(m_start, size, capacity);
- if (this->isPrealloc(m_start))
- free(m_start, size);
- if (m_data)
- m_data->ref.deref();
- m_data = data;
- m_start = data->array;
- m_end = m_start + size;
- m_limit = m_start + capacity;
- } else if ((size + needed) > m_data->capacity) {
- // Reallocate to create more capacity.
- reallocate(capacity);
- } else {
- // We have enough capacity - just fix the append limit.
- // This can happen when an array is copied and then the
- // copy is removed.
- m_limit = m_start + m_data->capacity;
- }
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::setSize(int size)
-{
- if (size <= PreallocSize) {
- initPrealloc();
- m_data = 0;
- } else {
- int capacity = qArrayAllocMore(size, 0, sizeof(T));
- Data *data = reinterpret_cast<Data *>
- (qMalloc(sizeof(Data) + sizeof(T) * (capacity - 1)));
- Q_CHECK_PTR(data);
- m_data = data;
- m_data->ref = 1;
- m_data->capacity = capacity;
- m_start = m_data->array;
- m_end = m_start;
- m_limit = m_start + capacity;
- }
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize>::QArray()
-{
- initPrealloc();
- m_data = 0;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize>::QArray(int size)
-{
- setSize(size);
- while (size-- > 0)
- new (m_end++) T();
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize>::QArray(int size, const T &value)
-{
- setSize(size);
- while (size-- > 0)
- new (m_end++) T(value);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize>::QArray(const T *values, int size)
-{
- setSize(size);
- while (size-- > 0)
- new (m_end++) T(*values++);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize>::QArray(const QArray<T, PreallocSize> &other)
-{
- assign(other);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize>::QArray(const T *data, int size, bool isWritable)
-{
- // Constructing a raw data array.
- m_start = const_cast<T *>(data);
- m_end = m_start + size;
- if (isWritable)
- m_limit = m_end;
- else
- m_limit = m_start;
- m_data = 0;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize>::~QArray()
-{
- release();
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> &QArray<T, PreallocSize>::operator=(const QArray<T, PreallocSize> &other)
-{
- if (this == &other)
- return *this;
- if (other.m_data && m_data == other.m_data)
- return *this;
- release();
- assign(other);
- return *this;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE int QArray<T, PreallocSize>::size() const
-{
- return m_end - m_start;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE int QArray<T, PreallocSize>::count() const
-{
- return m_end - m_start;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE int QArray<T, PreallocSize>::capacity() const
-{
- if (m_data)
- return m_data->capacity;
- else if (this->isPrealloc(m_start))
- return PreallocSize;
- else
- return m_end - m_start; // raw data, m_limit == m_start
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE bool QArray<T, PreallocSize>::isEmpty() const
-{
- return m_start == m_end;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE bool QArray<T, PreallocSize>::isDetached() const
-{
- // If m_limit is the same as m_start, then the array
- // is either shared or contains raw data.
- return m_limit != m_start;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::detach()
-{
- if (m_limit == m_start)
- detach_helper();
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::clear()
-{
- release();
- initPrealloc();
- m_data = 0;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE const T &QArray<T, PreallocSize>::operator[](int index) const
-{
- Q_ASSERT_X(index >= 0 && index < size(),
- "QArray<T>::at", "index out of range");
- return m_start[index];
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE const T &QArray<T, PreallocSize>::at(int index) const
-{
- Q_ASSERT_X(index >= 0 && index < size(),
- "QArray<T>::operator[]", "index out of range");
- return m_start[index];
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE T &QArray<T, PreallocSize>::operator[](int index)
-{
- Q_ASSERT_X(index >= 0 && index < size(),
- "QArray<T>::operator[]", "index out of range");
- return data()[index];
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE T QArray<T, PreallocSize>::value(int index) const
-{
- if (index >= 0 && index < size())
- return m_start[index];
- else
- return T();
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE T QArray<T, PreallocSize>::value(int index, const T &defaultValue) const
-{
- if (index >= 0 && index < size())
- return m_start[index];
- else
- return defaultValue;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE T *QArray<T, PreallocSize>::extend(int size)
-{
- Q_ASSERT(size > 0);
- if ((m_end + size) >= m_limit)
- grow(size);
- T *end = m_end;
- m_end += size; // Note: new elements are not initialized.
- return end;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::append(const T &value)
-{
- if (m_end >= m_limit)
- grow(1);
- new (m_end) T(value);
- ++m_end;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::append(const T &value1, const T &value2)
-{
- if ((m_end + 1) >= m_limit)
- grow(2);
- new (m_end) T(value1);
- ++m_end; // Increment one at a time in case an exception is thrown.
- new (m_end) T(value2);
- ++m_end;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::append(const T &value1, const T &value2, const T &value3)
-{
- if ((m_end + 2) >= m_limit)
- grow(3);
- new (m_end) T(value1);
- ++m_end;
- new (m_end) T(value2);
- ++m_end;
- new (m_end) T(value3);
- ++m_end;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::append(const T &value1, const T &value2, const T &value3, const T &value4)
-{
- if ((m_end + 3) >= m_limit)
- grow(4);
- new (m_end) T(value1);
- ++m_end;
- new (m_end) T(value2);
- ++m_end;
- new (m_end) T(value3);
- ++m_end;
- new (m_end) T(value4);
- ++m_end;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::append(const T *values, int count)
-{
- if (count <= 0)
- return;
- if (!m_start || (m_end + count) > m_limit)
- grow(count);
- while (count-- > 0) {
- new (m_end) T(*values++);
- ++m_end;
- }
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::append(const QArray<T, PreallocSize> &other)
-{
- if (isEmpty()) {
- *this = other;
- } else {
- if (&other == this || (m_data && other.m_data == m_data))
- grow(size()); // Appending to ourselves: make some room.
- append(other.constData(), other.size());
- }
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::prepend(const T &value)
-{
- insert(begin(), 1, value);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::insert(int index, const T &value)
-{
- Q_ASSERT_X(index >= 0 && index <= size(),
- "QArray<T>::insert", "index out of range");
- insert(begin() + index, 1, value);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::insert(int index, int count, const T &value)
-{
- Q_ASSERT_X(index >= 0 && index <= size(),
- "QArray<T>::insert", "index out of range");
- insert(begin() + index, count, value);
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE Q_TYPENAME QArray<T, PreallocSize>::iterator QArray<T, PreallocSize>::insert(iterator before, int count, const T &value)
-{
- // Check the parameters.
- int size = this->size();
- int offset = int(before - m_start);
- Q_ASSERT_X(offset >= 0 && offset <= size,
- "QArray<T>::insert", "iterator offset is out of range");
- Q_ASSERT(count >= 0);
- if (count <= 0)
- return m_start + offset;
-
- // Reserve extra space and then copy-on-write.
- reserve(size + count);
- detach();
-
- // Move items up to make room, and replace at the insert point.
- if (QTypeInfo<T>::isStatic) {
- int newcount = count;
- while (newcount > 0) {
- new (m_end++) T();
- --newcount;
- }
- int posn = size;
- while (posn > offset) {
- --posn;
- m_start[posn + count] = m_start[posn];
- }
- while (count > 0) {
- --count;
- m_start[offset + count] = value;
- }
- } else {
- ::memmove(m_start + offset + count, m_start + offset,
- (size - offset) * sizeof(T));
- m_end += count;
- while (count > 0) {
- --count;
- new (m_start + offset + count) T(value);
- }
- }
-
- // Return the new iterator at the insert position.
- return m_start + offset;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE Q_TYPENAME QArray<T, PreallocSize>::iterator QArray<T, PreallocSize>::insert(iterator before, const T &value)
-{
- return insert(before, 1, value);
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::replace(int index, const T &value)
-{
- Q_ASSERT_X(index >= 0 && index < size(),
- "QArray<T>::replace", "index out of range");
- data()[index] = value;
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::replace(int index, const T *values, int count)
-{
- if (index < 0 || count <= 0)
- return;
- int replaceSize = index + count;
- if (replaceSize > size())
- resize(replaceSize);
- copyReplace(data() + index, values, count);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::remove(int index)
-{
- remove(index, 1);
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::remove(int index, int count)
-{
- // Truncate the range to be removed.
- int currentSize = size();
- if (index < 0) {
- count += index;
- index = 0;
- }
- if (count > 0 && (index + count) > currentSize)
- count = currentSize - index;
- if (count <= 0)
- return;
-
- // Perform the removal.
- if (index == 0 && count >= currentSize) {
- clear();
- return;
- }
- T *start = data();
- copyReplace(start + index, start + index + count,
- (currentSize - (index + count)));
- resize(currentSize - count);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE Q_TYPENAME QArray<T, PreallocSize>::iterator QArray<T, PreallocSize>::erase(iterator begin, iterator end)
-{
- int index = begin - m_start;
- remove(index, end - begin);
- return m_start + index;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE Q_TYPENAME QArray<T, PreallocSize>::iterator QArray<T, PreallocSize>::erase(iterator pos)
-{
- int index = pos - m_start;
- remove(index, 1);
- return m_start + index;
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE int QArray<T, PreallocSize>::indexOf(const T &value, int from) const
-{
- if (from < 0)
- from = qMax(from + size(), 0);
- const T *ptr = m_start + from;
- while (ptr < m_end) {
- if (*ptr == value)
- return ptr - m_start;
- ++ptr;
- }
- return -1;
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE int QArray<T, PreallocSize>::lastIndexOf(const T &value, int from) const
-{
- int size = count();
- if (from < 0)
- from += size;
- else if (from >= size)
- from = size - 1;
- if (from >= 0) {
- const T *ptr = m_start + from;
- while (ptr >= m_start) {
- if (*ptr == value)
- return ptr - m_start;
- --ptr;
- }
- }
- return -1;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE bool QArray<T, PreallocSize>::contains(const T &value) const
-{
- const T *ptr = m_start;
- while (ptr < m_end) {
- if (*ptr == value)
- return true;
- ++ptr;
- }
- return false;
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE int QArray<T, PreallocSize>::count(const T &value) const
-{
- const T *ptr = m_start;
- int count = 0;
- while (ptr < m_end) {
- if (*ptr == value)
- ++count;
- ++ptr;
- }
- return count;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::resize(int size)
-{
- if (size < 0)
- return;
- int currentSize = count();
- if (size < currentSize) {
- T *start = data(); // Force copy on write if necessary.
- if (QTypeInfo<T>::isComplex)
- free(start + size, currentSize - size);
- m_end = start + size;
- } else if (size > currentSize) {
- grow(size - currentSize);
- while (currentSize++ < size) {
- new (m_end) T();
- ++m_end;
- }
- }
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE void QArray<T, PreallocSize>::reserve(int size)
-{
- int cap = capacity();
- if (size > cap)
- grow(size - this->size());
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE QArray<T, PreallocSize> &QArray<T, PreallocSize>::fill(const T &value, int size)
-{
- if (size >= 0)
- resize(size);
- T *ptr = m_start;
- while (ptr < m_end)
- *ptr++ = value;
- return *this;
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::squeeze()
-{
- int size = count();
- if (size <= 0) {
- clear();
- } else if (size < capacity() && m_data) {
- reallocate(size);
- }
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE void QArray<T, PreallocSize>::reverse()
-{
- if (count() > 0) {
- T *src = m_start;
- T *dst = m_end - 1;
- while (src < dst)
- qSwap(*(dst--), *(src++));
- }
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE QArray<T, PreallocSize> QArray<T, PreallocSize>::reversed() const
-{
- QArray<T, PreallocSize> result;
- int count = size();
- if (count > 0) {
- result.extend(count);
- const T *src = m_start;
- T *dst = result.m_end - 1;
- if (!QTypeInfo<T>::isComplex) {
- while (src != m_end)
- *(dst--) = *(src++);
- } else {
- while (src != m_end)
- new (dst--) T(*src++);
- }
- }
- return result;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> QArray<T, PreallocSize>::mid(int index, int length) const
-{
- int count = size();
- Q_ASSERT(index >= 0 && index <= count);
- if (length < 0 || (index + length) > count)
- length = count - index;
- if (index == 0 && length == count)
- return *this;
- QArray<T, PreallocSize> result;
- result.append(constData() + index, length);
- return result;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> QArray<T, PreallocSize>::left(int length) const
-{
- return mid(0, length);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> QArray<T, PreallocSize>::right(int length) const
-{
- int size = count();
- if (length < 0 || length >= size)
- length = size;
- return mid(size - length, length);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE T *QArray<T, PreallocSize>::data()
-{
- detach();
- return m_start;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE const T *QArray<T, PreallocSize>::data() const
-{
- return m_start;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE const T *QArray<T, PreallocSize>::constData() const
-{
- return m_start;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> QArray<T, PreallocSize>::fromRawData(const T *data, int size)
-{
- Q_ASSERT(size >= 0);
- return QArray<T, PreallocSize>(data, size, false);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> QArray<T, PreallocSize>::fromWritableRawData(T *data, int size)
-{
- Q_ASSERT(size >= 0);
- return QArray<T, PreallocSize>(data, size, true);
-}
-
-template <typename T, int PreallocSize>
-Q_OUTOFLINE_TEMPLATE bool QArray<T, PreallocSize>::operator==
- (const QArray<T, PreallocSize> &other) const
-{
- if (this == &other)
- return true;
- const T *thisData = constData();
- const T *otherData = other.constData();
- if (thisData == otherData)
- return true;
- int thisCount = count();
- int otherCount = other.count();
- if (thisCount == 0 && otherCount == 0)
- return true;
- if (thisCount != otherCount)
- return false;
- for (int index = 0; index < thisCount; ++index, ++thisData, ++otherData)
- if (*thisData != *otherData)
- return false;
- return true;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE bool QArray<T, PreallocSize>::operator!=
- (const QArray<T, PreallocSize> &other) const
-{
- return !(*this == other);
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> &QArray<T, PreallocSize>::operator+=(const T &value)
-{
- append(value);
- return *this;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> &QArray<T, PreallocSize>::operator+=(const QArray<T, PreallocSize> &other)
-{
- append(other);
- return *this;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> &QArray<T, PreallocSize>::operator<<(const T &value)
-{
- append(value);
- return *this;
-}
-
-template <typename T, int PreallocSize>
-Q_INLINE_TEMPLATE QArray<T, PreallocSize> &QArray<T, PreallocSize>::operator<<(const QArray<T, PreallocSize> &other)
-{
- append(other);
- return *this;
-}
-
-#ifndef QT_NO_DATASTREAM
-
-template <typename T, int PreallocSize>
-QDataStream& operator<<(QDataStream& stream, const QArray<T, PreallocSize>& array)
-{
- int size = array.size();
- stream << quint32(size);
- for (int index = 0; index < size; ++index)
- stream << array.at(index);
- return stream;
-}
-
-template <typename T, int PreallocSize>
-QDataStream& operator>>(QDataStream& stream, QArray<T, PreallocSize>& array)
-{
- array.clear();
- quint32 size;
- stream >> size;
- array.reserve(size);
- for (int index = 0; index < int(size); ++index) {
- T t;
- stream >> t;
- array.append(t);
- if (stream.atEnd())
- break;
- }
- return stream;
-}
-
-#endif
-
-#ifndef QT_NO_DEBUG_STREAM
-
-template <typename T, int PreallocSize>
-QDebug operator<<(QDebug dbg, const QArray<T, PreallocSize>& array)
-{
- dbg.nospace() << "QArray(\n";
- int size = array.size();
- for (int index = 0; index < size; ++index) {
- dbg << " " << index << ": " << array.at(index) << "\n";
- }
- dbg << ")\n";
- return dbg.space();
-}
-
-#endif
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qcolor4ub.cpp b/src/threed/arrays/qcolor4ub.cpp
deleted file mode 100644
index a27193cb..00000000
--- a/src/threed/arrays/qcolor4ub.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcolor4ub.h"
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QColor4ub
- \brief The QColor4ub class represents a color by four unsigned byte components.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- OpenGL applications commonly use four unsigned byte values to compactly
- represent a color value. QColor4ub provides a convenience
- class for manipulating such compact color values.
-
- An alternative is to represent a color value as four floating-point
- values between 0.0 and 1.0. The QVector4D class can be used for
- that purpose if required.
-*/
-
-/*!
- \fn QColor4ub::QColor4ub()
-
- Constructs a four-byte default color value of (0, 0, 0, 255).
-*/
-
-/*!
- \fn QColor4ub::QColor4ub(int red, int green, int blue, int alpha)
-
- Constructs a four-byte color value with the components \a red,
- \a green, \a blue, and \a alpha.
-*/
-
-/*!
- \fn QColor4ub::QColor4ub(const QColor& color)
-
- Constructs a four-byte color value from \a color.
-*/
-
-/*!
- \fn QColor4ub::QColor4ub(Qt::GlobalColor color)
-
- Constructs a four-byte color value from \a color.
-*/
-
-/*!
- \fn QColor4ub::QColor4ub(QRgb rgba)
-
- Constructs a four-byte color value from the red, green, blue, and
- alpha components of \a rgba.
-*/
-
-/*!
- \fn QColor4ub& QColor4ub::operator=(const QColor& color)
-
- Copies the red, green, blue, and alpha components of \a color
- into this object.
-*/
-
-/*!
- \fn QColor4ub& QColor4ub::operator=(Qt::GlobalColor color)
-
- Copies the red, green, blue, and alpha components of the
- specified global \a color name into this object.
-*/
-
-/*!
- \fn int QColor4ub::red() const
-
- Returns the red component of this color, between 0 and 255.
-
- \sa green(), blue(), alpha(), setRed(), redF()
-*/
-
-/*!
- \fn int QColor4ub::green() const
-
- Returns the green component of this color, between 0 and 255.
-
- \sa red(), blue(), alpha(), setGreen(), greenF()
-*/
-
-/*!
- \fn int QColor4ub::blue() const
-
- Returns the blue component of this color, between 0 and 255.
-
- \sa red(), green(), alpha(), setBlue(), blueF()
-*/
-
-/*!
- \fn int QColor4ub::alpha() const
-
- Returns the alpha component of this color, between 0 and 255.
-
- \sa red(), green(), blue(), setAlpha(), alphaF()
-*/
-
-/*!
- \fn void QColor4ub::setRed(int value)
-
- Sets the red component of this color to \a value, between 0 and 255.
-
- \sa setGreen(), setBlue(), setAlpha(), red(), setRedF()
-*/
-
-/*!
- \fn void QColor4ub::setGreen(int value)
-
- Sets the green component of this color to \a value, between 0 and 255.
-
- \sa setRed(), setBlue(), setAlpha(), green(), setGreenF()
-*/
-
-/*!
- \fn void QColor4ub::setBlue(int value)
-
- Sets the blue component of this color to \a value, between 0 and 255.
-
- \sa setRed(), setGreen(), setAlpha(), blue(), setBlueF()
-*/
-
-/*!
- \fn void QColor4ub::setAlpha(int value)
-
- Sets the alpha component of this color to \a value, between 0 and 255.
-
- \sa setRed(), setGreen(), setBlue(), alpha(), setAlphaF()
-*/
-
-/*!
- \fn qreal QColor4ub::redF() const { return m_red / 255.0f; }
-
- Returns the red component of this color as a floating-point
- value between 0 and 1.
-
- \sa greenF(), blueF(), alphaF(), setRedF(), red()
-*/
-
-/*!
- \fn qreal QColor4ub::greenF() const { return m_green / 255.0f; }
-
- Returns the green component of this color as a floating-point
- value between 0 and 1.
-
- \sa redF(), blueF(), alphaF(), setGreenF(), green()
-*/
-
-/*!
- \fn qreal QColor4ub::blueF() const { return m_blue / 255.0f; }
-
- Returns the blue component of this color as a floating-point
- value between 0 and 1.
-
- \sa redF(), greenF(), alphaF(), setBlueF(), blue()
-*/
-
-/*!
- \fn qreal QColor4ub::alphaF() const { return m_alpha / 255.0f; }
-
- Returns the alpha component of this color as a floating-point
- value between 0 and 1.
-
- \sa redF(), greenF(), blueF(), setAlphaF(), alpha()
-*/
-
-/*!
- \fn void QColor4ub::setRedF(qreal value)
-
- Sets the red component of this color to a floating-point \a value,
- between 0 and 1.
-
- \sa setGreenF(), setBlueF(), setAlphaF(), redF(), setRed()
-*/
-
-/*!
- \fn void QColor4ub::setGreenF(qreal value)
-
- Sets the green component of this color to a floating-point \a value,
- between 0 and 1.
-
- \sa setRedF(), setBlueF(), setAlphaF(), greenF(), setGreen()
-*/
-
-/*!
- \fn void QColor4ub::setBlueF(qreal value)
-
- Sets the blue component of this color to a floating-point \a value,
- between 0 and 1.
-
- \sa setRedF(), setGreenF(), setAlphaF(), blueF(), setBlue()
-*/
-
-/*!
- \fn void QColor4ub::setAlphaF(qreal value)
-
- Sets the alpha component of this color to a floating-point \a value,
- between 0 and 1.
-
- \sa setRedF(), setGreenF(), setBlueF(), alphaF(), setAlpha()
-*/
-
-/*!
- \fn void QColor4ub::setRgb(int red, int green, int blue, int alpha)
-
- Sets the components of this color to \a red, \a green, \a blue,
- and \a alpha. Each component is between 0 and 255.
-
- \sa setRgbF(), fromRgb()
-*/
-
-/*!
- \fn void QColor4ub::setRgbF(qreal red, qreal green, qreal blue, qreal alpha)
-
- Sets the components of this color to \a red, \a green, \a blue,
- and \a alpha. Each component is a floating-point value between 0 and 1.
-
- \sa setRgb(), fromRgbF()
-*/
-
-/*!
- \fn QColor4ub QColor4ub::fromRgb(int red, int green, int blue, int alpha)
-
- Returns a QColor4ub with the components \a red, \a green, \a blue,
- and \a alpha. Each component is between 0 and 255.
-
- \sa fromRgbF(), setRgb()
-*/
-
-/*!
- \fn QColor4ub QColor4ub::fromRgbF(qreal red, qreal green, qreal blue, qreal alpha)
-
- Returns a QColor4ub with the components \a red, \a green, \a blue,
- and \a alpha. Each component is a floating-point value between 0 and 1.
-
- \sa fromRgb(), setRgbF()
-*/
-
-/*!
- \fn QColor4ub QColor4ub::fromRaw(const uchar *data)
-
- Returns a QColor4ub with components from the first four elements
- in \a data. The \a data parameter must contain at least four
- elements and not be null.
-*/
-
-/*!
- \fn QColor QColor4ub::toColor() const
-
- Returns this color as a QColor.
-*/
-
-/*!
- \fn bool QColor4ub::operator==(const QColor4ub& other) const
-
- Returns true if this color is the same as \a other; false otherwise.
-*/
-
-/*!
- \fn bool QColor4ub::operator!=(const QColor4ub& other) const
-
- Returns true if this color is not the same as \a other; false otherwise.
-*/
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QColor4ub &color)
-{
- dbg.nospace() << "QColor4ub("
- << color.redF() << ", " << color.greenF() << ", "
- << color.blueF() << ", " << color.alphaF() << ')';
- return dbg.space();
-}
-
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qcolor4ub.h b/src/threed/arrays/qcolor4ub.h
deleted file mode 100644
index f306e6ab..00000000
--- a/src/threed/arrays/qcolor4ub.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCOLOR4UB_H
-#define QCOLOR4UB_H
-
-#include "qt3dglobal.h"
-#include <QtGui/qcolor.h>
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class Q_QT3D_EXPORT QColor4ub
-{
-public:
- QColor4ub();
- QColor4ub(int red, int green, int blue, int alpha = 255);
- QColor4ub(const QColor& color);
- QColor4ub(Qt::GlobalColor color);
- QColor4ub(QRgb rgba);
-
- QColor4ub& operator=(const QColor& color);
- QColor4ub& operator=(Qt::GlobalColor color);
-
- int red() const { return m_red; }
- int green() const { return m_green; }
- int blue() const { return m_blue; }
- int alpha() const { return m_alpha; }
-
- void setRed(int value) { m_red = uchar(value); }
- void setGreen(int value) { m_green = uchar(value); }
- void setBlue(int value) { m_blue = uchar(value); }
- void setAlpha(int value) { m_alpha = uchar(value); }
-
- qreal redF() const { return m_red / 255.0f; }
- qreal greenF() const { return m_green / 255.0f; }
- qreal blueF() const { return m_blue / 255.0f; }
- qreal alphaF() const { return m_alpha / 255.0f; }
-
- void setRedF(qreal value) { m_red = uchar(qRound(value * 255.0f)); }
- void setGreenF(qreal value) { m_green = uchar(qRound(value * 255.0f)); }
- void setBlueF(qreal value) { m_blue = uchar(qRound(value * 255.0f)); }
- void setAlphaF(qreal value) { m_alpha = uchar(qRound(value * 255.0f)); }
-
- void setRgb(int red, int green, int blue, int alpha = 255);
- void setRgbF(qreal red, qreal green, qreal blue, qreal alpha = 1.0f);
-
- static QColor4ub fromRgb(int red, int green, int blue, int alpha = 255);
- static QColor4ub fromRgbF
- (qreal red, qreal green, qreal blue, qreal alpha = 1.0f);
- static QColor4ub fromRaw(const uchar *data);
-
- QColor toColor() const;
-
- bool operator==(const QColor4ub& other) const;
- bool operator!=(const QColor4ub& other) const;
-
-private:
- QColor4ub(const uchar *data);
-
- uchar m_red;
- uchar m_green;
- uchar m_blue;
- uchar m_alpha;
-};
-
-inline QColor4ub::QColor4ub() : m_red(0), m_green(0), m_blue(0), m_alpha(255) {}
-
-inline QColor4ub::QColor4ub(int red, int green, int blue, int alpha)
- : m_red(uchar(red)), m_green(uchar(green)),
- m_blue(uchar(blue)), m_alpha(uchar(alpha)) {}
-
-inline QColor4ub::QColor4ub(const QColor& color)
- : m_red(uchar(color.red())), m_green(uchar(color.green())),
- m_blue(uchar(color.blue())), m_alpha(uchar(color.alpha())) {}
-
-inline QColor4ub::QColor4ub(Qt::GlobalColor color)
-{
- QColor c(color);
- m_red = uchar(c.red());
- m_green = uchar(c.green());
- m_blue = uchar(c.blue());
- m_alpha = uchar(c.alpha());
-}
-
-inline QColor4ub::QColor4ub(QRgb rgba)
- : m_red(uchar(qRed(rgba))), m_green(uchar(qGreen(rgba))),
- m_blue(uchar(qBlue(rgba))), m_alpha(uchar(qAlpha(rgba))) {}
-
-inline QColor4ub::QColor4ub(const uchar *data)
- : m_red(data[0]), m_green(data[1]), m_blue(data[2]), m_alpha(data[3]) {}
-
-inline QColor4ub& QColor4ub::operator=(const QColor& color)
-{
- m_red = uchar(color.red());
- m_green = uchar(color.green());
- m_blue = uchar(color.blue());
- m_alpha = uchar(color.alpha());
- return *this;
-}
-
-inline QColor4ub& QColor4ub::operator=(Qt::GlobalColor color)
-{
- QColor c(color);
- m_red = uchar(c.red());
- m_green = uchar(c.green());
- m_blue = uchar(c.blue());
- m_alpha = uchar(c.alpha());
- return *this;
-}
-
-inline void QColor4ub::setRgb(int red, int green, int blue, int alpha)
-{
- m_red = uchar(red);
- m_green = uchar(green);
- m_blue = uchar(blue);
- m_alpha = uchar(alpha);
-}
-
-inline void QColor4ub::setRgbF(qreal red, qreal green, qreal blue, qreal alpha)
-{
- m_red = uchar(qRound(red * 255.0f));
- m_green = uchar(qRound(green * 255.0f));
- m_blue = uchar(qRound(blue * 255.0f));
- m_alpha = uchar(qRound(alpha * 255.0f));
-}
-
-inline QColor4ub QColor4ub::fromRgb(int red, int green, int blue, int alpha)
-{
- return QColor4ub(red, green, blue, alpha);
-}
-
-inline QColor4ub QColor4ub::fromRgbF
- (qreal red, qreal green, qreal blue, qreal alpha)
-{
- return QColor4ub(qRound(red * 255.0f), qRound(green * 255.0f),
- qRound(blue * 255.0f), qRound(alpha * 255.0f));
-}
-
-inline QColor4ub QColor4ub::fromRaw(const uchar *data)
-{
- return QColor4ub(data);
-}
-
-inline QColor QColor4ub::toColor() const
-{
- return QColor(m_red, m_green, m_blue, m_alpha);
-}
-
-inline bool QColor4ub::operator==(const QColor4ub& other) const
-{
- return m_red == other.m_red && m_green == other.m_green &&
- m_blue == other.m_blue && m_alpha == other.m_alpha;
-}
-
-inline bool QColor4ub::operator!=(const QColor4ub& other) const
-{
- return m_red != other.m_red || m_green != other.m_green ||
- m_blue != other.m_blue || m_alpha != other.m_alpha;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_QT3D_EXPORT QDebug operator<<(QDebug dbg, const QColor4ub &color);
-#endif
-
-Q_DECLARE_TYPEINFO(QColor4ub, Q_MOVABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QColor4ub)
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qcustomdataarray.cpp b/src/threed/arrays/qcustomdataarray.cpp
deleted file mode 100644
index aaacfe98..00000000
--- a/src/threed/arrays/qcustomdataarray.cpp
+++ /dev/null
@@ -1,909 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcustomdataarray.h"
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCustomDataArray
- \brief The QCustomDataArray class is a polymorphic array of data values suitable for use in 3D applications.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- QArray is an efficient storage mechanism for vertex attributes.
- However, there are some situations where the element type of a custom
- vertex attribute is not known until runtime. QCustomDataArray is
- intended for use in those situations. It has a small performance
- penalty compared to QArray to achieve polymorphism.
-
- The elements that may be stored in a QCustomDataArray are limited
- to a few types: float, QVector2D, QVector3D, QVector4D, and
- QColor4ub. This provides a reasonable range of efficient use
- cases without overloading the API. QArray can be used on
- any type, but is restricted to types that are known at compile time.
-
- Like QArray, QCustomDataArray uses implicit sharing and
- copy-on-write semantics to support passing large arrays around
- an application with little overhead.
-
- \sa QArray
-*/
-
-/*!
- \enum QCustomDataArray::ElementType
- This enum defines the element type within a QCustomDataArray.
-
- \value Float The elements are of type float.
- \value Vector2D The elements are of type QVector2D.
- \value Vector3D The elements are of type QVector3D.
- \value Vector4D The elements are of type QVector4D.
- \value Color The elements are of type QColor4ub, which consists of
- four unsigned bytes. To represent colors as four floating-point
- values, use Vector4D as the element type.
-*/
-
-/*!
- \fn QCustomDataArray::QCustomDataArray()
-
- Constructs an empty custom data array. The elementType() will
- initially be QCustomDataArray::Float, which can be changed with a
- call to setElementType() before the elements are appended.
-
- \sa setElementType(), append()
-*/
-
-/*!
- Constructs an empty custom data array with elements represented
- by the specified \a type.
-
- \sa setElementType()
-*/
-QCustomDataArray::QCustomDataArray(QCustomDataArray::ElementType type)
-{
- setElementType(type);
-}
-
-/*!
- Constructs an empty custom data array with elements represented
- by the specified \a type. The array is initially resized to \a size;
- filling all elements with zeroes.
-
- \sa setElementType(), resize()
-*/
-QCustomDataArray::QCustomDataArray(QCustomDataArray::ElementType type, int size)
-{
- setElementType(type);
- resize(size);
-}
-
-/*!
- \fn QCustomDataArray::QCustomDataArray(const QCustomDataArray& other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- Constructs a copy of the floating-point QArray \a other.
-
- The elementType() will be set to QCustomDataArray::Float.
-
- \sa toFloatArray()
-*/
-QCustomDataArray::QCustomDataArray(const QArray<float>& other)
- : m_array(other),
- m_elementType(QCustomDataArray::Float),
- m_elementComponents(1)
-{
-}
-
-/*!
- Constructs a copy of the 2D vector QArray \a other.
-
- The elementType() will be set to QCustomDataArray::Vector2D.
-
- This constructor needs to make a complete copy of the data
- in \a other so it may be expensive performance-wise.
-
- \sa toVector2DArray()
-*/
-QCustomDataArray::QCustomDataArray(const QArray<QVector2D>& other)
- : m_elementType(QCustomDataArray::Vector2D),
- m_elementComponents(2)
-{
- int size = other.size();
- if (size > 0) {
- const QVector2D *src = other.constData();
- float *dst = m_array.extend(size * 2);
- qMemCopy(dst, src, size * sizeof(QVector2D));
- }
-}
-
-/*!
- Constructs a copy of the 3D vector QArray \a other.
-
- The elementType() will be set to QCustomDataArray::Vector3D.
-
- This constructor needs to make a complete copy of the data
- in \a other so it may be expensive performance-wise.
-
- \sa toVector3DArray()
-*/
-QCustomDataArray::QCustomDataArray(const QArray<QVector3D>& other)
- : m_elementType(QCustomDataArray::Vector3D),
- m_elementComponents(3)
-{
- int size = other.size();
- if (size > 0) {
- const QVector3D *src = other.constData();
- float *dst = m_array.extend(size * 3);
- qMemCopy(dst, src, size * sizeof(QVector3D));
- }
-}
-
-/*!
- Constructs a copy of the 4D vector QArray \a other.
-
- The elementType() will be set to QCustomDataArray::Vector4D.
-
- This constructor needs to make a complete copy of the data
- in \a other so it may be expensive performance-wise.
-
- \sa toVector3DArray()
-*/
-QCustomDataArray::QCustomDataArray(const QArray<QVector4D>& other)
- : m_elementType(QCustomDataArray::Vector4D),
- m_elementComponents(4)
-{
- int size = other.size();
- if (size > 0) {
- const QVector4D *src = other.constData();
- float *dst = m_array.extend(size * 4);
- qMemCopy(dst, src, size * sizeof(QVector4D));
- }
-}
-
-/*!
- Constructs a copy of the color QArray \a other.
-
- The elementType() will be set to QCustomDataArray::Color.
-
- This constructor needs to make a complete copy of the data
- in \a other so it may be expensive performance-wise.
-
- \sa toColorArray()
-*/
-QCustomDataArray::QCustomDataArray(const QArray<QColor4ub>& other)
- : m_elementType(QCustomDataArray::Color),
- m_elementComponents(1)
-{
- int size = other.size();
- qMemCopy(m_array.extend(size), other.constData(), sizeof(QColor4ub) * size);
-}
-
-/*!
- \fn QCustomDataArray::~QCustomDataArray()
-
- Destroys this custom data array.
-*/
-
-/*!
- \fn QCustomDataArray& QCustomDataArray::operator=(const QCustomDataArray& other)
-
- Assigns \a other to this custom data array and returns a reference
- to this custom data array.
-
- The previous elementType() for this custom data array will be
- replaced with the type from \a other. The element data is assigned
- directly without conversion.
-*/
-
-/*!
- \fn QCustomDataArray::ElementType QCustomDataArray::elementType() const
-
- Returns the representation type of elements in this custom data array.
-
- \sa setElementType()
-*/
-
-/*!
- Sets the representation \a type of elements in this custom data array.
- The array must be empty to change the element type.
-
- \sa elementType(), append()
-*/
-void QCustomDataArray::setElementType(QCustomDataArray::ElementType type)
-{
- Q_ASSERT(m_array.isEmpty());
- m_elementType = type;
- switch (type) {
- case QCustomDataArray::Float:
- m_elementComponents = 1;
- break;
- case QCustomDataArray::Vector2D:
- m_elementComponents = 2;
- break;
- case QCustomDataArray::Vector3D:
- m_elementComponents = 3;
- break;
- case QCustomDataArray::Vector4D:
- m_elementComponents = 4;
- break;
- case QCustomDataArray::Color:
- m_elementComponents = 1; // 4 bytes packed into a float.
- break;
- default:
- Q_ASSERT_X(false, "QCustomDataArray::setElementType",
- "unknown element type");
- m_elementComponents = 1;
- break;
- }
-}
-
-/*!
- \fn int QCustomDataArray::size() const
-
- Returns the number of elements in this custom data array.
-
- \sa resize(), capacity(), isEmpty()
-*/
-
-/*!
- \fn int QCustomDataArray::count() const
-
- Same as size(); provided for convenience.
-*/
-
-/*!
- \fn int QCustomDataArray::capacity() const
-
- Returns the number of elements that can be stored in this
- custom data array before reallocation.
-
- \sa reserve(), size()
-*/
-
-/*!
- \fn bool QCustomDataArray::isEmpty() const
-
- Returns true if this data array is empty; false otherwise.
-
- \sa size(), clear()
-*/
-
-/*!
- \fn int QCustomDataArray::elementSize() const
-
- Returns the size of individual elements in this custom data
- array, in bytes. For example, the element size of an array
- containing QVector3D values will be 3 * sizeof(float),
- normally 12.
-
- \sa setElementType()
-*/
-
-/*!
- \fn void QCustomDataArray::clear()
-
- Clears all elements from this custom data array and sets the size to zero.
-
- This function will deallocate any memory that is used on the heap
- to store the custom data array's elements. To reuse the same memory
- as before, call resize() with an argument of zero.
-
- \sa resize(), isEmpty()
-*/
-
-/*!
- \fn void QCustomDataArray::resize(int size)
-
- Sets the size of the custom data array to \a size. If \a size is greater
- than the current size, elements are added to the end; the new elements
- are initialized with all-zeroes. If \a size is less than the current
- size, elements are removed from the end.
-
- \sa size(), reserve(), squeeze()
-*/
-
-/*!
- \fn void QCustomDataArray::reserve(int size)
-
- Increases the capacity of this custom data array to reserve space for
- at least \a size elements. If the capacity is already larger
- than \a size, this function does nothing; in particular, it does
- not remove elements from the array like resize() does.
-
- This function can be useful when you know how roughly many elements
- will be appended ahead of time. Reserving the space once can avoid
- unnecessary realloc operations later.
-
- \sa capacity(), resize(), squeeze()
-*/
-
-/*!
- \fn void QCustomDataArray::squeeze()
-
- Releases any memory not required to store the custom data array's
- elements by reducing its capacity() to size().
-
- This function is intended for reclaiming memory in a custom data
- array that is being used over and over with different contents.
- As elements are added to a custom data array, it will be constantly
- expanded in size. This function can realloc the custom data array
- to a smaller size to reclaim unused memory.
-
- \sa reserve(), capacity()
-*/
-
-/*!
- Returns the value of the element at \a index in this custom
- data array as a QVariant.
-
- Color elements are returned as a QVariant containing a
- QColor4ub, not a QColor.
-
- \sa setAt(), append(), floatAt(), vector2DAt(), vector3DAt()
- \sa vector4DAt(), colorAt()
-*/
-QVariant QCustomDataArray::at(int index) const
-{
- Q_ASSERT(index >= 0 && index < size());
-
- const float *data;
- switch (m_elementType) {
-
- case QCustomDataArray::Float:
- return QVariant(m_array.at(index));
-
- case QCustomDataArray::Vector2D:
- data = m_array.constData() + index * 2;
- return qVariantFromValue(QVector2D(data[0], data[1]));
-
- case QCustomDataArray::Vector3D:
- data = m_array.constData() + index * 3;
- return qVariantFromValue(QVector3D(data[0], data[1], data[2]));
-
- case QCustomDataArray::Vector4D:
- data = m_array.constData() + index * 4;
- return qVariantFromValue
- (QVector4D(data[0], data[1], data[2], data[3]));
-
- case QCustomDataArray::Color:
- data = m_array.constData() + index;
- return qVariantFromValue
- (QColor4ub::fromRaw(reinterpret_cast<const uchar *>(data)));
-
- default: break;
- }
- return QVariant();
-}
-
-/*!
- Sets the element at \a index in this custom data array to \a value.
-
- The type of \a value must be consistent with elementType().
- The two exceptions to this are that a Float value can be
- specified by either a float or double QVariant, and a Color
- value can be specified as either a QColor4ub or QColor QVariant.
-
- \sa at(), elementType()
-*/
-void QCustomDataArray::setAt(int index, const QVariant& value)
-{
- Q_ASSERT(index >= 0 && index < size());
-
- switch (value.type()) {
-
- case (QVariant::Type)QMetaType::Float:
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- m_array[index] = value.toFloat();
- break;
-
- case QVariant::Double:
- // Convert Double into Float.
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- m_array[index] = float(value.toDouble());
- break;
-
- case QVariant::Vector2D:
- Q_ASSERT(m_elementType == QCustomDataArray::Vector2D);
- *(reinterpret_cast<QVector2D *>(m_array.data() + index * 2))
- = qVariantValue<QVector2D>(value);
- break;
-
- case QVariant::Vector3D:
- Q_ASSERT(m_elementType == QCustomDataArray::Vector3D);
- *(reinterpret_cast<QVector3D *>(m_array.data() + index * 3))
- = qVariantValue<QVector3D>(value);
- break;
-
- case QVariant::Vector4D:
- Q_ASSERT(m_elementType == QCustomDataArray::Vector4D);
- *(reinterpret_cast<QVector4D *>(m_array.data() + index * 4))
- = qVariantValue<QVector4D>(value);
- break;
-
- case QVariant::Color:
- // Convert QColor into QColor4ub.
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- *(reinterpret_cast<QColor4ub *>(m_array.data() + index))
- = QColor4ub(qVariantValue<QColor>(value));
- break;
-
- case QVariant::UserType:
- if (value.userType() == qMetaTypeId<QColor4ub>()) {
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- *(reinterpret_cast<QColor4ub *>(m_array.data() + index))
- = qVariantValue<QColor4ub>(value);
- break;
- }
- // Fall through.
-
- default:
- Q_ASSERT_X(false, "QCustomDataArray::setAt",
- "QVariant type not supported for elements");
- break;
- }
-}
-
-/*!
- \fn void QCustomDataArray::setAt(int index, qreal x)
- \overload
-
- Sets the floating-point element at \a index in this custom data
- array to \a x. The elementType() must be QCustomDataArray::Float.
-
- \sa at(), elementType(), floatAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, qreal x, qreal y)
- \overload
-
- Sets the 2D vector element at \a index in this custom
- data array to (\a x, \a y). The elementType() must be
- QCustomDataArray::Vector2D.
-
- \sa at(), elementType(), vector2DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, qreal x, qreal y, qreal z)
- \overload
-
- Sets the 3D vector element at \a index in this custom
- data array to (\a x, \a y, \a z). The elementType() must be
- QCustomDataArray::Vector3D.
-
- \sa at(), elementType(), vector3DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, qreal x, qreal y, qreal z, qreal w)
- \overload
-
- Sets the 4D vector element at \a index in this custom
- data array to (\a x, \a y, \a z, \a w). The elementType() must be
- QCustomDataArray::Vector4D.
-
- \sa at(), elementType(), vector4DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, const QVector2D& value)
- \overload
-
- Sets the 2D vector element at \a index in this custom
- data array to \a value. The elementType() must be
- QCustomDataArray::Vector2D.
-
- \sa at(), elementType(), vector2DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, const QVector3D& value)
- \overload
-
- Sets the 3D vector element at \a index in this custom
- data array to \a value. The elementType() must be
- QCustomDataArray::Vector3D.
-
- \sa at(), elementType(), vector3DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, const QVector4D& value)
- \overload
-
- Sets the 4D vector element at \a index in this custom
- data array to \a value. The elementType() must be
- QCustomDataArray::Vector4D.
-
- \sa at(), elementType(), vector4DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, const QColor4ub& value)
- \overload
-
- Sets the color element at \a index in this custom data array to \a value.
- The elementType() must be QCustomDataArray::Color.
-
- \sa at(), elementType(), colorAt()
-*/
-
-/*!
- \fn void QCustomDataArray::setAt(int index, Qt::GlobalColor value)
- \overload
-
- Sets the color element at \a index in this custom data array to \a value.
- The elementType() must be QCustomDataArray::Color.
-
- \sa at(), elementType(), colorAt()
-*/
-
-/*!
- \fn qreal QCustomDataArray::floatAt(int index) const
-
- Returns the floating-point element at \a index in this custom data array.
- The elementType() must be QCustomDataArray::Float.
-
- \sa at(), setAt(), elementType()
-*/
-
-/*!
- \fn QVector2D QCustomDataArray::vector2DAt(int index) const
-
- Returns the 2D vector element at \a index in this custom data array.
- The elementType() must be QCustomDataArray::Vector2D.
-
- \sa at(), setAt(), elementType()
-*/
-
-/*!
- \fn QVector3D QCustomDataArray::vector3DAt(int index) const
-
- Returns the 3D vector element at \a index in this custom data array.
- The elementType() must be QCustomDataArray::Vector3D.
-
- \sa at(), setAt(), elementType()
-*/
-
-/*!
- \fn QVector4D QCustomDataArray::vector4DAt(int index) const
-
- Returns the 4D vector element at \a index in this custom data array.
- The elementType() must be QCustomDataArray::Vector4D.
-
- \sa at(), setAt(), elementType()
-*/
-
-/*!
- \fn QColor4ub QCustomDataArray::colorAt(int index) const
-
- Returns the color element at \a index in this custom data array.
- The elementType() must be QCustomDataArray::Color.
-
- \sa at(), setAt(), elementType()
-*/
-
-/*!
- \fn void QCustomDataArray::append(qreal x)
- \overload
-
- Appends the floating-point value \a x to this custom data array.
- The elementType() must be QCustomDataArray::Float.
-
- \sa setAt(), floatAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(qreal x, qreal y)
- \overload
-
- Appends the 2D vector value (\a x, \a y) to this custom data array.
- The elementType() must be QCustomDataArray::Vector2D.
-
- \sa setAt(), vector2DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(qreal x, qreal y, qreal z)
- \overload
-
- Appends the 3D vector value (\a x, \a y, \a z) to this custom
- data array. The elementType() must be QCustomDataArray::Vector3D.
-
- \sa setAt(), vector3DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(qreal x, qreal y, qreal z, qreal w)
- \overload
-
- Appends the 4D vector value (\a x, \a y, \a z, \a w) to this custom
- data array. The elementType() must be QCustomDataArray::Vector4D.
-
- \sa setAt(), vector4DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(const QVector2D& value)
- \overload
-
- Appends the 2D vector \a value to this custom data array.
- The elementType() must be QCustomDataArray::Vector2D.
-
- \sa setAt(), vector2DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(const QVector3D& value)
- \overload
-
- Appends the 3D vector \a value to this custom data array.
- The elementType() must be QCustomDataArray::Vector3D.
-
- \sa setAt(), vector3DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(const QVector4D& value)
- \overload
-
- Appends the 4D vector \a value to this custom data array.
- The elementType() must be QCustomDataArray::Vector4D.
-
- \sa setAt(), vector4DAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(const QColor4ub& value)
- \overload
-
- Appends the color \a value to this custom data array.
- The elementType() must be QCustomDataArray::Color.
-
- \sa setAt(), colorAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(Qt::GlobalColor value)
- \overload
-
- Appends the color \a value to this custom data array.
- The elementType() must be QCustomDataArray::Color.
-
- \sa setAt(), colorAt()
-*/
-
-/*!
- \fn void QCustomDataArray::append(const QCustomDataArray &array)
- \overload
-
- Appends the values in \a array to this custom data array. This
- custom data array must have the same element type as \a array,
- unless this custom data array is empty - in which case the
- element type and data of \a array will be assigned to this.
-*/
-
-/*!
- Appends \a value to this custom data array.
-
- The type of \a value must be consistent with elementType().
- The two exceptions to this are that a Float value can be
- specified by either a float or double QVariant, and a Color
- value can be specified as either a QColor4ub or QColor QVariant.
-
- \sa at(), setAt(), elementType()
-*/
-void QCustomDataArray::append(const QVariant& value)
-{
- switch (value.type()) {
-
- case (QVariant::Type)QMetaType::Float:
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- m_array.append(value.toFloat());
- break;
-
- case QVariant::Double:
- // Convert Double into Float.
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- m_array.append(float(value.toDouble()));
- break;
-
- case QVariant::Vector2D:
- append(qVariantValue<QVector2D>(value));
- break;
-
- case QVariant::Vector3D:
- append(qVariantValue<QVector3D>(value));
- break;
-
- case QVariant::Vector4D:
- append(qVariantValue<QVector4D>(value));
- break;
-
- case QVariant::Color:
- // Convert QColor into QColor4ub.
- append(QColor4ub(qVariantValue<QColor>(value)));
- break;
-
- case QVariant::UserType:
- if (value.userType() == qMetaTypeId<QColor4ub>()) {
- append(qVariantValue<QColor4ub>(value));
- break;
- }
- // Fall through.
-
- default:
- Q_ASSERT_X(false, "QCustomDataArray::append",
- "QVariant type not supported for elements");
- break;
- }
-}
-
-/*!
- Returns the contents of this custom data array as a QArray
- of float values.
-
- The elementType() must be QCustomDataArray::Float.
-*/
-QArray<float> QCustomDataArray::toFloatArray() const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- return m_array;
-}
-
-/*!
- Returns the contents of this custom data array as a QArray
- of QVector2D values.
-
- The elementType() must be QCustomDataArray::Vector2D.
-
- This function needs to make a complete copy of the data
- in this array so it may be expensive performance-wise.
-*/
-QArray<QVector2D> QCustomDataArray::toVector2DArray() const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector2D);
- int size = m_array.size() / 2;
- QArray<QVector2D> result;
- if (size > 0) {
- QVector2D *dst = result.extend(size);
- const float *src = m_array.constData();
- qMemCopy(dst, src, size * sizeof(QVector2D));
- }
- return result;
-}
-
-/*!
- Returns the contents of this custom data array as a QArray
- of QVector3D values.
-
- The elementType() must be QCustomDataArray::Vector3D.
-
- This function needs to make a complete copy of the data
- in this array so it may be expensive performance-wise.
-*/
-QArray<QVector3D> QCustomDataArray::toVector3DArray() const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector3D);
- int size = m_array.size() / 3;
- QArray<QVector3D> result;
- if (size > 0) {
- QVector3D *dst = result.extend(size);
- const float *src = m_array.constData();
- qMemCopy(dst, src, size * sizeof(QVector3D));
- }
- return result;
-}
-
-/*!
- Returns the contents of this custom data array as a QArray
- of QVector4D values.
-
- The elementType() must be QCustomDataArray::Vector4D.
-
- This function needs to make a complete copy of the data
- in this array so it may be expensive performance-wise.
-*/
-QArray<QVector4D> QCustomDataArray::toVector4DArray() const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector4D);
- int size = m_array.size() / 4;
- QArray<QVector4D> result;
- if (size > 0) {
- QVector4D *dst = result.extend(size);
- const float *src = m_array.constData();
- qMemCopy(dst, src, size * sizeof(QVector4D));
- }
- return result;
-}
-
-/*!
- Returns the contents of this custom data array as a QArray
- of QColor4ub values.
-
- The elementType() must be QCustomDataArray::Color.
-
- This function needs to make a complete copy of the data
- in this array so it may be expensive performance-wise.
-*/
-QArray<QColor4ub> QCustomDataArray::toColorArray() const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- int size = m_array.size();
- QArray<QColor4ub> result;
- result.reserve(size);
- const QColor4ub *data =
- reinterpret_cast<const QColor4ub *>(m_array.constData());
- for (int index = 0; index < size; ++index)
- result.append(*data++);
- return result;
-}
-
-/*!
- \fn const void *QCustomDataArray::data() const
-
- Returns a const pointer to the data stored in the custom data array.
- The pointer can be used to access the items in the custom data array.
- The pointer remains valid as long as the custom data array isn't
- reallocated.
-
- This function is mostly useful to pass a custom data array to a function
- that accepts a plain C++ array.
-*/
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_QT3D_EXPORT QDebug operator<<(QDebug dbg, const QCustomDataArray &array)
-{
- dbg << "QCustomDataArray" << &array << " -- count:" << array.count();
- for (int i = 0; i < array.count(); ++i)
- dbg << array.at(i);
- return dbg;
-}
-#endif
-
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qcustomdataarray.h b/src/threed/arrays/qcustomdataarray.h
deleted file mode 100644
index 5a05ba15..00000000
--- a/src/threed/arrays/qcustomdataarray.h
+++ /dev/null
@@ -1,421 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCUSTOMDATAARRAY_H
-#define QCUSTOMDATAARRAY_H
-
-#include "qarray.h"
-#include "qcolor4ub.h"
-#include <QtCore/qvariant.h>
-#include <QtGui/qvector2d.h>
-#include <QtGui/qvector3d.h>
-#include <QtGui/qvector4d.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QGLVertexBundleCustomAttribute;
-class QGeometryData;
-
-class Q_QT3D_EXPORT QCustomDataArray
-{
-public:
- enum ElementType
- {
- Float,
- Vector2D,
- Vector3D,
- Vector4D,
- Color
- };
-
- QCustomDataArray();
- explicit QCustomDataArray(QCustomDataArray::ElementType type);
- QCustomDataArray(QCustomDataArray::ElementType type, int size);
- QCustomDataArray(const QCustomDataArray& other);
- QCustomDataArray(const QArray<float>& other);
- QCustomDataArray(const QArray<QVector2D>& other);
- QCustomDataArray(const QArray<QVector3D>& other);
- QCustomDataArray(const QArray<QVector4D>& other);
- QCustomDataArray(const QArray<QColor4ub>& other);
- ~QCustomDataArray();
-
- QCustomDataArray& operator=(const QCustomDataArray& other);
-
- QCustomDataArray::ElementType elementType() const;
- void setElementType(QCustomDataArray::ElementType type);
-
- int size() const;
- int count() const;
-
- int capacity() const;
- bool isEmpty() const;
-
- int elementSize() const;
-
- void clear();
- void reserve(int size);
- void resize(int size);
- void squeeze();
-
- QVariant at(int index) const;
- void setAt(int index, const QVariant& value);
-
- void setAt(int index, qreal x);
- void setAt(int index, qreal x, qreal y);
- void setAt(int index, qreal x, qreal y, qreal z);
- void setAt(int index, qreal x, qreal y, qreal z, qreal w);
- void setAt(int index, const QVector2D& value);
- void setAt(int index, const QVector3D& value);
- void setAt(int index, const QVector4D& value);
- void setAt(int index, const QColor4ub& value);
- void setAt(int index, Qt::GlobalColor value);
-
- qreal floatAt(int index) const;
- QVector2D vector2DAt(int index) const;
- QVector3D vector3DAt(int index) const;
- QVector4D vector4DAt(int index) const;
- QColor4ub colorAt(int index) const;
-
- void append(qreal x);
- void append(qreal x, qreal y);
- void append(qreal x, qreal y, qreal z);
- void append(qreal x, qreal y, qreal z, qreal w);
- void append(const QVector2D& value);
- void append(const QVector3D& value);
- void append(const QVector4D& value);
- void append(const QColor4ub& value);
- void append(const QVariant& value);
- void append(Qt::GlobalColor value);
- void append(const QCustomDataArray &array);
-
- QArray<float> toFloatArray() const;
- QArray<QVector2D> toVector2DArray() const;
- QArray<QVector3D> toVector3DArray() const;
- QArray<QVector4D> toVector4DArray() const;
- QArray<QColor4ub> toColorArray() const;
-
- const void *data() const;
-
-private:
- QArray<float> m_array;
- QCustomDataArray::ElementType m_elementType;
- int m_elementComponents;
-
- friend class QGLVertexBundleCustomAttribute;
- friend class QGeometryData;
-};
-
-inline QCustomDataArray::QCustomDataArray()
- : m_elementType(QCustomDataArray::Float),
- m_elementComponents(1)
-{
-}
-
-inline QCustomDataArray::QCustomDataArray(const QCustomDataArray& other)
- : m_array(other.m_array),
- m_elementType(other.m_elementType),
- m_elementComponents(other.m_elementComponents)
-{
-}
-
-inline QCustomDataArray::~QCustomDataArray() {}
-
-inline QCustomDataArray& QCustomDataArray::operator=(const QCustomDataArray& other)
-{
- if (this != &other) {
- m_array = other.m_array;
- m_elementType = other.m_elementType;
- m_elementComponents = other.m_elementComponents;
- }
- return *this;
-}
-
-inline QCustomDataArray::ElementType QCustomDataArray::elementType() const
-{
- return m_elementType;
-}
-
-inline int QCustomDataArray::size() const
-{
- return m_array.size() / m_elementComponents;
-}
-
-inline int QCustomDataArray::count() const
-{
- return m_array.size() / m_elementComponents;
-}
-
-inline int QCustomDataArray::capacity() const
-{
- return m_array.capacity() / m_elementComponents;
-}
-
-inline bool QCustomDataArray::isEmpty() const
-{
- return m_array.isEmpty();
-}
-
-inline int QCustomDataArray::elementSize() const
-{
- return m_elementComponents * sizeof(float);
-}
-
-inline void QCustomDataArray::clear()
-{
- m_array.clear();
-}
-
-inline void QCustomDataArray::reserve(int size)
-{
- m_array.reserve(size * m_elementComponents);
-}
-
-inline void QCustomDataArray::resize(int size)
-{
- m_array.resize(size * m_elementComponents);
-}
-
-inline void QCustomDataArray::squeeze()
-{
- m_array.squeeze();
-}
-
-inline void QCustomDataArray::setAt(int index, qreal x)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- Q_ASSERT(index >= 0 && index < size());
- m_array[index] = float(x);
-}
-
-inline void QCustomDataArray::setAt(int index, qreal x, qreal y)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector2D);
- Q_ASSERT(index >= 0 && index < size());
- float *data = m_array.data() + index * 2;
- data[0] = float(x);
- data[1] = float(y);
-}
-
-inline void QCustomDataArray::setAt(int index, qreal x, qreal y, qreal z)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector3D);
- Q_ASSERT(index >= 0 && index < size());
- float *data = m_array.data() + index * 3;
- data[0] = float(x);
- data[1] = float(y);
- data[2] = float(z);
-}
-
-inline void QCustomDataArray::setAt(int index, qreal x, qreal y, qreal z, qreal w)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector4D);
- Q_ASSERT(index >= 0 && index < size());
- float *data = m_array.data() + index * 4;
- data[0] = float(x);
- data[1] = float(y);
- data[2] = float(z);
- data[3] = float(w);
-}
-
-inline void QCustomDataArray::setAt(int index, const QVector2D& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector2D);
- Q_ASSERT(index >= 0 && index < size());
- float *data = m_array.data() + index * 2;
- data[0] = float(value.x());
- data[1] = float(value.y());
-}
-
-inline void QCustomDataArray::setAt(int index, const QVector3D& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector3D);
- Q_ASSERT(index >= 0 && index < size());
- float *data = m_array.data() + index * 3;
- data[0] = float(value.x());
- data[1] = float(value.y());
- data[2] = float(value.z());
-}
-
-inline void QCustomDataArray::setAt(int index, const QVector4D& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector4D);
- Q_ASSERT(index >= 0 && index < size());
- float *data = m_array.data() + index * 4;
- data[0] = float(value.x());
- data[1] = float(value.y());
- data[2] = float(value.z());
- data[3] = float(value.w());
-}
-
-inline void QCustomDataArray::setAt(int index, const QColor4ub& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- Q_ASSERT(index >= 0 && index < size());
- *(reinterpret_cast<QColor4ub *>(m_array.data() + index)) = value;
-}
-
-inline void QCustomDataArray::setAt(int index, Qt::GlobalColor value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- Q_ASSERT(index >= 0 && index < size());
- *(reinterpret_cast<QColor4ub *>(m_array.data() + index)) = QColor4ub(value);
-}
-
-inline qreal QCustomDataArray::floatAt(int index) const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- Q_ASSERT(index >= 0 && index < size());
- return m_array.at(index);
-}
-
-inline QVector2D QCustomDataArray::vector2DAt(int index) const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector2D);
- Q_ASSERT(index >= 0 && index < size());
- const float *data = m_array.constData() + index * 2;
- return QVector2D(data[0], data[1]);
-}
-
-inline QVector3D QCustomDataArray::vector3DAt(int index) const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector3D);
- Q_ASSERT(index >= 0 && index < size());
- const float *data = m_array.constData() + index * 3;
- return QVector3D(data[0], data[1], data[2]);
-}
-
-inline QVector4D QCustomDataArray::vector4DAt(int index) const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector4D);
- Q_ASSERT(index >= 0 && index < size());
- const float *data = m_array.constData() + index * 4;
- return QVector4D(data[0], data[1], data[2], data[3]);
-}
-
-inline QColor4ub QCustomDataArray::colorAt(int index) const
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- Q_ASSERT(index >= 0 && index < size());
- return *(reinterpret_cast<const QColor4ub *>(m_array.constData() + index));
-}
-
-inline void QCustomDataArray::append(qreal x)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Float);
- m_array.append(float(x));
-}
-
-inline void QCustomDataArray::append(qreal x, qreal y)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector2D);
- m_array.append(float(x), float(y));
-}
-
-inline void QCustomDataArray::append(qreal x, qreal y, qreal z)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector3D);
- m_array.append(float(x), float(y), float(z));
-}
-
-inline void QCustomDataArray::append(qreal x, qreal y, qreal z, qreal w)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector4D);
- m_array.append(float(x), float(y), float(z), float(w));
-}
-
-inline void QCustomDataArray::append(const QVector2D& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector2D);
- m_array.append(float(value.x()), float(value.y()));
-}
-
-inline void QCustomDataArray::append(const QVector3D& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector3D);
- m_array.append(float(value.x()), float(value.y()), float(value.z()));
-}
-
-inline void QCustomDataArray::append(const QVector4D& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Vector4D);
- m_array.append(float(value.x()), float(value.y()),
- float(value.z()), float(value.w()));
-}
-
-inline void QCustomDataArray::append(const QColor4ub& value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- *(reinterpret_cast<QColor4ub *>(m_array.extend(1))) = value;
-}
-
-inline void QCustomDataArray::append(Qt::GlobalColor value)
-{
- Q_ASSERT(m_elementType == QCustomDataArray::Color);
- *(reinterpret_cast<QColor4ub *>(m_array.extend(1))) = QColor4ub(value);
-}
-
-inline void QCustomDataArray::append(const QCustomDataArray &array)
-{
- Q_ASSERT(isEmpty() || (array.elementType() == elementType()));
- if (isEmpty())
- *this = array;
- else
- m_array.append(array.m_array);
-}
-
-inline const void *QCustomDataArray::data() const
-{
- return m_array.constData();
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_QT3D_EXPORT QDebug operator<<(QDebug dbg, const QCustomDataArray &array);
-#endif
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qglattributedescription.cpp b/src/threed/arrays/qglattributedescription.cpp
deleted file mode 100644
index 63ae1c34..00000000
--- a/src/threed/arrays/qglattributedescription.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglattributedescription.h"
-#include "qopenglfunctions.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGLAttributeDescription
- \brief The QGLAttributeDescription class encapsulates information about an OpenGL attribute value's layout and type.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- OpenGL has many functions that take a pointer to vertex attribute
- values: \c{glVertexPointer()}, \c{glNormalPointer()},
- \c{glVertexAttribPointer()}, etc. These functions typically
- take four arguments: tuple size (1, 2, 3, or 4), component type
- (e.g. GL_FLOAT), stride, and data pointer (\c{glNormalPointer()}
- does not use tuple size, assuming that it is 3). When used with
- vertex buffers, the data pointer may be an offset into the vertex
- buffer instead.
-
- QGLAttributeDescription encapsulates the vertex attribute() kind
- (QGL::Position, QGL::Normal, etc) with the type(), tupleSize(),
- and stride() information of an attribute. The companion
- QGLAttributeValue class adds the data pointer.
-
- \sa QGLAttributeValue
-*/
-
-/*!
- \fn QGLAttributeDescription::QGLAttributeDescription()
-
- Constructs a null attribute description with default parameters of
- tupleSize() and stride() set to zero, type() set to GL_FLOAT,
- and attribute() set to QGL::Position.
-
- \sa isNull()
-*/
-
-/*!
- \fn QGLAttributeDescription::QGLAttributeDescription(QGL::VertexAttribute attribute, int tupleSize, GLenum type, int stride)
-
- Constructs an attribute description with the fields \a attribute,
- \a tupleSize, \a type, and \a stride.
-*/
-
-/*!
- \fn bool QGLAttributeDescription::isNull() const
-
- Returns true if tupleSize() is zero, which indicates an unset
- attribute description; false otherwise.
-*/
-
-/*!
- \fn QGL::VertexAttribute QGLAttributeDescription::attribute() const
-
- Returns the vertex attribute that this description applies to.
- The default value is QGL::Position.
-
- \sa setAttribute(), type()
-*/
-
-/*!
- \fn void QGLAttributeDescription::setAttribute(QGL::VertexAttribute attribute)
-
- Sets the vertex \a attribute that this description applies to.
-
- \sa attribute()
-*/
-
-/*!
- \fn GLenum QGLAttributeDescription::type() const
-
- Returns the component type for this attribute description. The default
- value is GL_FLOAT.
-
- \sa setType(), sizeOfType(), attribute()
-*/
-
-/*!
- \fn void QGLAttributeDescription::setType(GLenum type)
-
- Sets the component \a type for this attribute description.
-
- \sa type(), sizeOfType()
-*/
-
-/*!
- Returns the size in bytes of type().
-
- \sa type(), tupleSize()
-*/
-int QGLAttributeDescription::sizeOfType() const
-{
- switch (m_type) {
- case GL_BYTE: return int(sizeof(GLbyte));
- case GL_UNSIGNED_BYTE: return int(sizeof(GLubyte));
- case GL_SHORT: return int(sizeof(GLshort));
- case GL_UNSIGNED_SHORT: return int(sizeof(GLushort));
- case GL_INT: return int(sizeof(GLint));
- case GL_UNSIGNED_INT: return int(sizeof(GLuint));
- case GL_FLOAT: return int(sizeof(GLfloat));
-#if defined(GL_DOUBLE) && !defined(QT_OPENGL_ES)
- case GL_DOUBLE: return int(sizeof(GLdouble));
-#endif
- default: return 0;
- }
-}
-
-/*!
- \fn int QGLAttributeDescription::tupleSize() const
-
- Returns the tuple size of this attribute in components. For example,
- a return value of 3 indicates a vector of 3-dimensional values.
- If tupleSize() is zero, then this attribute description is null.
-
- \sa setTupleSize(), isNull(), sizeOfType()
-*/
-
-/*!
- \fn void QGLAttributeDescription::setTupleSize(int tupleSize)
-
- Sets the tuple size of this attribute in components to \a tupleSize.
-
- \sa tupleSize()
-*/
-
-/*!
- \fn int QGLAttributeDescription::stride() const
-
- Returns the stride in bytes from one vertex element to the
- next for this attribute description. The default value of 0 indicates
- that the elements are tightly packed within the data array.
-
- \sa setStride()
-*/
-
-/*!
- \fn void QGLAttributeDescription::setStride(int stride)
-
- Sets the \a stride in bytes from one vertex element to the next
- for this attribute description.
-
- \sa stride()
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qglattributedescription.h b/src/threed/arrays/qglattributedescription.h
deleted file mode 100644
index 4be46cc9..00000000
--- a/src/threed/arrays/qglattributedescription.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGLATTRIBUTEDESCRIPTION_H
-#define QGLATTRIBUTEDESCRIPTION_H
-
-#include <QtOpenGL/qgl.h>
-#include "qt3dglobal.h"
-#include "qglnamespace.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class Q_QT3D_EXPORT QGLAttributeDescription
-{
-public:
- QGLAttributeDescription();
- QGLAttributeDescription(QGL::VertexAttribute attribute,
- int tupleSize, GLenum type, int stride);
-
- bool isNull() const;
-
- QGL::VertexAttribute attribute() const;
- void setAttribute(QGL::VertexAttribute attribute);
-
- GLenum type() const;
- void setType(GLenum type);
-
- int sizeOfType() const;
-
- int tupleSize() const;
- void setTupleSize(int tupleSize);
-
- int stride() const;
- void setStride(int stride);
-
-private:
- QGL::VertexAttribute m_attribute;
- GLenum m_type;
- int m_tupleSize;
- int m_stride;
-};
-
-inline QGLAttributeDescription::QGLAttributeDescription()
- : m_attribute(QGL::Position), m_type(GL_FLOAT),
- m_tupleSize(0), m_stride(0)
-{
-}
-
-inline QGLAttributeDescription::QGLAttributeDescription
- (QGL::VertexAttribute attribute, int tupleSize, GLenum type, int stride)
- : m_attribute(attribute), m_type(type),
- m_tupleSize(tupleSize), m_stride(stride)
-{
- Q_ASSERT(tupleSize >= 1 && tupleSize <= 4);
-}
-
-inline bool QGLAttributeDescription::isNull() const
-{
- return m_tupleSize == 0;
-}
-
-inline QGL::VertexAttribute QGLAttributeDescription::attribute() const
-{
- return m_attribute;
-}
-
-inline void QGLAttributeDescription::setAttribute(QGL::VertexAttribute attribute)
-{
- m_attribute = attribute;
-}
-
-inline GLenum QGLAttributeDescription::type() const
-{
- return m_type;
-}
-
-inline void QGLAttributeDescription::setType(GLenum type)
-{
- m_type = type;
-}
-
-inline int QGLAttributeDescription::tupleSize() const
-{
- return m_tupleSize;
-}
-
-inline void QGLAttributeDescription::setTupleSize(int tupleSize)
-{
- Q_ASSERT(tupleSize >= 1 && tupleSize <= 4);
- m_tupleSize = tupleSize;
-}
-
-inline int QGLAttributeDescription::stride() const
-{
- return m_stride;
-}
-
-inline void QGLAttributeDescription::setStride(int stride)
-{
- m_stride = stride;
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qglattributeset.cpp b/src/threed/arrays/qglattributeset.cpp
deleted file mode 100644
index 469ee8fa..00000000
--- a/src/threed/arrays/qglattributeset.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglattributeset.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGLAttributeSet
- \brief The QGLAttributeSet class provides a set of QGL::VertexAttribute indexes.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- QGLAttributeSet is intended for checking if a specific vertex
- attribute is present in a piece of geometry, or has been set on a
- QGLPainter during rendering operations. The members of the set
- are instances of QGL::VertexAttribute, with the restriction that
- the index must be between 0 and 31.
-
- The most common use for this class is to determine if specific
- attributes have been supplied on a QGLPainter so as to adjust the
- current drawing effect accordingly. The following example will
- use a lit texture effect if texture co-ordinates were provided
- in the vertex bundle, or a simple lit material effect if
- texture co-ordinates were not provided:
-
- \code
- painter.clearAttributes();
- painter.setVertexBundle(bundle);
- if (painter.attributes().contains(QGL::TextureCoord0))
- painter.setStandardEffect(QGL::LitModulateTexture2D);
- else
- painter.setStandardEffect(QGL::LitMaterial);
- \endcode
-
- It is important to clear the attributes before setting the vertex
- bundle, so that attributes from a previous bundle will not leak
- through. Multiple vertex bundles may be supplied if they contain
- different parts of the same logical piece of geometry.
-
- \sa QGLVertexBundle::attributes(), QGLPainter::attributes()
-*/
-
-/*!
- \fn QGLAttributeSet::QGLAttributeSet()
-
- Constructs an empty attribute set.
-
- \sa isEmpty()
-*/
-
-/*!
- \fn bool QGLAttributeSet::isEmpty() const
-
- Returns true if this attribute set is empty; false otherwise.
-*/
-
-/*!
- \fn void QGLAttributeSet::clear()
-
- Clears this attribute set to empty.
-*/
-
-/*!
- \fn bool QGLAttributeSet::contains(QGL::VertexAttribute attr) const
-
- Returns true if this attribute set contains \a attr; false otherwise.
-
- \sa insert(), remove()
-*/
-
-/*!
- \fn void QGLAttributeSet::insert(QGL::VertexAttribute attr)
-
- Inserts \a attr into this attribute set. Note: \a attr must be
- within the range 0 to 31. Attribute indexes outside this range
- are ignored and not added to the set.
-
- \sa remove(), contains()
-*/
-
-/*!
- \fn void QGLAttributeSet::remove(QGL::VertexAttribute attr)
-
- Removes \a attr from this attribute set.
-
- \sa insert(), contains()
-*/
-
-/*!
- Returns the members of this attribute set as a list.
-
- \sa fromList()
-*/
-QList<QGL::VertexAttribute> QGLAttributeSet::toList() const
-{
- QList<QGL::VertexAttribute> list;
- quint32 attrs = m_attrs;
- int index = 0;
- while (attrs != 0) {
- if ((attrs & 1) != 0)
- list.append(QGL::VertexAttribute(index));
- ++index;
- attrs >>= 1;
- }
- return list;
-}
-
-/*!
- Returns a new attribute set that is initialized with the members
- of \a list.
-
- \sa toList(), insert()
-*/
-QGLAttributeSet QGLAttributeSet::fromList(const QList<QGL::VertexAttribute> &list)
-{
- QGLAttributeSet set;
- for (int index = 0; index < list.size(); ++index)
- set.insert(list.at(index));
- return set;
-}
-
-/*!
- \fn void QGLAttributeSet::unite(const QGLAttributeSet &other)
-
- Unites the contents of \a other with this attribute set
- and modifies this set accordingly.
-
- \sa intersect(), subtract(), insert()
-*/
-
-/*!
- \fn void QGLAttributeSet::intersect(const QGLAttributeSet &other)
-
- Intersects the contents of \a other with this attribute set
- and modifies this set accordingly.
-
- \sa unite(), subtract()
-*/
-
-/*!
- \fn void QGLAttributeSet::subtract(const QGLAttributeSet &other)
-
- Subtracts the contents of \a other from this attribute set
- and modifies this set accordingly.
-
- \sa unite(), intersect(), remove()
-*/
-
-/*!
- \fn bool QGLAttributeSet::operator==(const QGLAttributeSet &other) const
-
- Returns true if this attribute set has the same elements as \a other;
- false otherwise.
-
- \sa operator!=()
-*/
-
-/*!
- \fn bool QGLAttributeSet::operator!=(const QGLAttributeSet &other) const
-
- Returns true if this attribute set does not have the same elements as
- \a other; false otherwise.
-
- \sa operator==()
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qglattributeset.h b/src/threed/arrays/qglattributeset.h
deleted file mode 100644
index c8f10e98..00000000
--- a/src/threed/arrays/qglattributeset.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGLATTRIBUTESET_H
-#define QGLATTRIBUTESET_H
-
-#include "qt3dglobal.h"
-#include "qglnamespace.h"
-#include <QtCore/qlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class Q_QT3D_EXPORT QGLAttributeSet
-{
-public:
- QGLAttributeSet() : m_attrs(0) {}
-
- bool isEmpty() const { return !m_attrs; }
- void clear() { m_attrs = 0; }
-
- bool contains(QGL::VertexAttribute attr) const;
- void insert(QGL::VertexAttribute attr);
- void remove(QGL::VertexAttribute attr);
-
- QList<QGL::VertexAttribute> toList() const;
- static QGLAttributeSet fromList(const QList<QGL::VertexAttribute> &list);
-
- void unite(const QGLAttributeSet &other);
- void intersect(const QGLAttributeSet &other);
- void subtract(const QGLAttributeSet &other);
-
- bool operator==(const QGLAttributeSet &other) const;
- bool operator!=(const QGLAttributeSet &other) const;
-
-private:
- bool isValidAttr(QGL::VertexAttribute attr) const;
-
- quint32 m_attrs;
-};
-
-inline bool QGLAttributeSet::isValidAttr(QGL::VertexAttribute attr) const
-{
- int a = int(attr);
- return (a > -1 && a < 32);
-}
-
-inline bool QGLAttributeSet::contains(QGL::VertexAttribute attr) const
-{
- quint32 flag = quint32(attr);
- return isValidAttr(attr) ? ((m_attrs & (((quint32)1) << flag)) != 0) : false;
-}
-
-inline void QGLAttributeSet::insert(QGL::VertexAttribute attr)
-{
- quint32 flag = quint32(attr);
- if (isValidAttr(attr))
- m_attrs |= (((quint32)1) << flag);
-}
-
-inline void QGLAttributeSet::remove(QGL::VertexAttribute attr)
-{
- quint32 flag = quint32(attr);
- if (isValidAttr(attr))
- m_attrs &= ~(((quint32)1) << flag);
-}
-
-inline void QGLAttributeSet::unite(const QGLAttributeSet &other)
-{
- m_attrs |= other.m_attrs;
-}
-
-inline void QGLAttributeSet::intersect(const QGLAttributeSet &other)
-{
- m_attrs &= other.m_attrs;
-}
-
-inline void QGLAttributeSet::subtract(const QGLAttributeSet &other)
-{
- m_attrs &= ~(other.m_attrs);
-}
-
-inline bool QGLAttributeSet::operator==(const QGLAttributeSet &other) const
-{
- return m_attrs == other.m_attrs;
-}
-
-inline bool QGLAttributeSet::operator!=(const QGLAttributeSet &other) const
-{
- return m_attrs != other.m_attrs;
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qglattributevalue.cpp b/src/threed/arrays/qglattributevalue.cpp
deleted file mode 100644
index b5647dbf..00000000
--- a/src/threed/arrays/qglattributevalue.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglattributevalue.h"
-#include "qopenglfunctions.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGLAttributeValue
- \brief The QGLAttributeValue class encapsulates information about an OpenGL attribute value.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- OpenGL has many functions that take a pointer to vertex attribute
- values: \c{glVertexPointer()}, \c{glNormalPointer()},
- \c{glVertexAttribPointer()}, etc. These functions typically
- take four arguments: tuple size (1, 2, 3, or 4), component type
- (e.g. GL_FLOAT), stride, and data pointer (\c{glNormalPointer()}
- does not use tuple size, assuming that it is 3). When used with
- vertex buffers, the data pointer may be an offset into the vertex
- buffer instead.
-
- QGLAttributeValue encapsulates these four values so that they can
- be easily manipulated as a set during OpenGL painting operations.
- Constructors are provided for converting QArray and
- QCustomDataArray objects into an attribute value.
-
- Because the data() value is a raw pointer to arbitrary memory,
- care should be taken that the memory remains valid until the
- QGLAttributeValue is no longer required.
-
- \sa QGLAttributeDescription, QArray, QCustomDataArray
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue()
-
- Constructs a null attribute value with default parameters of
- tupleSize(), and stride() set to zero, type() set to GL_FLOAT,
- and data() set to null.
-
- \sa isNull()
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(const QArray<float>& array)
-
- Constructs an attribute value that refers to the contents of \a array,
- setting tupleSize() to 1, type() to GL_FLOAT, and stride() to zero.
-
- The \a array must not be destroyed or modified until the attribute
- value is no longer required.
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(const QArray<QVector2D>& array)
-
- Constructs an attribute value that refers to the contents of \a array,
- setting tupleSize() to 2, type() to GL_FLOAT, and stride() to zero.
-
- The \a array must not be destroyed or modified until the attribute
- value is no longer required.
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(const QArray<QVector3D>& array)
-
- Constructs an attribute value that refers to the contents of \a array,
- setting tupleSize() to 3, type() to GL_FLOAT, and stride() to zero.
-
- The \a array must not be destroyed or modified until the attribute
- value is no longer required.
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(const QArray<QVector4D>& array)
-
- Constructs an attribute value that refers to the contents of \a array,
- setting tupleSize() to 4, type() to GL_FLOAT, and stride() to zero.
-
- The \a array must not be destroyed or modified until the attribute
- value is no longer required.
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(const QArray<QColor4ub>& array)
-
- Constructs an attribute value that refers to the contents of \a array,
- setting tupleSize() to 4, type() to GL_UNSIGNED_BYTE, and stride() to zero.
-
- The \a array must not be destroyed or modified until the attribute
- value is no longer required.
-*/
-
-/*!
- Constructs an attribute value that refers to the contents of \a array.
- The tupleSize() and type() of the attribute value will be set according
- to the QCustomDataArray::elementType() of \a array.
-
- The \a array must not be destroyed or modified until the attribute
- value is no longer required.
-*/
-QGLAttributeValue::QGLAttributeValue(const QCustomDataArray& array)
- : m_tupleSize(0), m_type(GL_FLOAT), m_stride(0)
- , m_data(array.data()), m_count(array.count())
-{
- switch (array.elementType()) {
- case QCustomDataArray::Float:
- m_tupleSize = 1;
- break;
- case QCustomDataArray::Vector2D:
- m_tupleSize = 2;
- break;
- case QCustomDataArray::Vector3D:
- m_tupleSize = 3;
- break;
- case QCustomDataArray::Vector4D:
- m_tupleSize = 4;
- break;
- case QCustomDataArray::Color:
- m_tupleSize = 4;
- m_type = GL_UNSIGNED_BYTE;
- break;
- }
-}
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(int tupleSize, GLenum type, int stride, const void *data, int count)
-
- Constructs an attribute value with the fields \a tupleSize, \a type,
- \a stride, \a data, and \a count.
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(int tupleSize, GLenum type, int stride, int offset, int count)
-
- Constructs an attribute value with the fields \a tupleSize, \a type,
- \a stride, \a offset, and \a count.
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(const QGLAttributeDescription& description, const void *data, int count)
-
- Constructs an attribute value with the supplied \a description,
- \a data, and \a count.
-*/
-
-/*!
- \fn QGLAttributeValue::QGLAttributeValue(const QGLAttributeDescription& description, int offset, int count)
-
- Constructs an attribute value with the supplied \a description,
- \a offset, and \a count.
-*/
-
-/*!
- \fn bool QGLAttributeValue::isNull() const
-
- Returns true if tupleSize() is zero, which indicates an unset
- attribute value; false otherwise.
-
- Note: it is possible for data() to be null, but isNull() returns true.
- This can happen when data() is actually a zero offset into a
- vertex buffer.
-*/
-
-/*!
- \fn QGLAttributeDescription QGLAttributeValue::description(QGL::VertexAttribute attribute) const
-
- Returns the description of this value, tagged with \a attribute.
-
- \sa type()
-*/
-
-/*!
- \fn GLenum QGLAttributeValue::type() const
-
- Returns the component type for this attribute value. The default
- value is GL_FLOAT.
-
- \sa sizeOfType(), description()
-*/
-
-/*!
- Returns the size in bytes of type().
-
- \sa type(), tupleSize()
-*/
-int QGLAttributeValue::sizeOfType() const
-{
- switch (m_type) {
- case GL_BYTE: return int(sizeof(GLbyte));
- case GL_UNSIGNED_BYTE: return int(sizeof(GLubyte));
- case GL_SHORT: return int(sizeof(GLshort));
- case GL_UNSIGNED_SHORT: return int(sizeof(GLushort));
- case GL_INT: return int(sizeof(GLint));
- case GL_UNSIGNED_INT: return int(sizeof(GLuint));
- case GL_FLOAT: return int(sizeof(GLfloat));
-#if defined(GL_DOUBLE) && !defined(QT_OPENGL_ES)
- case GL_DOUBLE: return int(sizeof(GLdouble));
-#endif
- default: return 0;
- }
-}
-
-/*!
- \fn int QGLAttributeValue::tupleSize() const
-
- Returns the tuple size of this attribute in components. For example,
- a return value of 3 indicates a vector of 3-dimensional values.
- If tupleSize() is zero, then this attribute value is null.
-
- \sa isNull(), sizeOfType()
-*/
-
-/*!
- \fn int QGLAttributeValue::stride() const
-
- Returns the stride in bytes from one vertex element to the
- next for this attribute value. The default value of 0 indicates
- that the elements are tightly packed within the data() array.
-*/
-
-/*!
- \fn const void *QGLAttributeValue::data() const
-
- Returns the data pointer for the elements in this attribute value.
-*/
-
-/*!
- \fn int QGLAttributeValue::count() const
-
- Returns the count of vertex elements in this attribute value;
- zero if the count is unknown.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qglattributevalue.h b/src/threed/arrays/qglattributevalue.h
deleted file mode 100644
index 00da039a..00000000
--- a/src/threed/arrays/qglattributevalue.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGLATTRIBUTEVALUE_H
-#define QGLATTRIBUTEVALUE_H
-
-#include "qglattributedescription.h"
-#include "qcustomdataarray.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QGLVertexBundle;
-
-class Q_QT3D_EXPORT QGLAttributeValue
-{
-public:
- QGLAttributeValue();
- QGLAttributeValue(const QArray<float>& array);
- QGLAttributeValue(const QArray<QVector2D>& array);
- QGLAttributeValue(const QArray<QVector3D>& array);
- QGLAttributeValue(const QArray<QVector4D>& array);
- QGLAttributeValue(const QArray<QColor4ub>& array);
- QGLAttributeValue(const QCustomDataArray& array);
- QGLAttributeValue(int tupleSize, GLenum type, int stride, const void *data, int count = 0);
- QGLAttributeValue(int tupleSize, GLenum type, int stride, int offset, int count = 0);
- QGLAttributeValue(const QGLAttributeDescription& description, const void *data, int count = 0);
- QGLAttributeValue(const QGLAttributeDescription& description, int offset, int count = 0);
-
- bool isNull() const;
-
- QGLAttributeDescription description(QGL::VertexAttribute attribute) const;
- GLenum type() const;
- int sizeOfType() const;
- int tupleSize() const;
- int stride() const;
- const void *data() const;
- int count() const;
-
-private:
- int m_tupleSize;
- GLenum m_type;
- int m_stride;
- const void *m_data;
- int m_count;
-
- void setStride(int stride) { m_stride = stride; }
- void setOffset(int offset)
- { m_data = reinterpret_cast<const void *>(offset); }
-
- friend class QGLVertexBundle;
-};
-
-inline QGLAttributeValue::QGLAttributeValue()
- : m_tupleSize(0), m_type(GL_FLOAT), m_stride(0), m_data(0), m_count(0)
-{
-}
-
-inline QGLAttributeValue::QGLAttributeValue(const QArray<float>& array)
- : m_tupleSize(1), m_type(GL_FLOAT), m_stride(0)
- , m_data(array.constData()), m_count(array.count())
-{
-}
-
-inline QGLAttributeValue::QGLAttributeValue(const QArray<QVector2D>& array)
- : m_tupleSize(2), m_type(GL_FLOAT), m_stride(0)
- , m_data(array.constData()), m_count(array.count())
-{
-}
-
-inline QGLAttributeValue::QGLAttributeValue(const QArray<QVector3D>& array)
- : m_tupleSize(3), m_type(GL_FLOAT), m_stride(0)
- , m_data(array.constData()), m_count(array.count())
-{
-}
-
-inline QGLAttributeValue::QGLAttributeValue(const QArray<QVector4D>& array)
- : m_tupleSize(4), m_type(GL_FLOAT), m_stride(0)
- , m_data(array.constData()), m_count(array.count())
-{
-}
-
-inline QGLAttributeValue::QGLAttributeValue(const QArray<QColor4ub>& array)
- : m_tupleSize(4), m_type(GL_UNSIGNED_BYTE), m_stride(0)
- , m_data(array.constData()), m_count(array.count())
-{
-}
-
-inline QGLAttributeValue::QGLAttributeValue
- (int tupleSize, GLenum type, int stride, const void *data, int count)
- : m_tupleSize(tupleSize), m_type(type), m_stride(stride)
- , m_data(data), m_count(count)
-{
- Q_ASSERT(tupleSize >= 1 && tupleSize <= 4);
-}
-
-inline QGLAttributeValue::QGLAttributeValue
- (int tupleSize, GLenum type, int stride, int offset, int count)
- : m_tupleSize(tupleSize), m_type(type), m_stride(stride)
- , m_data(reinterpret_cast<const void *>(offset)), m_count(count)
-{
- Q_ASSERT(tupleSize >= 1 && tupleSize <= 4);
-}
-
-inline QGLAttributeValue::QGLAttributeValue
- (const QGLAttributeDescription& description, const void *data, int count)
- : m_tupleSize(description.tupleSize()), m_type(description.type())
- , m_stride(description.stride()), m_data(data), m_count(count)
-{
-}
-
-inline QGLAttributeValue::QGLAttributeValue
- (const QGLAttributeDescription& description, int offset, int count)
- : m_tupleSize(description.tupleSize()), m_type(description.type())
- , m_stride(description.stride())
- , m_data(reinterpret_cast<const void *>(offset))
- , m_count(count)
-{
-}
-
-inline bool QGLAttributeValue::isNull() const
-{
- return m_tupleSize == 0;
-}
-
-inline QGLAttributeDescription QGLAttributeValue::description(QGL::VertexAttribute attribute) const
-{
- if (!isNull()) {
- return QGLAttributeDescription(attribute, m_tupleSize, m_type, m_stride);
- } else {
- QGLAttributeDescription desc;
- desc.setAttribute(attribute);
- return desc;
- }
-}
-
-inline GLenum QGLAttributeValue::type() const
-{
- return m_type;
-}
-
-inline int QGLAttributeValue::tupleSize() const
-{
- return m_tupleSize;
-}
-
-inline int QGLAttributeValue::stride() const
-{
- return m_stride;
-}
-
-inline const void *QGLAttributeValue::data() const
-{
- return m_data;
-}
-
-inline int QGLAttributeValue::count() const
-{
- return m_count;
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qglindexbuffer.cpp b/src/threed/arrays/qglindexbuffer.cpp
deleted file mode 100644
index 55802551..00000000
--- a/src/threed/arrays/qglindexbuffer.cpp
+++ /dev/null
@@ -1,777 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglindexbuffer.h"
-#include "qglpainter.h"
-#include "qglpainter_p.h"
-#include "qglext_p.h"
-#include <QtOpenGL/qgl.h>
-#include <QtCore/qatomic.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGLIndexBuffer
- \brief The QGLIndexBuffer class manages uploading of index arrays into a GL server.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-*/
-
-#ifdef QT_OPENGL_ES
-
-static bool qt_has_uint_buffers()
-{
- static bool done = false;
- static bool answer = false;
- if (!done) {
- QGLExtensionChecker extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
- answer = extensions.match("GL_OES_element_index_uint");
- done = true;
- }
- return answer;
-}
-
-#endif
-
-class QGLIndexBufferPrivate
-{
-public:
- QGLIndexBufferPrivate()
- : indexCount(0)
- , elementType(GL_UNSIGNED_SHORT)
- , buffer(QGLBuffer::IndexBuffer)
-#ifdef QT_OPENGL_ES
- , hasIntBuffers(qt_has_uint_buffers())
-#else
- , hasIntBuffers(true)
-#endif
- {
- ref = 1;
- }
-
- QBasicAtomicInt ref;
- int indexCount;
- QArray<ushort> indexesShort;
- QArray<uint> indexesInt;
- GLenum elementType;
- QGLBuffer buffer;
- bool hasIntBuffers;
-
- void append(const QGLIndexBufferPrivate *other, uint offset, int start);
- uint headIndex(int posn) const;
- uint tailIndex(int posn) const;
-};
-
-/*!
- Creates a new index buffer.
-*/
-QGLIndexBuffer::QGLIndexBuffer()
- : d_ptr(new QGLIndexBufferPrivate)
-{
-}
-
-/*!
- Creates a copy of \a other. Note that this just copies a reference
- to the index buffer. Any modifications to the copy will also
- affect the original object.
-*/
-QGLIndexBuffer::QGLIndexBuffer(const QGLIndexBuffer& other)
- : d_ptr(other.d_ptr)
-{
- d_ptr->ref.ref();
-}
-
-/*!
- Destroys this index buffer if this object is the last reference to it.
-*/
-QGLIndexBuffer::~QGLIndexBuffer()
-{
- if (!d_ptr->ref.deref())
- delete d_ptr;
-}
-
-/*!
- Assigns \a other to this object. Note that this just assigns a
- reference to the \a other index buffer. Any modifications to this
- object will also affect \a other.
-*/
-QGLIndexBuffer& QGLIndexBuffer::operator=(const QGLIndexBuffer& other)
-{
- if (d_ptr != other.d_ptr) {
- if (!d_ptr->ref.deref())
- delete d_ptr;
- d_ptr = other.d_ptr;
- d_ptr->ref.ref();
- }
- return *this;
-}
-
-/*!
- Returns the indexes in this buffer as an array of ushort values.
-
- Returns an empty array if type() is not \c GL_UNSIGNED_SHORT or the
- buffer has already been uploaded.
-*/
-QArray<ushort> QGLIndexBuffer::indexesUShort() const
-{
- Q_D(const QGLIndexBuffer);
- return d->indexesShort;
-}
-
-/*!
- Returns the indexes in this buffer as an array of uint values.
-
- Returns an empty array if type() is not \c GL_UNSIGNED_INT or the
- buffer has already been uploaded.
-*/
-QArray<uint> QGLIndexBuffer::indexesUInt() const
-{
- Q_D(const QGLIndexBuffer);
- return d->indexesInt;
-}
-
-/*!
- Returns the usage pattern for this index buffer.
- The default value is QGLBuffer::StaticDraw.
-
- \sa setUsagePattern()
-*/
-QGLBuffer::UsagePattern QGLIndexBuffer::usagePattern() const
-{
- Q_D(const QGLIndexBuffer);
- return d->buffer.usagePattern();
-}
-
-/*!
- Sets the usage pattern for this index buffer to \a value.
- This function must be called before upload() for the \a value
- to take effect.
-
- \sa usagePattern(), upload()
-*/
-void QGLIndexBuffer::setUsagePattern(QGLBuffer::UsagePattern value)
-{
- Q_D(QGLIndexBuffer);
- d->buffer.setUsagePattern(value);
-}
-
-static QArray<ushort> qt_qarray_uint_to_ushort(const QArray<uint> &array)
-{
- QArray<ushort> result;
- const uint *values = array.constData();
- int size = array.size();
- bool largeValue = false;
- result.reserve(size);
- while (size-- > 0) {
- uint value = *values++;
- if (ushort(value) != value)
- largeValue = true;
- result.append(ushort(value));
- }
- if (largeValue)
- qWarning("QGLIndexBuffer::setIndexes: large 32-bit value provided to a 16-bit only buffer");
- return result;
-}
-
-/*!
- Sets the index \a values in this index buffer, replacing the
- entire current contents.
-
- If the index buffer has been uploaded to the GL server, then this
- function must be called with a current GL context that is compatible
- with the uploaded buffer.
-
- \sa replaceIndexes()
-*/
-void QGLIndexBuffer::setIndexes(const QArray<ushort>& values)
-{
- Q_D(QGLIndexBuffer);
- if (d->buffer.isCreated()) {
- d->buffer.bind();
- d->buffer.allocate(values.constData(), values.size() * sizeof(ushort));
- d->buffer.release();
- // The element type may have changed from int to ushort.
- d->elementType = GL_UNSIGNED_SHORT;
- } else {
- d->indexesShort = values;
- d->elementType = GL_UNSIGNED_SHORT;
- d->indexesInt = QArray<uint>();
- }
- d->indexCount = values.size();
-}
-
-/*!
- Sets the index \a values in this index buffer, replacing the
- entire current contents.
-
- If the index buffer has been uploaded to the GL server, then this
- function must be called with a current GL context that is compatible
- with the uploaded buffer.
-
- OpenGL/ES systems usually do not support 32-bit index values unless
- they have a special extension for that purpose. On systems without
- 32-bit index values, this function will need to convert all values
- to 16-bit which may incur a performance penalty and lose information.
-
- \sa replaceIndexes()
-*/
-void QGLIndexBuffer::setIndexes(const QArray<uint>& values)
-{
- Q_D(QGLIndexBuffer);
- if (d->buffer.isCreated()) {
- if (d->hasIntBuffers) {
- d->buffer.bind();
- d->buffer.allocate(values.constData(), values.size() * sizeof(int));
- d->buffer.release();
- // The element type may have changed from ushort to int.
- d->elementType = GL_UNSIGNED_INT;
- } else {
- QArray<ushort> svalues = qt_qarray_uint_to_ushort(values);
- d->buffer.bind();
- d->buffer.allocate(svalues.constData(), svalues.size() * sizeof(ushort));
- d->buffer.release();
- }
- } else if (d->hasIntBuffers) {
- d->indexesInt = values;
- d->elementType = GL_UNSIGNED_INT;
- d->indexesShort = QArray<ushort>();
- } else {
- d->indexesShort = qt_qarray_uint_to_ushort(values);
- d->elementType = GL_UNSIGNED_SHORT;
- d->indexesInt = QArray<uint>();
- }
- d->indexCount = values.size();
-}
-
-/*!
- Replaces the elements of this index buffer, starting at \a index,
- with the contents of \a values. All other elements keep their
- current values.
-
- If the index buffer has been uploaded to the GL server, then this
- function must be called with a current GL context that is compatible
- with the uploaded buffer.
-
- The index buffer must have been originally created with the
- ushort element type.
-
- \sa setIndexes()
-*/
-void QGLIndexBuffer::replaceIndexes(int index, const QArray<ushort>& values)
-{
- Q_D(QGLIndexBuffer);
- Q_ASSERT_X(d->elementType == GL_UNSIGNED_SHORT,
- "QGLIndexBuffer::replaceIndexes()",
- "buffer created with int element type, replacing with ushort");
- if (d->elementType != GL_UNSIGNED_SHORT)
- return;
- if (d->buffer.isCreated()) {
- d->buffer.bind();
- d->buffer.write(index * sizeof(ushort),
- values.constData(), values.size() * sizeof(ushort));
- d->buffer.release();
- } else {
- d->indexesShort.replace(index, values.constData(), values.size());
- d->indexCount = d->indexesShort.size();
- }
-}
-
-/*!
- Replaces the elements of this index buffer, starting at \a index,
- with the contents of \a values. All other elements keep their
- current values.
-
- If the index buffer has been uploaded to the GL server, then this
- function must be called with a current GL context that is compatible
- with the uploaded buffer.
-
- The index buffer must have been originally created with the
- int element type.
-
- OpenGL/ES systems usually do not support 32-bit index values unless
- they have a special extension for that purpose. On systems without
- 32-bit index values, this function will need to convert all values
- to 16-bit which may incur a performance penalty and lose information.
-
- \sa setIndexes()
-*/
-void QGLIndexBuffer::replaceIndexes(int index, const QArray<uint>& values)
-{
- Q_D(QGLIndexBuffer);
- Q_ASSERT_X(d->elementType == GL_UNSIGNED_INT || !d->hasIntBuffers,
- "QGLIndexBuffer::replaceIndexes()",
- "buffer created with ushort element type, replacing with int");
- if (d->elementType != GL_UNSIGNED_INT && d->hasIntBuffers)
- return;
- if (d->buffer.isCreated()) {
- if (d->hasIntBuffers) {
- d->buffer.bind();
- d->buffer.write(index * sizeof(int),
- values.constData(), values.size() * sizeof(int));
- d->buffer.release();
- } else {
- QArray<ushort> svalues = qt_qarray_uint_to_ushort(values);
- d->buffer.bind();
- d->buffer.write(index * sizeof(ushort),
- svalues.constData(),
- svalues.size() * sizeof(ushort));
- d->buffer.release();
- }
- } else if (d->elementType == GL_UNSIGNED_INT) {
- d->indexesInt.replace(index, values.constData(), values.size());
- d->indexCount = d->indexesInt.size();
- } else {
- QArray<ushort> svalues = qt_qarray_uint_to_ushort(values);
- d->indexesShort.replace(index, svalues.constData(), svalues.size());
- d->indexCount = d->indexesShort.size();
- }
-}
-
-/*!
- Returns the element type for this index buffer, \c{GL_UNSIGNED_SHORT}
- or \c{GL_UNSIGNED_INT}.
-*/
-GLenum QGLIndexBuffer::elementType() const
-{
- Q_D(const QGLIndexBuffer);
- return d->elementType;
-}
-
-/*!
- Returns the number of indexes in this index buffer.
-*/
-int QGLIndexBuffer::indexCount() const
-{
- Q_D(const QGLIndexBuffer);
- return d->indexCount;
-}
-
-/*!
- \fn bool QGLIndexBuffer::isEmpty() const
-
- Returns true if indexCount() is zero; false otherwise.
-*/
-
-/*!
- Uploads the index data specified by a previous setIndexes()
- call into the GL server as an index buffer object.
-
- Returns true if the data could be uploaded; false if index buffer
- objects are not supported or there is insufficient memory to complete
- the request. Returns true if the data was already uploaded.
-
- Once the index data has been uploaded, the client-side copies of
- the data arrays will be released. If the index data could not be
- uploaded, then it is retained client-side. This way, regardless of
- whether the data could be uploaded or not, QGLPainter::draw() can
- be used to support drawing of primitives using this object.
-
- \sa isUploaded(), setIndexes(), QGLPainter::draw()
-*/
-bool QGLIndexBuffer::upload()
-{
- Q_D(QGLIndexBuffer);
- if (d->buffer.isCreated())
- return true;
- if (!d->buffer.create())
- return false;
- d->buffer.bind();
- if (d->elementType == GL_UNSIGNED_SHORT) {
- d->buffer.allocate(d->indexesShort.constData(),
- d->indexesShort.size() * sizeof(ushort));
- d->indexesShort = QArray<ushort>();
- } else {
- d->buffer.allocate(d->indexesInt.constData(),
- d->indexesInt.size() * sizeof(int));
- d->indexesInt = QArray<uint>();
- }
- d->buffer.release();
- return true;
-}
-
-/*!
- Returns true if the index data specified by previous a setIndexes()
- call has been uploaded into the GL server; false otherwise.
-
- \sa upload(), setIndexes()
-*/
-bool QGLIndexBuffer::isUploaded() const
-{
- Q_D(const QGLIndexBuffer);
- return d->buffer.isCreated();
-}
-
-/*!
- Returns the QGLBuffer in use by this index buffer object,
- so that its properties or contents can be modified directly.
-
- \sa isUploaded()
-*/
-QGLBuffer QGLIndexBuffer::buffer() const
-{
- Q_D(const QGLIndexBuffer);
- return d->buffer;
-}
-
-/*!
- Binds this index buffer to the current GL context. Returns false if
- binding was not possible, usually because upload() has not been called.
-
- The buffer must be bound to the same QGLContext current when upload()
- was called, or to another QGLContext that is sharing with it.
- Otherwise, false will be returned from this function.
-
- \sa release(), upload()
-*/
-bool QGLIndexBuffer::bind()
-{
- Q_D(QGLIndexBuffer);
- return d->buffer.bind();
-}
-
-/*!
- Releases this index buffer from the current GL context.
-
- This function must be called with the same QGLContext current
- as when bind() was called on the index buffer.
-
- \sa bind()
-*/
-void QGLIndexBuffer::release()
-{
- Q_D(QGLIndexBuffer);
- d->buffer.release();
-}
-
-void QGLIndexBufferPrivate::append
- (const QGLIndexBufferPrivate *other, uint offset, int start)
-{
- if (elementType == GL_UNSIGNED_SHORT &&
- other->elementType == GL_UNSIGNED_SHORT) {
- // Both buffers are ushort.
- const ushort *data = other->indexesShort.constData() + start;
- int count = other->indexesShort.count() - start;
- indexesShort.reserve(indexesShort.count() + count);
- indexCount += count;
- while (count-- > 0)
- indexesShort.append(ushort(*data++ + offset));
- } else if (elementType == GL_UNSIGNED_SHORT) {
- // Only first buffer is ushort: convert it to int first.
- const ushort *indexes = indexesShort.constData();
- int count = indexesShort.count();
- indexesInt.reserve(count + other->indexesInt.count());
- while (count-- > 0)
- indexesInt.append(*indexes++);
- indexesShort = QArray<ushort>();
- elementType = GL_UNSIGNED_INT;
- const uint *data = other->indexesInt.constData() + start;
- count = other->indexesInt.count() - start;
- indexCount += count;
- while (count-- > 0)
- indexesInt.append(*data++ + offset);
- } else if (other->elementType == GL_UNSIGNED_SHORT) {
- // Only second buffer is ushort.
- const ushort *data = other->indexesShort.constData() + start;
- int count = other->indexesShort.count() - start;
- indexesInt.reserve(indexesInt.count() + count);
- indexCount += count;
- while (count-- > 0)
- indexesInt.append(*data++ + offset);
- } else {
- // Neither buffer is ushort.
- const uint *data = other->indexesInt.constData() + start;
- int count = other->indexesInt.count() - start;
- indexesInt.reserve(indexesInt.count() + count);
- indexCount += count;
- while (count-- > 0)
- indexesInt.append(*data++ + offset);
- }
-}
-
-uint QGLIndexBufferPrivate::headIndex(int posn) const
-{
- if (indexCount <= posn)
- return uint(-1);
- if (elementType == GL_UNSIGNED_SHORT)
- return indexesShort[posn];
- else
- return indexesInt[posn];
-}
-
-uint QGLIndexBufferPrivate::tailIndex(int posn) const
-{
- if (indexCount <= posn)
- return uint(-1);
- if (elementType == GL_UNSIGNED_SHORT)
- return indexesShort[indexCount - posn - 1];
- else
- return indexesInt[indexCount - posn - 1];
-}
-
-/*!
- Appends the contents of \a buffer to this index buffer and adds
- \a offset to all of the entries in \a buffer.
-
- This function is typically used to combine multiple geometry meshes
- into a single mesh that can be bound as a single buffer.
-
- The request is ignored if this index buffer or \a buffer have already
- been uploaded, or \a buffer is this index buffer.
-
- \sa isUploaded(), setIndexes()
-*/
-void QGLIndexBuffer::append(const QGLIndexBuffer &buffer, uint offset)
-{
- Q_D(QGLIndexBuffer);
- const QGLIndexBufferPrivate *dbuf = buffer.d_ptr;
-
- // Bail out if the buffers are uploaded or identical.
- if (d->buffer.isCreated() || dbuf->buffer.isCreated())
- return;
- if (d == dbuf)
- return;
-
- // Append the two index arrays.
- d->append(dbuf, offset, 0);
-}
-
-/*!
- Appends the contents of \a buffer to this index buffer and adds
- \a offset to all of the entries in \a buffer.
-
- The two buffers will be merged at the join point according to
- \a combineMode. For example, if \a combineMode is QGL::TriangleStrip,
- then the result will be a single triangle strip. Indexes are
- dropped from the front of \a buffer as necessary to correctly
- merge the buffers.
-
- This function is typically used to combine multiple geometry meshes
- into a single mesh that can be bound as a single buffer.
-
- The request is ignored if this index buffer or \a buffer have already
- been uploaded, or \a buffer is this index buffer.
-
- \sa isUploaded(), setIndexes()
-*/
-void QGLIndexBuffer::append
- (const QGLIndexBuffer &buffer, uint offset, QGL::DrawingMode combineMode)
-{
- Q_D(QGLIndexBuffer);
- const QGLIndexBufferPrivate *dbuf = buffer.d_ptr;
-
- // Bail out if the buffers are uploaded or identical.
- if (d->buffer.isCreated() || dbuf->buffer.isCreated())
- return;
- if (d == dbuf)
- return;
-
- // Determine how to combine the buffers.
- switch (int(combineMode)) {
- case QGL::Points:
- case QGL::Lines:
- case QGL::Triangles:
- case QGL::LinesAdjacency:
- case QGL::TrianglesAdjacency:
- case 0x0007: // GL_QUADS
- // These can be done by just appending the raw data with no changes.
- d->append(dbuf, offset, 0);
- break;
-
- case QGL::LineLoop:
- case QGL::LineStrip:
- case 0x0009: // GL_POLYGON
- // Join the last index of the first buffer to the first
- // index of the second buffer to continue the loop or strip.
- if (d->tailIndex(0) == (dbuf->headIndex(0) + offset))
- d->append(dbuf, offset, 1);
- else
- d->append(dbuf, offset, 0);
- break;
-
- case QGL::TriangleStrip:
- // Join the last two indexes of the first buffer to the first
- // two indexes of the second buffer to continue the strip.
- // It is possible that the first two indexes of the second
- // buffer may be reversed for strip continuation depending
- // upon whether the first strip is odd or even in length.
- if (d->tailIndex(1) == (dbuf->headIndex(0) + offset) &&
- d->tailIndex(0) == (dbuf->headIndex(1) + offset))
- d->append(dbuf, offset, 2);
- else if (d->tailIndex(1) == (dbuf->headIndex(1) + offset) &&
- d->tailIndex(0) == (dbuf->headIndex(0) + offset))
- d->append(dbuf, offset, 2);
- else
- d->append(dbuf, offset, 0);
- break;
-
- case 0x0008: // GL_QUAD_STRIP
- // Join the last two indexes of the first buffer to the first
- // two indexes of the second buffer to continue the strip.
- if (d->tailIndex(1) == (dbuf->headIndex(0) + offset) &&
- d->tailIndex(0) == (dbuf->headIndex(1) + offset))
- d->append(dbuf, offset, 2);
- else
- d->append(dbuf, offset, 0);
- break;
-
- case QGL::TriangleFan:
- // The first index of both buffers should be the same, and the
- // last index of the first buffer should be the same as the second
- // index of the second buffer.
- if (d->headIndex(0) == (dbuf->headIndex(0) + offset) &&
- d->tailIndex(0) == (dbuf->headIndex(1) + offset))
- d->append(dbuf, offset, 2);
- else
- d->append(dbuf, offset, 0);
- break;
-
- case QGL::LineStripAdjacency:
- // Join the last three indexes of the first buffer to the first
- // three indexes of the second buffer to continue the strip.
- if (d->tailIndex(2) == (dbuf->headIndex(0) + offset) &&
- d->tailIndex(1) == (dbuf->headIndex(1) + offset) &&
- d->tailIndex(0) == (dbuf->headIndex(2) + offset))
- d->append(dbuf, offset, 3);
- else
- d->append(dbuf, offset, 0);
- break;
-
- case QGL::TriangleStripAdjacency:
- // Fourth last and second last of first buffer need to be the
- // same as the first and third of the second buffer.
- if (d->tailIndex(3) == (dbuf->headIndex(0) + offset) &&
- d->tailIndex(1) == (dbuf->headIndex(2) + offset))
- d->append(dbuf, offset, 4);
- else
- d->append(dbuf, offset, 0);
- break;
-
- default:
- qWarning("QGLIndexBuffer::append: unknown drawing mode 0x%04x",
- int(combineMode));
- break;
- }
-}
-
-/*!
- \overload
-
- Draws primitives using vertices from the arrays specified by
- setVertexAttribute(). The type of primitive to draw is
- specified by \a mode.
-
- This operation will consume all of the elements of \a indexes,
- which are used to index into the enabled arrays.
-
- If \a indexes has not been uploaded to the GL server as an index
- buffer, then this function will draw using a client-side array.
-
- \sa update(), QGLIndexBuffer::upload()
-*/
-void QGLPainter::draw(QGL::DrawingMode mode, const QGLIndexBuffer& indexes)
-{
- QGLIndexBufferPrivate *d = const_cast<QGLIndexBufferPrivate *>(indexes.d_func());
- update();
- GLuint id = d->buffer.bufferId();
- if (id != d_ptr->boundIndexBuffer) {
- if (id)
- d->buffer.bind();
- else
- QGLBuffer::release(QGLBuffer::IndexBuffer);
- d_ptr->boundIndexBuffer = id;
- }
- if (id) {
- glDrawElements(GLenum(mode), d->indexCount, d->elementType, 0);
- } else if (d->elementType == GL_UNSIGNED_SHORT) {
- glDrawElements(GLenum(mode), d->indexCount, GL_UNSIGNED_SHORT,
- d->indexesShort.constData());
- } else {
- glDrawElements(GLenum(mode), d->indexCount, GL_UNSIGNED_INT,
- d->indexesInt.constData());
- }
-}
-
-/*!
- \overload
-
- Draws primitives using vertices from the arrays specified by
- setVertexAttribute(). The type of primitive to draw is
- specified by \a mode.
-
- This operation will consume \a count elements of \a indexes,
- starting at \a offset, which are used to index into the enabled arrays.
-
- If \a indexes has not been uploaded to the GL server as an index
- buffer, then this function will draw using a client-side array.
-
- \sa update(), QGLIndexBuffer::upload()
-*/
-void QGLPainter::draw(QGL::DrawingMode mode, const QGLIndexBuffer& indexes, int offset, int count)
-{
- QGLIndexBufferPrivate *d = const_cast<QGLIndexBufferPrivate *>(indexes.d_func());
- update();
- GLuint id = d->buffer.bufferId();
- if (id != d_ptr->boundIndexBuffer) {
- if (id)
- d->buffer.bind();
- else
- QGLBuffer::release(QGLBuffer::IndexBuffer);
- d_ptr->boundIndexBuffer = id;
- }
- if (id) {
- if (d->elementType == GL_UNSIGNED_SHORT) {
- glDrawElements(GLenum(mode), count, GL_UNSIGNED_SHORT,
- reinterpret_cast<const void *>(offset * sizeof(ushort)));
- } else {
- glDrawElements(GLenum(mode), count, GL_UNSIGNED_INT,
- reinterpret_cast<const void *>(offset * sizeof(int)));
- }
- } else if (d->elementType == GL_UNSIGNED_SHORT) {
- glDrawElements(GLenum(mode), count, GL_UNSIGNED_SHORT,
- d->indexesShort.constData() + offset);
- } else {
- glDrawElements(GLenum(mode), count, GL_UNSIGNED_INT,
- d->indexesInt.constData() + offset);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qglindexbuffer.h b/src/threed/arrays/qglindexbuffer.h
deleted file mode 100644
index e1a54971..00000000
--- a/src/threed/arrays/qglindexbuffer.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGLINDEXBUFFER_H
-#define QGLINDEXBUFFER_H
-
-#include <QtOpenGL/qgl.h>
-#include <QtOpenGL/qglbuffer.h>
-#include "qglnamespace.h"
-#include "qarray.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QGLIndexBufferPrivate;
-class QGLPainter;
-
-class Q_QT3D_EXPORT QGLIndexBuffer
-{
-public:
- QGLIndexBuffer();
- QGLIndexBuffer(const QGLIndexBuffer& other);
- ~QGLIndexBuffer();
-
- QGLIndexBuffer& operator=(const QGLIndexBuffer& other);
-
- QGLBuffer::UsagePattern usagePattern() const;
- void setUsagePattern(QGLBuffer::UsagePattern value);
-
- QArray<ushort> indexesUShort() const;
- QArray<uint> indexesUInt() const;
-
- void setIndexes(const QArray<ushort>& values);
- void setIndexes(const QArray<uint>& values);
-
- void replaceIndexes(int index, const QArray<ushort>& values);
- void replaceIndexes(int index, const QArray<uint>& values);
-
- GLenum elementType() const;
-
- int indexCount() const;
- bool isEmpty() const { return indexCount() == 0; }
-
- bool upload();
- bool isUploaded() const;
-
- QGLBuffer buffer() const;
-
- bool bind();
- void release();
-
- void append(const QGLIndexBuffer &buffer, uint offset);
- void append(const QGLIndexBuffer &buffer, uint offset, QGL::DrawingMode combineMode);
-
-private:
- QGLIndexBufferPrivate *d_ptr;
-
- Q_DECLARE_PRIVATE(QGLIndexBuffer)
-
- friend class QGLPainter;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qglvertexbundle.cpp b/src/threed/arrays/qglvertexbundle.cpp
deleted file mode 100644
index f2e14b9d..00000000
--- a/src/threed/arrays/qglvertexbundle.cpp
+++ /dev/null
@@ -1,495 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglvertexbundle.h"
-#include "qglvertexbundle_p.h"
-#include "qglabstracteffect.h"
-#include <QtCore/qlist.h>
-#include <QtCore/qatomic.h>
-#include <QtOpenGL/qglshaderprogram.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGLVertexBundle
- \brief The QGLVertexBundle class bundles vertex attribute arrays for efficient uploading into a GL server.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- QGLVertexBundle provides an implementation of a static vertex
- buffer, where the vertex attributes are supplied once at construction
- time and then never modified until the bundle is destroyed.
- When the vertex attributes are sent ot the GL server by upload(),
- they may be repacked for greater drawing efficiency.
-
- For general-purpose vertex buffers that can be allocated and modified
- in-place, use QGLBuffer instead.
-*/
-
-/*!
- Constructs a new vertex bundle.
-*/
-QGLVertexBundle::QGLVertexBundle()
- : d_ptr(new QGLVertexBundlePrivate())
-{
-}
-
-/*!
- Creates a copy of \a other. Note that this just copies a reference
- to the vertex bundle. Any modifications to the copy will also
- affect the original object.
-*/
-QGLVertexBundle::QGLVertexBundle(const QGLVertexBundle& other)
- : d_ptr(other.d_ptr)
-{
- d_ptr->ref.ref();
-}
-
-/*!
- Destroys this vertex bundle if this object is the last reference to it.
-*/
-QGLVertexBundle::~QGLVertexBundle()
-{
- if (!d_ptr->ref.deref())
- delete d_ptr;
-}
-
-/*!
- Assigns \a other to this object. Note that this just assigns a
- reference to the \a other vertex bundle. Any modifications to this
- object will also affect \a other.
-*/
-QGLVertexBundle& QGLVertexBundle::operator=(const QGLVertexBundle& other)
-{
- if (d_ptr != other.d_ptr) {
- if (!d_ptr->ref.deref())
- delete d_ptr;
- d_ptr = other.d_ptr;
- d_ptr->ref.ref();
- }
- return *this;
-}
-
-/*!
- Adds the floating-point array \a value to this vertex bundle as the
- data for \a attribute.
-
- \sa upload()
-*/
-void QGLVertexBundle::addAttribute
- (QGL::VertexAttribute attribute, const QArray<float>& value)
-{
- Q_D(QGLVertexBundle);
- if (!d->buffer.isCreated()) {
- d->attributeSet.insert(attribute);
- d->attributes +=
- new QGLVertexBundleFloatAttribute(attribute, value);
- d->vertexCount = qMax(d->vertexCount, value.count());
- }
-}
-
-/*!
- Adds the 2D vector array \a value to this vertex bundle as the
- data for \a attribute.
-
- \sa upload()
-*/
-void QGLVertexBundle::addAttribute
- (QGL::VertexAttribute attribute, const QArray<QVector2D>& value)
-{
- Q_D(QGLVertexBundle);
- if (!d->buffer.isCreated()) {
- d->attributeSet.insert(attribute);
- d->attributes +=
- new QGLVertexBundleVector2DAttribute(attribute, value);
- d->vertexCount = qMax(d->vertexCount, value.count());
- }
-}
-
-/*!
- Adds the 3D vector array \a value to this vertex bundle as the
- data for \a attribute.
-
- \sa upload()
-*/
-void QGLVertexBundle::addAttribute
- (QGL::VertexAttribute attribute, const QArray<QVector3D>& value)
-{
- Q_D(QGLVertexBundle);
- if (!d->buffer.isCreated()) {
- d->attributeSet.insert(attribute);
- d->attributes +=
- new QGLVertexBundleVector3DAttribute(attribute, value);
- d->vertexCount = qMax(d->vertexCount, value.count());
- }
-}
-
-/*!
- Adds the 4D vector array \a value to this vertex bundle as the
- data for \a attribute.
-
- \sa upload()
-*/
-void QGLVertexBundle::addAttribute
- (QGL::VertexAttribute attribute, const QArray<QVector4D>& value)
-{
- Q_D(QGLVertexBundle);
- if (!d->buffer.isCreated()) {
- d->attributeSet.insert(attribute);
- d->attributes +=
- new QGLVertexBundleVector4DAttribute(attribute, value);
- d->vertexCount = qMax(d->vertexCount, value.count());
- }
-}
-
-/*!
- Adds the color array \a value to this vertex bundle as the
- data for \a attribute.
-
- \sa upload()
-*/
-void QGLVertexBundle::addAttribute
- (QGL::VertexAttribute attribute, const QArray<QColor4ub>& value)
-{
- Q_D(QGLVertexBundle);
- if (!d->buffer.isCreated()) {
- d->attributeSet.insert(attribute);
- d->attributes +=
- new QGLVertexBundleColorAttribute(attribute, value);
- d->vertexCount = qMax(d->vertexCount, value.count());
- }
-}
-
-/*!
- Adds the custom data array \a value to this vertex bundle as the
- data for \a attribute.
-
- \sa upload()
-*/
-void QGLVertexBundle::addAttribute
- (QGL::VertexAttribute attribute, const QCustomDataArray& value)
-{
- Q_D(QGLVertexBundle);
- if (!d->buffer.isCreated()) {
- d->attributeSet.insert(attribute);
- d->attributes +=
- new QGLVertexBundleCustomAttribute(attribute, value);
- d->vertexCount = qMax(d->vertexCount, value.count());
- }
-}
-
-// Interleave a source array into a destination array.
-static void vertexBufferInterleave
- (float *dst, int dstStride, const float *src, int srcStride, int count)
-{
- switch (srcStride) {
- case 1:
- while (count-- > 0) {
- dst[0] = src[0];
- ++src;
- dst += dstStride;
- }
- break;
- case 2:
- while (count-- > 0) {
- dst[0] = src[0];
- dst[1] = src[1];
- src += 2;
- dst += dstStride;
- }
- break;
- case 3:
- while (count-- > 0) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- src += 3;
- dst += dstStride;
- }
- break;
- case 4:
- while (count-- > 0) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = src[3];
- src += 4;
- dst += dstStride;
- }
- break;
- default:
- while (count-- > 0) {
- for (int component = 0; component < srcStride; ++component)
- dst[component] = src[component];
- src += srcStride;
- dst += dstStride;
- }
- break;
- }
-}
-
-/*!
- Returns the set of attributes that are present in this vertex bundle.
-*/
-QGLAttributeSet QGLVertexBundle::attributes() const
-{
- Q_D(const QGLVertexBundle);
- return d->attributeSet;
-}
-
-/*!
- Returns the raw attribute value associated with \a attribute in
- this vertex bundle; null if \a attribute does not exist in the
- vertex bundle.
-
- If isUploaded() is true, then the returned value will contain a
- buffer offset to the attribute. If isUploaded() is false,
- then the returned value will contain a client-side data pointer
- to the attribute.
-
- \sa addAttribute()
-*/
-QGLAttributeValue QGLVertexBundle::attributeValue(QGL::VertexAttribute attribute) const
-{
- Q_D(const QGLVertexBundle);
- QGLVertexBundleAttribute *attr = 0;
- int attrIndex;
- for (attrIndex = 0; attrIndex < d->attributes.size(); ++attrIndex) {
- attr = d->attributes[attrIndex];
- if (attr->attribute == attribute)
- return attr->value;
- }
- return QGLAttributeValue();
-}
-
-/*!
- Returns the number of vertices that were defined by previous
- called to addAttribute().
-
- \sa addAttribute()
-*/
-int QGLVertexBundle::vertexCount() const
-{
- Q_D(const QGLVertexBundle);
- return d->vertexCount;
-}
-
-/*!
- \fn bool QGLVertexBundle::isEmpty() const
-
- Returns true if vertexCount() is zero; false otherwise.
-*/
-
-/*!
- Uploads the vertex data specified by previous addAttribute()
- calls into the GL server as a vertex buffer object.
-
- Returns true if the data could be uploaded; false if vertex buffer
- objects are not supported or there is insufficient memory to complete
- the request. Returns true if the data was already uploaded.
-
- Once the vertex data has been uploaded, the client-side copies of
- the data arrays will be released. If the vertex data could not be
- uploaded, then it is retained client-side. This way, regardless of
- whether the data could be uploaded or not, QGLPainter::setVertexBundle()
- can be used to support drawing of primitives using this object.
-
- \sa isUploaded(), addAttribute(), QGLPainter::setVertexBundle()
-*/
-bool QGLVertexBundle::upload()
-{
- Q_D(QGLVertexBundle);
- QGLVertexBundleAttribute *attr;
-
- // Nothing to do if already uploaded or there are no attributes.
- if (d->buffer.isCreated())
- return true;
- if (d->attributes.isEmpty())
- return false;
-
- // Create the VBO in the GL server and bind it.
- if (!d->buffer.create())
- return false;
- d->buffer.bind();
-
- // If there is only one attribute, then realloc and write in one step.
- if (d->attributes.size() == 1) {
- attr = d->attributes[0];
- d->buffer.allocate(attr->value.data(),
- attr->count() * attr->elementSize());
- attr->value.setOffset(0);
- attr->clear();
- d->buffer.release();
- return true;
- }
-
- // Calculate the total size of the VBO that we will need,
- // the maximum number of interleaved vertices, and the
- // interleaved stride.
- int size = 0;
- int stride = 0;
- int maxCount = 0;
- for (int index = 0; index < d->attributes.size(); ++index) {
- attr = d->attributes[index];
- int count = attr->count();
- if (count > maxCount)
- maxCount = count;
- int elemSize = attr->elementSize();
- size += count * elemSize;
- stride += elemSize;
- }
- int bufferSize = size;
- d->buffer.allocate(bufferSize);
- stride /= sizeof(float);
-
- // Determine how to upload the data, using a map if possible.
- // Interleave the data into the final buffer. We do it in
- // sections so as to keep locality problems to a minimum.
- void *mapped = d->buffer.map(QGLBuffer::WriteOnly);
- int offset = 0;
- QArray<float> temp;
- float *dst;
- if (mapped)
- dst = reinterpret_cast<float *>(mapped);
- else
- dst = temp.extend(1024);
- int sectionSize = 1024 / stride;
- for (int vertex = 0; vertex < maxCount; vertex += sectionSize) {
- int attrPosn = 0;
- for (int index = 0; index < d->attributes.size(); ++index) {
- attr = d->attributes[index];
- int count = attr->count() - vertex;
- if (count <= 0)
- continue;
- count = qMin(count, sectionSize);
- int components = attr->elementSize() / sizeof(float);
- vertexBufferInterleave
- (dst + attrPosn, stride,
- reinterpret_cast<const float *>(attr->value.data()) +
- vertex * components,
- components, count);
- attrPosn += attr->elementSize() / sizeof(float);
- }
- size = sectionSize * stride;
- if (mapped) {
- dst += size;
- } else {
- size *= sizeof(float);
- if ((offset + size) > bufferSize) // buffer overflow check
- size = bufferSize-offset;
- d->buffer.write(offset, dst, size);
- offset += size;
- }
- }
- offset = 0;
- for (int index = 0; index < d->attributes.size(); ++index) {
- attr = d->attributes[index];
- attr->value.setOffset(offset);
- attr->value.setStride(stride * sizeof(float));
- offset += attr->elementSize();
- attr->clear();
- }
- if (mapped)
- d->buffer.unmap();
-
- // Buffer is uploaded and ready to go.
- d->buffer.release();
- return true;
-}
-
-/*!
- Returns true if the vertex data specified by previous addAttribute()
- calls has been uploaded into the GL server; false otherwise.
-
- \sa upload(), addAttribute()
-*/
-bool QGLVertexBundle::isUploaded() const
-{
- Q_D(const QGLVertexBundle);
- return d->buffer.isCreated();
-}
-
-/*!
- Returns the QGLBuffer in use by this vertex bundle object,
- so that its properties or contents can be modified directly.
-
- \sa isUploaded()
-*/
-QGLBuffer QGLVertexBundle::buffer() const
-{
- Q_D(const QGLVertexBundle);
- return d->buffer;
-}
-
-/*!
- Binds the vertex buffer associated with this bundle to the current GL
- context. Returns false if binding was not possible, usually because
- upload() has not been called.
-
- The buffer must be bound to the same QGLContext current when upload()
- was called, or to another QGLContext that is sharing with it.
- Otherwise, false will be returned from this function.
-
- \sa release(), upload()
-*/
-bool QGLVertexBundle::bind()
-{
- Q_D(QGLVertexBundle);
- return d->buffer.bind();
-}
-
-/*!
- Releases the vertex buffer associated with this bundle from the
- current GL context.
-
- This function must be called with the same QGLContext current
- as when bind() was called on the vertex buffer.
-
- \sa bind()
-*/
-void QGLVertexBundle::release()
-{
- Q_D(QGLVertexBundle);
- d->buffer.release();
-}
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qglvertexbundle.h b/src/threed/arrays/qglvertexbundle.h
deleted file mode 100644
index fb978eb4..00000000
--- a/src/threed/arrays/qglvertexbundle.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGLVERTEXBUNDLE_H
-#define QGLVERTEXBUNDLE_H
-
-#include <QtOpenGL/qglbuffer.h>
-#include "qcustomdataarray.h"
-#include "qglattributevalue.h"
-#include "qglattributeset.h"
-#include <QtCore/qlist.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QGLVertexBundlePrivate;
-class QGLPainter;
-class QGLAbstractEffect;
-class QGLShaderProgram;
-
-class Q_QT3D_EXPORT QGLVertexBundle
-{
-public:
- QGLVertexBundle();
- QGLVertexBundle(const QGLVertexBundle& other);
- ~QGLVertexBundle();
-
- QGLVertexBundle& operator=(const QGLVertexBundle& other);
-
- void addAttribute(QGL::VertexAttribute attribute,
- const QArray<float>& value);
- void addAttribute(QGL::VertexAttribute attribute,
- const QArray<QVector2D>& value);
- void addAttribute(QGL::VertexAttribute attribute,
- const QArray<QVector3D>& value);
- void addAttribute(QGL::VertexAttribute attribute,
- const QArray<QVector4D>& value);
- void addAttribute(QGL::VertexAttribute attribute,
- const QArray<QColor4ub>& value);
- void addAttribute(QGL::VertexAttribute attribute,
- const QCustomDataArray& value);
-
- QGLAttributeSet attributes() const;
-
- QGLAttributeValue attributeValue(QGL::VertexAttribute attribute) const;
-
- int vertexCount() const;
- bool isEmpty() const { return vertexCount() == 0; }
-
- bool upload();
- bool isUploaded() const;
-
- QGLBuffer buffer() const;
-
- bool bind();
- void release();
-
-private:
- QGLVertexBundlePrivate *d_ptr;
-
- Q_DECLARE_PRIVATE(QGLVertexBundle)
-
- friend class QGLPainter;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qglvertexbundle_p.h b/src/threed/arrays/qglvertexbundle_p.h
deleted file mode 100644
index eb4672fe..00000000
--- a/src/threed/arrays/qglvertexbundle_p.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGLVERTEXBUNDLE_P_H
-#define QGLVERTEXBUNDLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qglvertexbundle.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGLVertexBundleAttribute
-{
-public:
- QGLVertexBundleAttribute(QGL::VertexAttribute attr) : attribute(attr) {}
- virtual ~QGLVertexBundleAttribute() {}
-
- virtual void clear() = 0;
- virtual QGLAttributeValue uploadValue() = 0;
- virtual int count() = 0;
- virtual int elementSize() = 0;
-
- QGL::VertexAttribute attribute;
- QGLAttributeValue value;
-};
-
-class QGLVertexBundleFloatAttribute : public QGLVertexBundleAttribute
-{
-public:
- QGLVertexBundleFloatAttribute
- (QGL::VertexAttribute attr, const QArray<float>& array)
- : QGLVertexBundleAttribute(attr), floatArray(array)
- {
- value = QGLAttributeValue(floatArray);
- }
-
- void clear() { floatArray.clear(); }
- QGLAttributeValue uploadValue()
- { return QGLAttributeValue(floatArray); }
- int count() { return floatArray.count(); }
- int elementSize() { return sizeof(float); }
-
- QArray<float> floatArray;
-};
-
-class QGLVertexBundleVector2DAttribute : public QGLVertexBundleAttribute
-{
-public:
- QGLVertexBundleVector2DAttribute
- (QGL::VertexAttribute attr, const QArray<QVector2D>& array)
- : QGLVertexBundleAttribute(attr), vector2DArray(array)
- {
- value = QGLAttributeValue(vector2DArray);
- }
-
- void clear() { vector2DArray.clear(); }
- QGLAttributeValue uploadValue()
- { return QGLAttributeValue(vector2DArray); }
- int count() { return vector2DArray.count(); }
- int elementSize() { return sizeof(QVector2D); }
-
- QArray<QVector2D> vector2DArray;
-};
-
-class QGLVertexBundleVector3DAttribute : public QGLVertexBundleAttribute
-{
-public:
- QGLVertexBundleVector3DAttribute
- (QGL::VertexAttribute attr, const QArray<QVector3D>& array)
- : QGLVertexBundleAttribute(attr), vector3DArray(array)
- {
- value = QGLAttributeValue(vector3DArray);
- }
-
- void clear() { vector3DArray.clear(); }
- QGLAttributeValue uploadValue()
- { return QGLAttributeValue(vector3DArray); }
- int count() { return vector3DArray.count(); }
- int elementSize() { return sizeof(QVector3D); }
-
- QArray<QVector3D> vector3DArray;
-};
-
-class QGLVertexBundleVector4DAttribute : public QGLVertexBundleAttribute
-{
-public:
- QGLVertexBundleVector4DAttribute
- (QGL::VertexAttribute attr, const QArray<QVector4D>& array)
- : QGLVertexBundleAttribute(attr), vector4DArray(array)
- {
- value = QGLAttributeValue(vector4DArray);
- }
-
- void clear() { vector4DArray.clear(); }
- QGLAttributeValue uploadValue()
- { return QGLAttributeValue(vector4DArray); }
- int count() { return vector4DArray.count(); }
- int elementSize() { return sizeof(QVector4D); }
-
- QArray<QVector4D> vector4DArray;
-};
-
-class QGLVertexBundleColorAttribute : public QGLVertexBundleAttribute
-{
-public:
- QGLVertexBundleColorAttribute
- (QGL::VertexAttribute attr, const QArray<QColor4ub>& array)
- : QGLVertexBundleAttribute(attr), colorArray(array)
- {
- value = QGLAttributeValue(colorArray);
- }
-
- void clear() { colorArray.clear(); }
- QGLAttributeValue uploadValue()
- { return QGLAttributeValue(colorArray); }
- int count() { return colorArray.count(); }
- int elementSize() { return sizeof(QColor4ub); }
-
- QArray<QColor4ub> colorArray;
-};
-
-class QGLVertexBundleCustomAttribute : public QGLVertexBundleAttribute
-{
-public:
- QGLVertexBundleCustomAttribute
- (QGL::VertexAttribute attr, const QCustomDataArray& array)
- : QGLVertexBundleAttribute(attr), customArray(array)
- {
- value = QGLAttributeValue(customArray);
- }
-
- void clear() { customArray.clear(); }
- QGLAttributeValue uploadValue()
- { return QGLAttributeValue(customArray); }
- int count() { return customArray.count(); }
- int elementSize() { return customArray.elementSize(); }
-
- QCustomDataArray customArray;
-};
-
-class QGLVertexBundlePrivate
-{
-public:
- QGLVertexBundlePrivate()
- : buffer(QGLBuffer::VertexBuffer),
- vertexCount(0)
- {
- ref = 1;
- }
- ~QGLVertexBundlePrivate()
- {
- qDeleteAll(attributes);
- }
-
- QBasicAtomicInt ref;
- QGLBuffer buffer;
- QList<QGLVertexBundleAttribute *> attributes;
- int vertexCount;
- QGLAttributeSet attributeSet;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qvector2darray.cpp b/src/threed/arrays/qvector2darray.cpp
deleted file mode 100644
index 2617cb5f..00000000
--- a/src/threed/arrays/qvector2darray.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvector2darray.h"
-#include <QtGui/qmatrix4x4.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVector2DArray
- \brief The QVector2DArray class is a convenience for wrapping a QArray of QVector2D values.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- QVector2DArray is used to build an array of 2D vector values
- based on floating-point x and y arguments:
-
- \code
- QVector2DArray array;
- array.append(1.0f, 2.0f);
- array.append(-1.0f, 2.0f);
- array.append(1.0f, -2.0f);
- \endcode
-
- This is more convenient and readable than the equivalent with
- QArray:
-
- \code
- QArray<QVector2D> array;
- array.append(QVector2D(1.0f, 2.0f));
- array.append(QVector2D(-1.0f, 2.0f));
- array.append(QVector2D(1.0f, -2.0f));
- \endcode
-
- QVector2DArray also has convenience functions for transforming
- the contents of the array with translate(), translated(),
- transform(), and transformed().
-
- \sa QArray, QVector3DArray, QVector4DArray
-*/
-
-/*!
- \fn QVector2DArray::QVector2DArray()
-
- Constructs an empty array of QVector2D values.
-*/
-
-/*!
- \fn QVector2DArray::QVector2DArray(int size, const QVector2D& value)
-
- Constructs an array of QVector2D values with an initial \a size.
- All elements in the array are initialized to \a value.
-*/
-
-/*!
- \fn QVector2DArray::QVector2DArray(const QArray<QVector2D>& other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- \fn void QVector2DArray::append(qreal x, qreal y)
- \overload
-
- Appends (\a x, \a y) to this array of QVector2D values.
-*/
-
-/*!
- \fn void QVector2DArray::append(const QPointF& point)
- \overload
-
- Appends \a point to this array of QVector2D values.
-*/
-
-/*!
- \fn void QVector2DArray::append(const QPoint& point);
- \overload
-
- Appends \a point to this array of QVector2D values.
-*/
-
-/*!
- Multiplies the elements in this array of QVector2D values by
- the \a scale.
-
- \sa scaled()
-*/
-void QVector2DArray::scale(qreal scale)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector2D *dst = data();
- for (int index = 0; index < size; ++index)
- *dst++ *= scale;
- } else {
- // Create a new array, translate the values, and assign.
- QArray<QVector2D> result;
- int size = count();
- const QVector2D *src = constData();
- QVector2D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ * scale;
- *this = result;
- }
-}
-
-/*!
- Returns a copy of this array of QVector2D values, multiplied
- by the \a scale.
-
- \sa scale()
-*/
-QVector2DArray QVector2DArray::scaled(qreal scale) const
-{
- const qreal identity = 1.0;
- if (qFuzzyCompare(scale, identity))
- return *this;
- QArray<QVector2D> result;
- int size = count();
- const QVector2D *src = constData();
- QVector2D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ * scale;
- return result;
-}
-
-/*!
- Translates the elements in this array of QVector2D values
- by the components of \a value.
-
- \sa translated()
-*/
-void QVector2DArray::translate(const QVector2D& value)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector2D *dst = data();
- for (int index = 0; index < size; ++index)
- *dst++ += value;
- } else {
- // Create a new array, translate the values, and assign.
- QArray<QVector2D> result;
- int size = count();
- const QVector2D *src = constData();
- QVector2D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ + value;
- *this = result;
- }
-}
-
-/*!
- \fn void QVector2DArray::translate(qreal x, qreal y)
- \overload
-
- Translates the elements in this array of QVector2D values
- by (\a x, \a y).
-
- \sa translated()
-*/
-
-/*!
- Returns a copy of this array of QVector2D values, translated
- by the components of \a value.
-
- \sa translate()
-*/
-QArray<QVector2D> QVector2DArray::translated(const QVector2D& value) const
-{
- QArray<QVector2D> result;
- int size = count();
- QVector2D *dst = result.extend(size);
- const QVector2D *src = constData();
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ + value;
- return result;
-}
-
-/*!
- \fn QArray<QVector2D> QVector2DArray::translated(qreal x, qreal y) const
- \overload
-
- Returns a copy of this array of QVector2D values, translated
- by (\a x, \a y).
-
- \sa translate()
-*/
-
-/*!
- Transforms the elements in this array of QVector2D values
- by \a matrix.
-
- \sa transformed()
-*/
-void QVector2DArray::transform(const QMatrix4x4& matrix)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector2D *dst = data();
- for (int index = 0; index < size; ++index) {
- *dst = (matrix * QVector3D(*dst, 0.0f)).toVector2D();
- ++dst;
- }
- } else {
- // Create a new array, transform the values, and assign.
- QArray<QVector2D> result;
- int size = count();
- const QVector2D *src = constData();
- QVector2D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = (matrix * QVector3D(*src++, 0.0f)).toVector2D();
- *this = result;
- }
-}
-
-/*!
- Returns a copy of this array of QVector2D values,
- transformed by \a matrix.
-
- \sa transform()
-*/
-QArray<QVector2D> QVector2DArray::transformed(const QMatrix4x4& matrix) const
-{
- QArray<QVector2D> result;
- int size = count();
- const QVector2D *src = constData();
- QVector2D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = (matrix * QVector3D(*src++, 0.0f)).toVector2D();
- return result;
-}
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qvector2darray.h b/src/threed/arrays/qvector2darray.h
deleted file mode 100644
index df6087ff..00000000
--- a/src/threed/arrays/qvector2darray.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVECTOR2DARRAY_H
-#define QVECTOR2DARRAY_H
-
-#include "qarray.h"
-#include <QtGui/qvector2d.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QMatrix4x4;
-
-class Q_QT3D_EXPORT QVector2DArray : public QArray<QVector2D>
-{
-public:
- QVector2DArray();
- QVector2DArray(int size, const QVector2D& value = QVector2D());
- QVector2DArray(const QArray<QVector2D>& other);
-
- void append(qreal x, qreal y);
- void append(const QPointF& point);
- void append(const QPoint& point);
-
- void scale(qreal scale);
- QVector2DArray scaled(qreal scale) const;
-
- void translate(const QVector2D& value);
- void translate(qreal x, qreal y);
-
- QArray<QVector2D> translated(const QVector2D& value) const;
- QArray<QVector2D> translated(qreal x, qreal y) const;
-
- void transform(const QMatrix4x4& matrix);
- QArray<QVector2D> transformed(const QMatrix4x4& matrix) const;
-
-#if !defined(Q_NO_USING_KEYWORD) || defined(Q_QDOC)
- using QArray<QVector2D>::append;
-#else
- inline void append(const QVector2D& value)
- { QArray<QVector2D>::append(value); }
- inline void append(const QVector2D& value1, const QVector2D& value2)
- { QArray<QVector2D>::append(value1, value2); }
- inline void append(const QVector2D& value1, const QVector2D& value2, const QVector2D& value3)
- { QArray<QVector2D>::append(value1, value2, value3); }
- inline void append(const QVector2D& value1, const QVector2D& value2, const QVector2D& value3, const QVector2D& value4)
- { QArray<QVector2D>::append(value1, value2, value3, value4); }
- inline void append(const QVector2D *values, int count)
- { QArray<QVector2D>::append(values, count); }
- inline void append(const QArray<QVector2D>& other)
- { QArray<QVector2D>::append(other); }
-#endif
-};
-
-inline QVector2DArray::QVector2DArray() {}
-
-inline QVector2DArray::QVector2DArray(int size, const QVector2D& value)
- : QArray<QVector2D>(size, value) {}
-
-inline QVector2DArray::QVector2DArray(const QArray<QVector2D>& other)
- : QArray<QVector2D>(other) {}
-
-inline void QVector2DArray::append(qreal x, qreal y)
- { QArray<QVector2D>::append(QVector2D(x, y)); }
-
-inline void QVector2DArray::append(const QPointF& point)
- { QArray<QVector2D>::append(QVector2D(point)); }
-
-inline void QVector2DArray::append(const QPoint& point)
- { QArray<QVector2D>::append(QVector2D(point)); }
-
-inline void QVector2DArray::translate(qreal x, qreal y)
- { translate(QVector2D(x, y)); }
-
-inline QArray<QVector2D> QVector2DArray::translated(qreal x, qreal y) const
- { return translated(QVector2D(x, y)); }
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qvector3darray.cpp b/src/threed/arrays/qvector3darray.cpp
deleted file mode 100644
index f72dda46..00000000
--- a/src/threed/arrays/qvector3darray.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvector3darray.h"
-#include <QtGui/qmatrix4x4.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVector3DArray
- \brief The QVector3DArray class is a convenience for wrapping a QArray of QVector3D values.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- QVector3DArray is used to build an array of 3D vector values
- based on floating-point x, y, and z arguments:
-
- \code
- QVector3DArray array;
- array.append(1.0f, 2.0f, 3.0f);
- array.append(-1.0f, 2.0f, 3.0f);
- array.append(1.0f, -2.0f, 3.0f);
- \endcode
-
- This is more convenient and readable than the equivalent with
- QArray:
-
- \code
- QArray<QVector3D> array;
- array.append(QVector3D(1.0f, 2.0f, 3.0f));
- array.append(QVector3D(-1.0f, 2.0f, 3.0f));
- array.append(QVector3D(1.0f, -2.0f, 3.0f));
- \endcode
-
- QVector3DArray also has convenience functions for transforming
- the contents of the array with translate(), translated(),
- transform(), and transformed().
-
- \sa QArray, QVector2DArray, QVector4DArray
-*/
-
-/*!
- \fn QVector3DArray::QVector3DArray()
-
- Constructs an empty array of QVector3D values.
-*/
-
-/*!
- \fn QVector3DArray::QVector3DArray(int size, const QVector3D& value)
-
- Constructs an array of QVector3D values with an initial \a size.
- All elements in the array are initialized to \a value.
-*/
-
-/*!
- \fn QVector3DArray::QVector3DArray(const QArray<QVector3D>& other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- \fn void QVector3DArray::append(qreal x, qreal y, qreal z)
-
- Appends (\a x, \a y, \a z) to this array of QVector3D values.
-*/
-
-/*!
- Multiplies the elements in this array of QVector3D values by
- the \a scale.
-
- \sa scaled()
-*/
-void QVector3DArray::scale(qreal scale)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector3D *dst = data();
- for (int index = 0; index < size; ++index)
- *dst++ *= scale;
- } else {
- // Create a new array, translate the values, and assign.
- QArray<QVector3D> result;
- int size = count();
- const QVector3D *src = constData();
- QVector3D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ * scale;
- *this = result;
- }
-}
-
-/*!
- Returns a copy of this array of QVector3D values, multiplied
- by the \a scale.
-
- \sa scale()
-*/
-QVector3DArray QVector3DArray::scaled(qreal scale) const
-{
- QArray<QVector3D> result;
- int size = count();
- const QVector3D *src = constData();
- QVector3D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ * scale;
- return result;
-}
-
-/*!
- Translates the elements in this array of QVector3D values
- by the components of \a value.
-
- \sa translated()
-*/
-void QVector3DArray::translate(const QVector3D& value)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector3D *dst = data();
- for (int index = 0; index < size; ++index)
- *dst++ += value;
- } else {
- // Create a new array, translate the values, and assign.
- QArray<QVector3D> result;
- int size = count();
- const QVector3D *src = constData();
- QVector3D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ + value;
- *this = result;
- }
-}
-
-/*!
- \fn void QVector3DArray::translate(qreal x, qreal y, qreal z)
- \overload
-
- Translates the elements in this array of QVector3D values
- by (\a x, \a y, \a z).
-
- \sa translated()
-*/
-
-/*!
- Returns a copy of this array of QVector3D values, translated
- by the components of \a value.
-
- \sa translate()
-*/
-QArray<QVector3D> QVector3DArray::translated(const QVector3D& value) const
-{
- QArray<QVector3D> result;
- int size = count();
- const QVector3D *src = constData();
- QVector3D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ + value;
- return result;
-}
-
-/*!
- \fn QArray<QVector3D> QVector3DArray::translated(qreal x, qreal y, qreal z) const
- \overload
-
- Returns a copy of this array of QVector3D values, translated
- by (\a x, \a y, \a z).
-
- \sa translate()
-*/
-
-/*!
- Transforms the elements in this array of QVector3D values
- by \a matrix.
-
- \sa transformed()
-*/
-void QVector3DArray::transform(const QMatrix4x4& matrix)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector3D *dst = data();
- for (int index = 0; index < size; ++index) {
- *dst = matrix * *dst;
- ++dst;
- }
- } else {
- // Create a new array, transform the values, and assign.
- QArray<QVector3D> result;
- int size = count();
- const QVector3D *src = constData();
- QVector3D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = matrix * *src++;
- *this = result;
- }
-}
-
-/*!
- Returns a copy of this array of QVector3D values, transformed
- by \a matrix.
-
- \sa transform()
-*/
-QArray<QVector3D> QVector3DArray::transformed(const QMatrix4x4& matrix) const
-{
- QArray<QVector3D> result;
- int size = count();
- const QVector3D *src = constData();
- QVector3D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = matrix * *src++;
- return result;
-}
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qvector3darray.h b/src/threed/arrays/qvector3darray.h
deleted file mode 100644
index acab2538..00000000
--- a/src/threed/arrays/qvector3darray.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVECTOR3DARRAY_H
-#define QVECTOR3DARRAY_H
-
-#include "qarray.h"
-#include <QtGui/qvector3d.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QMatrix4x4;
-
-class Q_QT3D_EXPORT QVector3DArray : public QArray<QVector3D>
-{
-public:
- QVector3DArray();
- QVector3DArray(int size, const QVector3D& value = QVector3D());
- QVector3DArray(const QArray<QVector3D>& other);
-
- void append(qreal x, qreal y, qreal z);
-
- void scale(qreal scale);
- QVector3DArray scaled(qreal scale) const;
-
- void translate(const QVector3D& value);
- void translate(qreal x, qreal y, qreal z);
-
- QArray<QVector3D> translated(const QVector3D& value) const;
- QArray<QVector3D> translated(qreal x, qreal y, qreal z) const;
-
- void transform(const QMatrix4x4& matrix);
- QArray<QVector3D> transformed(const QMatrix4x4& matrix) const;
-
-#if !defined(Q_NO_USING_KEYWORD) || defined(Q_QDOC)
- using QArray<QVector3D>::append;
-#else
- inline void append(const QVector3D& value)
- { QArray<QVector3D>::append(value); }
- inline void append(const QVector3D& value1, const QVector3D& value2)
- { QArray<QVector3D>::append(value1, value2); }
- inline void append(const QVector3D& value1, const QVector3D& value2, const QVector3D& value3)
- { QArray<QVector3D>::append(value1, value2, value3); }
- inline void append(const QVector3D& value1, const QVector3D& value2, const QVector3D& value3, const QVector3D& value4)
- { QArray<QVector3D>::append(value1, value2, value3, value4); }
- inline void append(const QVector3D *values, int count)
- { QArray<QVector3D>::append(values, count); }
- inline void append(const QArray<QVector3D>& other)
- { QArray<QVector3D>::append(other); }
-#endif
-};
-
-inline QVector3DArray::QVector3DArray() {}
-
-inline QVector3DArray::QVector3DArray(int size, const QVector3D& value)
- : QArray<QVector3D>(size, value) {}
-
-inline QVector3DArray::QVector3DArray(const QArray<QVector3D>& other)
- : QArray<QVector3D>(other) {}
-
-inline void QVector3DArray::append(qreal x, qreal y, qreal z)
- { QArray<QVector3D>::append(QVector3D(x, y, z)); }
-
-inline void QVector3DArray::translate(qreal x, qreal y, qreal z)
- { translate(QVector3D(x, y, z)); }
-
-inline QArray<QVector3D> QVector3DArray::translated(qreal x, qreal y, qreal z) const
- { return translated(QVector3D(x, y, z)); }
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/arrays/qvector4darray.cpp b/src/threed/arrays/qvector4darray.cpp
deleted file mode 100644
index df06ba97..00000000
--- a/src/threed/arrays/qvector4darray.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvector4darray.h"
-#include <QtGui/qmatrix4x4.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVector4DArray
- \brief The QVector4DArray class is a convenience for wrapping a QArray of QVector4D values.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::arrays
-
- QVector4DArray is used to build an array of 4D vector values
- based on floating-point x, y, and z arguments:
-
- \code
- QVector4DArray array;
- array.append(1.0f, 2.0f, 3.0f, -4.0f);
- array.append(-1.0f, 2.0f, 3.0f, -4.0f);
- array.append(1.0f, -2.0f, 3.0f, -4.0f);
- \endcode
-
- This is more convenient and readable than the equivalent with
- QArray:
-
- \code
- QArray<QVector4D> array;
- array.append(QVector4D(1.0f, 2.0f, 3.0f, -4.0f));
- array.append(QVector4D(-1.0f, 2.0f, 3.0f, -4.0f));
- array.append(QVector4D(1.0f, -2.0f, 3.0f, -4.0f));
- \endcode
-
- QVector4DArray also has convenience functions for transforming
- the contents of the array with translate(), translated(),
- transform(), and transformed().
-
- \sa QArray, QVector2DArray, QVector3DArray
-*/
-
-/*!
- \fn QVector4DArray::QVector4DArray()
-
- Constructs an empty array of QVector4D values.
-*/
-
-/*!
- \fn QVector4DArray::QVector4DArray(int size, const QVector4D& value)
-
- Constructs an array of QVector4D values with an initial \a size.
- All elements in the array are initialized to \a value.
-*/
-
-/*!
- \fn QVector4DArray::QVector4DArray(const QArray<QVector4D>& other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- \fn void QVector4DArray::append(qreal x, qreal y, qreal z, qreal w)
-
- Appends (\a x, \a y, \a z, \a w) to this array of QVector4D values.
-*/
-
-/*!
- Multiplies the elements in this array of QVector4D values by
- the \a scale.
-
- \sa scaled()
-*/
-void QVector4DArray::scale(qreal scale)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector4D *dst = data();
- for (int index = 0; index < size; ++index)
- *dst++ *= scale;
- } else {
- // Create a new array, translate the values, and assign.
- QArray<QVector4D> result;
- int size = count();
- const QVector4D *src = constData();
- QVector4D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ * scale;
- *this = result;
- }
-}
-
-/*!
- Returns a copy of this array of QVector4D values, multiplied
- by the \a scale.
-
- \sa scale()
-*/
-QVector4DArray QVector4DArray::scaled(qreal scale) const
-{
- QArray<QVector4D> result;
- int size = count();
- const QVector4D *src = constData();
- QVector4D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ * scale;
- return result;
-}
-
-/*!
- Translates the elements in this array of QVector4D values
- by the components of \a value.
-
- \sa translated()
-*/
-void QVector4DArray::translate(const QVector4D& value)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector4D *dst = data();
- for (int index = 0; index < size; ++index)
- *dst++ += value;
- } else {
- // Create a new array, translate the values, and assign.
- QArray<QVector4D> result;
- int size = count();
- const QVector4D *src = constData();
- QVector4D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ + value;
- *this = result;
- }
-}
-
-/*!
- \fn void QVector4DArray::translate(qreal x, qreal y, qreal z, qreal w);
- \overload
-
- Translates the elements in this array of QVector4D values
- by (\a x, \a y, \a z, \a w).
-
- \sa translated()
-*/
-
-/*!
- Returns a copy of this array of QVector4D values, translated
- by the components of \a value.
-
- \sa translate()
-*/
-QArray<QVector4D> QVector4DArray::translated(const QVector4D& value) const
-{
- QArray<QVector4D> result;
- int size = count();
- const QVector4D *src = constData();
- QVector4D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = *src++ + value;
- return result;
-}
-
-/*!
- \fn QArray<QVector4D> QVector4DArray::translated(qreal x, qreal y, qreal z, qreal w) const
- \overload
-
- Returns a copy of this array of QVector4D values, translated
- by (\a x, \a y, \a z, \a w).
-
- \sa translate()
-*/
-
-/*!
- Transforms the elements in this array of QVector4D values
- by \a matrix.
-
- \sa transformed()
-*/
-void QVector4DArray::transform(const QMatrix4x4& matrix)
-{
- if (isDetached()) {
- // Modify the array in-place.
- int size = count();
- QVector4D *dst = data();
- for (int index = 0; index < size; ++index) {
- *dst = matrix * *dst;
- ++dst;
- }
- } else {
- // Create a new array, transform the values, and assign.
- QArray<QVector4D> result;
- int size = count();
- const QVector4D *src = constData();
- QVector4D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = matrix * *src++;
- *this = result;
- }
-}
-
-/*!
- Returns a copy of this array of QVector3D values, transformed
- by \a matrix.
-
- \sa transform()
-*/
-QArray<QVector4D> QVector4DArray::transformed(const QMatrix4x4& matrix) const
-{
- QArray<QVector4D> result;
- int size = count();
- const QVector4D *src = constData();
- QVector4D *dst = result.extend(size);
- for (int index = 0; index < size; ++index)
- *dst++ = matrix * *src++;
- return result;
-}
-
-QT_END_NAMESPACE
diff --git a/src/threed/arrays/qvector4darray.h b/src/threed/arrays/qvector4darray.h
deleted file mode 100644
index 4d215fad..00000000
--- a/src/threed/arrays/qvector4darray.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVECTOR4DARRAY_H
-#define QVECTOR4DARRAY_H
-
-#include "qarray.h"
-#include <QtGui/qvector4d.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QMatrix4x4;
-
-class Q_QT3D_EXPORT QVector4DArray : public QArray<QVector4D>
-{
-public:
- QVector4DArray();
- QVector4DArray(int size, const QVector4D& value = QVector4D());
- QVector4DArray(const QArray<QVector4D>& other);
-
- void append(qreal x, qreal y, qreal z, qreal w);
-
- void scale(qreal scale);
- QVector4DArray scaled(qreal scale) const;
-
- void translate(const QVector4D& value);
- void translate(qreal x, qreal y, qreal z, qreal w);
-
- QArray<QVector4D> translated(const QVector4D& value) const;
- QArray<QVector4D> translated
- (qreal x, qreal y, qreal z, qreal w) const;
-
- void transform(const QMatrix4x4& matrix);
- QArray<QVector4D> transformed(const QMatrix4x4& matrix) const;
-
-#if !defined(Q_NO_USING_KEYWORD) || defined(Q_QDOC)
- using QArray<QVector4D>::append;
-#else
- inline void append(const QVector4D& value)
- { QArray<QVector4D>::append(value); }
- inline void append(const QVector4D& value1, const QVector4D& value2)
- { QArray<QVector4D>::append(value1, value2); }
- inline void append(const QVector4D& value1, const QVector4D& value2, const QVector4D& value3)
- { QArray<QVector4D>::append(value1, value2, value3); }
- inline void append(const QVector4D& value1, const QVector4D& value2, const QVector4D& value3, const QVector4D& value4)
- { QArray<QVector4D>::append(value1, value2, value3, value4); }
- inline void append(const QVector4D *values, int count)
- { QArray<QVector4D>::append(values, count); }
- inline void append(const QArray<QVector4D>& other)
- { QArray<QVector4D>::append(other); }
-#endif
-};
-
-inline QVector4DArray::QVector4DArray() {}
-
-inline QVector4DArray::QVector4DArray(int size, const QVector4D& value)
- : QArray<QVector4D>(size, value) {}
-
-inline QVector4DArray::QVector4DArray(const QArray<QVector4D>& other)
- : QArray<QVector4D>(other) {}
-
-inline void QVector4DArray::append(qreal x, qreal y, qreal z, qreal w)
- { QArray<QVector4D>::append(QVector4D(x, y, z, w)); }
-
-inline void QVector4DArray::translate(qreal x, qreal y, qreal z, qreal w)
- { translate(QVector4D(x, y, z, w)); }
-
-inline QArray<QVector4D> QVector4DArray::translated
- (qreal x, qreal y, qreal z, qreal w) const
- { return translated(QVector4D(x, y, z, w)); }
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif