something draws, now

This commit is contained in:
Seth Alves 2015-05-21 10:42:14 -07:00
parent 72e227eefe
commit fe188f9a43
2 changed files with 10 additions and 1 deletions

View file

@ -97,13 +97,15 @@ void RenderablePolyVoxEntityItem::getModel() {
mesh->setVertexBuffer(gpu::BufferView(vertexBufferPtr,
0,
vertexBufferPtr->getSize() - sizeof(float) * 3,
sizeof(float) * 7,
sizeof(float) * 3,
// sizeof(PolyVox::PositionMaterialNormal),
gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RAW)));
mesh->addAttribute(gpu::Stream::NORMAL,
gpu::BufferView(vertexBufferPtr,
sizeof(float) * 3,
vertexBufferPtr->getSize() - sizeof(float) * 3,
sizeof(float) * 7,
// sizeof(PolyVox::PositionMaterialNormal),
gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RAW)));
@ -138,6 +140,10 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
gpu::Batch batch;
// XXX why do I need these?
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
auto mesh = _modelGeometry.getMesh();
batch.setInputFormat(mesh->getVertexFormat());
batch.setIndexBuffer(gpu::UINT32, mesh->getIndexBuffer()._buffer, 0);

View file

@ -21,6 +21,7 @@
EntityItem* PolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
qDebug() << "XXXXXXXXXXXX XXXXXXXXXXXX making PolyVoxEntityItem entity";
EntityItem* result = new PolyVoxEntityItem(entityID, properties);
return result;
}
@ -28,6 +29,8 @@ EntityItem* PolyVoxEntityItem::factory(const EntityItemID& entityID, const Entit
PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
{
qDebug() << "XXXXXXXXXXXX XXXXXXXXXXXX making PolyVoxEntityItem entity";
_type = EntityTypes::PolyVox;
_created = properties.getCreated();
setProperties(properties);