public ServerSimple() { one = 1; clients = new ClientSimple[256]; clientsCount = 0; blockTypes = new Packet_BlockType[GlobalVar.MAX_BLOCKTYPES]; blockTypesCount = 0; mods = new ModSimple[128]; ModManagerSimple1 m = new ModManagerSimple1(); m.Start(this); mods[modsCount++] = new ModSimpleDefault(); mods[modsCount++] = new ModSimpleWorldGenerator(); for (int i = 0; i < modsCount; i++) { mods[i].Start(m); } MapSizeX = 8192; MapSizeY = 8192; MapSizeZ = 128; chunks = new ChunkSimple[(MapSizeX / ChunkSize) * (MapSizeY / ChunkSize)][]; chunkdrawdistance = 4; actions = new QueueAction(); mainThreadActions = new QueueAction(); spawnGlX = MapSizeX / 2; spawnGlY = MapSizeZ; for (int i = 0; i < modsCount; i++) { int spawnHeight = mods[i].GetHeight(); if (spawnHeight != -1) { spawnGlY = spawnHeight; } } spawnGlZ = MapSizeY / 2; }
private SDFNode GenerateNode() { //Shapes var sphere = _cachedNode as Sphere; var box = _cachedNode as Box; //Binaries var intersection = _cachedNode as Intersection; var union = _cachedNode as Union; var smoothUnion = _cachedNode as UnionSmooth; //Unaries var inverse = _cachedNode as Inverse; var offset = _cachedNode as Offset; //Domains var modSimple = _cachedNode as ModSimple; switch (Type) { //Shapes case NodeType.Sphere: if (sphere == null) { _cachedNode = sphere = new Sphere(); } sphere.Center = transform.position; sphere.Radius = transform.lossyScale.x * 0.5f; break; case NodeType.Box: if (box == null) { _cachedNode = box = new Box(); } box.ToLocalSpace = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one).inverse; box.Extents = transform.lossyScale * 0.5f; break; //Binaries case NodeType.Intersection: if (intersection == null) { _cachedNode = intersection = new Intersection(); } break; case NodeType.Union: if (union == null) { _cachedNode = union = new Union(); } break; case NodeType.SmoothUnion: if (smoothUnion == null) { _cachedNode = smoothUnion = new UnionSmooth(); } smoothUnion.K = K; break; //Unaries case NodeType.Inverse: if (inverse == null) { _cachedNode = inverse = new Inverse(); } break; case NodeType.Offset: if (offset == null) { _cachedNode = offset = new Offset(); } offset.Value = Offset; break; //Domains case NodeType.ModSimple: if (modSimple == null) { _cachedNode = modSimple = new ModSimple(); } modSimple.CellSize = CellSize; modSimple.ModX = X; modSimple.ModY = Y; modSimple.ModZ = Z; break; } return(_cachedNode); }