public LanesConfiguration() { LanesToAdd = 0; PedLaneOffset = 0.0f; PedPropOffsetX = null; SpeedLimit = null; LaneWidth = 3.0f; IsTwoWay = true; HasBusStop = true; BusStopOffset = 1.5f; CenterLane = CenterLaneType.None; CenterLaneWidth = 3.0f; LayoutStyle = LanesLayoutStyle.Symmetrical; }
public LanesConfiguration() { LanesToAdd = 0; PedLaneOffset = 0.0f; PedPropOffsetX = null; SpeedLimit = null; LaneWidth = 3.0f; LanePositionOffst = 0; IsTwoWay = true; HasBusStop = true; BusStopOffset = 1.5f; CenterLane = CenterLaneType.None; CenterLaneWidth = 3.0f; CenterLanePosition = 0; LayoutStyle = LanesLayoutStyle.Symmetrical; }
public static void HandleAsymComplementarySegmentsFlags(NetInfo.Segment fSegment, NetInfo.Segment bSegment, LanesLayoutStyle lanesLayoutStyle) { switch (lanesLayoutStyle) { case LanesLayoutStyle.AsymL1R2: case LanesLayoutStyle.AsymL1R3: fSegment.m_forwardForbidden |= NetSegment.Flags.Invert; fSegment.m_backwardRequired |= NetSegment.Flags.Invert; bSegment.m_forwardRequired |= NetSegment.Flags.Invert; bSegment.m_backwardForbidden |= NetSegment.Flags.Invert; break; case LanesLayoutStyle.AsymL3R1: fSegment.m_forwardRequired |= NetSegment.Flags.Invert; fSegment.m_backwardForbidden |= NetSegment.Flags.Invert; bSegment.m_forwardForbidden |= NetSegment.Flags.Invert; bSegment.m_backwardRequired |= NetSegment.Flags.Invert; break; } }
public static void HandleAsymSegmentFlags(this NetInfo.Segment segment, LanesLayoutStyle asymLaneType) { switch (asymLaneType) { case LanesLayoutStyle.AsymL3R1: segment.m_forwardForbidden |= NetSegment.Flags.Invert; segment.m_backwardRequired |= NetSegment.Flags.Invert; break; case LanesLayoutStyle.AsymL1R2: case LanesLayoutStyle.AsymL1R3: segment.m_forwardForbidden |= NetSegment.Flags.Invert; segment.m_backwardRequired |= NetSegment.Flags.Invert; break; default: segment.SetFlagsDefault(); break; } }
public static NetInfo Setup16m3mSW3mMdnMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle lanesLayoutStyle = LanesLayoutStyle.Symmetrical) { var highwayInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var highwaySlopeInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_SLOPE); var defaultMaterial = highwayInfo.m_nodes[0].m_material; switch (version) { case NetInfoVersion.Ground: case NetInfoVersion.GroundGrass: case NetInfoVersion.GroundTrees: { var segments0 = info.m_segments[0]; var segments1 = info.m_segments[1]; var segments2 = info.m_segments[2]; var segments3 = info.m_segments[0].ShallowClone(); segments3.SetFlagsDefault().SetMeshes(@"Roads\Common\Meshes\16m\3mSW3mMdn\Ground_Segment_Median.obj", @"Roads\Common\Meshes\16m\3mSW3mMdn\Ground_Segment_Median_LOD.obj"); var theNodes = new List <NetInfo.Node>(); theNodes.AddRange(info.m_nodes); var medianNode = info.m_nodes[0].ShallowClone(); medianNode.SetMeshes(@"Roads\Common\Meshes\16m\3mSW3mMdn\Ground_Node_Median.obj", @"Roads\Common\Meshes\blank.obj"); theNodes.Add(medianNode); info.m_segments = new[] { segments0, segments1, segments2, segments3 }; info.m_nodes = theNodes.ToArray(); break; } case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: { var segments0 = info.m_segments[0]; var segments1 = info.m_segments[0].ShallowClone(); var nodes0 = info.m_nodes[0]; var nodes1 = info.m_nodes[0].ShallowClone(); segments0 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Elevated.obj", @"Roads\Common\Meshes\16m\3mSW\Elevated_LOD.obj"); segments1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW3mMdn\Elevated_Segment_Median.obj", @"Roads\Common\Meshes\16m\3mSW3mMdn\Ground_Segment_Median_LOD.obj"); nodes0 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Elevated_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Elevated_Node_LOD.obj"); nodes1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW3mMdn\Elevated_Node_Median.obj", @"Roads\Common\Meshes\blank.obj") .SetConsistentUVs(); info.m_segments = new[] { segments0, segments1 }; info.m_nodes = new[] { nodes0, nodes1 }; break; } case NetInfoVersion.Slope: { var segment0 = info.m_segments[0]; var segment1 = highwaySlopeInfo.m_segments[1].ShallowClone(); var segment2 = info.m_segments[1]; var segment3 = info.m_segments[1].ShallowClone(); var node0 = info.m_nodes[0]; var node1 = info.m_nodes[1]; var node2 = node0.ShallowClone(); var node3 = node1.ShallowClone(); var node4 = node0.ShallowClone(); segment2 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_LOD.obj"); segment3 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW3mMdn\Elevated_Segment_Median.obj", @"Roads\Common\Meshes\16m\3mSW3mMdn\Ground_Segment_Median_LOD.obj"); node1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_Node_LOD.obj"); node2 .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope_U_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_U_Node_LOD.obj"); node3 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW3mMdn\Elevated_Node_Median.obj", @"Roads\Common\Meshes\blank.obj"); node4 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW3mMdn\Elevated_Node_Median.obj", @"Roads\Common\Meshes\blank.obj"); node2.m_material = defaultMaterial; node4.m_material = defaultMaterial; info.m_segments = new[] { segment0, segment1, segment2, segment3 }; info.m_nodes = new[] { node0, node1, node2, node3, node4 }; break; } case NetInfoVersion.Tunnel: { var segments0 = info.m_segments[0]; var segments1 = segments0.ShallowClone(); var segments2 = segments0.ShallowClone(); var nodes0 = info.m_nodes[0]; var nodes1 = nodes0.ShallowClone(); var nodes2 = nodes0.ShallowClone(); segments1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Tunnel.obj", @"Roads\Common\Meshes\16m\3mSW\Tunnel_LOD.obj"); segments2 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW3mMdn\Elevated_Segment_Median.obj", @"Roads\Common\Meshes\16m\3mSW3mMdn\Ground_Segment_Median_LOD.obj"); nodes1 .SetFlags(NetNode.Flags.None, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Tunnel_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Tunnel_Node_LOD.obj"); nodes2 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW3mMdn\Elevated_Node_Median.obj", @"Roads\Common\Meshes\blank.obj"); segments1.m_material = defaultMaterial; segments2.m_material = defaultMaterial; nodes1.m_material = defaultMaterial; nodes2.m_material = defaultMaterial; info.m_segments = new[] { segments0, segments1, segments2 }; info.m_nodes = new[] { nodes0, nodes1, nodes2 }; break; } } return(info); }
public static NetInfo Setup16m2mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical) { var highwayInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var highwaySlopeInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_SLOPE); var defaultMaterial = highwayInfo.m_nodes[0].m_material; switch (version) { case NetInfoVersion.Ground: { var segment0 = info.m_segments[0]; var segment1 = info.m_segments[1]; var segment2 = info.m_segments[2]; var segment3 = info.m_segments[1].ShallowClone(); if (laneStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segment1, segment3); } var node0 = info.m_nodes[0].ShallowClone(); segment0 .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Ground.obj", @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj"); segment1 .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Ground.obj", @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj"); segment2 .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Ground.obj", @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj"); segment3 .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Ground.obj", @"Roads\Common\Meshes\16m\2mSW\Ground_LOD.obj"); node0 .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Ground_Node.obj", @"Roads\Common\Meshes\16m\2mSW\Ground_Node_LOD.obj"); RoadHelper.HandleAsymSegmentFlags(segment0); RoadHelper.HandleAsymSegmentFlags(segment2); info.m_segments = new[] { segment0, segment1, segment2, segment3 }; info.m_nodes = new[] { node0 }; break; } case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: { var segment0 = info.m_segments[0]; var node0 = info.m_nodes[0]; segment0 .SetFlagsDefault() .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Elevated.obj", @"Roads\Common\Meshes\16m\2mSW\Elevated_LOD.obj"); node0. SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Elevated_Node.obj", @"Roads\Common\Meshes\16m\2mSW\Elevated_Node_LOD.obj"); RoadHelper.HandleAsymSegmentFlags(segment0); info.m_segments = new[] { segment0 }; info.m_nodes = new[] { node0 }; break; } case NetInfoVersion.Slope: { var segment0 = info.m_segments[0]; var segment1 = highwaySlopeInfo.m_segments[1].ShallowClone(); var segment2 = info.m_segments[1]; var node0 = info.m_nodes[0]; var node1 = info.m_nodes[1]; var node2 = node0.ShallowClone(); //segment0 // .SetFlagsDefault() // **ToDo segment2 .SetFlagsDefault() .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Slope.obj", @"Roads\Common\Meshes\16m\2mSW\Slope_LOD.obj"); node1 .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Slope_Node.obj", @"Roads\Common\Meshes\16m\2mSW\Slope_Node_LOD.obj"); node2 .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Slope_U_Node.obj", @"Roads\Common\Meshes\16m\2mSW\Slope_U_Node_LOD.obj"); RoadHelper.HandleAsymSegmentFlags(segment2); node2.m_material = defaultMaterial; info.m_segments = new[] { segment0, segment1, segment2 }; info.m_nodes = new[] { node0, node1, node2 }; break; } case NetInfoVersion.Tunnel: { var segment0 = info.m_segments[0]; var segment1 = segment0.ShallowClone(); var node0 = info.m_nodes[0]; var node1 = node0.ShallowClone(); segment1 .SetFlagsDefault() .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Tunnel.obj", @"Roads\Common\Meshes\16m\2mSW\Tunnel_LOD.obj"); node1 .SetFlags(NetNode.Flags.None, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\2mSW\Tunnel_Node.obj", @"Roads\Common\Meshes\16m\2mSW\Tunnel_Node_LOD.obj"); RoadHelper.HandleAsymSegmentFlags(segment1); segment1.m_material = defaultMaterial; node1.m_material = defaultMaterial; info.m_segments = new[] { segment0, segment1 }; info.m_nodes = new[] { node0, node1 }; break; } } return(info); }
public static NetInfo Setup32m5mSW3mMdn(this NetInfo info, NetInfoVersion version, LanesLayoutStyle layoutStyle = LanesLayoutStyle.Symmetrical) { var highwayInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var defaultMaterial = highwayInfo.m_nodes[0].m_material; //var inverted = string.Empty; //if (L > R) //{ // inverted = "_Inverted"; //} switch (version) { case NetInfoVersion.Ground: { var segments0 = info.m_segments[0]; var segments1 = info.m_segments[1]; var segments2 = info.m_segments[2]; var segments3 = info.m_segments[1].ShallowClone(); segments0.SetMeshes( @"Roads\Common\Meshes\32m\5mSw3mMdn\Ground.obj"); segments1.SetMeshes( @"Roads\Common\Meshes\32m\5mSw3mMdn\Bus.obj"); segments2.SetMeshes( @"Roads\Common\Meshes\32m\5mSw3mMdn\BusBoth.obj"); segments3.SetMeshes( @"Roads\Common\Meshes\32m\5mSw3mMdn\BusInv.obj"); if (layoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments3, segments1); RoadHelper.HandleAsymSegmentFlags(segments0); } info.m_segments = new[] { segments0, segments1, segments2, segments3 }; break; } case NetInfoVersion.Elevated: { var segments0 = info.m_segments[0]; segments0 .SetMeshes ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Elevated.obj"); if (layoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments0); } info.m_segments = new[] { segments0 }; break; } case NetInfoVersion.Bridge: { var segments0 = info.m_segments[0]; var segments1 = info.m_segments[1]; segments0 .SetMeshes ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Elevated.obj"); if (layoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments0); } info.m_segments = new[] { segments0, segments1 }; //info.m_nodes = new[] { nodes0 }; break; } case NetInfoVersion.Slope: { var segment0 = info.m_segments[0]; var segment1 = info.m_segments[1].ShallowClone(); var segment2 = info.m_segments[1].ShallowClone(); var node0 = info.m_nodes[0]; var node1 = info.m_nodes[1]; var node2 = node0.ShallowClone(); segment1 .SetMeshes ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Slope.obj", @"Roads\Common\Meshes\32m\3mSw2mMdn\Slope_LOD.obj"); node2 .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\32m\5mSw3mMdn\Slope_U_Node.obj", @"Roads\Common\Meshes\32m\5mSW\Slope_U_Node.obj"); RoadHelper.HandleAsymSegmentFlags(segment1); node2.m_material = defaultMaterial; info.m_segments = new[] { segment0, segment1, segment2 }; info.m_nodes = new[] { node0, node1, node2 }; break; } case NetInfoVersion.Tunnel: { var segments0 = info.m_segments[0]; var segments1 = segments0.ShallowClone(); var segments2 = segments0.ShallowClone(); var nodes0 = info.m_nodes[0]; var nodes1 = nodes0.ShallowClone(); segments1 .SetMeshes ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Tunnel.obj"); segments2 .SetMeshes ($@"Roads\Common\Meshes\32m\5mSw3mMdn\Tunnel_Inverted.obj"); nodes1 .SetFlags(NetNode.Flags.None, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\32m\5mSw3mMdn\Tunnel_Node.obj", @"Roads\Highways\Common\Meshes\32m\Tunnel_LOD.obj"); if (layoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments1, segments2); } segments1.m_material = defaultMaterial; nodes1.m_material = defaultMaterial; info.m_segments = new[] { segments0, segments1, segments2 }; info.m_nodes = new[] { nodes0, nodes1 }; break; } } return(info); }
public static void SetupTextures(this NetInfo info, NetInfoVersion version, LanesLayoutStyle lanesStyle) { switch (version) { case NetInfoVersion.Ground: for (int i = 0; i < info.m_segments.Length; i++) { if (lanesStyle != LanesLayoutStyle.Symmetrical) { var inverted = string.Empty; var lodInverted = string.Empty; var invertMe = (lanesStyle == LanesLayoutStyle.AsymL2R3 && ((info.m_segments[i].m_backwardForbidden & NetSegment.Flags.Invert) == 0)); if (invertMe) { lodInverted = "_Inverted"; } if (invertMe || info.m_segments[i].m_mesh.name == "Bus") { inverted = "_Inverted"; } info.m_segments[i].SetTextures( new TextureSet (string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment{0}__AlphaMap.png", inverted)), new LODTextureSet (string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment{0}__MainTex_LOD.png", lodInverted), string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment{0}__AlphaMap_LOD.png", lodInverted), @"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment__XYSMap_LOD.png")); } } break; case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: for (int i = 0; i < info.m_segments.Length; i++) { if (lanesStyle != LanesLayoutStyle.Symmetrical) { var inverted = (lanesStyle == LanesLayoutStyle.AsymL2R3 ? "_Inverted" : string.Empty); info.m_segments[i].SetTextures( new TextureSet (string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Elevated_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Elevated_Segment{0}__AlphaMap.png", inverted)), new LODTextureSet (string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Elevated_Segment{0}__MainTex_LOD.png", inverted), string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Elevated_Segment{0}__AlphaMap_LOD.png", inverted), @"Roads\Avenues\AsymAvenue5L\Textures\Elevated_Segment__XYSMap_LOD.png")); } //else //{ // info.m_segments[i].SetTextures( //new TextureSet // (@"Roads\Avenues\AsymAvenue5L\Textures\Elevated_Segment__MainTex.png", // @"Roads\Avenues\AsymAvenue5L\Textures\Elevated_Segment__AlphaMap.png")); // //new LODTextureSet // // (@"Roads\Avenues\AsymAvenue5L\Textures\Elevated_LOD__MainTex.png", // // @"Roads\Avenues\AsymAvenue5L\Textures\Elevated_SegmentLOD__AlphaMap.png", // // @"Roads\Avenues\AsymAvenue5L\Textures\Elevated_LOD__XYSMap.png")); //} } break; case NetInfoVersion.Slope: for (int i = 0; i < info.m_segments.Length; i++) { if (info.m_segments[i].m_mesh.name == "Slope") { info.m_segments[i].SetTextures( new TextureSet( @"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment_Inverted__MainTex.png", @"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment_Inverted__AlphaMap.png"), new LODTextureSet( @"Roads\Avenues\AsymAvenue5L\Textures\Slope_Segment__MainTex_LOD.png", @"Roads\Avenues\AsymAvenue5L\Textures\Slope_Segment__AlphaMap_LOD.png", @"Roads\Avenues\AsymAvenue5L\Textures\Slope_Segment__XYSMap_LOD.png")); } else { info.m_segments[i].SetTextures( new TextureSet (@"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment__MainTex.png", @"Roads\Avenues\LargeAvenue8LM\Textures\Slope_Segment_Cover__APRMap.png"), new LODTextureSet( @"Roads\Avenues\AsymAvenue5L\Textures\Slope_Segment__MainTex_LOD.png", @"Roads\Avenues\AsymAvenue5L\Textures\Slope_Segment__AlphaMap_LOD.png", @"Roads\Avenues\AsymAvenue5L\Textures\Slope_Segment__XYSMap_LOD.png")); } } for (int i = 0; i < info.m_nodes.Length; i++) { if (info.m_nodes[i].m_mesh.name == "Slope_U_Node") { info.m_nodes[i].SetTextures( new TextureSet (@"Roads\Avenues\AsymAvenue5L\Textures\Ground_Segment__MainTex.png", @"Roads\Avenues\AsymAvenue5L\Textures\Slope_U_Node__AlphaMap.png")); } } break; case NetInfoVersion.Tunnel: { for (int i = 0; i < info.m_segments.Length; i++) { if (info.m_segments[i].m_mesh.name == "Tunnel") { var inverted = (lanesStyle == LanesLayoutStyle.AsymL2R3 ? "_Inverted" : string.Empty); info.m_segments[i].SetTextures( new TextureSet (string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Tunnel_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\Avenues\AsymAvenue5L\Textures\Tunnel_Segment{0}__AlphaMap.png", inverted))); } else { info.m_segments[i].SetTextures( new TextureSet (@"Roads\Avenues\AsymAvenue5L\Textures\Tunnel_Segment__MainTex.png", @"Roads\Avenues\AsymAvenue5L\Textures\Tunnel_Segment__AlphaMap.png")); } } info.SetAllNodesTexture( new TextureSet (@"Roads\Avenues\AsymAvenue5L\Textures\Tunnel_Node__MainTex.png", @"Roads\Avenues\AsymAvenue5L\Textures\Tunnel_Node__AlphaMap.png")); break; } } }
public static NetInfo Setup16m3mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle lanesLayoutStyle = LanesLayoutStyle.Symmetrical) { var highwayInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var highwaySlopeInfo = Prefabs.Find<NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_SLOPE); var defaultMaterial = highwayInfo.m_nodes[0].m_material; switch (version) { case NetInfoVersion.Ground: { var segments0 = info.m_segments[0]; var segments1 = info.m_segments[1]; var segments2 = info.m_segments[2]; var segments3 = info.m_segments[1].ShallowClone(); segments3.SetMeshes(@"Roads\Common\Meshes\16m\3mSW\BusStopInv.obj"); if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymComplementarySegmentsFlags(segments1, segments3, lanesLayoutStyle); segments0.HandleAsymSegmentFlags(lanesLayoutStyle); segments2.HandleAsymSegmentFlags(lanesLayoutStyle); } info.m_segments = new[] { segments0, segments1, segments2, segments3 }; break; } case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: { var segments0 = info.m_segments[0]; var nodes0 = info.m_nodes[0]; segments0 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Elevated.obj", @"Roads\Common\Meshes\16m\3mSW\Elevated_LOD.obj"); nodes0.SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Elevated_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Elevated_Node_LOD.obj"); segments0.HandleAsymSegmentFlags(lanesLayoutStyle); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; break; } case NetInfoVersion.Slope: { var segment0 = info.m_segments[0]; var segment1 = highwaySlopeInfo.m_segments[1].ShallowClone(); var segment2 = info.m_segments[1]; var node0 = info.m_nodes[0]; var node1 = info.m_nodes[1]; var node2 = node0.ShallowClone(); segment2 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_LOD.obj"); node1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_Node_LOD.obj"); node2 .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope_U_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_U_Node_LOD.obj"); segment2.HandleAsymSegmentFlags(lanesLayoutStyle); node2.m_material = defaultMaterial; info.m_segments = new[] { segment0, segment1, segment2 }; info.m_nodes = new[] { node0, node1, node2 }; break; } case NetInfoVersion.Tunnel: { var segments0 = info.m_segments[0]; var segments1 = segments0.ShallowClone(); var nodes0 = info.m_nodes[0]; var nodes1 = nodes0.ShallowClone(); segments1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Tunnel.obj", @"Roads\Common\Meshes\16m\3mSW\Tunnel_LOD.obj"); nodes1 .SetFlags(NetNode.Flags.None, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Tunnel_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Tunnel_Node_LOD.obj"); segments1.HandleAsymSegmentFlags(lanesLayoutStyle); segments1.m_material = defaultMaterial; nodes1.m_material = defaultMaterial; info.m_segments = new[] { segments0, segments1 }; info.m_nodes = new[] { nodes0, nodes1 }; break; } } return info; }
public static NetInfo Setup8m1p5mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical) { switch (version) { case NetInfoVersion.Ground: { var segments0 = info.m_segments[0].ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = info.m_nodes[0].ShallowClone(); segments0 .SetFlagsDefault() .SetMeshes (@"Roads\Common\Meshes\8m\1p5mSW\Ground.obj", @"Roads\Common\Meshes\8m\1p5mSW\Ground_LOD.obj"); nodes0 .SetFlags(NetNode.Flags.None, NetNode.Flags.Transition) .SetMeshes (@"Roads\Common\Meshes\8m\1p5mSW\Ground_Node.obj", @"Roads\Common\Meshes\8m\1p5mSW\Ground_Node_LOD.obj"); nodes1 .SetFlags(NetNode.Flags.Transition, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\8m\1p5mSW\Ground_Trans.obj", @"Roads\Common\Meshes\8m\1p5mSW\Ground_Node_LOD.obj"); if (laneStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments0); } info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0, nodes1 }; break; } } return(info); }
public static void Setup22mMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle lanesLayoutStyle = LanesLayoutStyle.Symmetrical) { /////////////////////////// // Template // /////////////////////////// var highwayInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var defaultMaterial = highwayInfo.m_nodes[0].m_material; var defaultLODMaterial = highwayInfo.m_nodes[0].m_lodMaterial; if (version == NetInfoVersion.Ground) { if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical) { var segment0 = info.m_segments[0].ShallowClone(); RoadHelper.HandleAsymSegmentFlags(segment0); info.m_segments = new[] { segment0 }; } } if (version == NetInfoVersion.Elevated || version == NetInfoVersion.Bridge) { if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical) { var segment0 = info.m_segments[0].ShallowClone(); RoadHelper.HandleAsymSegmentFlags(segment0); var segments = info.m_segments.ToList(); segments[0] = segment0; info.m_segments = segments.ToArray(); } } if (version == NetInfoVersion.Slope) { var segments0 = info.m_segments[0].ShallowClone(); var segments1 = info.m_segments[1].ShallowClone(); var segments2 = info.m_segments[1].ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = info.m_nodes[1].ShallowClone(); var nodes2 = info.m_nodes[0].ShallowClone(); //var nodes1 = info.m_nodes[1].ShallowClone(); segments1 .SetMeshes (@"Roads\Highways\Common\Meshes\22m\Slope.obj"); segments2 .SetMeshes (@"Roads\Highways\Common\Meshes\22m\Slope_Cover.obj", @"Roads\Common\Meshes\Blank.obj") .SetConsistentUVs(); nodes2 .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None) .SetMeshes (@"Roads\Highways\Common\Meshes\22m\Slope_U_Node.obj", @"Roads\Highways\Common\Meshes\22m\Slope_U_Node_LOD.obj"); //nodes1 // .SetFlags(NetNode.Flags.UndergroundTransition, NetNode.Flags.None) // .SetMeshes // (@"Roads\Highways\Common\Meshes\22m\Slope_U_Trans.obj", // @"Roads\Highways\Common\Meshes\22m\Slope_U_Trans_LOD.obj"); if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments1); } nodes2.m_material = defaultMaterial; nodes2.m_lodMaterial = defaultLODMaterial; //nodes1.m_material = defaultMaterial; //nodes1.m_lodMaterial = defaultLODMaterial; info.m_segments = new[] { segments0, segments1 }; info.m_nodes = new[] { nodes0, nodes1, nodes2 }; } else if (version == NetInfoVersion.Tunnel) { var segments0 = info.m_segments[0].ShallowClone(); var segments1 = info.m_segments[0].ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = info.m_nodes[0].ShallowClone(); var nodes2 = info.m_nodes[0].ShallowClone(); nodes1.m_flagsForbidden = NetNode.Flags.None; nodes1.m_flagsRequired = NetNode.Flags.None; segments1.SetMeshes (@"Roads\Highways\Common\Meshes\22m\Tunnel.obj", @"Roads\Highways\Common\Meshes\22m\Tunnel_LOD.obj"); nodes1.SetMeshes (@"Roads\Highways\Common\Meshes\22m\Tunnel_Node.obj", @"Roads\Highways\Common\Meshes\22m\Tunnel_Node_LOD.obj"); //nodes2.SetMeshes // (@"Roads\Highways\Common\Meshes\22m\Tunnel_Trans.obj", // @"Roads\Highways\Common\Meshes\22m\Tunnel_Trans_LOD.obj"); if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments1); } segments1.m_material = defaultMaterial; segments1.m_lodMaterial = defaultLODMaterial; nodes1.m_material = defaultMaterial; nodes1.m_lodMaterial = defaultLODMaterial; info.m_segments = new[] { segments0, segments1 }; info.m_nodes = new[] { nodes0, nodes1, nodes2 }; } }
private void SetupTextures(NetInfo info, NetInfoVersion version, LanesLayoutStyle asymLaneType) { switch (version) { case NetInfoVersion.Ground: foreach (var segment in info.m_segments) { if (asymLaneType != LanesLayoutStyle.Symmetrical) { var inverted = string.Empty; if ((asymLaneType == LanesLayoutStyle.AsymL1R3 && ((segment.m_backwardForbidden & NetSegment.Flags.Invert) == 0)) || (asymLaneType == LanesLayoutStyle.AsymL3R1 && ((segment.m_backwardForbidden & NetSegment.Flags.Invert) != 0))) { inverted = "_Inverted"; } segment.SetTextures( new TextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__AlphaMap.png", inverted)), new LODTextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__AlphaMap.png", inverted), @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__XYS.png")); } } break; case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: foreach (var segment in info.m_segments) { if (segment.m_mesh.name == "Elevated" || segment.m_mesh.name == "Bridge") { var inverted = (asymLaneType == LanesLayoutStyle.AsymL1R3 ? "_Inverted" : string.Empty); segment.SetTextures( new TextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_Segment{0}__APRMap.png", inverted)), new LODTextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_SegmentLOD{0}__APRMap.png", inverted), @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__XYSMap.png")); } else { segment.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_Segment__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_SegmentLOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__XYSMap.png")); } } info.SetAllNodesTexture( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_Node__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_NodeLOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__XYSMap.png")); break; case NetInfoVersion.Slope: foreach (var segment in info.m_segments) { if (segment.m_mesh.name == "Slope") { var inverted = (asymLaneType == LanesLayoutStyle.AsymL1R3 ? "_Inverted" : string.Empty); segment.SetTextures( new TextureSet( string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__AlphaMap.png", inverted)), new LODTextureSet( string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__AlphaMap.png", inverted), @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD2__XYSMap.png")); } else { segment.SetTextures( new TextureSet (@"Roads\Highways\Highway4L\Textures\Slope_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_Segment__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD__XYSMap.png")); } } foreach (var node in info.m_nodes) { if (node.m_mesh.name == "Slope_Node") { node.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Node__AlphaMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__AlphaMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__XYS.png")); } else { node.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Node__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); } } //info.SetAllNodesTexture( //new TextureSet // (@"Roads\Highways\Highway4L\Textures\Slope_Node__MainTex.png", // @"Roads\Highways\Highway4L\Textures\Ground_Node__APRMap.png"), //new LODTextureSet // (@"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__MainTex.png", // @"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__APRMap.png", // @"Roads\Highways\Highway4L\Textures\Ground_LOD__XYSMap.png")); break; case NetInfoVersion.Tunnel: { foreach (var segment in info.m_segments) { if (segment.m_mesh.name == "Tunnel") { var inverted = (asymLaneType == LanesLayoutStyle.AsymL1R3 ? "_Inverted" : string.Empty); segment.SetTextures( new TextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment{0}__APRMap.png", inverted)), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); } else { segment.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); } } info.SetAllNodesTexture( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Node__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); break; } } }
public static void Setup24mMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle lanesLayoutStyle = LanesLayoutStyle.Symmetrical) { /////////////////////////// // Template // /////////////////////////// var highwayInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var defaultMaterial = highwayInfo.m_nodes[0].m_material; if (version == NetInfoVersion.Ground) { var segments0 = info.m_segments[0].ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = info.m_nodes[1].ShallowClone(); segments0.SetMeshes( @"Roads\Highways\Common\Meshes\24m\Ground.obj", @"Roads\Highways\Common\Meshes\24m\Ground_LOD.obj"); nodes0.SetMeshes( @"Roads\Highways\Common\Meshes\24m\Ground_Node.obj", @"Roads\Highways\Common\Meshes\24m\Ground_Node_LOD.obj"); nodes1.SetMeshes( @"Roads\Highways\Common\Meshes\24m\Ground_Trans.obj", @"Roads\Highways\Common\Meshes\24m\Ground_Trans_LOD.obj"); if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments0); } info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0, nodes1 }; } if (version == NetInfoVersion.Slope) { var segments0 = info.m_segments[0].ShallowClone(); var segments1 = info.m_segments[1].ShallowClone(); var segments2 = segments1.ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = info.m_nodes[1].ShallowClone(); var nodes2 = nodes0.ShallowClone(); var nodes3 = nodes1.ShallowClone(); segments0.m_backwardForbidden = NetSegment.Flags.None; segments0.m_backwardRequired = NetSegment.Flags.None; segments0.m_forwardForbidden = NetSegment.Flags.None; segments0.m_forwardRequired = NetSegment.Flags.None; segments1.m_backwardForbidden = NetSegment.Flags.None; segments1.m_backwardRequired = NetSegment.Flags.None; segments1.m_forwardForbidden = NetSegment.Flags.None; segments1.m_forwardRequired = NetSegment.Flags.None; segments2.m_backwardForbidden = NetSegment.Flags.None; segments2.m_backwardRequired = NetSegment.Flags.None; segments2.m_forwardForbidden = NetSegment.Flags.None; segments2.m_forwardRequired = NetSegment.Flags.None; nodes0.m_flagsForbidden = NetNode.Flags.None; nodes0.m_flagsRequired = NetNode.Flags.Underground; nodes1.m_flagsForbidden = NetNode.Flags.UndergroundTransition; nodes1.m_flagsRequired = NetNode.Flags.None; nodes2.m_flagsForbidden = NetNode.Flags.None; nodes2.m_flagsRequired = NetNode.Flags.Underground; nodes3.m_flagsForbidden = NetNode.Flags.None; nodes3.m_flagsRequired = NetNode.Flags.Transition; nodes1.SetMeshes (@"Roads\Highways\Common\Meshes\24m\Ground_Node.obj", @"Roads\Highways\Common\Meshes\24m\Ground_Node_LOD.obj"); nodes2.SetMeshes (@"Roads\Highways\Common\Meshes\24m\Slope_U_Node.obj", @"Roads\Highways\Common\Meshes\24m\Slope_U_Node_LOD.obj"); nodes3.SetMeshes (@"Roads\Highways\Common\Meshes\24m\Ground_Trans.obj", @"Roads\Highways\Common\Meshes\24m\Ground_Trans_LOD.obj"); nodes2.m_material = defaultMaterial; info.m_segments = new[] { segments0, segments1 }; info.m_nodes = new[] { nodes0, nodes1, nodes2, nodes3 }; } else if (version == NetInfoVersion.Tunnel) { var segments0 = info.m_segments[0].ShallowClone(); var segments1 = segments0.ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = nodes0.ShallowClone(); //var nodes2 = nodes1.ShallowClone(); //segments1.m_backwardForbidden = NetSegment.Flags.None; //segments1.m_backwardRequired = NetSegment.Flags.None; //segments1.m_forwardForbidden = NetSegment.Flags.None; //segments1.m_forwardRequired = NetSegment.Flags.None; nodes0.m_flagsForbidden = NetNode.Flags.None; nodes0.m_flagsRequired = NetNode.Flags.None; nodes1.m_flagsForbidden = NetNode.Flags.None; nodes1.m_flagsRequired = NetNode.Flags.None; //nodes2.m_flagsForbidden = NetNode.Flags.None; // nodes2.m_flagsRequired = NetNode.Flags.UndergroundTransition; segments0.SetMeshes (@"Roads\Highways\Common\Meshes\24m\Tunnel_Gray.obj", @"Roads\Highways\Common\Meshes\24m\Ground_LOD.obj"); segments1.SetMeshes (@"Roads\Highways\Common\Meshes\24m\Tunnel.obj", @"Roads\Highways\Common\Meshes\24m\Tunnel_LOD.obj"); nodes0.SetMeshes (@"Roads\Highways\Common\Meshes\24m\Tunnel_Node_Gray.obj", @"Roads\Highways\Common\Meshes\24m\Ground_Node_LOD.obj"); nodes1.SetMeshes (@"Roads\Highways\Common\Meshes\24m\Tunnel_Node.obj", @"Roads\Highways\Common\Meshes\24m\Tunnel_Node_LOD.obj"); // nodes2.SetMeshes // (@"Roads\Highways\Common\Meshes\32m\Tunnel.obj", // @"Roads\Highways\Common\Meshes\32m\Ground_LOD.obj"); segments1.m_material = defaultMaterial; nodes1.m_material = defaultMaterial; //nodes2.m_material = defaultMaterial; info.m_segments = new[] { segments0, segments1 }; info.m_nodes = new[] { nodes0, nodes1 }; } }
public static NetInfo Setup8m1p5mSW1SMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle laneStyle = LanesLayoutStyle.Symmetrical) { switch (version) { case NetInfoVersion.Ground: { var segments0 = info.m_segments[0].ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = info.m_nodes[0].ShallowClone(); var nodes2 = info.m_nodes[0].ShallowClone(); segments0 .SetFlagsDefault() .SetMeshes (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground.obj", @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_LOD.obj"); nodes0 .SetMeshes (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node.obj", @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj"); nodes1 .SetMeshes (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node2.obj", @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj"); nodes2 .SetMeshes (@"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node3.obj", @"Roads\Common\Meshes\8m\1p5mSW1S\Ground_Node_LOD.obj"); if (laneStyle != LanesLayoutStyle.Symmetrical) { RoadHelper.HandleAsymSegmentFlags(segments0); } nodes1.m_directConnect = true; nodes1.m_connectGroup = NetInfo.ConnectGroup.NarrowTram | NetInfo.ConnectGroup.OnewayStart | NetInfo.ConnectGroup.OnewayEnd; nodes2.m_directConnect = true; nodes2.m_connectGroup = NetInfo.ConnectGroup.NarrowTram | NetInfo.ConnectGroup.OnewayEnd; info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0, nodes1 }; break; } } return(info); }
private void SetupTextures(NetInfo info, NetInfoVersion version, LanesLayoutStyle asymLaneType) { switch (version) { case NetInfoVersion.Ground: foreach (var segment in info.m_segments) { if (asymLaneType != LanesLayoutStyle.Symmetrical) { var inverted = string.Empty; if ((asymLaneType == LanesLayoutStyle.AsymL1R3 && ((segment.m_backwardForbidden & NetSegment.Flags.Invert) == 0)) || (asymLaneType == LanesLayoutStyle.AsymL3R1 && ((segment.m_backwardForbidden & NetSegment.Flags.Invert) != 0))) { inverted = "_Inverted"; } segment.SetTextures( new TextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__AlphaMap.png", inverted)), new LODTextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__AlphaMap.png", inverted), @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__XYS.png")); } } break; case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: foreach (var segment in info.m_segments) { if (segment.m_mesh.name == "Elevated" || segment.m_mesh.name == "Bridge") { var inverted = (asymLaneType == LanesLayoutStyle.AsymL1R3 ? "_Inverted" : string.Empty); segment.SetTextures( new TextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_Segment{0}__APRMap.png", inverted)), new LODTextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_SegmentLOD{0}__APRMap.png", inverted), @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__XYSMap.png")); } else { segment.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_Segment__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_SegmentLOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__XYSMap.png")); } } info.SetAllNodesTexture( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_Node__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_NodeLOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Elevated_LOD__XYSMap.png")); break; case NetInfoVersion.Slope: foreach (var segment in info.m_segments) { if (segment.m_mesh.name == "Slope") { var inverted = (asymLaneType == LanesLayoutStyle.AsymL1R3 ? "_Inverted" : string.Empty); segment.SetTextures( new TextureSet( string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment{0}__AlphaMap.png", inverted)), new LODTextureSet( string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD{0}__AlphaMap.png", inverted), @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD2__XYSMap.png")); } else { segment.SetTextures( new TextureSet (@"Roads\Highways\Highway4L\Textures\Slope_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_Segment__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Slope_SegmentLOD__XYSMap.png")); } } foreach (var node in info.m_nodes) { if (node.m_mesh.name == "Slope_Node") { node.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_Node__AlphaMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__AlphaMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Ground_SegmentLOD__XYS.png")); } else { node.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Node__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); } } //info.SetAllNodesTexture( //new TextureSet // (@"Roads\Highways\Highway4L\Textures\Slope_Node__MainTex.png", // @"Roads\Highways\Highway4L\Textures\Ground_Node__APRMap.png"), //new LODTextureSet // (@"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__MainTex.png", // @"Roads\Highways\Highway4L\Textures\Ground_NodeLOD__APRMap.png", // @"Roads\Highways\Highway4L\Textures\Ground_LOD__XYSMap.png")); break; case NetInfoVersion.Tunnel: { foreach (var segment in info.m_segments) { if (segment.m_mesh.name == "Tunnel") { var inverted = (asymLaneType == LanesLayoutStyle.AsymL1R3 ? "_Inverted" : string.Empty); segment.SetTextures( new TextureSet (string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment{0}__MainTex.png", inverted), string.Format(@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment{0}__APRMap.png", inverted)), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); } else { segment.SetTextures( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); } } info.SetAllNodesTexture( new TextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Segment__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_Node__APRMap.png"), new LODTextureSet (@"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_NodeLOD__MainTex.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__APRMap.png", @"Roads\SmallHeavyRoads\AsymRoadL1R3\Textures\Tunnel_LOD__XYSMap.png")); break; } } }
public static NetInfo Setup16m3mSWMesh(this NetInfo info, NetInfoVersion version, LanesLayoutStyle lanesLayoutStyle = LanesLayoutStyle.Symmetrical) { var highwayInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L); var highwaySlopeInfo = Prefabs.Find <NetInfo>(NetInfos.Vanilla.HIGHWAY_3L_SLOPE); var defaultMaterial = highwayInfo.m_nodes[0].m_material; switch (version) { case NetInfoVersion.Ground: case NetInfoVersion.GroundGrass: case NetInfoVersion.GroundTrees: { var segments0 = info.m_segments[0].ShallowClone(); var segments1 = info.m_segments[1].ShallowClone(); var segments2 = info.m_segments[2].ShallowClone(); if (lanesLayoutStyle != LanesLayoutStyle.Symmetrical) { var segments3 = info.m_segments[1].ShallowClone(); segments3.SetMeshes(@"Roads\Common\Meshes\16m\3mSW\BusStopInv.obj"); RoadHelper.HandleAsymSegmentFlags(segments1, segments3); RoadHelper.HandleAsymSegmentFlags(segments0); RoadHelper.HandleAsymSegmentFlags(segments2); info.m_segments = new[] { segments0, segments1, segments2, segments3 }; } else { info.m_segments = new[] { segments0, segments1, segments2 }; } break; } case NetInfoVersion.Elevated: case NetInfoVersion.Bridge: { var segments0 = info.m_segments[0].ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); segments0 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Elevated.obj", @"Roads\Common\Meshes\16m\3mSW\Elevated_LOD.obj"); nodes0.SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Elevated_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Elevated_Node_LOD.obj"); RoadHelper.HandleAsymSegmentFlags(segments0); info.m_segments = new[] { segments0 }; info.m_nodes = new[] { nodes0 }; break; } case NetInfoVersion.Slope: { var segment0 = info.m_segments[0].ShallowClone(); var segment1 = highwaySlopeInfo.m_segments[1].ShallowClone(); var segment2 = info.m_segments[1].ShallowClone(); var node0 = info.m_nodes[0].ShallowClone(); var node1 = info.m_nodes[1].ShallowClone(); var node2 = node0.ShallowClone(); segment2 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_LOD.obj") .SetConsistentUVs(); node1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_Node_LOD.obj"); node2 .SetFlags(NetNode.Flags.Underground, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Slope_U_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Slope_U_Node_LOD.obj"); RoadHelper.HandleAsymSegmentFlags(segment2); node2.m_material = defaultMaterial; info.m_segments = new[] { segment0, segment1, segment2 }; info.m_nodes = new[] { node0, node1, node2 }; break; } case NetInfoVersion.Tunnel: { var segments0 = info.m_segments[0].ShallowClone(); var segments1 = segments0.ShallowClone(); var nodes0 = info.m_nodes[0].ShallowClone(); var nodes1 = nodes0.ShallowClone(); segments1 .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Tunnel.obj", @"Roads\Common\Meshes\16m\3mSW\Tunnel_LOD.obj") .SetConsistentUVs(); nodes1 .SetFlags(NetNode.Flags.None, NetNode.Flags.None) .SetMeshes (@"Roads\Common\Meshes\16m\3mSW\Tunnel_Node.obj", @"Roads\Common\Meshes\16m\3mSW\Tunnel_Node_LOD.obj"); RoadHelper.HandleAsymSegmentFlags(segments1); segments1.m_material = defaultMaterial; nodes1.m_material = defaultMaterial; info.m_segments = new[] { segments0, segments1 }; info.m_nodes = new[] { nodes0, nodes1 }; break; } } return(info); }