public void TransformBasis(Matrix4x4 newThisToVesselMatrix)
        {
            try
            {
                // ReSharper disable once InconsistentlySynchronizedField
                Matrix4x4 tempMatrix = newThisToVesselMatrix * meshLocalToWorld;

                Vector3 low  = Vector3.one * float.PositiveInfinity;
                Vector3 high = Vector3.one * float.NegativeInfinity;

                for (int i = 0; i < vertices.Length; i++)
                {
                    Vector3 vert = tempMatrix.MultiplyPoint3x4(meshLocalVerts[i]);

                    float tmpTestVert = vert.x + vert.y + vert.z;
                    if (float.IsNaN(tmpTestVert) || float.IsInfinity(tmpTestVert))
                    {
                        ThreadSafeDebugLogger.Error("Transform error in " + module.part.partInfo.title);
                        valid = false;
                    }
                    else
                    {
                        valid = true;
                    }

                    vertices[i] = vert;
                    low         = Vector3.Min(low, vert);
                    high        = Vector3.Max(high, vert);
                }

                bounds = new Bounds(0.5f * (high + low), high - low);
            }
            catch (Exception e)
            {
                FARLogger.Exception(e);
            }
            finally
            {
                module.DecrementMeshesToUpdate();
            }
        }
        } //use the fairing events instead

        // ReSharper disable once MemberCanBeMadeStatic.Local
        private void FairingDeployGeometryUpdate(Part p)
        {
            ThreadSafeDebugLogger.Info("Fairing Geometry Update");
            validParts[p].GeometryPartModuleRebuildMeshData();
        }
        public GeometryMesh(
            MeshData meshData,
            Transform meshTransform,
            Matrix4x4 worldToVesselMatrix,
            GeometryPartModule module
            )
        {
            this.module    = module;
            part           = module.part;
            meshLocalVerts = meshData.vertices;
            triangles      = meshData.triangles;
            isSkinned      = meshData.isSkinned;
            Bounds meshBounds = meshData.bounds;

            vertices           = new Vector3[meshLocalVerts.Length];
            this.meshTransform = meshTransform;
            partTransform      = part.transform;
            UpdateLocalToWorldMatrix();
            thisToVesselMatrix = worldToVesselMatrix * meshLocalToWorld;

            for (int i = 0; i < vertices.Length; i++)
            {
                Vector3 v    = meshLocalVerts[i];
                Vector3 vert = Vector3.zero;
                vert.x = thisToVesselMatrix.m00 * v.x +
                         thisToVesselMatrix.m01 * v.y +
                         thisToVesselMatrix.m02 * v.z +
                         thisToVesselMatrix.m03;
                vert.y = thisToVesselMatrix.m10 * v.x +
                         thisToVesselMatrix.m11 * v.y +
                         thisToVesselMatrix.m12 * v.z +
                         thisToVesselMatrix.m13;
                vert.z = thisToVesselMatrix.m20 * v.x +
                         thisToVesselMatrix.m21 * v.y +
                         thisToVesselMatrix.m22 * v.z +
                         thisToVesselMatrix.m23;

                float tmpTestVert = vert.x + vert.y + vert.z;
                if (float.IsNaN(tmpTestVert) || float.IsInfinity(tmpTestVert))
                {
                    ThreadSafeDebugLogger.Error("Mesh error in " + module.part.partInfo.title);
                }
                vertices[i] = vert;
            }

            gameObjectActiveInHierarchy = meshTransform.gameObject.activeInHierarchy;

            meshLocalBounds = meshBounds;
            bounds          = TransformBounds(meshBounds, thisToVesselMatrix);

            float tmpTestBounds = bounds.center.x +
                                  bounds.center.y +
                                  bounds.center.z +
                                  bounds.extents.x +
                                  bounds.extents.y +
                                  bounds.extents.z;

            if (float.IsNaN(tmpTestBounds) || float.IsInfinity(tmpTestBounds))
            {
                ThreadSafeDebugLogger.Error("Bounds error in " + module.part.partInfo.title);
                valid = false;
            }
            else
            {
                valid = true;
            }

            if (!module.part.isMirrored)
            {
                invertXYZ = 1;
            }
            else
            {
                invertXYZ = -1;
            }
        }