graphics/mesh.h
(Diff revision 1)
|
namespace GluonGraphics |
71 |
/** |
73 |
VertexBuffer* vertexBuffer() const; |
Please add a comment about what this method does.
graphics/mesh.cpp
(Diff revision 1)
|
|
126 |
glGenBuffers( 1, &d->buffer ); |
107 |
return d->buffer->isLoaded(); |
Why does buffer have an isLoaded method? Buffer should not track that state, it should be indifferent to how vertices have been added.
insert? insert where? if you mean append, please use append as method name. :)
Hm, I tend to prefer to use QString as much as possible.
What about using size() for the size in bytes and itemCount or something similar for the number of items?
Just copying these pointers seems rather dangerous to me. Then again, you're not cleaning them so I guess we just leak instead of crashing....
graphics/vertexattribute.cpp
(Diff revision 1)
|
|
VertexAttribute::VertexAttribute( const VertexAttribute& other ) |
|
|
106 |
d->data = other.d->data; |
See the comment @ copy ctor. (By the way, it is usually easier to either write *this = other in the copy ctor so you use the assignment operator and save some additional lines of code)
create does not really seem the best name for this method, maybe use initialize() or initializeHardwareBuffer even?
See my comment on mesh, buffer should not track loading state. If it means "created has been called" then that should be the name of the method.
- Arjen
On January 14th, 2011, 9:54 p.m., Giulio Camuffo wrote:
Review request for Gluon.
By Giulio Camuffo.
Updated Jan. 14, 2011, 9:54 p.m.
Description
This patch adds the VertexAttribute and VertexBuffer classes, moving the rendering out of Mesh. It allows a Mesh subclass to use more vertex attributes adding them to the buffer provided by the method Mesh::vertexBuffer.
There is the singleDataSize method in VertexAttribute which name is basically a placeholder because i could not find a better one. It returns the number of fields for each vertex. E.g 3 for the vertex position (x,y,z), 4 for the color (r,g,b,a), etc. Suggestions welcome!
|
Testing
I tested it with a sprite component and my TerrainMesh. It works right.
|
Diffs
- graphics/CMakeLists.txt (984fe25)
- graphics/mesh.h (95d1230)
- graphics/mesh.cpp (d367c62)
- graphics/vertexattribute.h (PRE-CREATION)
- graphics/vertexattribute.cpp (PRE-CREATION)
- graphics/vertexbuffer.h (PRE-CREATION)
- graphics/vertexbuffer.cpp (PRE-CREATION)
View Diff
|