private void Init(long seed) { float radius = (float)this.m_data.Radius; float num3 = radius + (radius * this.Generator.HillParams.Max); this.StorageSize = MyVoxelCoordSystems.FindBestOctreeSize(2f * num3); float num4 = this.StorageSize.X * 0.5f; MyPlanetTextureMapProvider texProvider = new MyPlanetTextureMapProvider(); texProvider.Init(seed, this.Generator, this.Generator.MapProvider); this.Shape = new MyPlanetShapeProvider(new Vector3(num4), radius, this.Generator, texProvider.GetHeightmap(), texProvider); this.Material = new MyPlanetMaterialProvider(this.Generator, this.Shape, texProvider.GetMaps(this.Generator.PlanetMaps.ToSet())); }
public MyPlanetShapeProvider(Vector3 translation, float radius, MyPlanetGeneratorDefinition definition, MyHeightCubemap cubemap, MyPlanetTextureMapProvider texProvider) { this.m_radius = radius; this.m_translation = translation; this.m_maxHillHeight = definition.HillParams.Max * this.m_radius; this.m_minHillHeight = definition.HillParams.Min * this.m_radius; this.InnerRadius = radius + this.m_minHillHeight; this.OuterRadius = radius + this.m_maxHillHeight; this.m_heightmap = cubemap; this.m_mapResolutionMinusOne = this.m_heightmap.Resolution - 1; this.m_heightRatio = this.m_maxHillHeight - this.m_minHillHeight; this.m_heightRatioRecip = 1f / this.m_heightRatio; float faceSize = (float)((radius * 3.1415926535897931) * 0.5); this.m_pixelSize = faceSize / ((float)this.m_heightmap.Resolution); this.m_pixelSizeRecip = 1f / this.m_pixelSize; this.m_pixelSizeRecip2 = 0.5f / this.m_pixelSize; double num2 = (Math.Sin(Math.Acos((double)((radius - 1f) / radius))) * 2.0) * radius; this.m_curvatureThresholdRecip = 1.0 / num2; this.m_pixelSize4 = this.m_pixelSize * 4f; this.m_voxelSize = (float)(2.0 / (radius * 3.1415926535897931)); this.m_mapStepScale = this.m_pixelSize / this.m_heightRatio; this.m_mapStepScaleSquare = this.m_mapStepScale * this.m_mapStepScale; if (definition.Detail != null) { this.m_detail.Init(texProvider, definition.Detail, faceSize); } VrPlanetShape.Mapset maps = this.m_heightmap.GetMapset(); VrPlanetShape.DetailMapData detailMapData = new VrPlanetShape.DetailMapData(); if (definition.Detail != null) { detailMapData = this.m_detail.GetDetailMapData(); } this.m_nativeShape = new VrPlanetShape(translation, radius, definition.HillParams.Min, definition.HillParams.Max, maps, detailMapData, true); this.Closed = false; }