Exemple #1
0
        public void GetICrossSectionAdjusters(List <ICrossSectionAdjuster> activeAdjusters, Matrix4x4 basis, Vector3 vehicleMainAxis)
        {
            if (crossSectionAdjusters == null)
            {
                return;
            }

            for (int i = 0; i < crossSectionAdjusters.Count; ++i)
            {
                ICrossSectionAdjuster adjuster = crossSectionAdjusters[i];
                //adjuster.TransformBasis(basis);

                if (adjuster.AreaRemovedFromCrossSection(vehicleMainAxis) != 0)
                {
                    adjuster.SetForwardBackwardNoFlowDirection(1);
                    activeAdjusters.Add(adjuster);
                }
                else if (adjuster.AreaRemovedFromCrossSection(-vehicleMainAxis) != 0)
                {
                    adjuster.SetForwardBackwardNoFlowDirection(-1);
                    activeAdjusters.Add(adjuster);
                }
                else
                {
                    adjuster.SetForwardBackwardNoFlowDirection(0);
                }
            }
        }
Exemple #2
0
        public void UpdateTransformMatrixList(Matrix4x4 worldToVesselMatrix)
        {
            if (meshDataList != null)
            {
                _ready = false;
                while (_meshesToUpdate > 0) //if the previous transform order hasn't been completed yet, wait here to let it
                {
                    if (this == null)
                    {
                        return;
                    }
                }
                _ready = false;

                _meshesToUpdate = meshDataList.Count;
                for (int i = 0; i < meshDataList.Count; ++i)
                {
                    GeometryMesh mesh = meshDataList[i];
                    if (mesh.TrySetThisToVesselMatrixForTransform())
                    {
                        ThreadPool.QueueUserWorkItem(mesh.MultithreadTransformBasis, worldToVesselMatrix);
                        //mesh.TransformBasis(worldToVesselMatrix);
                    }
                    else
                    {
                        Debug.Log("A mesh on " + part.partInfo.title + " did not exist and was removed");
                        meshDataList.RemoveAt(i);
                        --i;
                        lock (this)
                            --_meshesToUpdate;
                    }

                    /*if (mesh.TrySetThisToVesselMatrixForTransform())
                     * {
                     *  mesh.TransformBasis(worldToVesselMatrix);
                     * }
                     * else
                     * {
                     *  meshDataList.RemoveAt(i);
                     *  i--;
                     * }*/
                }
            }
            if (crossSectionAdjusters != null)
            {
                for (int i = 0; i < crossSectionAdjusters.Count; i++)
                {
                    ICrossSectionAdjuster adjuster = crossSectionAdjusters[i];
                    adjuster.SetThisToVesselMatrixForTransform();
                    adjuster.TransformBasis(worldToVesselMatrix);
                    adjuster.UpdateArea();
                }
            }
            //overallMeshBounds = part.GetPartOverallMeshBoundsInBasis(worldToVesselMatrix);
        }
Exemple #3
0
        public void UpdateTransformMatrixList(Matrix4x4 worldToVesselMatrix)
        {
            _ready = false;
            if (meshDataList != null)
            {
                _meshesToUpdate = meshDataList.Count;
                for (int i = 0; i < meshDataList.Count; ++i)
                {
                    GeometryMesh mesh = meshDataList[i];
                    if (mesh.TrySetThisToVesselMatrixForTransform())
                    {
                        ThreadPool.QueueUserWorkItem(mesh.MultithreadTransformBasis, worldToVesselMatrix);
                        //mesh.TransformBasis(worldToVesselMatrix);
                    }
                    else
                    {
                        meshDataList.RemoveAt(i);
                        --i;
                        lock (this)
                            --_meshesToUpdate;
                    }

                    /*if (!meshDataList[i].TryTransformBasis(worldToVesselMatrix))
                     * {
                     *  meshDataList.RemoveAt(i);
                     *  i--;
                     * }*/
                }
            }
            if (crossSectionAdjusters != null)
            {
                for (int i = 0; i < crossSectionAdjusters.Count; i++)
                {
                    ICrossSectionAdjuster adjuster = crossSectionAdjusters[i];
                    adjuster.SetThisToVesselMatrixForTransform();
                    adjuster.TransformBasis(worldToVesselMatrix);
                    adjuster.UpdateArea();
                }
            }
            overallMeshBounds = part.GetPartOverallMeshBoundsInBasis(worldToVesselMatrix);
        }