public ITransport MakeTransport() { switch (_options.TransportType) { case SinkTransportType.Udp: IDnsInfoProvider dns = new DnsWrapper(); IPAddress[] ipAddreses = Task.Run(() => dns.GetHostAddresses(_options.HostnameOrAddress)).Result; IPAddress ipAddress = ipAddreses.FirstOrDefault(c => c.AddressFamily == AddressFamily.InterNetwork); var ipEndpoint = new IPEndPoint(ipAddress ?? throw new InvalidOperationException(), _options.Port); var chunkSettings = new ChunkSettings(_options.MessageGeneratorType, _options.MaxMessageSizeInUdp); IDataToChunkConverter chunkConverter = new DataToChunkConverter(chunkSettings, new MessageIdGeneratorResolver()); var udpClient = new UdpTransportClient(ipEndpoint); var udpTransport = new UdpTransport(udpClient, chunkConverter); return(udpTransport); case SinkTransportType.Http: var httpClient = new HttpTransportClient($"{_options.HostnameOrAddress}:{_options.Port}/gelf"); var httpTransport = new HttpTransport(httpClient); return(httpTransport); default: throw new ArgumentOutOfRangeException(nameof(_options), _options.TransportType, null); } }
public Chunk(int _x, int _z, ChunkSettings _settings) { Position = new Vector2i(); Position.X = _x; Position.Z = _z; settings = _settings; }
//public ChunkLayer lodLayers; public World(ChunkSettings chunkSettings, Vector3Int voxelSLs) { this.chunkSettings = chunkSettings; this.voxelSLs = voxelSLs; AllocateMainLayer(); //GenerateMainLayer(); }
public async Task <ChunkHandler> CreateChunkHandlerAsync(long battleId, ChunkSettings chunkSettings, ChunkKey chunkKey, IChunklerClient chunklerClient) { var handler = new ChunkHandler(battleId, chunkSettings, chunkKey, chunklerClient); await handler.SubscribeToChunkAsync(); return(handler); }
public object Load(IResource resource) { var definition = (ChunkSettingsDefinition)serializer.Deserialize(resource); var settings = new ChunkSettings { ChunkSize = definition.ChunkSize, VertexBuildConcurrencyLevel = definition.VertexBuildConcurrencyLevel, UpdateBufferCountPerFrame = definition.UpdateBufferCountPerFrame, MinActiveVolume = definition.MinActiveRange, MaxActiveVolume = definition.MaxActiveRange, ChunkStoreType = definition.ChunkStoreType }; settings.PartitionManager.ClusterSize = definition.ClusterSize; settings.PartitionManager.ActivationCapacity = definition.ActivationCapacity; settings.PartitionManager.PassivationCapacity = definition.PassivationCapacity; settings.PartitionManager.PassivationSearchCapacity = definition.PassivationSearchCapacity; settings.PartitionManager.PriorActiveDistance = definition.PriorActiveDistance; settings.PartitionManager.PartitionSize = definition.ChunkSize.ToVector3(); settings.PartitionManager.MinActiveVolume = new DefaultActiveVolume(settings.MinActiveVolume); settings.PartitionManager.MaxActiveVolume = new DefaultActiveVolume(settings.MaxActiveVolume); return(settings); }
public static void GetChunkAndVoxelIndex(Vector3Int index, ChunkSettings chunkSettings, out Vector3Int chunkIndex3D, out Vector3Int voxelIndex3D) { Vector3Int quotinent = index.Divide(chunkSettings.ChunkSL); // deltaFromStart / chunkWorldLen; // get chunk index Vector3Int remainder = index - quotinent * chunkSettings.ChunkSL; // get voxel index chunkIndex3D = new Vector3Int((int)quotinent.x, (int)quotinent.y, (int)quotinent.z); voxelIndex3D = new Vector3Int((int)remainder.x, (int)remainder.y, (int)remainder.z); }
virtual public void updateFromParent(INoiseGenerator ng, ChunkSettings cs, Vector3 pos) { chunk_set = cs; transform.position = pos; noise_gen = ng; updateMesh(); }
void Start() { chunkSettings = new ChunkSettings(16, 1); renderedChunks = new List <GameObject>(); world = new World <Voxel>(chunkSettings, new Vector3Int(256, 64, 256)); chunkMesherVoxel = new VoxelChunkMesher(world.chunkSettings); RenderTest(); }
public Chunk(ChunkSettings chunkSettings, Transform parent, Vector3 pos) { this.chunkSettings = chunkSettings; GameObject = new GameObject("Chunk"); GameObject.transform.SetParent(parent); GameObject.transform.position = pos; CreateTrees(); }
public DataToChunkConverterFixture() { _settings = new ChunkSettings { MessageIdGeneratorType = MessageIdGeneratortype.Md5 }; _fixture = new Fixture(); _resolver = new Mock <IMessageIdGeneratorResolver>(); }
public TechWorld(ItemsContainer itemsContainer, ChunkSettings chunkSettings, Vector3Int worldSLs) { items = itemsContainer.items; recipes = itemsContainer.recipes; this.chunkSettings = chunkSettings; world = new World <Block>(chunkSettings, worldSLs); worldSimulator = new TechWorldSimulator(chunkSettings); }
public ChunkHandler(long battleId, ChunkSettings chunkSettings, ChunkKey chunkKey, IChunklerClient chunklerClient) { _chunkKey = chunkKey; _chunkSettings = chunkSettings ?? throw new ArgumentNullException(nameof(chunkSettings)); _chunklerClient = chunklerClient ?? throw new ArgumentNullException(nameof(chunklerClient)); _subscriptions = new ConcurrentDictionary <IChunkHandlerSubscription, Func <ChunkKey, ChunkUpdate, Task> >(); _lastUpdatedTicksUTC = DateTime.MinValue.Ticks; _subscriptionCounter = 0; _battleId = battleId; }
public VoxelChunkMesher(ChunkSettings chunkSettings) { int sideLen = chunkSettings.ChunkSL; sl = sideLen + 1; slSqr = sl * sl; renderBuffer = new float[(int)Mathf.Pow(sideLen + 1, 3)]; this.chunkSettings = chunkSettings; }
private void Start() { settings = new ChunkSettings(LevelManager.Instance.ChunkSize, LevelManager.Instance.ChunkHeight, LevelManager.Instance.Scale , LevelManager.Instance.Layers, LevelManager.Instance.RateOfAmplitude, LevelManager.Instance.RateOfFrequency); loadedChunks = new Dictionary <Vector2i, Chunk>(); renderDistance = GetComponent <GameManager>().RenderDistance; prevPos = new Vector2i(100000000, 100000000); }
public void Start() { chunkSettings = new ChunkSettings(16, 1); world = new TechWorld(itemsContainer, chunkSettings, new Vector3Int(64, 16, 64)); chunkSettings = world.chunkSettings; chunkMesher = new TechWorldMesher(chunkSettings, itemsContainer.models.Length); worldRenderer = new TechWorldRenderer(itemsContainer); print("Ready"); }
virtual public void createdByParent(INoiseGenerator ng, ChunkSettings cs, Vector3 pos) { Debug.Log("created by parent"); //noise_set = ns; chunk_set = cs; has_parent = true; noise_gen = ng; init(); updateMesh(); transform.position = pos; }
public ChunkLayer(Vector3Int chunkLayerSLs, float chunkWorldLength, ChunkSettings chunkSettings) { this.chunkSettings = chunkSettings; this.chunkWorldLength = chunkWorldLength; this.chunkLayerSLs = chunkLayerSLs; chunks = new Chunk <T> [chunkLayerSLs.x * chunkLayerSLs.y * chunkLayerSLs.z]; InitializeChunks(); yJump = chunkLayerSLs.x; zJump = chunkLayerSLs.x * chunkLayerSLs.y; voxelSize = (int)(chunkWorldLength / chunkSettings.ChunkWorldLen) * chunkSettings.VoxelSize; // hmm }
public ITransport MakeTransport() { switch (_options.TransportType) { case SinkTransportType.Udp: { var ipAddress = Task.Run(() => GetIpAddress(_options.HostnameOrAddress)).GetAwaiter().GetResult(); var ipEndpoint = new IPEndPoint(ipAddress ?? throw new InvalidOperationException(), _options.Port.GetValueOrDefault(12201)); var chunkSettings = new ChunkSettings(_options.MessageGeneratorType, _options.MaxMessageSizeInUdp); IDataToChunkConverter chunkConverter = new DataToChunkConverter(chunkSettings, new MessageIdGeneratorResolver()); var udpClient = new UdpTransportClient(ipEndpoint); var udpTransport = new UdpTransport(udpClient, chunkConverter); return(udpTransport); } case SinkTransportType.Http: { var builder = new UriBuilder(_options.HostnameOrAddress) { Port = _options.Port.GetValueOrDefault(12201), Path = "gelf" }; var httpClient = new HttpTransportClient(builder.Uri.ToString()); var httpTransport = new HttpTransport(httpClient); return(httpTransport); } case SinkTransportType.Tcp: { var ipAddress = Task.Run(() => GetIpAddress(_options.HostnameOrAddress)).GetAwaiter().GetResult(); var tcpClient = new TcpTransportClient(ipAddress, _options.Port.GetValueOrDefault(12201), _options.UseSsl ? _options.HostnameOrAddress : null); var transport = new TcpTransport(tcpClient); return(transport); } default: throw new ArgumentOutOfRangeException(nameof(_options), _options.TransportType, null); } }
public ITransport MakeTransport() { switch (_options.TransportType) { case SinkTransportType.Udp: { var ipAddress = Task.Run(() => GetIpAddress(_options.HostnameOrAddress)).GetAwaiter().GetResult(); var ipEndpoint = new IPEndPoint(ipAddress ?? throw new InvalidOperationException(), _options.Port); var chunkSettings = new ChunkSettings(_options.MessageGeneratorType, _options.MaxMessageSizeInUdp); IDataToChunkConverter chunkConverter = new DataToChunkConverter(chunkSettings, new MessageIdGeneratorResolver()); var udpClient = new UdpTransportClient(ipEndpoint); var udpTransport = new UdpTransport(udpClient, chunkConverter); return(udpTransport); } case SinkTransportType.Http: { var httpClient = new HttpTransportClient($"{_options.HostnameOrAddress}:{_options.Port}/gelf"); var httpTransport = new HttpTransport(httpClient); return(httpTransport); } case SinkTransportType.Tcp: { var ipAddress = Task.Run(() => GetIpAddress(_options.HostnameOrAddress)).GetAwaiter().GetResult(); var tcpClient = new TcpTransportClient(ipAddress, _options.Port); Task.Run(() => tcpClient.Connect()).GetAwaiter().GetResult(); var transport = new TcpTransport(tcpClient); return(transport); } default: throw new ArgumentOutOfRangeException(nameof(_options), _options.TransportType, null); } }
public ChunkSurfaceExtractor(World <Voxel> world) { this.world = world; this.chunkSettings = world.chunkSettings; }
public ChunkDownsampler(ChunkSettings chunkSettings) { this.chunkSettings = chunkSettings; }
public Chunk(Vector2i _pos, ChunkSettings _settings) { Position = _pos; settings = _settings; }
public TechWorldMesher(ChunkSettings chunkSettings, int modelTypeCount) { this.modelTypeCount = modelTypeCount; this.chunkSL = chunkSettings.ChunkSL; this.chunkSettings = chunkSettings; }
public Chunk(ChunkSettings chunkSettings) { voxels = new T[(int)Mathf.Pow(chunkSettings.ChunkSL, 3)]; this.chunkSettings = chunkSettings; }
public ChunkGenerator(ChunkSettings chunkSettings) { this.chunkSettings = chunkSettings; }