Пример #1
0
 static bool IsSegmentInfoSuitable(NetInfo.Segment segmentInfo)
 {
     if (segmentInfo == null)
     {
         return(false);
     }
     if (!segmentInfo.m_mesh || !segmentInfo.m_material)
     {
         return(false);
     }
     if (segmentInfo.m_material.name.Contains("NetworkTiling"))
     {
         return(false);
     }
     if (!segmentInfo.m_material.TryGetTexture2D(TextureUtils.ID_Defuse))
     {
         return(false);
     }
     return(segmentInfo.CheckFlags(NetSegment.Flags.None, out _));
 }
Пример #2
0
        private void RenderInstance(ref NetSegment This, RenderManager.CameraInfo cameraInfo, ushort segmentID, int layerMask, NetInfo info, ref RenderManager.Instance data)
        {
            NetManager instance = Singleton <NetManager> .instance;

            if (data.m_dirty)
            {
                data.m_dirty = false;
                Vector3 position  = instance.m_nodes.m_buffer[m_startNode].m_position;
                Vector3 position2 = instance.m_nodes.m_buffer[m_endNode].m_position;
                data.m_position     = (position + position2) * 0.5f;
                data.m_rotation     = Quaternion.identity;
                data.m_dataColor0   = info.m_color;
                data.m_dataColor0.a = 0f;
                data.m_dataFloat0   = Singleton <WeatherManager> .instance.GetWindSpeed(data.m_position);

                data.m_dataVector0 = new Vector4(0.5f / info.m_halfWidth, 1f / info.m_segmentLength, 1f, 1f);
                Vector4 colorLocation = RenderManager.GetColorLocation((uint)(49152 + segmentID));
                Vector4 vector        = colorLocation;
                if (NetNode.BlendJunction(m_startNode))
                {
                    colorLocation = RenderManager.GetColorLocation((uint)(86016 + m_startNode));
                }
                if (NetNode.BlendJunction(m_endNode))
                {
                    vector = RenderManager.GetColorLocation((uint)(86016 + m_endNode));
                }
                data.m_dataVector3 = new Vector4(colorLocation.x, colorLocation.y, vector.x, vector.y);
                if (info.m_segments == null || info.m_segments.Length == 0)
                {
                    if (info.m_lanes != null)
                    {
                        bool invert;
                        if ((m_flags & Flags.Invert) != 0)
                        {
                            invert = true;
                            instance.m_nodes.m_buffer[m_endNode].Info.m_netAI.GetNodeState(m_endNode, ref instance.m_nodes.m_buffer[m_endNode], segmentID, ref This, out _, out _);       // unused code
                            instance.m_nodes.m_buffer[m_startNode].Info.m_netAI.GetNodeState(m_startNode, ref instance.m_nodes.m_buffer[m_startNode], segmentID, ref This, out _, out _); // unused code
                        }
                        else
                        {
                            invert = false;
                            instance.m_nodes.m_buffer[m_startNode].Info.m_netAI.GetNodeState(m_startNode, ref instance.m_nodes.m_buffer[m_startNode], segmentID, ref This, out _, out _); // unused code
                            instance.m_nodes.m_buffer[m_endNode].Info.m_netAI.GetNodeState(m_endNode, ref instance.m_nodes.m_buffer[m_endNode], segmentID, ref This, out _, out _);       // unused code
                        }
                        float startAngle = (float)(int)m_cornerAngleStart * ((float)Math.PI / 128f);
                        float endAngle   = (float)(int)m_cornerAngleEnd * ((float)Math.PI / 128f);
                        int   propIndex  = 0;
                        uint  num        = m_lanes;
                        for (int i = 0; i < info.m_lanes.Length; i++)
                        {
                            if (num == 0)
                            {
                                break;
                            }
                            instance.m_lanes.m_buffer[num].RefreshInstance(num, info.m_lanes[i], startAngle, endAngle, invert, ref data, ref propIndex);
                            num = instance.m_lanes.m_buffer[num].m_nextLane;
                        }
                    }
                }
                else
                {
                    float vScale = info.m_netAI.GetVScale();
                    CalculateCorner(segmentID, heightOffset: true, start: true, leftSide: true, out var posSL, out var dirSL, out var smoothStart);
                    CalculateCorner(segmentID, heightOffset: true, start: false, leftSide: true, out var posEL, out var dirEL, out var smoothEnd);
                    CalculateCorner(segmentID, heightOffset: true, start: true, leftSide: false, out var posSR, out var dirSR, out smoothStart);
                    CalculateCorner(segmentID, heightOffset: true, start: false, leftSide: false, out var posER, out var dirER, out smoothEnd);
                    CalculateMiddlePoints(posSL, dirSL, posER, dirER, smoothStart, smoothEnd, out var b1, out var c1);
                    CalculateMiddlePoints(posSR, dirSR, posEL, dirEL, smoothStart, smoothEnd, out var b2, out var c2);
                    data.m_dataMatrix0 = CalculateControlMatrix(posSL, b1, c1, posER, posSR, b2, c2, posEL, data.m_position, vScale);
                    data.m_dataMatrix1 = CalculateControlMatrix(posSR, b2, c2, posEL, posSL, b1, c1, posER, data.m_position, vScale);
                }
                if (info.m_requireSurfaceMaps)
                {
                    Singleton <TerrainManager> .instance.GetSurfaceMapping(data.m_position, out data.m_dataTexture0, out data.m_dataTexture1, out data.m_dataVector1);
                }
                else if (info.m_requireHeightMap)
                {
                    Singleton <TerrainManager> .instance.GetHeightMapping(data.m_position, out data.m_dataTexture0, out data.m_dataVector1, out data.m_dataVector2);
                }
            }
            if (info.m_segments != null && (layerMask & info.m_netLayers) != 0)
            {
                for (int j = 0; j < info.m_segments.Length; j++)
                {
                    NetInfo.Segment segment = info.m_segments[j];
                    if (!segment.CheckFlags(m_flags, out var turnAround))
                    {
                        continue;
                    }
                    Vector4 objectIndex = data.m_dataVector3;
                    Vector4 meshScale   = data.m_dataVector0;
                    if (segment.m_requireWindSpeed)
                    {
                        objectIndex.w = data.m_dataFloat0;
                    }
                    if (turnAround)
                    {
                        meshScale.x = 0f - meshScale.x;
                        meshScale.y = 0f - meshScale.y;
                    }
                    if (cameraInfo.CheckRenderDistance(data.m_position, segment.m_lodRenderDistance))
                    {
                        instance.m_materialBlock.Clear();
                        instance.m_materialBlock.SetMatrix(instance.ID_LeftMatrix, data.m_dataMatrix0);
                        instance.m_materialBlock.SetMatrix(instance.ID_RightMatrix, data.m_dataMatrix1);
                        instance.m_materialBlock.SetVector(instance.ID_MeshScale, meshScale);
                        instance.m_materialBlock.SetVector(instance.ID_ObjectIndex, objectIndex);
                        instance.m_materialBlock.SetColor(instance.ID_Color, data.m_dataColor0);
                        if (segment.m_requireSurfaceMaps && data.m_dataTexture0 != null)
                        {
                            instance.m_materialBlock.SetTexture(instance.ID_SurfaceTexA, data.m_dataTexture0);
                            instance.m_materialBlock.SetTexture(instance.ID_SurfaceTexB, data.m_dataTexture1);
                            instance.m_materialBlock.SetVector(instance.ID_SurfaceMapping, data.m_dataVector1);
                        }
                        else if (segment.m_requireHeightMap && data.m_dataTexture0 != null)
                        {
                            instance.m_materialBlock.SetTexture(instance.ID_HeightMap, data.m_dataTexture0);
                            instance.m_materialBlock.SetVector(instance.ID_HeightMapping, data.m_dataVector1);
                            instance.m_materialBlock.SetVector(instance.ID_SurfaceMapping, data.m_dataVector2);
                        }
                        instance.m_drawCallData.m_defaultCalls++;
                        Graphics.DrawMesh(segment.m_segmentMesh, data.m_position, data.m_rotation, segment.m_segmentMaterial, segment.m_layer, null, 0, instance.m_materialBlock);
                        continue;
                    }
                    NetInfo.LodValue combinedLod = segment.m_combinedLod;
                    if (combinedLod == null)
                    {
                        continue;
                    }
                    if (segment.m_requireSurfaceMaps)
                    {
                        if (data.m_dataTexture0 != combinedLod.m_surfaceTexA)
                        {
                            if (combinedLod.m_lodCount != 0)
                            {
                                RenderLod(cameraInfo, combinedLod);
                            }
                            combinedLod.m_surfaceTexA    = data.m_dataTexture0;
                            combinedLod.m_surfaceTexB    = data.m_dataTexture1;
                            combinedLod.m_surfaceMapping = data.m_dataVector1;
                        }
                    }
                    else if (segment.m_requireHeightMap && data.m_dataTexture0 != combinedLod.m_heightMap)
                    {
                        if (combinedLod.m_lodCount != 0)
                        {
                            RenderLod(cameraInfo, combinedLod);
                        }
                        combinedLod.m_heightMap      = data.m_dataTexture0;
                        combinedLod.m_heightMapping  = data.m_dataVector1;
                        combinedLod.m_surfaceMapping = data.m_dataVector2;
                    }
                    ref Matrix4x4 reference = ref combinedLod.m_leftMatrices[combinedLod.m_lodCount];
                    reference = data.m_dataMatrix0;
                    ref Matrix4x4 reference2 = ref combinedLod.m_rightMatrices[combinedLod.m_lodCount];
                    reference2 = data.m_dataMatrix1;
                    combinedLod.m_meshScales[combinedLod.m_lodCount]    = meshScale;
                    combinedLod.m_objectIndices[combinedLod.m_lodCount] = objectIndex;
                    ref Vector4 reference3 = ref combinedLod.m_meshLocations[combinedLod.m_lodCount];
Пример #3
0
        public void PopulateGroupData(ushort segmentID, int groupX, int groupZ, int layer, ref int vertexIndex, ref int triangleIndex, Vector3 groupPosition, RenderGroup.MeshData data, ref Vector3 min, ref Vector3 max, ref float maxRenderDistance, ref float maxInstanceDistance, ref bool requireSurfaceMaps)
        {
            bool       hasProps = false;
            NetInfo    info     = Info;
            NetManager instance = Singleton <NetManager> .instance;

            if (m_problems != Notification.Problem.None && layer == Singleton <NotificationManager> .instance.m_notificationLayer)
            {
                Vector3 middlePosition = m_middlePosition;
                middlePosition.y += info.m_maxHeight;
                Notification.PopulateGroupData(m_problems, middlePosition, 1f, groupX, groupZ, ref vertexIndex, ref triangleIndex, groupPosition, data, ref min, ref max, ref maxRenderDistance, ref maxInstanceDistance);
            }
            if (info.m_hasForwardVehicleLanes != info.m_hasBackwardVehicleLanes && layer == Singleton <NetManager> .instance.m_arrowLayer)
            {
                Bezier3 bezier = default(Bezier3);
                bezier.a = Singleton <NetManager> .instance.m_nodes.m_buffer[m_startNode].m_position;
                bezier.d = Singleton <NetManager> .instance.m_nodes.m_buffer[m_endNode].m_position;
                CalculateMiddlePoints(bezier.a, m_startDirection, bezier.d, m_endDirection, smoothStart: true, smoothEnd: true, out bezier.b, out bezier.c);
                Vector3 pos = bezier.Position(0.5f);
                pos.y += info.m_netAI.GetSnapElevation();
                Vector3 vector = VectorUtils.NormalizeXZ(bezier.Tangent(0.5f)) * (4f + info.m_halfWidth * 0.5f);
                if ((m_flags & Flags.Invert) != 0 == info.m_hasForwardVehicleLanes)
                {
                    vector = -vector;
                }
                PopulateArrowGroupData(pos, vector, ref vertexIndex, ref triangleIndex, groupPosition, data, ref min, ref max, ref maxRenderDistance, ref maxInstanceDistance);
            }
            if (info.m_lanes != null)
            {
                bool          invert;
                NetNode.Flags flags;
                NetNode.Flags flags2;
                if ((m_flags & Flags.Invert) != 0)
                {
                    invert = true;
                    instance.m_nodes.m_buffer[m_endNode].Info.m_netAI.GetNodeFlags(m_endNode, ref instance.m_nodes.m_buffer[m_endNode], segmentID, ref this, out flags);
                    instance.m_nodes.m_buffer[m_startNode].Info.m_netAI.GetNodeFlags(m_startNode, ref instance.m_nodes.m_buffer[m_startNode], segmentID, ref this, out flags2);
                }
                else
                {
                    invert = false;
                    instance.m_nodes.m_buffer[m_startNode].Info.m_netAI.GetNodeFlags(m_startNode, ref instance.m_nodes.m_buffer[m_startNode], segmentID, ref this, out flags);
                    instance.m_nodes.m_buffer[m_endNode].Info.m_netAI.GetNodeFlags(m_endNode, ref instance.m_nodes.m_buffer[m_endNode], segmentID, ref this, out flags2);
                }
                bool  terrainHeight = info.m_segments == null || info.m_segments.Length == 0;
                float startAngle    = (float)(int)m_cornerAngleStart * ((float)Math.PI / 128f);
                float endAngle      = (float)(int)m_cornerAngleEnd * ((float)Math.PI / 128f);
                bool  destroyed     = (m_flags & Flags.Collapsed) != 0;
                uint  num           = m_lanes;
                for (int i = 0; i < info.m_lanes.Length; i++)
                {
                    if (num == 0)
                    {
                        break;
                    }
                    instance.m_lanes.m_buffer[num].PopulateGroupData(segmentID, num, info.m_lanes[i], destroyed, flags, flags2, startAngle, endAngle, invert, terrainHeight, layer, ref vertexIndex, ref triangleIndex, groupPosition, data, ref min, ref max, ref maxRenderDistance, ref maxInstanceDistance, ref hasProps);
                    num = instance.m_lanes.m_buffer[num].m_nextLane;
                }
            }
            if ((info.m_netLayers & (1 << layer)) == 0)
            {
                return;
            }
            bool flag = info.m_segments != null && info.m_segments.Length != 0;

            if (!flag && !hasProps)
            {
                return;
            }
            min = Vector3.Min(min, m_bounds.min);
            max = Vector3.Max(max, m_bounds.max);
            maxRenderDistance   = Mathf.Max(maxRenderDistance, 30000f);
            maxInstanceDistance = Mathf.Max(maxInstanceDistance, 1000f);
            if (!flag)
            {
                return;
            }
            float vScale = info.m_netAI.GetVScale();

            CalculateCorner(segmentID, heightOffset: true, start: true, leftSide: true, out var cornerPosSL, out var cornerDirectionSL, out var smoothStart);
            CalculateCorner(segmentID, heightOffset: true, start: false, leftSide: true, out var cornerPosEL, out var cornerDirectionEL, out var smoothEnd);
            CalculateCorner(segmentID, heightOffset: true, start: true, leftSide: false, out var cornerPosSR, out var cornerDirectionSR, out smoothStart);
            CalculateCorner(segmentID, heightOffset: true, start: false, leftSide: false, out var cornerPosER, out var cornerDirectionER, out smoothEnd);
            CalculateMiddlePoints(cornerPosSL, cornerDirectionSL, cornerPosER, cornerDirectionER, smoothStart, smoothEnd, out var b1, out var c1);
            CalculateMiddlePoints(cornerPosSR, cornerDirectionSR, cornerPosEL, cornerDirectionEL, smoothStart, smoothEnd, out var b2, out var c2);
            Vector3 position           = instance.m_nodes.m_buffer[m_startNode].m_position;
            Vector3 position2          = instance.m_nodes.m_buffer[m_endNode].m_position;
            Vector4 meshScale          = new Vector4(0.5f / info.m_halfWidth, 1f / info.m_segmentLength, 1f, 1f);
            Vector4 colorLocationStart = RenderManager.GetColorLocation((uint)(49152 + segmentID));
            Vector4 colorlocationEnd   = colorLocationStart;

            if (NetNode.BlendJunction(m_startNode))
            {
                colorLocationStart = RenderManager.GetColorLocation((uint)(86016 + m_startNode));
            }
            if (NetNode.BlendJunction(m_endNode))
            {
                colorlocationEnd = RenderManager.GetColorLocation((uint)(86016 + m_endNode));
            }
            Vector4 objectIndex0 = new Vector4(colorLocationStart.x, colorLocationStart.y, colorlocationEnd.x, colorlocationEnd.y);

            for (int j = 0; j < info.m_segments.Length; j++)
            {
                NetInfo.Segment segment    = info.m_segments[j];
                bool            turnAround = false;
                if (segment.m_layer == layer && segment.CheckFlags(m_flags, out turnAround) && segment.m_combinedLod != null)
                {
                    Vector4 objectIndex = objectIndex0;
                    if (segment.m_requireWindSpeed)
                    {
                        objectIndex.w = Singleton <WeatherManager> .instance.GetWindSpeed((position + position2) * 0.5f);
                    }
                    else if (turnAround)
                    {
                        objectIndex = new Vector4(objectIndex.z, objectIndex.w, objectIndex.x, objectIndex.y);
                    }
                    Matrix4x4 leftMatrix;
                    Matrix4x4 rightMatrix;
                    if (turnAround)
                    {
                        leftMatrix  = CalculateControlMatrix(cornerPosEL, c2, b2, cornerPosSR, cornerPosER, c1, b1, cornerPosSL, groupPosition, vScale);
                        rightMatrix = CalculateControlMatrix(cornerPosER, c1, b1, cornerPosSL, cornerPosEL, c2, b2, cornerPosSR, groupPosition, vScale);
                    }
                    else
                    {
                        leftMatrix  = CalculateControlMatrix(cornerPosSL, b1, c1, cornerPosER, cornerPosSR, b2, c2, cornerPosEL, groupPosition, vScale);
                        rightMatrix = CalculateControlMatrix(cornerPosSR, b2, c2, cornerPosEL, cornerPosSL, b1, c1, cornerPosER, groupPosition, vScale);
                    }
                    PopulateGroupData(info, segment, leftMatrix, rightMatrix, meshScale, objectIndex, ref vertexIndex, ref triangleIndex, groupPosition, data, ref requireSurfaceMaps);
                }
            }
        }
Пример #4
0
        public bool CalculateGroupData(ushort segmentID, int layer, ref int vertexCount, ref int triangleCount, ref int objectCount, ref RenderGroup.VertexArrays vertexArrays)
        {
            bool    result   = false;
            bool    hasProps = false;
            NetInfo info     = Info;

            if (m_problems != Notification.Problem.None && layer == Singleton <NotificationManager> .instance.m_notificationLayer && Notification.CalculateGroupData(ref vertexCount, ref triangleCount, ref objectCount, ref vertexArrays))
            {
                result = true;
            }
            if (info.m_hasForwardVehicleLanes != info.m_hasBackwardVehicleLanes && layer == Singleton <NetManager> .instance.m_arrowLayer && CalculateArrowGroupData(ref vertexCount, ref triangleCount, ref objectCount, ref vertexArrays))
            {
                result = true;
            }
            if (info.m_lanes != null)
            {
                bool          invert;
                NetNode.Flags flags;
                NetNode.Flags flags2;
                if ((m_flags & Flags.Invert) != 0)
                {
                    invert = true;
                    m_endNode.ToNode().Info.m_netAI.GetNodeFlags(m_endNode, ref m_endNode.ToNode(), segmentID, ref this, out flags);
                    m_startNode.ToNode().Info.m_netAI.GetNodeFlags(m_startNode, ref m_startNode.ToNode(), segmentID, ref this, out flags2);
                }
                else
                {
                    invert = false;
                    m_startNode.ToNode().Info.m_netAI.GetNodeFlags(m_startNode, ref m_startNode.ToNode(), segmentID, ref this, out flags);
                    m_endNode.ToNode().Info.m_netAI.GetNodeFlags(m_endNode, ref m_endNode.ToNode(), segmentID, ref this, out flags2);
                }
                bool destroyed = (m_flags & Flags.Collapsed) != 0;
                uint laneID    = m_lanes;
                for (int i = 0; i < info.m_lanes.Length; i++)
                {
                    if (laneID == 0)
                    {
                        break;
                    }
                    if (laneID.ToLane().CalculateGroupData(laneID, info.m_lanes[i], destroyed, flags, flags2, invert, layer, ref vertexCount, ref triangleCount, ref objectCount, ref vertexArrays, ref hasProps))
                    {
                        result = true;
                    }
                    laneID = laneID.ToLane().m_nextLane;
                }
            }
            if ((info.m_netLayers & (1 << layer)) != 0)
            {
                bool hasSegments = !info.m_segments.IsNullorEmpty();
                if (hasSegments || hasProps)
                {
                    result = true;
                    if (hasSegments)
                    {
                        for (int i = 0; i < info.m_segments.Length; i++)
                        {
                            NetInfo.Segment segmentInfo = info.m_segments[i];
                            if (segmentInfo.m_layer == layer && segmentInfo.CheckFlags(m_flags, out _) && segmentInfo.m_combinedLod != null)
                            {
                                CalculateGroupData(segmentInfo, ref vertexCount, ref triangleCount, ref objectCount, ref vertexArrays);
                            }
                        }
                    }
                }
            }
            return(result);
        }
Пример #5
0
 // NetNode
 // Token: 0x060034C1 RID: 13505 RVA: 0x0023A834 File Offset: 0x00238C34
 private void RenderInstance(RenderManager.CameraInfo cameraInfo, ushort nodeID, NetInfo info, int iter, NetNode.Flags flags, ref uint instanceIndex, ref RenderManager.Instance data)
 {
     if (data.m_dirty)
     {
         data.m_dirty = false;
         if (iter == 0)
         {
             if ((flags & NetNode.Flags.Junction) != NetNode.Flags.None)
             {
                 this.RefreshJunctionData(nodeID, info, instanceIndex);
             }
             else if ((flags & NetNode.Flags.Bend) != NetNode.Flags.None)
             {
                 this.RefreshBendData(nodeID, info, instanceIndex, ref data);
             }
             else if ((flags & NetNode.Flags.End) != NetNode.Flags.None)
             {
                 this.RefreshEndData(nodeID, info, instanceIndex, ref data);
             }
         }
     }
     if (data.m_initialized)
     {
         if ((flags & NetNode.Flags.Junction) != NetNode.Flags.None)
         {
             if ((data.m_dataInt0 & 8) != 0)
             {
                 ushort segment  = this.GetSegment(data.m_dataInt0 & 7);
                 ushort segment2 = this.GetSegment(data.m_dataInt0 >> 4);
                 if (segment != 0 && segment2 != 0)
                 {
                     NetManager instance = Singleton <NetManager> .instance;
                     info = instance.m_segments.m_buffer[(int)segment].Info;
                     NetInfo       info2  = instance.m_segments.m_buffer[(int)segment2].Info;
                     NetNode.Flags flags2 = flags;
                     if (((instance.m_segments.m_buffer[(int)segment].m_flags | instance.m_segments.m_buffer[(int)segment2].m_flags) & NetSegment.Flags.Collapsed) != NetSegment.Flags.None)
                     {
                         flags2 |= NetNode.Flags.Collapsed;
                     }
                     for (int i = 0; i < info.m_nodes.Length; i++)
                     {
                         NetInfo.Node node = info.m_nodes[i];
                         if (node.CheckFlags(flags2) && node.m_directConnect && (node.m_connectGroup == NetInfo.ConnectGroup.None || (node.m_connectGroup & info2.m_connectGroup & NetInfo.ConnectGroup.AllGroups) != NetInfo.ConnectGroup.None))
                         {
                             Vector4 dataVector  = data.m_dataVector3;
                             Vector4 dataVector2 = data.m_dataVector0;
                             if (node.m_requireWindSpeed)
                             {
                                 dataVector.w = data.m_dataFloat0;
                             }
                             if ((node.m_connectGroup & NetInfo.ConnectGroup.Oneway) != NetInfo.ConnectGroup.None)
                             {
                                 bool flag = instance.m_segments.m_buffer[(int)segment].m_startNode == nodeID == ((instance.m_segments.m_buffer[(int)segment].m_flags & NetSegment.Flags.Invert) == NetSegment.Flags.None);
                                 if (info2.m_hasBackwardVehicleLanes != info2.m_hasForwardVehicleLanes || (node.m_connectGroup & NetInfo.ConnectGroup.Directional) != NetInfo.ConnectGroup.None)
                                 {
                                     bool flag2 = instance.m_segments.m_buffer[(int)segment2].m_startNode == nodeID == ((instance.m_segments.m_buffer[(int)segment2].m_flags & NetSegment.Flags.Invert) == NetSegment.Flags.None);
                                     if (flag == flag2)
                                     {
                                         goto IL_570;
                                     }
                                 }
                                 if (flag)
                                 {
                                     if ((node.m_connectGroup & NetInfo.ConnectGroup.OnewayStart) == NetInfo.ConnectGroup.None)
                                     {
                                         goto IL_570;
                                     }
                                 }
                                 else
                                 {
                                     if ((node.m_connectGroup & NetInfo.ConnectGroup.OnewayEnd) == NetInfo.ConnectGroup.None)
                                     {
                                         goto IL_570;
                                     }
                                     dataVector2.x = -dataVector2.x;
                                     dataVector2.y = -dataVector2.y;
                                 }
                             }
                             if (cameraInfo.CheckRenderDistance(data.m_position, node.m_lodRenderDistance))
                             {
                                 instance.m_materialBlock.Clear();
                                 instance.m_materialBlock.SetMatrix(instance.ID_LeftMatrix, data.m_dataMatrix0);
                                 instance.m_materialBlock.SetMatrix(instance.ID_RightMatrix, data.m_extraData.m_dataMatrix2);
                                 instance.m_materialBlock.SetVector(instance.ID_MeshScale, dataVector2);
                                 instance.m_materialBlock.SetVector(instance.ID_ObjectIndex, dataVector);
                                 instance.m_materialBlock.SetColor(instance.ID_Color, data.m_dataColor0);
                                 if (node.m_requireSurfaceMaps && data.m_dataTexture1 != null)
                                 {
                                     instance.m_materialBlock.SetTexture(instance.ID_SurfaceTexA, data.m_dataTexture0);
                                     instance.m_materialBlock.SetTexture(instance.ID_SurfaceTexB, data.m_dataTexture1);
                                     instance.m_materialBlock.SetVector(instance.ID_SurfaceMapping, data.m_dataVector1);
                                 }
                                 NetManager netManager = instance;
                                 netManager.m_drawCallData.m_defaultCalls = netManager.m_drawCallData.m_defaultCalls + 1;
                                 Graphics.DrawMesh(node.m_nodeMesh, data.m_position, data.m_rotation, node.m_nodeMaterial, node.m_layer, null, 0, instance.m_materialBlock);
                             }
                             else
                             {
                                 NetInfo.LodValue combinedLod = node.m_combinedLod;
                                 if (combinedLod != null)
                                 {
                                     if (node.m_requireSurfaceMaps && data.m_dataTexture0 != combinedLod.m_surfaceTexA)
                                     {
                                         if (combinedLod.m_lodCount != 0)
                                         {
                                             NetSegment.RenderLod(cameraInfo, combinedLod);
                                         }
                                         combinedLod.m_surfaceTexA    = data.m_dataTexture0;
                                         combinedLod.m_surfaceTexB    = data.m_dataTexture1;
                                         combinedLod.m_surfaceMapping = data.m_dataVector1;
                                     }
                                     combinedLod.m_leftMatrices[combinedLod.m_lodCount]  = data.m_dataMatrix0;
                                     combinedLod.m_rightMatrices[combinedLod.m_lodCount] = data.m_extraData.m_dataMatrix2;
                                     combinedLod.m_meshScales[combinedLod.m_lodCount]    = dataVector2;
                                     combinedLod.m_objectIndices[combinedLod.m_lodCount] = dataVector;
                                     combinedLod.m_meshLocations[combinedLod.m_lodCount] = data.m_position;
                                     combinedLod.m_lodMin = Vector3.Min(combinedLod.m_lodMin, data.m_position);
                                     combinedLod.m_lodMax = Vector3.Max(combinedLod.m_lodMax, data.m_position);
                                     if (++combinedLod.m_lodCount == combinedLod.m_leftMatrices.Length)
                                     {
                                         NetSegment.RenderLod(cameraInfo, combinedLod);
                                     }
                                 }
                             }
                         }
                         IL_570 :;
                     }
                 }
             }
             else
             {
                 ushort segment3 = this.GetSegment(data.m_dataInt0 & 7);
                 if (segment3 != 0)
                 {
                     NetManager instance2 = Singleton <NetManager> .instance;
                     info = instance2.m_segments.m_buffer[(int)segment3].Info;
                     for (int j = 0; j < info.m_nodes.Length; j++)
                     {
                         NetInfo.Node node2 = info.m_nodes[j];
                         if (node2.CheckFlags(flags) && !node2.m_directConnect)
                         {
                             Vector4 dataVector3 = data.m_extraData.m_dataVector4;
                             if (node2.m_requireWindSpeed)
                             {
                                 dataVector3.w = data.m_dataFloat0;
                             }
                             if (cameraInfo.CheckRenderDistance(data.m_position, node2.m_lodRenderDistance))
                             {
                                 instance2.m_materialBlock.Clear();
                                 instance2.m_materialBlock.SetMatrix(instance2.ID_LeftMatrix, data.m_dataMatrix0);
                                 instance2.m_materialBlock.SetMatrix(instance2.ID_RightMatrix, data.m_extraData.m_dataMatrix2);
                                 instance2.m_materialBlock.SetMatrix(instance2.ID_LeftMatrixB, data.m_extraData.m_dataMatrix3);
                                 instance2.m_materialBlock.SetMatrix(instance2.ID_RightMatrixB, data.m_dataMatrix1);
                                 instance2.m_materialBlock.SetVector(instance2.ID_MeshScale, data.m_dataVector0);
                                 instance2.m_materialBlock.SetVector(instance2.ID_CenterPos, data.m_dataVector1);
                                 instance2.m_materialBlock.SetVector(instance2.ID_SideScale, data.m_dataVector2);
                                 instance2.m_materialBlock.SetVector(instance2.ID_ObjectIndex, dataVector3);
                                 instance2.m_materialBlock.SetColor(instance2.ID_Color, data.m_dataColor0);
                                 if (node2.m_requireSurfaceMaps && data.m_dataTexture1 != null)
                                 {
                                     instance2.m_materialBlock.SetTexture(instance2.ID_SurfaceTexA, data.m_dataTexture0);
                                     instance2.m_materialBlock.SetTexture(instance2.ID_SurfaceTexB, data.m_dataTexture1);
                                     instance2.m_materialBlock.SetVector(instance2.ID_SurfaceMapping, data.m_dataVector3);
                                 }
                                 NetManager netManager2 = instance2;
                                 netManager2.m_drawCallData.m_defaultCalls = netManager2.m_drawCallData.m_defaultCalls + 1;
                                 Graphics.DrawMesh(node2.m_nodeMesh, data.m_position, data.m_rotation, node2.m_nodeMaterial, node2.m_layer, null, 0, instance2.m_materialBlock);
                             }
                             else
                             {
                                 NetInfo.LodValue combinedLod2 = node2.m_combinedLod;
                                 if (combinedLod2 != null)
                                 {
                                     if (node2.m_requireSurfaceMaps && data.m_dataTexture0 != combinedLod2.m_surfaceTexA)
                                     {
                                         if (combinedLod2.m_lodCount != 0)
                                         {
                                             NetNode.RenderLod(cameraInfo, combinedLod2);
                                         }
                                         combinedLod2.m_surfaceTexA    = data.m_dataTexture0;
                                         combinedLod2.m_surfaceTexB    = data.m_dataTexture1;
                                         combinedLod2.m_surfaceMapping = data.m_dataVector3;
                                     }
                                     combinedLod2.m_leftMatrices[combinedLod2.m_lodCount]    = data.m_dataMatrix0;
                                     combinedLod2.m_leftMatricesB[combinedLod2.m_lodCount]   = data.m_extraData.m_dataMatrix3;
                                     combinedLod2.m_rightMatrices[combinedLod2.m_lodCount]   = data.m_extraData.m_dataMatrix2;
                                     combinedLod2.m_rightMatricesB[combinedLod2.m_lodCount]  = data.m_dataMatrix1;
                                     combinedLod2.m_meshScales[combinedLod2.m_lodCount]      = data.m_dataVector0;
                                     combinedLod2.m_centerPositions[combinedLod2.m_lodCount] = data.m_dataVector1;
                                     combinedLod2.m_sideScales[combinedLod2.m_lodCount]      = data.m_dataVector2;
                                     combinedLod2.m_objectIndices[combinedLod2.m_lodCount]   = dataVector3;
                                     combinedLod2.m_meshLocations[combinedLod2.m_lodCount]   = data.m_position;
                                     combinedLod2.m_lodMin = Vector3.Min(combinedLod2.m_lodMin, data.m_position);
                                     combinedLod2.m_lodMax = Vector3.Max(combinedLod2.m_lodMax, data.m_position);
                                     if (++combinedLod2.m_lodCount == combinedLod2.m_leftMatrices.Length)
                                     {
                                         NetNode.RenderLod(cameraInfo, combinedLod2);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         else if ((flags & NetNode.Flags.End) != NetNode.Flags.None)
         {
             NetManager instance3 = Singleton <NetManager> .instance;
             for (int k = 0; k < info.m_nodes.Length; k++)
             {
                 NetInfo.Node node3 = info.m_nodes[k];
                 if (node3.CheckFlags(flags) && !node3.m_directConnect)
                 {
                     Vector4 dataVector4 = data.m_extraData.m_dataVector4;
                     if (node3.m_requireWindSpeed)
                     {
                         dataVector4.w = data.m_dataFloat0;
                     }
                     if (cameraInfo.CheckRenderDistance(data.m_position, node3.m_lodRenderDistance))
                     {
                         instance3.m_materialBlock.Clear();
                         instance3.m_materialBlock.SetMatrix(instance3.ID_LeftMatrix, data.m_dataMatrix0);
                         instance3.m_materialBlock.SetMatrix(instance3.ID_RightMatrix, data.m_extraData.m_dataMatrix2);
                         instance3.m_materialBlock.SetMatrix(instance3.ID_LeftMatrixB, data.m_extraData.m_dataMatrix3);
                         instance3.m_materialBlock.SetMatrix(instance3.ID_RightMatrixB, data.m_dataMatrix1);
                         instance3.m_materialBlock.SetVector(instance3.ID_MeshScale, data.m_dataVector0);
                         instance3.m_materialBlock.SetVector(instance3.ID_CenterPos, data.m_dataVector1);
                         instance3.m_materialBlock.SetVector(instance3.ID_SideScale, data.m_dataVector2);
                         instance3.m_materialBlock.SetVector(instance3.ID_ObjectIndex, dataVector4);
                         instance3.m_materialBlock.SetColor(instance3.ID_Color, data.m_dataColor0);
                         if (node3.m_requireSurfaceMaps && data.m_dataTexture1 != null)
                         {
                             instance3.m_materialBlock.SetTexture(instance3.ID_SurfaceTexA, data.m_dataTexture0);
                             instance3.m_materialBlock.SetTexture(instance3.ID_SurfaceTexB, data.m_dataTexture1);
                             instance3.m_materialBlock.SetVector(instance3.ID_SurfaceMapping, data.m_dataVector3);
                         }
                         NetManager netManager3 = instance3;
                         netManager3.m_drawCallData.m_defaultCalls = netManager3.m_drawCallData.m_defaultCalls + 1;
                         Graphics.DrawMesh(node3.m_nodeMesh, data.m_position, data.m_rotation, node3.m_nodeMaterial, node3.m_layer, null, 0, instance3.m_materialBlock);
                     }
                     else
                     {
                         NetInfo.LodValue combinedLod3 = node3.m_combinedLod;
                         if (combinedLod3 != null)
                         {
                             if (node3.m_requireSurfaceMaps && data.m_dataTexture0 != combinedLod3.m_surfaceTexA)
                             {
                                 if (combinedLod3.m_lodCount != 0)
                                 {
                                     NetNode.RenderLod(cameraInfo, combinedLod3);
                                 }
                                 combinedLod3.m_surfaceTexA    = data.m_dataTexture0;
                                 combinedLod3.m_surfaceTexB    = data.m_dataTexture1;
                                 combinedLod3.m_surfaceMapping = data.m_dataVector3;
                             }
                             combinedLod3.m_leftMatrices[combinedLod3.m_lodCount]    = data.m_dataMatrix0;
                             combinedLod3.m_leftMatricesB[combinedLod3.m_lodCount]   = data.m_extraData.m_dataMatrix3;
                             combinedLod3.m_rightMatrices[combinedLod3.m_lodCount]   = data.m_extraData.m_dataMatrix2;
                             combinedLod3.m_rightMatricesB[combinedLod3.m_lodCount]  = data.m_dataMatrix1;
                             combinedLod3.m_meshScales[combinedLod3.m_lodCount]      = data.m_dataVector0;
                             combinedLod3.m_centerPositions[combinedLod3.m_lodCount] = data.m_dataVector1;
                             combinedLod3.m_sideScales[combinedLod3.m_lodCount]      = data.m_dataVector2;
                             combinedLod3.m_objectIndices[combinedLod3.m_lodCount]   = dataVector4;
                             combinedLod3.m_meshLocations[combinedLod3.m_lodCount]   = data.m_position;
                             combinedLod3.m_lodMin = Vector3.Min(combinedLod3.m_lodMin, data.m_position);
                             combinedLod3.m_lodMax = Vector3.Max(combinedLod3.m_lodMax, data.m_position);
                             if (++combinedLod3.m_lodCount == combinedLod3.m_leftMatrices.Length)
                             {
                                 NetNode.RenderLod(cameraInfo, combinedLod3);
                             }
                         }
                     }
                 }
             }
         }
         else if ((flags & NetNode.Flags.Bend) != NetNode.Flags.None)
         {
             NetManager instance4 = Singleton <NetManager> .instance;
             for (int l = 0; l < info.m_segments.Length; l++)
             {
                 NetInfo.Segment segment4 = info.m_segments[l];
                 bool            flag3;
                 if (segment4.CheckFlags(info.m_netAI.GetBendFlags(nodeID, ref this), out flag3) && !segment4.m_disableBendNodes)
                 {
                     Vector4 dataVector5 = data.m_dataVector3;
                     Vector4 dataVector6 = data.m_dataVector0;
                     if (segment4.m_requireWindSpeed)
                     {
                         dataVector5.w = data.m_dataFloat0;
                     }
                     if (flag3)
                     {
                         dataVector6.x = -dataVector6.x;
                         dataVector6.y = -dataVector6.y;
                     }
                     if (cameraInfo.CheckRenderDistance(data.m_position, segment4.m_lodRenderDistance))
                     {
                         instance4.m_materialBlock.Clear();
                         instance4.m_materialBlock.SetMatrix(instance4.ID_LeftMatrix, data.m_dataMatrix0);
                         instance4.m_materialBlock.SetMatrix(instance4.ID_RightMatrix, data.m_extraData.m_dataMatrix2);
                         instance4.m_materialBlock.SetVector(instance4.ID_MeshScale, dataVector6);
                         instance4.m_materialBlock.SetVector(instance4.ID_ObjectIndex, dataVector5);
                         instance4.m_materialBlock.SetColor(instance4.ID_Color, data.m_dataColor0);
                         if (segment4.m_requireSurfaceMaps && data.m_dataTexture1 != null)
                         {
                             instance4.m_materialBlock.SetTexture(instance4.ID_SurfaceTexA, data.m_dataTexture0);
                             instance4.m_materialBlock.SetTexture(instance4.ID_SurfaceTexB, data.m_dataTexture1);
                             instance4.m_materialBlock.SetVector(instance4.ID_SurfaceMapping, data.m_dataVector1);
                         }
                         NetManager netManager4 = instance4;
                         netManager4.m_drawCallData.m_defaultCalls = netManager4.m_drawCallData.m_defaultCalls + 1;
                         Graphics.DrawMesh(segment4.m_segmentMesh, data.m_position, data.m_rotation, segment4.m_segmentMaterial, segment4.m_layer, null, 0, instance4.m_materialBlock);
                     }
                     else
                     {
                         NetInfo.LodValue combinedLod4 = segment4.m_combinedLod;
                         if (combinedLod4 != null)
                         {
                             if (segment4.m_requireSurfaceMaps && data.m_dataTexture0 != combinedLod4.m_surfaceTexA)
                             {
                                 if (combinedLod4.m_lodCount != 0)
                                 {
                                     NetSegment.RenderLod(cameraInfo, combinedLod4);
                                 }
                                 combinedLod4.m_surfaceTexA    = data.m_dataTexture0;
                                 combinedLod4.m_surfaceTexB    = data.m_dataTexture1;
                                 combinedLod4.m_surfaceMapping = data.m_dataVector1;
                             }
                             combinedLod4.m_leftMatrices[combinedLod4.m_lodCount]  = data.m_dataMatrix0;
                             combinedLod4.m_rightMatrices[combinedLod4.m_lodCount] = data.m_extraData.m_dataMatrix2;
                             combinedLod4.m_meshScales[combinedLod4.m_lodCount]    = dataVector6;
                             combinedLod4.m_objectIndices[combinedLod4.m_lodCount] = dataVector5;
                             combinedLod4.m_meshLocations[combinedLod4.m_lodCount] = data.m_position;
                             combinedLod4.m_lodMin = Vector3.Min(combinedLod4.m_lodMin, data.m_position);
                             combinedLod4.m_lodMax = Vector3.Max(combinedLod4.m_lodMax, data.m_position);
                             if (++combinedLod4.m_lodCount == combinedLod4.m_leftMatrices.Length)
                             {
                                 NetSegment.RenderLod(cameraInfo, combinedLod4);
                             }
                         }
                     }
                 }
             }
             for (int m = 0; m < info.m_nodes.Length; m++)
             {
                 ushort segment5 = this.GetSegment(data.m_dataInt0 & 7);
                 ushort segment6 = this.GetSegment(data.m_dataInt0 >> 4);
                 if (((instance4.m_segments.m_buffer[(int)segment5].m_flags | instance4.m_segments.m_buffer[(int)segment6].m_flags) & NetSegment.Flags.Collapsed) != NetSegment.Flags.None)
                 {
                     NetNode.Flags flags3 = flags | NetNode.Flags.Collapsed;
                 }
                 NetInfo.Node node4 = info.m_nodes[m];
                 if (node4.CheckFlags(flags) && node4.m_directConnect && (node4.m_connectGroup == NetInfo.ConnectGroup.None || (node4.m_connectGroup & info.m_connectGroup & NetInfo.ConnectGroup.AllGroups) != NetInfo.ConnectGroup.None))
                 {
                     Vector4 dataVector7 = data.m_dataVector3;
                     Vector4 dataVector8 = data.m_dataVector0;
                     if (node4.m_requireWindSpeed)
                     {
                         dataVector7.w = data.m_dataFloat0;
                     }
                     if ((node4.m_connectGroup & NetInfo.ConnectGroup.Oneway) != NetInfo.ConnectGroup.None)
                     {
                         bool flag4 = instance4.m_segments.m_buffer[(int)segment5].m_startNode == nodeID == ((instance4.m_segments.m_buffer[(int)segment5].m_flags & NetSegment.Flags.Invert) == NetSegment.Flags.None);
                         bool flag5 = instance4.m_segments.m_buffer[(int)segment6].m_startNode == nodeID == ((instance4.m_segments.m_buffer[(int)segment6].m_flags & NetSegment.Flags.Invert) == NetSegment.Flags.None);
                         if (flag4 == flag5)
                         {
                             goto IL_1637;
                         }
                         if (flag4)
                         {
                             if ((node4.m_connectGroup & NetInfo.ConnectGroup.OnewayStart) == NetInfo.ConnectGroup.None)
                             {
                                 goto IL_1637;
                             }
                         }
                         else
                         {
                             if ((node4.m_connectGroup & NetInfo.ConnectGroup.OnewayEnd) == NetInfo.ConnectGroup.None)
                             {
                                 goto IL_1637;
                             }
                             dataVector8.x = -dataVector8.x;
                             dataVector8.y = -dataVector8.y;
                         }
                     }
                     if (cameraInfo.CheckRenderDistance(data.m_position, node4.m_lodRenderDistance))
                     {
                         instance4.m_materialBlock.Clear();
                         instance4.m_materialBlock.SetMatrix(instance4.ID_LeftMatrix, data.m_dataMatrix0);
                         instance4.m_materialBlock.SetMatrix(instance4.ID_RightMatrix, data.m_extraData.m_dataMatrix2);
                         instance4.m_materialBlock.SetVector(instance4.ID_MeshScale, dataVector8);
                         instance4.m_materialBlock.SetVector(instance4.ID_ObjectIndex, dataVector7);
                         instance4.m_materialBlock.SetColor(instance4.ID_Color, data.m_dataColor0);
                         if (node4.m_requireSurfaceMaps && data.m_dataTexture1 != null)
                         {
                             instance4.m_materialBlock.SetTexture(instance4.ID_SurfaceTexA, data.m_dataTexture0);
                             instance4.m_materialBlock.SetTexture(instance4.ID_SurfaceTexB, data.m_dataTexture1);
                             instance4.m_materialBlock.SetVector(instance4.ID_SurfaceMapping, data.m_dataVector1);
                         }
                         NetManager netManager5 = instance4;
                         netManager5.m_drawCallData.m_defaultCalls = netManager5.m_drawCallData.m_defaultCalls + 1;
                         Graphics.DrawMesh(node4.m_nodeMesh, data.m_position, data.m_rotation, node4.m_nodeMaterial, node4.m_layer, null, 0, instance4.m_materialBlock);
                     }
                     else
                     {
                         NetInfo.LodValue combinedLod5 = node4.m_combinedLod;
                         if (combinedLod5 != null)
                         {
                             if (node4.m_requireSurfaceMaps && data.m_dataTexture0 != combinedLod5.m_surfaceTexA)
                             {
                                 if (combinedLod5.m_lodCount != 0)
                                 {
                                     NetSegment.RenderLod(cameraInfo, combinedLod5);
                                 }
                                 combinedLod5.m_surfaceTexA    = data.m_dataTexture0;
                                 combinedLod5.m_surfaceTexB    = data.m_dataTexture1;
                                 combinedLod5.m_surfaceMapping = data.m_dataVector1;
                             }
                             combinedLod5.m_leftMatrices[combinedLod5.m_lodCount]  = data.m_dataMatrix0;
                             combinedLod5.m_rightMatrices[combinedLod5.m_lodCount] = data.m_extraData.m_dataMatrix2;
                             combinedLod5.m_meshScales[combinedLod5.m_lodCount]    = dataVector8;
                             combinedLod5.m_objectIndices[combinedLod5.m_lodCount] = dataVector7;
                             combinedLod5.m_meshLocations[combinedLod5.m_lodCount] = data.m_position;
                             combinedLod5.m_lodMin = Vector3.Min(combinedLod5.m_lodMin, data.m_position);
                             combinedLod5.m_lodMax = Vector3.Max(combinedLod5.m_lodMax, data.m_position);
                             if (++combinedLod5.m_lodCount == combinedLod5.m_leftMatrices.Length)
                             {
                                 NetSegment.RenderLod(cameraInfo, combinedLod5);
                             }
                         }
                     }
                 }
                 IL_1637 :;
             }
         }
     }
     instanceIndex = (uint)data.m_nextInstance;
 }