mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +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) {
|
||||
PerformanceTimer perfTimer("RenderablePolyVoxEntityItem::render");
|
||||
assert(getType() == EntityTypes::PolyVox);
|
||||
Q_ASSERT(args->_batch);
|
||||
|
||||
if (start == 0) {
|
||||
start = usecTimestampNow();
|
||||
return;
|
||||
}
|
||||
|
||||
bool voxelDataDirty;
|
||||
bool volDataDirty;
|
||||
withWriteLock([&] {
|
||||
|
@ -600,29 +607,34 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
|||
_pipeline = gpu::Pipeline::create(program, state);
|
||||
}
|
||||
|
||||
|
||||
if (!_vertexFormat) {
|
||||
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::NORMAL, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 12);
|
||||
_vertexFormat = vf;
|
||||
}
|
||||
if (!_vertexFormat) {
|
||||
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::NORMAL, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 12);
|
||||
_vertexFormat = vf;
|
||||
}
|
||||
|
||||
gpu::Batch& batch = *args->_batch;
|
||||
batch.setPipeline(_pipeline);
|
||||
|
||||
Transform transform(voxelToWorldMatrix());
|
||||
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,
|
||||
0,
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue