Fix naming of umbral and penumbral shadows

This commit is contained in:
Alexander Bock
2023-10-06 14:12:18 +02:00
parent 4ef2bd0519
commit 49b3cb9eb1

View File

@@ -456,34 +456,9 @@ void RenderableEclipseCone::createCone(double et) {
);
// 4. Construct the penumbral shadow
std::vector<VBOLayout> penumbralVertices;
if (_showPenumbralShadow) {
penumbralVertices = calculateShadowPoints(
resSrc.terminatorPoints,
resDst.terminatorPoints,
shadowerToLightSource,
lightSourceToShadower,
distance * static_cast<double>(_shadowLength)
);
// We need to duplicate the first two vertices to close the cylinder at the seam
penumbralVertices.push_back(penumbralVertices[0]);
penumbralVertices.push_back(penumbralVertices[1]);
}
// 5. Construct the umbral shadow
// 4. Construct the umbral shadow
std::vector<VBOLayout> umbralVertices;
if (_showUmbralShadow) {
// For the umbral shadow, we need to mix the terminator points with a 180
// degree phase shift, so that the top terminator point of the sun gets matched
// with the bottom terminator point of the Moon, etc
std::rotate(
resSrc.terminatorPoints.begin(),
resSrc.terminatorPoints.begin() + resSrc.terminatorPoints.size() / 2,
resSrc.terminatorPoints.end()
);
umbralVertices = calculateShadowPoints(
resSrc.terminatorPoints,
resDst.terminatorPoints,
@@ -498,6 +473,31 @@ void RenderableEclipseCone::createCone(double et) {
}
// 5. Construct the penumbral shadow
std::vector<VBOLayout> penumbralVertices;
if (_showPenumbralShadow) {
// For the penumbral shadow, we need to mix the terminator points with a 180
// degree phase shift, so that the top terminator point of the sun gets matched
// with the bottom terminator point of the Moon, etc
std::rotate(
resSrc.terminatorPoints.begin(),
resSrc.terminatorPoints.begin() + resSrc.terminatorPoints.size() / 2,
resSrc.terminatorPoints.end()
);
penumbralVertices = calculateShadowPoints(
resSrc.terminatorPoints,
resDst.terminatorPoints,
shadowerToLightSource,
lightSourceToShadower,
distance * static_cast<double>(_shadowLength)
);
// We need to duplicate the first two vertices to close the cylinder at the seam
penumbralVertices.push_back(penumbralVertices[0]);
penumbralVertices.push_back(penumbralVertices[1]);
}
// 6. Combine vertices
std::vector<VBOLayout> vertices;
vertices.reserve(umbralVertices.size() + penumbralVertices.size());