mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
Feature/interactionsphere (#1561)
* Add ability to render the bounding sphere as a debug option * Separate boundingsphere and interactionspheres * Correctly compute BoundingSpheres for more renderables (RenderablePlanesCloud, RenderableOrbitalKepler)
This commit is contained in:
@@ -1486,14 +1486,21 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
-std::numeric_limits<float>::max()
|
||||
);
|
||||
|
||||
double maxRadius = 0.0;
|
||||
|
||||
for (size_t i = 0; i < _fullData.size(); i += _nValuesPerStar) {
|
||||
glm::vec3 position = glm::vec3(
|
||||
glm::dvec3 position = glm::dvec3(
|
||||
_fullData[i + 0],
|
||||
_fullData[i + 1],
|
||||
_fullData[i + 2]
|
||||
);
|
||||
position *= openspace::distanceconstants::Parsec;
|
||||
|
||||
const double r = glm::length(position);
|
||||
if (r > maxRadius) {
|
||||
maxRadius = r;
|
||||
}
|
||||
|
||||
switch (option) {
|
||||
case ColorOption::Color:
|
||||
case ColorOption::FixedColor:
|
||||
@@ -1503,7 +1510,11 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
std::array<float, sizeof(ColorVBOLayout) / sizeof(float)> data;
|
||||
} layout;
|
||||
|
||||
layout.value.position = { { position[0], position[1], position[2] } };
|
||||
layout.value.position = { {
|
||||
static_cast<float>(position[0]),
|
||||
static_cast<float>(position[1]),
|
||||
static_cast<float>(position[2])
|
||||
}};
|
||||
|
||||
if (_enableTestGrid) {
|
||||
float sunColor = 0.650f;
|
||||
@@ -1531,7 +1542,11 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
std::array<float, sizeof(VelocityVBOLayout) / sizeof(float)> data;
|
||||
} layout;
|
||||
|
||||
layout.value.position = { { position[0], position[1], position[2] } };
|
||||
layout.value.position = {{
|
||||
static_cast<float>(position[0]),
|
||||
static_cast<float>(position[1]),
|
||||
static_cast<float>(position[2])
|
||||
}};
|
||||
|
||||
layout.value.value = _fullData[i + _bvColorArrayPos];
|
||||
layout.value.luminance = _fullData[i + _lumArrayPos];
|
||||
@@ -1556,7 +1571,11 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
std::array<float, sizeof(SpeedVBOLayout) / sizeof(float)> data;
|
||||
} layout;
|
||||
|
||||
layout.value.position = { { position[0], position[1], position[2] } };
|
||||
layout.value.position = {{
|
||||
static_cast<float>(position[0]),
|
||||
static_cast<float>(position[1]),
|
||||
static_cast<float>(position[2])
|
||||
}};
|
||||
|
||||
layout.value.value = _fullData[i + _bvColorArrayPos];
|
||||
layout.value.luminance = _fullData[i + _lumArrayPos];
|
||||
@@ -1579,7 +1598,11 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
std::array<float, sizeof(OtherDataLayout)> data;
|
||||
} layout = {};
|
||||
|
||||
layout.value.position = { { position[0], position[1], position[2] } };
|
||||
layout.value.position = {{
|
||||
static_cast<float>(position[0]),
|
||||
static_cast<float>(position[1]),
|
||||
static_cast<float>(position[2])
|
||||
}};
|
||||
|
||||
int index = _otherDataOption.value();
|
||||
// plus 3 because of the position
|
||||
@@ -1612,6 +1635,8 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setBoundingSphere(maxRadius);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user