Beispiel #1
0
            internal void ComputeEffects(DefenseShields shield, Vector3D impactPos, int prevLod, float shieldPercent, bool activeVisible)
            {
                Shield = shield;
                if (Shield?.ShellActive != null)
                {
                    ComputeSides();
                }
                else
                {
                    return;
                }
                _matrix = Shield.ShieldShapeMatrix;

                if (Session.Instance.Settings.ClientConfig.ShowHitRings && impactPos != Vector3D.NegativeInfinity && impactPos != Vector3D.PositiveInfinity)
                {
                    CreateImpactRing(shield, impactPos, _lod);
                }

                _flash = shieldPercent <= 10;
                if (_flash && _mainLoop < 30)
                {
                    shieldPercent += 10;
                }

                var newActiveColor = UtilsStatic.GetShieldColorFromFloat(shieldPercent);

                _activeColor = newActiveColor;

                ImpactPosState = impactPos;
                _active        = activeVisible && _activeColor != Session.Instance.Color90;

                if (prevLod != _lod)
                {
                    var ib = _backing.IndexBuffer[_lod];
                    Array.Resize(ref _preCalcNormLclPos, ib.Length / 3);
                    Array.Resize(ref _triColorBuffer, ib.Length / 3);
                }

                StepEffects();

                /*
                 * if (refreshAnim && _refresh && ImpactsFinished && prevLod == _lod) RefreshColorAssignments(prevLod);
                 * if (ImpactsFinished && prevLod == _lod) return;
                 *
                 * ImpactColorAssignments(prevLod);
                 */

                //// vec3 localSpherePositionOfImpact;
                //    foreach (vec3 triangleCom in triangles) {
                //    var surfDistance = Math.acos(dot(triangleCom, localSpherePositionOfImpact));
                // }
                // surfDistance will be the distance, along the surface, between the impact point and the triangle
                // Equinox - It won't distort properly for anything that isn't a sphere
                // localSpherePositionOfImpact = a direction
                // triangleCom is another direction
                // Dot product is the cosine of the angle between them
                // Acos gives you that angle in radians
                // Multiplying by the sphere radius(1 for the unit sphere in question) gives the arc length.
            }
Beispiel #2
0
            internal void ComputeEffects(MatrixD matrix, Vector3D impactPos, MyEntity shellPassive, MyEntity shellActive, int prevLod, float shieldPercent, bool activeVisible, bool refreshAnim)
            {
                if (ShellActive == null)
                {
                    ComputeSides(shellActive);
                }

                _flash = shieldPercent <= 10;
                if (_flash && _mainLoop < 30)
                {
                    shieldPercent += 10;
                }

                var newActiveColor = UtilsStatic.GetShieldColorFromFloat(shieldPercent);

                _activeColor = newActiveColor;

                _matrix        = matrix;
                ImpactPosState = impactPos;
                _active        = activeVisible && _activeColor != Session.Instance.Color90;

                if (prevLod != _lod)
                {
                    var ib = _backing.IndexBuffer[_lod];
                    Array.Resize(ref _preCalcNormLclPos, ib.Length / 3);
                    Array.Resize(ref _triColorBuffer, ib.Length / 3);
                }

                StepEffects();

                if (refreshAnim && _refresh && ImpactsFinished && prevLod == _lod)
                {
                    RefreshColorAssignments(prevLod);
                }
                if (ImpactsFinished && prevLod == _lod)
                {
                    return;
                }

                ImpactColorAssignments(prevLod);
                //// vec3 localSpherePositionOfImpact;
                //    foreach (vec3 triangleCom in triangles) {
                //    var surfDistance = Math.acos(dot(triangleCom, localSpherePositionOfImpact));
                // }
                // surfDistance will be the distance, along the surface, between the impact point and the triangle
                // Equinox - It won't distort properly for anything that isn't a sphere
                // localSpherePositionOfImpact = a direction
                // triangleCom is another direction
                // Dot product is the cosine of the angle between them
                // Acos gives you that angle in radians
                // Multiplying by the sphere radius(1 for the unit sphere in question) gives the arc length.
            }