MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / updateTranslucency

Method updateTranslucency

src/clientbase/Player.cpp:631–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

629
630
631void Player::updateTranslucency(float dt) {
632 // update the alpha value
633 if (alphaRate != 0.0f) {
634 alpha += dt * alphaRate;
635 if (alphaRate < 0.0f) {
636 if (alpha < alphaTarget) {
637 alpha = alphaTarget;
638 alphaRate = 0.0f;
639 }
640 }
641 else {
642 if (alpha > alphaTarget) {
643 alpha = alphaTarget;
644 alphaRate = 0.0f;
645 }
646 }
647 }
648
649 // set the tankNode color
650 if (isPhantomZoned()) {
651 teleAlpha = 1.0f;
652 color.a = 0.25f; // barely visible, regardless of teleporter proximity
653 }
654 else {
655 World* world = World::getWorld();
656 if (!world) {
657 return;
658 }
659 teleporterProximity = world->getProximity(state.pos, BZDBCache::tankRadius);
660 teleAlpha = (1.0f - (0.75f * teleporterProximity));
661
662 if (alpha == 0.0f) {
663 color.a = 0.0f; // not trusting FP accuracy
664 }
665 else {
666 color.a = teleAlpha * alpha;
667 }
668 }
669}
670
671
672void Player::updateTreads(float dt) {

Callers

nothing calls this directly

Calls 1

getProximityMethod · 0.45

Tested by

no test coverage detected