mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 17:03:43 +02:00
don't crash if entity dimensions somehow include a zero
This commit is contained in:
parent
7641677902
commit
6f6343420c
1 changed files with 4 additions and 0 deletions
|
@ -404,6 +404,9 @@ bool RenderablePolyVoxEntityItem::setSphere(glm::vec3 centerWorldCoords, float r
|
|||
float smallestDimensionSize = voxelSize.x;
|
||||
smallestDimensionSize = glm::min(smallestDimensionSize, voxelSize.y);
|
||||
smallestDimensionSize = glm::min(smallestDimensionSize, voxelSize.z);
|
||||
if (smallestDimensionSize <= 0.0f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
glm::vec3 maxRadiusInVoxelCoords = glm::vec3(radiusWorldCoords / smallestDimensionSize);
|
||||
glm::vec3 centerInVoxelCoords = wtvMatrix * glm::vec4(centerWorldCoords, 1.0f);
|
||||
|
@ -1310,6 +1313,7 @@ void RenderablePolyVoxEntityItem::recomputeMesh() {
|
|||
mesh->setVertexBuffer(vertexBufferView);
|
||||
|
||||
|
||||
// TODO -- use 3-byte normals rather than 3-float normals
|
||||
mesh->addAttribute(gpu::Stream::NORMAL,
|
||||
gpu::BufferView(vertexBufferPtr,
|
||||
sizeof(float) * 3, // polyvox mesh is packed: position, normal, material
|
||||
|
|
Loading…
Reference in a new issue