GameObject RunOpenDrivePipeline(ContentPipeline pipeline) { var parentObject = new GameObject("Placed Road Objects"); // if (useEcsRoadNetwork) // { // pipeline.RunGenerator<RoadNetworkDescriptionToEcsSystem, RoadNetworkDescriptionToEcsSystemParameters>(new RoadNetworkDescriptionToEcsSystemParameters() // { // roadNetworkDescription = roadNetworkDescription // }); // pipeline.RunGenerator<GeneratePolygonsFromEcsSystem, PolygonSystemFromEcsParameters>(new PolygonSystemFromEcsParameters() // { // minimumPolygonArea = MinimumPolygonArea, // extensionDistance = ExtensionDistance, // processingScheme = processingScheme // }); // } // else // { pipeline.RunGenerator <PlacementPathsFromPolygonsSystem, PolygonSystemParameters>(new PolygonSystemParameters() { roadNetworkDescription = roadNetworkDescription, minimumPolygonArea = MinimumPolygonArea, extensionDistance = ExtensionDistance, outermostLaneType = BorderLaneType }); // } pipeline.RunGenerator <MeshFromPolygonsSystem, MeshFromPolygonsParameters>(new MeshFromPolygonsParameters() { Material = roadMaterial, Parent = parentObject.transform, UVMultiplier = uvMultiplier }); if (createRoadMesh) { pipeline.RunGenerator <MeshFromPolygonsSystem, MeshFromPolygonsParameters>(new MeshFromPolygonsParameters() { Material = roadMaterial, Parent = parentObject.transform, UVMultiplier = uvMultiplier }); } if (drawRoadOutline) { pipeline.RunGenerator <PolygonDrawingSystem, PolygonDrawingParameters>(new PolygonDrawingParameters { parent = parentObject.transform }); } ExecutePlacementAlgorithms(pipeline, parentObject); return(parentObject); }
void TestPoissonPlacement(GameObject parentObj) { var placementCategory = ScriptableObject.CreateInstance <PlacementCategory>(); m_TearDownObjects.Add(placementCategory); var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); m_TearDownObjects.Add(cube); placementCategory.prefabs = new [] { cube }; var poissonParams = new PoissonPlacementSystemParameters() { spacing = 10f, category = placementCategory, parent = parentObj.transform, innerOffsetFromPath = 10f, outerOffsetFromPath = 100f }; m_Pipeline.RunGenerator <PoissonDiscSamplingPlacementSystem, PoissonPlacementSystemParameters>(poissonParams); }
public void GenerateRoadMesh( ContentPipeline pipeline, GameObject parentObject, RoadConditionConfiguration roadConditionConfig = null) { Profiler.BeginSample("GenerateRoadMesh"); m_RoadPathNetwork = GetComponent <RoadPathNetwork>(); materialParams.parentObject = parentObject; roadBuilderParameters.parentObject = parentObject; debugDrawingParameters.parentObject = parentObject; cameraPathParameters.parentObject = parentObject; roadBuilderParameters.baseRandomSeed = baseRandomSeed; var roadPathParams = new RoadPathNetworkToEcsParameters { network = m_RoadPathNetwork }; // TODO: Validate roadBuilderParameter inputs pipeline.RunGenerator <RoadPathNetworkToEcsSystem, RoadPathNetworkToEcsParameters>(roadPathParams); pipeline.RunGenerator <RoadBuilderSystem, RoadBuilderParameters>(roadBuilderParameters); if (generateRoadMesh) { pipeline.RunGenerator <AssembleMeshSystem, RoadMaterialParameters>(materialParams); } pipeline.RunGenerator <CreateRoadEdgePathsSystem>(); pipeline.RunGenerator <CameraPathSystem, CameraPathParameters>(cameraPathParameters); pipeline.RunGenerator <DebugDrawingSystem, DebugDrawingParameters>(debugDrawingParameters); #if HDRP_PRESENT manholeCoverPlacementParameters.parentObject = parentObject; manholeCoverPlacementParameters.baseRandomSeed = roadBuilderParameters.baseRandomSeed; pipeline.RunGenerator <ManholeCoverPlacementSystem, ManholeCoverPlacementParameters>(manholeCoverPlacementParameters); #endif parentObject.AddComponent <RoadConditionAssigner>(); Profiler.EndSample(); }
void ExecutePlacementAlgorithms(ContentPipeline pipeline, GameObject parentObject) { if (placeBuildings) { pipeline.RunGenerator <UniformPlacementSystem, PlacementSystemParameters>(new PlacementSystemParameters { spacing = buildingSpacing, category = buildingCategory, collisionLayerMask = buildingLayerMask.value, parent = parentObject.transform, offsetFromPath = buildingOffset }); } if (placeTrees) { pipeline.RunGenerator <UniformPlacementSystem, PlacementSystemParameters>(new PlacementSystemParameters { spacing = treeSpacing, category = treeCategory, collisionLayerMask = treeLayerMask.value, parent = parentObject.transform, offsetFromPath = treeOffset }); } if (placeStreetLights) { pipeline.RunGenerator <UniformPlacementSystem, PlacementSystemParameters>(new PlacementSystemParameters { spacing = streetLightSpacing, category = streetLightCategory, collisionLayerMask = streetLightLayerMask.value, parent = parentObject.transform, offsetFromPath = streetLightOffset }); } if (placeRoadSigns) { pipeline.RunGenerator <UniformPlacementSystem, PlacementSystemParameters>(new PlacementSystemParameters { spacing = roadSignSpacing, category = roadSignCategory, collisionLayerMask = signLayerMask.value, parent = parentObject.transform, offsetFromPath = roadSignOffset, rotationFromPath = quaternion.RotateY(math.PI) }); } if (placePoissonTrees) { pipeline.RunGenerator <PoissonDiscSamplingPlacementSystem, PoissonPlacementSystemParameters>( new PoissonPlacementSystemParameters { spacing = poissonTreeSpacing, category = treeCategory, collisionLayerMask = areaTreeLayerMask.value, parent = parentObject.transform, innerOffsetFromPath = innerPoissonPolygonOffset, outerOffsetFromPath = outerPoissonPolygonOffset }); } }