Beispiel #1
0
        public bool AddEdgeInfo(long hash, MyEdgeInfo info, MySlimBlock owner)
        {
            MyFourEdgeInfo orAdd;
            bool           flag;

            if (!this.m_edgeInfosNew.TryGetValue(hash, out orAdd))
            {
                orAdd = new MyFourEdgeInfo(info.LocalOrthoMatrix, info.EdgeType);
                orAdd = this.m_edgeInfosNew.GetOrAdd(hash, orAdd);
            }
            MyFourEdgeInfo info3 = orAdd;

            lock (info3)
            {
                flag = orAdd.AddInstance((Vector3)(owner.Position * owner.CubeGrid.GridSize), info.Color, owner.SkinSubtypeId, info.EdgeModel, info.PackedNormal0, info.PackedNormal1);
            }
            if (flag)
            {
                if (!orAdd.Full)
                {
                    this.m_dirtyEdges[hash] = orAdd;
                }
                else
                {
                    this.m_dirtyEdges.Remove <long, MyFourEdgeInfo>(hash);
                    this.m_edgesToRender.Remove <long, MyEdgeRenderData>(hash);
                }
            }
            return(flag);
        }
        public void AddEdgeInfo(ref Vector3 point0, ref Vector3 point1, ref Vector3 normal0, ref Vector3 normal1, Color color, MySlimBlock owner)
        {
            var hash = CalculateEdgeHash(point0, point1);
            var pos = (point0 + point1) * 0.5f;
            Vector3I direction = Vector3I.Round((point0 - point1) / m_gridRender.GridSize);

            MyEdgeInfo info = new MyEdgeInfo(ref pos, ref direction, ref normal0, ref normal1, ref color, MyStringHash.GetOrCompute(owner.BlockDefinition.EdgeType));
            var cell = GetCell(pos);
            if (cell.AddEdgeInfo(hash, info, owner))
                m_dirtyCells.Add(cell);
        }
        public bool AddEdgeInfo(long hash, MyEdgeInfo info, MySlimBlock owner)
        {
            MyFourEdgeInfo fourInfo;

            if (!m_edgeInfosNew.TryGetValue(hash, out fourInfo))
            {
                fourInfo = new MyFourEdgeInfo(info.LocalOrthoMatrix, info.EdgeType);
                m_edgeInfosNew.Add(hash, fourInfo);
            }
            return(fourInfo.AddInstance(owner.Position * owner.CubeGrid.GridSize, info.Color, info.EdgeModel, info.PackedNormal0, info.PackedNormal1));
        }
        public void AddEdgeInfo(ref Vector3 point0, ref Vector3 point1, ref Vector3 normal0, ref Vector3 normal1, Color color, MySlimBlock owner)
        {
            var      hash      = CalculateEdgeHash(point0, point1);
            var      pos       = (point0 + point1) * 0.5f;
            Vector3I direction = Vector3I.Round((point0 - point1) / m_gridRender.GridSize);

            MyEdgeInfo info = new MyEdgeInfo(ref pos, ref direction, ref normal0, ref normal1, ref color, MyLibraryUtils.GetHash(owner.BlockDefinition.EdgeType));
            var        cell = GetCell(pos);

            if (cell.AddEdgeInfo(hash, info, owner))
            {
                m_dirtyCells.Add(cell);
            }
        }
 public bool AddEdgeInfo(long hash, MyEdgeInfo info, MySlimBlock owner)
 {
     MyFourEdgeInfo fourInfo;
     if (!m_edgeInfosNew.TryGetValue(hash, out fourInfo))
     {
         fourInfo = new MyFourEdgeInfo(info.LocalOrthoMatrix, info.EdgeType);
         m_edgeInfosNew.Add(hash, fourInfo);
     }
     return fourInfo.AddInstance(owner.Position * owner.CubeGrid.GridSize, info.Color, info.EdgeModel, info.PackedNormal0, info.PackedNormal1);
 }