Ejemplo n.º 1
0
 public ZoomLevelViewer(ChunkedSpace space, Transform observer, float ratio = 1f)
 {
     this.space         = space;
     this.observer      = observer;
     this.ratio         = ratio;
     this.updateDistace = space.GetChunkScale() / 10f;
 }
Ejemplo n.º 2
0
 public TerrainRenderer(Transform parent, ChunkedSpace space, Viewer viewer, TerrainGenerator transform, Material material)
 {
     this.viewer        = viewer;
     this.meshGenerator = new MeshGenerator(space, transform);
     this.material      = material;
     objectCache        = new TerrainObjectCache(parent);
 }
    public FixedViewer(ChunkedSpace space, Vector3 origin, float distace, MeshLod?visibleLod = null)
    {
        Point originPoint = space.GetPointFromPosition(origin);

        Chunk[] chunks = space.GetChunksWithin(originPoint, distace);
        view = chunks
               .Select(chunk => new ViewChunk(chunk, visibleLod ?? new MeshLod(0)))
               .ToArray();
    }
 public FalloffViewer(
     ChunkedSpace space,
     Transform observer,
     SortedList <MeshLod, float> visibilityLodPlanes = null,
     SortedList <MeshLod, float> collisionLodPlanes  = null
     )
 {
     this.space               = space;
     this.observer            = observer;
     this.visibilityLodPlanes = visibilityLodPlanes ?? GetDefaultVisibilityLodPlanes();
     this.collisionLodPlanes  = collisionLodPlanes ?? GetDefaultCollisionLodPlanes();
     this.updateDistace       = space.GetChunkScale() / 10f;
 }
 public CutoffViewer(
     ChunkedSpace space,
     Transform observer,
     float clipDistace,
     MeshLod?visibleLod  = null,
     MeshLod?tangibleLod = null
     )
 {
     this.space         = space;
     this.observer      = observer;
     this.clipDistace   = clipDistace;
     this.visibleLod    = visibleLod ?? new MeshLod(0);
     this.tangibleLod   = tangibleLod;
     this.updateDistace = space.GetChunkScale() / 10f;
 }
Ejemplo n.º 6
0
    void Awake()
    {
        space = new SphericalSpace(150f, 4);
        //space = new PlanarSpace();

        terrain = new Gain(new RidgeNoise() / 2f, 0.3f) * 50f;
        //terrain = new Constant(10);

        //Viewer viewer = new CutoffViewer(space, observer, 4f, new MeshLod(4));
        //SortedList<MeshLod, float> defaultLodPlanes = new SortedList<MeshLod, float>();
        //defaultLodPlanes.Add(new MeshLod(0), Mathf.PI / 12);
        //defaultLodPlanes.Add(new MeshLod(2), Mathf.PI / 6);
        //defaultLodPlanes.Add(new MeshLod(4), Mathf.PI / 2);
        //defaultLodPlanes.Add(new MeshLod(6), Mathf.PI);
        //Viewer viewer = new FalloffViewer(space, observer, defaultLodPlanes);
        ZoomLevelViewer zoomViewer = new ZoomLevelViewer(space, observer);

        terrainRenderer = new TerrainRenderer(transform, space, zoomViewer, terrain, material);
        //terrainRenderer2 = new TerrainRenderer(transform, viewer, meshGenerator2, material);
        terrainRenderer.OnRenderFinished += HandleRenderComplete;
        //terrainRenderer2 = new TerrainRenderer(transform, viewer, meshGenerator2, material);
    }
 public MeshDataGenerator(ChunkedSpace space, TerrainGenerator terrainTransform)
 {
     this.space            = space;
     this.terrainTransform = terrainTransform;
 }