summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2015-01-23 16:22:00 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-08-07 00:11:31 +0000
commitc2f6f37699296557c5d79ae750e0ce91647de2ee (patch)
tree6c140186656c46d5e8584d48772f70e78d04806c /src/plugins
parentce69c98f6954ef2c8806bc44a457a58e4202d751 (diff)
New Buffer API Frontend Classes
- Switch QAbstractAttribute and QAbstractBuffer to QNode subclasses - Get rid of all shared pointer when dealing with these (needed to expose to QML and use the QObject ownership) - Introduce QGeometryRender, QGeometry, QAttributeProvider, QAttributeAggregator. A QMesh component now is: a QGeometryRenderer which specifies its QGeometry. The QGeometry refererences n attributes. Each attribute references a QAbstractBuffer. Change-Id: I49a10c11a605e5fe7c180af86a404f622e763f48 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp
index 351faa281..c477ea51f 100644
--- a/src/plugins/sceneparsers/assimp/assimpparser.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpparser.cpp
@@ -599,44 +599,44 @@ void AssimpParser::loadMesh(uint meshIndex)
}
}
// Create a Buffer from the raw array
- BufferPtr vbuffer(new Buffer(QOpenGLBuffer::VertexBuffer));
- vbuffer->setUsage(QOpenGLBuffer::StaticDraw);
+ QBuffer *vbuffer(new QBuffer(QBuffer::VertexBuffer));
+ vbuffer->setUsage(QBuffer::StaticDraw);
vbuffer->setData(bufferArray);
// Add vertex attributes to the mesh with the right array
meshData->addAttribute(VERTICES_ATTRIBUTE_NAME,
- AttributePtr(new Attribute(vbuffer,
- GL_FLOAT_VEC3,
- mesh->mNumVertices,
- 0,
- chunkSize * sizeof(float))));
+ new QAttribute(vbuffer,
+ GL_FLOAT_VEC3,
+ mesh->mNumVertices,
+ 0,
+ chunkSize * sizeof(float)));
meshData->addAttribute(NORMAL_ATTRIBUTE_NAME,
- AttributePtr(new Attribute(vbuffer,
- GL_FLOAT_VEC3,
- mesh->mNumVertices,
- 3 * sizeof(float),
- chunkSize * sizeof(float))));
+ new QAttribute(vbuffer,
+ GL_FLOAT_VEC3,
+ mesh->mNumVertices,
+ 3 * sizeof(float),
+ chunkSize * sizeof(float)));
if (hasTangent)
meshData->addAttribute(TANGENT_ATTRIBUTE_NAME,
- AttributePtr(new Attribute(vbuffer,
- GL_FLOAT_VEC3,
- mesh->mNumVertices,
- 6 * sizeof(float),
- chunkSize * sizeof(float))));
+ new QAttribute(vbuffer,
+ GL_FLOAT_VEC3,
+ mesh->mNumVertices,
+ 6 * sizeof(float),
+ chunkSize * sizeof(float)));
if (hasTexture)
meshData->addAttribute(TEXTCOORD_ATTRIBUTE_NAME,
- AttributePtr(new Attribute(vbuffer,
- GL_FLOAT_VEC2,
- mesh->mNumVertices,
- (hasTangent ? 9 : 6) * sizeof(float),
- chunkSize * sizeof(float))));
+ new QAttribute(vbuffer,
+ GL_FLOAT_VEC2,
+ mesh->mNumVertices,
+ (hasTangent ? 9 : 6) * sizeof(float),
+ chunkSize * sizeof(float)));
if (hasColor)
meshData->addAttribute(COLOR_ATTRIBUTE_NAME,
- AttributePtr(new Attribute(vbuffer,
- GL_FLOAT_VEC4,
- mesh->mNumVertices,
- (6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0)) * sizeof(float),
- chunkSize * sizeof(float))));
+ new QAttribute(vbuffer,
+ GL_FLOAT_VEC4,
+ mesh->mNumVertices,
+ (6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0)) * sizeof(float),
+ chunkSize * sizeof(float)));
GLuint indiceType;
QByteArray ibufferContent;
uint indices = mesh->mNumFaces * 3;
@@ -663,12 +663,12 @@ void AssimpParser::loadMesh(uint meshIndex)
}
// Create Indices buffer
- BufferPtr ibuffer(new Buffer(QOpenGLBuffer::IndexBuffer));
- ibuffer->setUsage(QOpenGLBuffer::StaticDraw);
+ QBuffer *ibuffer(new QBuffer(QBuffer::IndexBuffer));
+ ibuffer->setUsage(QBuffer::StaticDraw);
ibuffer->setData(ibufferContent);
// Add indices attributes
- meshData->setIndexAttribute(AttributePtr(new Attribute(ibuffer, indiceType, indices, 0, 0)));
+ meshData->setIndexAttribute(new QAttribute(ibuffer, indiceType, indices, 0, 0));
meshData->computeBoundsFromAttribute(VERTICES_ATTRIBUTE_NAME);