Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the "meeting point" arrow always visible #239

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions source/glest_game/graphics/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5683,7 +5683,7 @@ void Renderer::renderSelectionEffects(int healthbarMode) {
map->clampPos(pos);

Vec3f arrowTarget= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
renderArrow(unit->getCurrVectorFlat(), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.3f);
renderArrow(unit->getCurrVectorFlat(), arrowTarget, Vec3f(0.f, 0.f, 1.f), 0.25f);
}
}
}
Expand Down Expand Up @@ -8716,17 +8716,11 @@ void Renderer::renderArrow(const Vec3f &pos1, const Vec3f &pos2,
}

const int tesselation= 3;
const float arrowEndSize= 0.4f;
const float maxlen= 25;
const float blendDelay= 5.f;
const float arrowEndSize= 0.6f;

Vec3f dir= Vec3f(pos2-pos1);
float len= dir.length();

if(len>maxlen) {
return;
}
float alphaFactor= clamp((maxlen-len)/blendDelay, 0.f, 1.f);
float alphaFactor= 0.25;

dir.normalize();
Vec3f normal= dir.cross(Vec3f(0, 1, 0));
Expand All @@ -8742,7 +8736,7 @@ void Renderer::renderArrow(const Vec3f &pos1, const Vec3f &pos2,
float t= static_cast<float>(i)/tesselation;
Vec3f a= pos1Left.lerp(t, pos2Left);
Vec3f b= pos1Right.lerp(t, pos2Right);
Vec4f c= Vec4f(color, t*0.25f*alphaFactor);
Vec4f c= Vec4f(color, std::max(0.04f,t*alphaFactor));

glColor4fv(c.ptr());

Expand Down