mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 19:50:38 +02:00
hack to avoid crash
This commit is contained in:
parent
f5536a01a7
commit
a66a1d392e
1 changed files with 25 additions and 13 deletions
|
@ -551,11 +551,18 @@ void RenderablePolyVoxEntityItem::setZTextureURL(QString zTextureURL) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint64 start { 0 };
|
||||||
|
|
||||||
void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
||||||
PerformanceTimer perfTimer("RenderablePolyVoxEntityItem::render");
|
PerformanceTimer perfTimer("RenderablePolyVoxEntityItem::render");
|
||||||
assert(getType() == EntityTypes::PolyVox);
|
assert(getType() == EntityTypes::PolyVox);
|
||||||
Q_ASSERT(args->_batch);
|
Q_ASSERT(args->_batch);
|
||||||
|
|
||||||
|
if (start == 0) {
|
||||||
|
start = usecTimestampNow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool voxelDataDirty;
|
bool voxelDataDirty;
|
||||||
bool volDataDirty;
|
bool volDataDirty;
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
|
@ -600,29 +607,34 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
||||||
_pipeline = gpu::Pipeline::create(program, state);
|
_pipeline = gpu::Pipeline::create(program, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_vertexFormat) {
|
||||||
if (!_vertexFormat) {
|
auto vf = std::make_shared<gpu::Stream::Format>();
|
||||||
auto vf = std::make_shared<gpu::Stream::Format>();
|
vf->setAttribute(gpu::Stream::POSITION, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||||
vf->setAttribute(gpu::Stream::POSITION, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
vf->setAttribute(gpu::Stream::NORMAL, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 12);
|
||||||
vf->setAttribute(gpu::Stream::NORMAL, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 12);
|
_vertexFormat = vf;
|
||||||
_vertexFormat = vf;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gpu::Batch& batch = *args->_batch;
|
gpu::Batch& batch = *args->_batch;
|
||||||
batch.setPipeline(_pipeline);
|
batch.setPipeline(_pipeline);
|
||||||
|
|
||||||
Transform transform(voxelToWorldMatrix());
|
Transform transform(voxelToWorldMatrix());
|
||||||
batch.setModelTransform(transform);
|
batch.setModelTransform(transform);
|
||||||
// batch.setInputFormat(mesh->getVertexFormat());
|
batch.setInputFormat(_vertexFormat);
|
||||||
batch.setInputFormat(_vertexFormat);
|
|
||||||
|
// ok
|
||||||
|
if (usecTimestampNow() - start < 200000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// batch.setInputStream(0, mesh->getVertexStream());
|
|
||||||
batch.setInputBuffer(gpu::Stream::POSITION, mesh->getVertexBuffer()._buffer,
|
batch.setInputBuffer(gpu::Stream::POSITION, mesh->getVertexBuffer()._buffer,
|
||||||
0,
|
0,
|
||||||
sizeof(PolyVox::PositionMaterialNormal));
|
sizeof(PolyVox::PositionMaterialNormal));
|
||||||
/* batch.setInputBuffer(gpu::Stream::NORMAL, mesh->getVertexBuffer()._buffer,
|
|
||||||
sizeof(float) * 3,
|
|
||||||
sizeof(PolyVox::PositionMaterialNormal));*/
|
// crash
|
||||||
|
// if (usecTimestampNow() - start < 200000) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
batch.setIndexBuffer(gpu::UINT32, mesh->getIndexBuffer()._buffer, 0);
|
batch.setIndexBuffer(gpu::UINT32, mesh->getIndexBuffer()._buffer, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue