mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-13 08:58:54 -05:00
Force an even number of vertices for the RenderableSpheres (closes #957)
This commit is contained in:
@@ -137,7 +137,12 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
|
||||
if (dictionary.hasKey(SegmentsInfo.identifier)) {
|
||||
_segments = static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));
|
||||
}
|
||||
_segments.onChange([&]() { _gridIsDirty = true; });
|
||||
_segments.onChange([&]() {
|
||||
if (_segments.value() % 2 == 1) {
|
||||
_segments = _segments - 1;
|
||||
}
|
||||
_gridIsDirty = true;
|
||||
});
|
||||
addProperty(_segments);
|
||||
|
||||
if (dictionary.hasKey(LineWidthInfo.identifier)) {
|
||||
@@ -259,7 +264,10 @@ void RenderableSphericalGrid::update(const UpdateData&) {
|
||||
_isize = 6 * _segments * _segments;
|
||||
_vsize = (_segments + 1) * (_segments + 1);
|
||||
_varray.resize(_vsize);
|
||||
Vertex v = { 0.f, 0.f, 0.f };
|
||||
std::fill(_varray.begin(), _varray.end(), v);
|
||||
_iarray.resize(_isize);
|
||||
std::fill(_iarray.begin(), _iarray.end(), 0);
|
||||
|
||||
int nr = 0;
|
||||
const float fsegments = static_cast<float>(_segments);
|
||||
|
||||
Reference in New Issue
Block a user