├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ ├── assets │ │ └── stellarium │ │ │ ├── deepsky │ │ │ └── messier │ │ │ │ ├── messier.json │ │ │ │ ├── m15.png │ │ │ │ ├── m31.png │ │ │ │ ├── m33.png │ │ │ │ ├── m51.png │ │ │ │ ├── m63.png │ │ │ │ ├── m101-vasey.png │ │ │ │ ├── m42dumont.png │ │ │ │ ├── crab_nebula.png │ │ │ │ ├── m24.json │ │ │ │ ├── ring_nebula.png │ │ │ │ ├── trifid_nebula.png │ │ │ │ ├── m7.json │ │ │ │ ├── m42.json │ │ │ │ ├── m20.json │ │ │ │ ├── m33.json │ │ │ │ ├── m57.json │ │ │ │ ├── m51.json │ │ │ │ ├── m15.json │ │ │ │ ├── m1.json │ │ │ │ ├── m31.json │ │ │ │ ├── m101.json │ │ │ │ └── m63.json │ │ │ ├── stellar │ │ │ ├── sun.png │ │ │ ├── halo.png │ │ │ ├── lune.png │ │ │ ├── star.png │ │ │ ├── haloLune.png │ │ │ └── milkyway.png │ │ │ ├── textures │ │ │ ├── gui │ │ │ │ ├── fix.png │ │ │ │ ├── alpha.png │ │ │ │ ├── ampm.png │ │ │ │ ├── hhmm.png │ │ │ │ ├── lock.png │ │ │ │ ├── round.png │ │ │ │ ├── tick.png │ │ │ │ ├── clicked.png │ │ │ │ ├── display.png │ │ │ │ ├── ecliptic.png │ │ │ │ ├── equator.png │ │ │ │ ├── horizon.png │ │ │ │ ├── milkyway.png │ │ │ │ ├── moonfrag.png │ │ │ │ ├── optics.png │ │ │ │ ├── parallel.png │ │ │ │ ├── scroll.png │ │ │ │ ├── unlock.png │ │ │ │ ├── atmosphere.png │ │ │ │ ├── background.png │ │ │ │ ├── equatorial.png │ │ │ │ ├── fragments.png │ │ │ │ ├── horizontal.png │ │ │ │ ├── landscape.png │ │ │ │ ├── rollround.png │ │ │ │ ├── rollscroll.png │ │ │ │ ├── scrollbtn.png │ │ │ │ ├── turbulance.png │ │ │ │ ├── eclipticgrid.png │ │ │ │ ├── eclipticline.png │ │ │ │ ├── fillfragments.png │ │ │ │ ├── milkywayfrag.png │ │ │ │ ├── rollparallel.png │ │ │ │ ├── scrollregion.png │ │ │ │ ├── solarsystem.png │ │ │ │ ├── equatorialgrid.png │ │ │ │ ├── horizontalgrid.png │ │ │ │ ├── milkywaybrightness.png │ │ │ │ └── atmospherecachelevel.png │ │ │ └── overlay │ │ │ │ └── landscape.png │ │ │ └── shaders │ │ │ ├── postprocess │ │ │ ├── scope.vsh │ │ │ ├── hdr_to_ldr.vsh │ │ │ ├── linear_to_srgb.vsh │ │ │ ├── sky_to_queried.vsh │ │ │ ├── hdr_to_ldr.psh │ │ │ ├── sky_to_queried.psh │ │ │ ├── linear_to_srgb.psh │ │ │ └── scope.psh │ │ │ ├── atmosphere │ │ │ ├── atmosphere_extinction.psh │ │ │ ├── atmosphere_refraction.psh │ │ │ ├── atmosphere_refraction.vsh │ │ │ └── atmosphere_single.psh │ │ │ ├── point.vsh │ │ │ ├── textured.vsh │ │ │ ├── point.psh │ │ │ └── textured.psh │ └── mcmod.info │ └── java │ └── stellarium │ ├── display │ ├── PerDisplaySettings.java │ ├── IDisplayRenderer.java │ ├── IDisplayCache.java │ ├── IDisplayInjectable.java │ ├── DisplayRenderer.java │ ├── IDisplayElementType.java │ ├── DisplayOverallSettings.java │ ├── DisplayCacheInfo.java │ ├── ecgrid │ │ └── EcGridType.java │ ├── eqgrid │ │ └── EqGridType.java │ ├── horgrid │ │ ├── HorGridType.java │ │ └── HorGridCache.java │ ├── DisplayRenderInfo.java │ ├── DisplayRegistry.java │ └── DisplayModel.java │ ├── world │ ├── IStellarSkySet.java │ ├── provider │ │ └── EndReplacer.java │ ├── RefractiveSkySet.java │ ├── StellarPack.java │ ├── landscape │ │ ├── LandscapeModel.java │ │ ├── LandscapeClientSettings.java │ │ └── LandscapeRenderer.java │ └── NonRefractiveSkySet.java │ ├── render │ ├── stellars │ │ ├── access │ │ │ ├── ICheckedAtmModel.java │ │ │ ├── IDominateRenderer.java │ │ │ └── EnumStellarPass.java │ │ ├── atmosphere │ │ │ └── EnumAtmospherePass.java │ │ ├── layer │ │ │ ├── LayerSettings.java │ │ │ ├── ObjectSettings.java │ │ │ ├── IObjRenderCache.java │ │ │ ├── StellarLayerRenderer.java │ │ │ └── StellarLayerModel.java │ │ ├── phased │ │ │ ├── StellarPhasedRenderer.java │ │ │ └── StellarRenderModel.java │ │ ├── UtilShaders.java │ │ ├── QualitySettings.java │ │ ├── StellarRI.java │ │ └── StellarModel.java │ ├── util │ │ ├── IVertexBuffer.java │ │ ├── EnumIndexType.java │ │ ├── VertexReferences.java │ │ ├── FloatVertexFormats.java │ │ └── VertexDirect.java │ ├── shader │ │ ├── IShaderObject.java │ │ └── IUniformField.java │ ├── adapt │ │ ├── SkyRenderTypeEnd.java │ │ └── SkySetTypeEnd.java │ ├── SkyRI.java │ ├── GenericSkyRenderer.java │ ├── SkyRenderer.java │ └── SkyModel.java │ ├── stellars │ ├── system │ │ ├── Earth.java │ │ ├── LayerSolarSystemRenderer.java │ │ ├── PlanetRenderer.java │ │ ├── SolarSystemClientSettings.java │ │ ├── SolarSystemSettings.java │ │ ├── PlanetRenderCache.java │ │ ├── Sun.java │ │ └── SunRenderCache.java │ ├── milkyway │ │ ├── Milkyway.java │ │ ├── MilkywayLayerRenderer.java │ │ ├── LayerMilkyway.java │ │ ├── MilkywayRenderCache.java │ │ ├── MilkywaySettings.java │ │ └── MilkywayRenderer.java │ ├── layer │ │ ├── IRenderCache.java │ │ ├── StellarObject.java │ │ └── StellarLayer.java │ ├── render │ │ ├── ICelestialObjectRenderer.java │ │ └── ICelestialLayerRenderer.java │ ├── deepsky │ │ ├── DeepSkyRenderer.java │ │ ├── DSObjectRenderer.java │ │ ├── PositionUtil.java │ │ ├── DeepSkyTexture.java │ │ └── DeepSkyObject.java │ ├── star │ │ ├── LayerStarRenderer.java │ │ ├── StarRenderer.java │ │ ├── LayerBgStar.java │ │ ├── StarRenderCache.java │ │ └── BgStar.java │ └── util │ │ ├── ExtinctionRefraction.java │ │ └── StarColor.java │ ├── api │ ├── ISkySetType.java │ ├── SkySetTypeDefault.java │ ├── SkyRenderTypeSurface.java │ └── ISkyRenderType.java │ ├── client │ ├── overlay │ │ ├── clientcfg │ │ │ ├── category │ │ │ │ └── ICategoryController.java │ │ │ ├── ICfgTooltipHandler.java │ │ │ ├── property │ │ │ │ └── IPropertyElementType.java │ │ │ ├── CfgConstants.java │ │ │ ├── ICfgHierarchyHandler.java │ │ │ ├── model │ │ │ │ ├── ModelMain.java │ │ │ │ ├── ModelClick.java │ │ │ │ ├── ModelCfgScrollButton.java │ │ │ │ ├── ModelCfgScrollRegion.java │ │ │ │ ├── ModelLockButton.java │ │ │ │ ├── ModelCfgFixButton.java │ │ │ │ ├── ModelBackground.java │ │ │ │ └── ModelRowBackground.java │ │ │ ├── OverlayClientSettingsType.java │ │ │ ├── SettingsOverlaySettings.java │ │ │ └── ConfigElementSimple.java │ │ ├── StellarSkyOverlays.java │ │ └── clock │ │ │ ├── EnumViewMode.java │ │ │ ├── OverlayClockType.java │ │ │ └── model │ │ │ ├── ModelScrollRegion.java │ │ │ ├── ModelScrollButton.java │ │ │ ├── ModelHourFormat.java │ │ │ ├── ModelFixButton.java │ │ │ ├── ModelTextShadowButton.java │ │ │ └── ModelViewMode.java │ ├── StellarClientFMLHook.java │ ├── config │ │ ├── StellarConfigGuiFactory.java │ │ └── StellarConfigScreen.java │ ├── EnumLockBtnPosition.java │ ├── lib │ │ └── gui │ │ │ ├── IRollHelper.java │ │ │ └── IHierarchyElement.java │ └── ClientSettings.java │ ├── StellarSkyReferences.java │ ├── sync │ ├── StellarNetworkManager.java │ └── MessageLockSync.java │ ├── util │ ├── math │ │ ├── Allocator.java │ │ └── CachedGaussianRandom.java │ ├── MCUtil.java │ └── RenderUtil.java │ ├── common │ └── DimensionSettings.java │ ├── command │ └── CommandLock.java │ ├── StellarForgeEventHook.java │ ├── IProxy.java │ └── StellarTickHandler.java ├── README.md ├── .gitattributes ├── plan └── rendering_scheme.json └── gradlew.bat /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/messier.json: -------------------------------------------------------------------------------- 1 | [ 2 | "m1", "m7", "m15", "m20", "m24", "m31", "m33", "m42", "m51", "m57", "m63", "m101" 3 | ] -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/stellar/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/stellar/sun.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/stellar/halo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/stellar/halo.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/stellar/lune.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/stellar/lune.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/stellar/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/stellar/star.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/stellar/haloLune.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/stellar/haloLune.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/stellar/milkyway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/stellar/milkyway.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/fix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/fix.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/alpha.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/ampm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/ampm.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/hhmm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/hhmm.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/lock.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/round.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/tick.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/m15.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/m31.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/m33.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/m51.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m63.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/m63.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/clicked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/clicked.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/display.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/ecliptic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/ecliptic.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/equator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/equator.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/horizon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/horizon.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/milkyway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/milkyway.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/moonfrag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/moonfrag.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/optics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/optics.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/parallel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/parallel.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/scroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/scroll.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/unlock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/unlock.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/atmosphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/atmosphere.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/background.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/equatorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/equatorial.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/fragments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/fragments.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/horizontal.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/landscape.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/rollround.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/rollround.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/rollscroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/rollscroll.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/scrollbtn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/scrollbtn.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/turbulance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/turbulance.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m101-vasey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/m101-vasey.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m42dumont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/m42dumont.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/eclipticgrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/eclipticgrid.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/eclipticline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/eclipticline.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/fillfragments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/fillfragments.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/milkywayfrag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/milkywayfrag.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/rollparallel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/rollparallel.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/scrollregion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/scrollregion.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/solarsystem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/solarsystem.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/overlay/landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/overlay/landscape.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/crab_nebula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/crab_nebula.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m24.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Messier 24", 3 | "position" : ["18h17m", "-18d29m"], 4 | "magnitude" : "4.6V", 5 | "size" : ["90m", "90m"], 6 | "Type" : "Cluster" 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/ring_nebula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/ring_nebula.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/postprocess/scope.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | void main() { 4 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 5 | gl_TexCoord[0] = gl_MultiTexCoord0; 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/equatorialgrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/equatorialgrid.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/horizontalgrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/horizontalgrid.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/trifid_nebula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/deepsky/messier/trifid_nebula.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/atmosphere/atmosphere_extinction.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | varying vec4 alpha4; 4 | 5 | void main() 6 | { 7 | gl_FragColor = alpha4; 8 | gl_FragColor.a = 1.0; 9 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/postprocess/hdr_to_ldr.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | void main() { 4 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 5 | gl_TexCoord[0] = gl_MultiTexCoord0; 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/milkywaybrightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/milkywaybrightness.png -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m7.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Messier 7", 3 | "position" : ["17h53m51.2s", "-34d47m34s"], 4 | "magnitude" : "3.3V", 5 | "size" : ["80m", "80m"], 6 | "Type" : "Cluster" 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/postprocess/linear_to_srgb.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | void main() { 4 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 5 | gl_TexCoord[0] = gl_MultiTexCoord0; 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/postprocess/sky_to_queried.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | void main() { 4 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 5 | gl_TexCoord[0] = gl_MultiTexCoord0; 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/textures/gui/atmospherecachelevel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftModDevelopmentMods/StellarSky/HEAD/src/main/resources/assets/stellarium/textures/gui/atmospherecachelevel.png -------------------------------------------------------------------------------- /src/main/java/stellarium/display/PerDisplaySettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import stellarapi.api.lib.config.SimpleConfigHandler; 4 | 5 | public class PerDisplaySettings extends SimpleConfigHandler { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/IDisplayRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | public interface IDisplayRenderer { 4 | 5 | public void render(DisplayRenderInfo info, Cache cache); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/stellarium/world/IStellarSkySet.java: -------------------------------------------------------------------------------- 1 | package stellarium.world; 2 | 3 | import stellarapi.api.view.IAtmosphereEffect; 4 | 5 | public interface IStellarSkySet extends IAtmosphereEffect { 6 | public boolean hideObjectsUnderHorizon(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/access/ICheckedAtmModel.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.access; 2 | 3 | import stellarapi.api.lib.math.SpCoord; 4 | 5 | public interface ICheckedAtmModel { 6 | public boolean isRendered(SpCoord pos); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/point.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | varying vec4 color; 4 | 5 | void main() { 6 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 7 | color = gl_Color; 8 | 9 | gl_TexCoord[0] = gl_MultiTexCoord0; 10 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/textured.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | varying vec4 color; 4 | 5 | void main() { 6 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 7 | color = gl_Color; 8 | 9 | gl_TexCoord[0] = gl_MultiTexCoord0; 10 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/point.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | varying vec4 color; 4 | 5 | void main() 6 | { 7 | float u = gl_TexCoord[0].x; 8 | float v = gl_TexCoord[0].y; 9 | gl_FragColor = color * 4 * min(u, 1-u) * min(v, 1-v); 10 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/Earth.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | public class Earth extends Planet { 4 | 5 | public Earth(String name, SolarObject parent, double yearUnit) { 6 | super(name, parent, yearUnit); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/textured.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D texture; 4 | 5 | varying vec4 color; 6 | 7 | void main() 8 | { 9 | vec4 fragColor = color * texture2D(texture, gl_TexCoord[0].st); 10 | gl_FragColor = fragColor; 11 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Aug 06 18:24:48 PDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip 7 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/access/IDominateRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.access; 2 | 3 | import stellarapi.api.lib.math.Vector3; 4 | 5 | public interface IDominateRenderer { 6 | public void renderDominate(Vector3 lightDir, float red, float green, float blue); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/atmosphere/EnumAtmospherePass.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.atmosphere; 2 | 3 | public enum EnumAtmospherePass { 4 | /* 5 | * Prepare/Finalize Atmospheric Rendering 6 | * */ 7 | Prepare, 8 | Finalize, 9 | 10 | /* 11 | * Setup Rendering 12 | * */ 13 | SetupDominateScatter; 14 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/display/IDisplayCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import stellarium.client.ClientSettings; 4 | 5 | public interface IDisplayCache { 6 | 7 | public void initialize(ClientSettings settings, Settings specificSettings); 8 | 9 | public void updateCache(DisplayCacheInfo info); 10 | 11 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/render/util/IVertexBuffer.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.util; 2 | 3 | import java.nio.ByteBuffer; 4 | 5 | import net.minecraft.client.renderer.BufferBuilder; 6 | 7 | public interface IVertexBuffer { 8 | public void upload(BufferBuilder builder); 9 | 10 | public void drawArrays(); 11 | public void drawElements(EnumIndexType type, ByteBuffer indices); 12 | } 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # StellarSky 2 | Stellar Sky, Real Constellations in Minecraft! 3 | 4 | Stellar Sky is open source mod, and the code is on this github. 5 | 6 | ##API 7 | Currently stellar sky provides an api for more compatibility. 8 | 9 | So when you are mod developer who want to make your mod compatible with mine, 10 | 11 | Just copy the api code(stellarium.api package) into your mod, and use it however you want. 12 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/shader/IShaderObject.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.shader; 2 | 3 | public interface IShaderObject { 4 | 5 | public void bindShader(); 6 | public void releaseShader(); 7 | 8 | /** 9 | * Gets uniform field for certain name in this shader object. 10 | * @param fieldName the name of the uniform field 11 | * */ 12 | public IUniformField getField(String fieldName); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/util/EnumIndexType.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.util; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | public enum EnumIndexType { 6 | BYTE(GL11.GL_UNSIGNED_BYTE, 1), 7 | SHORT(GL11.GL_UNSIGNED_SHORT, 2), 8 | INT(GL11.GL_UNSIGNED_INT, 4); 9 | 10 | public final int type; 11 | public final int size; 12 | 13 | EnumIndexType(int type, int size) { 14 | this.type = type; 15 | this.size = size; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/util/VertexReferences.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.util; 2 | 3 | public class VertexReferences { 4 | private static final BufferBuilderEx BUILDER = new BufferBuilderEx(2097152); 5 | private static final VertexDirect RENDERER = new VertexDirect(); 6 | 7 | public static BufferBuilderEx getBuilder() { 8 | return BUILDER; 9 | } 10 | 11 | public static VertexDirect getRenderer() { 12 | return RENDERER; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m42.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Orion Nebula", 3 | "position" : ["05h35m17.3s", "-05d23m28s"], 4 | "magnitude" : "4.0V", 5 | "size" : ["85m", "60m"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/m42dumont.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["1.4d", "1.4d"], 11 | "brightness" : 0.179, 12 | "attribution" : "Stephane Dumont" 13 | }, 14 | "Type" : "Nebula" 15 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/display/IDisplayInjectable.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import stellarapi.api.lib.config.SimpleHierarchicalConfig; 4 | import stellarium.client.ClientSettings; 5 | 6 | public interface IDisplayInjectable { 7 | public > void injectDisplay( 8 | IDisplayElementType type, Cfg settings); 9 | 10 | public SimpleHierarchicalConfig getSubSettings(ClientSettings settings); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m20.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Trifid Nebula", 3 | "position" : ["18h02m23s", "-23d01m48s"], 4 | "magnitude" : "6.3V", 5 | "size" : ["28m", "28m"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/trifid_nebula.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["70m", "70m"], 11 | "brightness" : 0.195, 12 | "attribution" : "CCL BY-SA 3.0, by Hewholooks" 13 | }, 14 | "type" : "Nebula" 15 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m33.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Triangulum Galaxy", 3 | "position" : ["01h33m50.02s", "30d39m36.7s"], 4 | "magnitude" : "5.72V", 5 | "size" : ["70.8m", "41.7m"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/m33.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["57.04m", "68.01m"], 11 | "brightness" : 0.2483, 12 | "attribution" : "CCL BY 4.0, Credit: ESO" 13 | }, 14 | "Type" : "Galaxy" 15 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/api/ISkySetType.java: -------------------------------------------------------------------------------- 1 | package stellarium.api; 2 | 3 | /** 4 | * Type of sky default settings. 5 | * */ 6 | public interface ISkySetType { 7 | public double getLatitude(); 8 | public double getLongitude(); 9 | public double getDispersionRate(); 10 | public double getSkyRenderBrightness(); 11 | /** Gives color array with r,g,b components */ 12 | public double[] getSkyExtinctionFactors(); 13 | public boolean hideObjectsUnderHorizon(); 14 | public boolean doesAllowExtinction(); 15 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m57.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Ring Nebula", 3 | "position" : ["18h53m35.079s", "33d01m45.03s"], 4 | "magnitude" : "8.8V", 5 | "size" : ["230s", "230s"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/ring_nebula.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["2m", "2m"], 11 | "brightness" : 0.295, 12 | "attribution" : "By NASA and The Hubble Heritage Team (STScI/AURA))[Public domain]" 13 | }, 14 | "type" : "Nebula" 15 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m51.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Whirlpool Galaxy", 3 | "position" : ["13h29m52.7s", "47d11m43s"], 4 | "magnitude" : "8.4V", 5 | "size" : ["11.2m", "6.9m"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/m51.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["6.64m", "9.56m"], 11 | "brightness" : 0.2877, 12 | "attribution" : "NASA, ESA, S. Beckwith (STScI), and The Hubble Heritage Team STScI/AURA)[Public Domain]" 13 | }, 14 | "Type" : "Galaxy" 15 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/category/ICategoryController.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.category; 2 | 3 | import net.minecraftforge.common.config.Property; 4 | import stellarapi.lib.gui.GuiElement; 5 | import stellarium.client.overlay.clientcfg.DefCfgHierarchyHandler; 6 | 7 | public interface ICategoryController { 8 | 9 | public String mainPropertyName(); 10 | 11 | public GuiElement generateSpecificElement(Property property, DefCfgHierarchyHandler helper); 12 | 13 | public boolean hasRoll(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/DisplayRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import stellarium.render.SkyRI; 4 | 5 | public enum DisplayRenderer { 6 | INSTANCE; 7 | 8 | public void render(DisplayModel model, boolean isPostCelestials, SkyRI info) { 9 | DisplayRenderInfo subInfo = new DisplayRenderInfo(info.minecraft, info.tessellator, info.worldRenderer, info.partialTicks, isPostCelestials); 10 | for(DisplayModel.Delegate delegate : model.displayList) { 11 | delegate.renderer.render(subInfo, delegate.cache); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m15.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Messier 15", 3 | "position" : ["21h29m58.33s", "12d10m01.2s"], 4 | "magnitude" : "6.2V", 5 | "size" : ["18m", "18m"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/m15.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["20m", "20m"], 11 | "brightness" : 0.251, 12 | "attribution" : "By Ngc1535 (Own work) [CC BY-SA 4.0 (http://creativecommons.org/licenses/by-sa/4.0)], via Wikimedia Commons" 13 | }, 14 | "Type" : "Cluster" 15 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/milkyway/Milkyway.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.milkyway; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | import stellarapi.api.celestials.EnumObjectType; 5 | import stellarium.StellarSkyReferences; 6 | import stellarium.stellars.layer.StellarObject; 7 | 8 | public class Milkyway extends StellarObject { 9 | public Milkyway() { 10 | super("milkyway", 11 | new ResourceLocation(StellarSkyReferences.MODID, "milkyway"), 12 | EnumObjectType.DeepSkyObject); 13 | this.setStandardMagnitude(4.5); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m1.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Crab Nebula", 3 | "position" : ["5h34m31.94s", "22d00m52.2s"], 4 | "magnitude" : "8.4V", 5 | "size" : ["420s", "290s"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/crab_nebula.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["6m", "6m"], 11 | "brightness" : 0.387, 12 | "attribution" : "By NASA, ESA, J. Hester and A. Loll (Arizona State University) (HubbleSite: gallery, release.) [Public domain]" 13 | }, 14 | "type" : "Nebula" 15 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m31.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Andromeda Galaxy", 3 | "position" : ["00h42m44.3s", "41d16m09s"], 4 | "magnitude" : "3.44V", 5 | "size" : ["3.167d", "1d"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/m31.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["6.4d", "4.2d"], 11 | "brightness" : 0.1767, 12 | "attribution" : "CC BY-NC 2.0, by Adam Evans", 13 | "attributionURL" : "http://www.flickr.com/photos/astroporn/4999978603/" 14 | }, 15 | "Type" : "Galaxy" 16 | } -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [{ 2 | "modid": "stellarsky", 3 | "name": "Stellar Sky", 4 | "description": "Constellations & Planets in Minecraft! You can see Real Sky with this mod.", 5 | "version": "${version}", 6 | "mcversion": "${mcversion}", 7 | "url": "http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1444983-wip-stellarium-real-constellations-sun-moon", 8 | "authorList": [ "Abastro" ], 9 | "credits": "CC BY-SA", 10 | "requiredMods": [ "Forge", "sciapi" ], 11 | "depenencies": [ "sciapi", "CalendarAPI" ] 12 | }] 13 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/IDisplayElementType.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | 6 | public interface IDisplayElementType> { 7 | public Cfg generateSettings(); 8 | public Cache generateCache(); 9 | 10 | @SideOnly(Side.CLIENT) 11 | public IDisplayRenderer getRenderer(); 12 | 13 | /** 14 | * Configuration Name, can be used as identifier 15 | * */ 16 | public String getName(); 17 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m101.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Pinwheel Galaxy", 3 | "position" : ["14h03m12.6s", "54d20m57s"], 4 | "magnitude" : "7.86V", 5 | "size" : ["28.8m", "26.9m"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/m101-vasey.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["0.8d", "0.8d"], // TODO This doesn't seem right 11 | "brightness" : 0.2223, 12 | "attribution" : "Plover Hill Observatory", 13 | "attributionURL" : "http://www.madpc.co.uk/~peterv/" 14 | }, 15 | "Type" : "Galaxy" 16 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/deepsky/messier/m63.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Sunflower Galaxy", 3 | "position" : ["13h15m49.3s", "42d01m45s"], 4 | "magnitude" : "9.3V", 5 | "size" : ["12.6m", "7.2m"], 6 | "textures" : { 7 | "location" : "stellarium:deepsky/messier/m63.png", 8 | "orientation" : "equatorial", 9 | "wavelength" : "visible", 10 | "size" : ["0.19d", "0.13d"], 11 | "brightness" : 0.362, // TODO Exclude star visible in the photo 12 | "attribution" : "NASA, ESA, S. Beckwith (STScI), and The Hubble Heritage Team STScI/AURA)[Public Domain]" 13 | }, 14 | "Type" : "Galaxy" 15 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/client/StellarClientFMLHook.java: -------------------------------------------------------------------------------- 1 | package stellarium.client; 2 | 3 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 4 | import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; 5 | import net.minecraftforge.fml.common.gameevent.TickEvent; 6 | 7 | public class StellarClientFMLHook { 8 | 9 | public StellarClientFMLHook() { } 10 | 11 | @SubscribeEvent 12 | public void onTick(TickEvent.ClientTickEvent event) { 13 | 14 | } 15 | 16 | @SubscribeEvent 17 | public void onKeyInput(KeyInputEvent event) { 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/layer/IRenderCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.layer; 2 | 3 | import stellarapi.api.lib.config.IConfigHandler; 4 | import stellarium.client.ClientSettings; 5 | import stellarium.view.ViewerInfo; 6 | 7 | public interface IRenderCache { 8 | 9 | public void initialize(ClientSettings settings, Config specificSettings, Obj object); 10 | 11 | public void updateCache(ClientSettings settings, Config specificSettings, Obj object, ViewerInfo info); 12 | 13 | public int getRenderId(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/render/ICelestialObjectRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.render; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarium.render.stellars.access.EnumStellarPass; 6 | import stellarium.render.stellars.layer.IObjRenderCache; 7 | import stellarium.render.stellars.layer.LayerRHelper; 8 | 9 | @SideOnly(Side.CLIENT) 10 | public interface ICelestialObjectRenderer { 11 | 12 | public void render(Cache cache, EnumStellarPass pass, LayerRHelper info); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/layer/LayerSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.layer; 2 | 3 | import stellarapi.api.lib.config.IConfigHandler; 4 | import stellarium.stellars.layer.StellarObject; 5 | 6 | public class LayerSettings { 7 | 8 | private ObjectSettings cachedObjectSettings; 9 | 10 | public LayerSettings(IConfigHandler settings) { 11 | this.cachedObjectSettings = new ObjectSettings(settings); 12 | } 13 | 14 | public ObjectSettings getSettingsFor(StellarObject object) { 15 | cachedObjectSettings.setObject(object); 16 | return this.cachedObjectSettings; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/render/ICelestialLayerRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.render; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarium.render.stellars.access.EnumStellarPass; 6 | import stellarium.render.stellars.layer.LayerRHelper; 7 | 8 | @SideOnly(Side.CLIENT) 9 | public interface ICelestialLayerRenderer { 10 | 11 | public void preRender(EnumStellarPass pass, LayerRHelper info); 12 | public void postRender(EnumStellarPass pass, LayerRHelper info); 13 | 14 | public boolean acceptPass(EnumStellarPass pass); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/DisplayOverallSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import net.minecraftforge.common.config.Configuration; 4 | import stellarapi.api.lib.config.SimpleHierarchicalConfig; 5 | 6 | public class DisplayOverallSettings extends SimpleHierarchicalConfig { 7 | 8 | @Override 9 | public void setupConfig(Configuration config, String category) { 10 | config.setCategoryComment(category, "Configurations for additional display."); 11 | config.setCategoryLanguageKey(category, "config.category.display"); 12 | config.setCategoryRequiresMcRestart(category, false); 13 | 14 | super.setupConfig(config, category); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/shader/IUniformField.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.shader; 2 | 3 | import stellarapi.api.lib.math.SpCoord; 4 | import stellarapi.api.lib.math.Vector3; 5 | 6 | /** 7 | * The uniform field for the shader. 8 | * Use after the shader object is binded. 9 | * */ 10 | public interface IUniformField { 11 | 12 | public void setInteger(int val); 13 | public void setDouble(double val); 14 | public void setSpCoord(SpCoord val); 15 | public void setVector3(Vector3 val); 16 | public void setDouble2(double x, double y); 17 | public void setDouble3(double x, double y, double z); 18 | public void setDouble4(double x, double y, double z, double w); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/access/EnumStellarPass.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.access; 2 | 3 | public enum EnumStellarPass { 4 | /** Light source which contributes to the total intensity */ 5 | Source(false), 6 | /** Opaque object */ 7 | Opaque(true), 8 | /** Dominating scatter for brightest objects */ 9 | DominateScatter(true, false); 10 | 11 | public final boolean isDominate, isOpaque; 12 | 13 | EnumStellarPass(boolean isOpaque) { 14 | this.isDominate = false; 15 | this.isOpaque = isOpaque; 16 | } 17 | 18 | EnumStellarPass(boolean isDominate, boolean isOpaque) { 19 | this.isDominate = isDominate; 20 | this.isOpaque = isOpaque; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/atmosphere/atmosphere_refraction.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D texture; 4 | 5 | vec4 encode(vec4 color) 6 | { 7 | vec4 vEncoded; 8 | float maxComponent = max(max(color.r, color.g), color.b ); 9 | float fExp = ceil( log2(maxComponent) ); 10 | vEncoded = color / exp2(fExp); 11 | vEncoded.a = (fExp + 128) / 255; 12 | return vEncoded; 13 | } 14 | 15 | vec4 decode(vec4 rgbe) 16 | { 17 | vec4 vDecoded; 18 | float fExp = rgbe.a * 255 - 128; 19 | vDecoded = rgbe * exp2(fExp); 20 | return vDecoded; 21 | } 22 | 23 | void main() { 24 | gl_FragColor = encode(texture2D(texture, gl_TexCoord[0].st)); 25 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/StellarSkyOverlays.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay; 2 | 3 | import stellarapi.api.gui.overlay.IOverlaySetType; 4 | import stellarapi.api.gui.overlay.IRawOverlayElement; 5 | import stellarium.StellarSkyReferences; 6 | 7 | public class StellarSkyOverlays implements IOverlaySetType { 8 | 9 | @Override 10 | public String getLanguageKey() { 11 | return "hud.overlay.stellarsky"; 12 | } 13 | 14 | @Override 15 | public boolean acceptOverlayByDefault(IRawOverlayElement overlay) { 16 | return overlay.getModId().equals(StellarSkyReferences.MODID); 17 | } 18 | 19 | @Override 20 | public boolean isMain() { 21 | return false; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/phased/StellarPhasedRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.phased; 2 | 3 | import stellarium.render.stellars.access.EnumStellarPass; 4 | import stellarium.render.stellars.layer.LayerRHelper; 5 | import stellarium.render.stellars.layer.StellarLayerModel; 6 | import stellarium.render.stellars.layer.StellarLayerRenderer; 7 | 8 | public enum StellarPhasedRenderer { 9 | INSTANCE; 10 | 11 | public void render(StellarRenderModel model, EnumStellarPass pass, LayerRHelper info) { 12 | // Render all layers 13 | for(StellarLayerModel layerModel : model.layerModels) 14 | StellarLayerRenderer.INSTANCE.render(layerModel, pass, info); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/deepsky/DeepSkyRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.deepsky; 2 | 3 | import stellarium.render.stellars.access.EnumStellarPass; 4 | import stellarium.render.stellars.layer.LayerRHelper; 5 | import stellarium.stellars.render.ICelestialLayerRenderer; 6 | 7 | public enum DeepSkyRenderer implements ICelestialLayerRenderer { 8 | INSTANCE; 9 | 10 | @Override 11 | public void preRender(EnumStellarPass pass, LayerRHelper info) { } 12 | 13 | @Override 14 | public void postRender(EnumStellarPass pass, LayerRHelper info) { } 15 | 16 | @Override 17 | public boolean acceptPass(EnumStellarPass pass) { 18 | return pass == EnumStellarPass.Source; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/DisplayCacheInfo.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import stellarapi.api.lib.math.Matrix3; 4 | import stellarapi.api.lib.math.SpCoord; 5 | import stellarapi.api.view.IAtmosphereEffect; 6 | import stellarapi.api.view.ICCoordinates; 7 | 8 | public class DisplayCacheInfo { 9 | 10 | public final Matrix3 projectionToGround; 11 | private final IAtmosphereEffect sky; 12 | 13 | public DisplayCacheInfo(ICCoordinates coordinate, IAtmosphereEffect sky) { 14 | this.projectionToGround = coordinate.getProjectionToGround(); 15 | this.sky = sky; 16 | } 17 | 18 | public void applyAtmRefraction(SpCoord appCoord) { 19 | sky.applyAtmRefraction(appCoord); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/stellarium/api/SkySetTypeDefault.java: -------------------------------------------------------------------------------- 1 | package stellarium.api; 2 | 3 | public enum SkySetTypeDefault implements ISkySetType { 4 | INSTANCE; 5 | 6 | @Override 7 | public double getLatitude() { return 37.5; } 8 | @Override 9 | public double getLongitude() { return 0.0; } 10 | 11 | @Override 12 | public double getDispersionRate() { return 1.0; } 13 | 14 | @Override 15 | public double getSkyRenderBrightness() { return 0.2; } 16 | 17 | @Override 18 | public double[] getSkyExtinctionFactors() { return new double[] {0.1, 0.2, 0.35}; } 19 | 20 | @Override 21 | public boolean hideObjectsUnderHorizon() { return true; } 22 | @Override 23 | public boolean doesAllowExtinction() { return true; } 24 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/milkyway/MilkywayLayerRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.milkyway; 2 | 3 | import stellarium.render.stellars.access.EnumStellarPass; 4 | import stellarium.render.stellars.layer.LayerRHelper; 5 | import stellarium.stellars.render.ICelestialLayerRenderer; 6 | 7 | public enum MilkywayLayerRenderer implements ICelestialLayerRenderer { 8 | 9 | INSTANCE; 10 | 11 | @Override 12 | public void preRender(EnumStellarPass pass, LayerRHelper info) { } 13 | 14 | @Override 15 | public void postRender(EnumStellarPass pass, LayerRHelper info) { } 16 | 17 | @Override 18 | public boolean acceptPass(EnumStellarPass pass) { 19 | return pass == EnumStellarPass.Source; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/LayerSolarSystemRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | import stellarium.render.stellars.access.EnumStellarPass; 4 | import stellarium.render.stellars.layer.LayerRHelper; 5 | import stellarium.stellars.render.ICelestialLayerRenderer; 6 | 7 | public enum LayerSolarSystemRenderer implements ICelestialLayerRenderer { 8 | 9 | INSTANCE; 10 | 11 | @Override 12 | public void preRender(EnumStellarPass pass, LayerRHelper info) { } 13 | 14 | @Override 15 | public void postRender(EnumStellarPass pass, LayerRHelper info) { } 16 | 17 | @Override 18 | public boolean acceptPass(EnumStellarPass pass) { 19 | return pass.isDominate || pass.isOpaque; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/layer/ObjectSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.layer; 2 | 3 | import stellarapi.api.lib.config.IConfigHandler; 4 | import stellarium.stellars.layer.StellarObject; 5 | 6 | public class ObjectSettings { 7 | 8 | private IConfigHandler settings; 9 | private StellarObject object; 10 | 11 | public ObjectSettings(IConfigHandler settings) { 12 | this.settings = settings; 13 | } 14 | 15 | public void setObject(StellarObject object) { 16 | this.object = object; 17 | } 18 | 19 | public StellarObject getObject() { 20 | return this.object; 21 | } 22 | 23 | public T getLayerSettings() { 24 | return (T) this.settings; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/adapt/SkyRenderTypeEnd.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.adapt; 2 | 3 | import net.minecraftforge.client.IRenderHandler; 4 | import stellarapi.api.render.IAdaptiveRenderer; 5 | import stellarapi.api.world.worldset.WorldSet; 6 | import stellarium.api.ISkyRenderType; 7 | 8 | public enum SkyRenderTypeEnd implements ISkyRenderType { 9 | INSTANCE; 10 | 11 | @Override 12 | public String getName() { 13 | return "End Sky"; 14 | } 15 | 16 | @Override 17 | public boolean acceptFor(WorldSet worldSet) { 18 | return true; 19 | } 20 | 21 | @Override 22 | public IAdaptiveRenderer createSkyRenderer(IRenderHandler celestialRenderer) { 23 | return new SkyRendererEnd(celestialRenderer); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /plan/rendering_scheme.json: -------------------------------------------------------------------------------- 1 | { 2 | Universal : Time 3 | Time : { 4 | Loop, 5 | Interpolator 6 | } 7 | Viewer : { 8 | Sub-Universal : { 9 | ViewPointCoord, 10 | Atmosphere 11 | }, 12 | Local : { 13 | Scope, 14 | Filter 15 | }, 16 | Dynamic : View Range 17 | }, 18 | Object : { 19 | ObjectPointCoord, 20 | Brightness, 21 | Shape 22 | } 23 | PointCoord : { 24 | Parent, 25 | RelPos, 26 | RelCoord 27 | } 28 | 29 | Layer : { 30 | CommonPointCoord, 31 | Range, 32 | MinBrightness, 33 | Shape 34 | } 35 | 36 | Render : { 37 | Prepare, 38 | Transversal : { 39 | Check, 40 | RenderFar, 41 | RenderMain, 42 | RenderNear 43 | }, 44 | ApplyEffect 45 | } 46 | } 47 | 48 | // Layer can be served as Object sometimes 49 | // Tree transversal -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/star/LayerStarRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.star; 2 | 3 | import stellarium.render.stellars.access.EnumStellarPass; 4 | import stellarium.render.stellars.layer.LayerRHelper; 5 | import stellarium.stellars.render.ICelestialLayerRenderer; 6 | 7 | public enum LayerStarRenderer implements ICelestialLayerRenderer { 8 | 9 | INSTANCE; 10 | 11 | @Override 12 | public void preRender(EnumStellarPass pass, LayerRHelper info) { 13 | info.beginPoint(); 14 | } 15 | 16 | @Override 17 | public void postRender(EnumStellarPass pass, LayerRHelper info) { 18 | info.endPoint(); 19 | } 20 | 21 | @Override 22 | public boolean acceptPass(EnumStellarPass pass) { 23 | return pass == EnumStellarPass.Source; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/postprocess/hdr_to_ldr.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D texture; 4 | uniform float brScale; 5 | 6 | vec4 encode(vec4 color) 7 | { 8 | vec4 vEncoded; 9 | float maxComponent = max(max(color.r, color.g), color.b ); 10 | float fExp = ceil( log2(maxComponent) ); 11 | vEncoded = color / exp2(fExp); 12 | vEncoded.a = (fExp + 128) / 255; 13 | return vEncoded; 14 | } 15 | 16 | vec4 decode(vec4 rgbe) 17 | { 18 | vec4 vDecoded; 19 | float fExp = rgbe.a * 255 - 128; 20 | vDecoded = rgbe * exp2(fExp); 21 | return vDecoded; 22 | } 23 | 24 | void main() 25 | { 26 | vec4 fragColor = decode(texture2D(texture, gl_TexCoord[0].st)); 27 | gl_FragColor = encode(fragColor / brScale); 28 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/star/StarRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.star; 2 | 3 | import stellarium.render.stellars.access.EnumStellarPass; 4 | import stellarium.render.stellars.layer.LayerRHelper; 5 | import stellarium.stellars.OpticsHelper; 6 | import stellarium.stellars.render.ICelestialObjectRenderer; 7 | 8 | public enum StarRenderer implements ICelestialObjectRenderer { 9 | INSTANCE; 10 | 11 | @Override 12 | public void render(StarRenderCache cache, EnumStellarPass pass, LayerRHelper info) { 13 | float multiplier = OpticsHelper.getMultFromArea(info.pointArea()); 14 | info.renderPoint(cache.pos, LayerRHelper.DEEP_DEPTH, 15 | cache.red * multiplier, cache.green * multiplier, cache.blue * multiplier); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/adapt/SkySetTypeEnd.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.adapt; 2 | 3 | import stellarium.api.ISkySetType; 4 | 5 | public enum SkySetTypeEnd implements ISkySetType { 6 | INSTANCE; 7 | 8 | @Override 9 | public double getLatitude() { return -52.5; } 10 | @Override 11 | public double getLongitude() { return 180.0; } 12 | 13 | @Override 14 | public double getDispersionRate() { return 0.0; } 15 | 16 | @Override 17 | public double getSkyRenderBrightness() { return 0.3; } 18 | 19 | @Override 20 | public double[] getSkyExtinctionFactors() { return new double[] {0, 0, 0}; } 21 | 22 | @Override 23 | public boolean hideObjectsUnderHorizon() { return false; } 24 | @Override 25 | public boolean doesAllowExtinction() { return false; } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/config/StellarConfigGuiFactory.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.config; 2 | 3 | import java.util.Set; 4 | 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.GuiScreen; 7 | import net.minecraftforge.fml.client.IModGuiFactory; 8 | 9 | public class StellarConfigGuiFactory implements IModGuiFactory { 10 | 11 | @Override 12 | public void initialize(Minecraft minecraftInstance) { } 13 | 14 | @Override 15 | public boolean hasConfigGui() { 16 | return true; 17 | } 18 | 19 | @Override 20 | public GuiScreen createConfigGui(GuiScreen parentScreen) { 21 | return new StellarConfigScreen(parentScreen); 22 | } 23 | 24 | @Override 25 | public Set runtimeGuiCategories() { 26 | return null; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/stellarium/StellarSkyReferences.java: -------------------------------------------------------------------------------- 1 | package stellarium; 2 | 3 | import java.io.File; 4 | 5 | import net.minecraftforge.common.config.Configuration; 6 | 7 | public class StellarSkyReferences { 8 | 9 | public static final String MODID = "stellarsky"; 10 | public static final String VERSION = "@VERSION@"; 11 | 12 | public static final String CELESTIAL_SETTINGS = "CelestialSettings.cfg"; 13 | public static final String GUI_SETTINGS = "GuiSettings.cfg"; 14 | 15 | // MAYBE Change the resource id. In case Stellarium becomes a thing. 16 | public static final String RESOURCE_ID = "stellarium"; 17 | 18 | public static Configuration getConfiguration(File main, String sub) { 19 | return new Configuration(new File(new File(main, StellarSkyReferences.MODID), sub)); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/stellarium/world/provider/EndReplacer.java: -------------------------------------------------------------------------------- 1 | package stellarium.world.provider; 2 | 3 | import net.minecraft.world.World; 4 | import net.minecraft.world.WorldProvider; 5 | import net.minecraft.world.WorldProviderEnd; 6 | import stellarapi.api.world.ICelestialHelper; 7 | import stellarapi.api.world.IWorldProviderReplacer; 8 | 9 | @Deprecated 10 | public class EndReplacer implements IWorldProviderReplacer { 11 | 12 | @Override 13 | public boolean accept(World world, WorldProvider provider) { 14 | return provider instanceof WorldProviderEnd; 15 | } 16 | 17 | @Override 18 | public WorldProvider createWorldProvider(World world, WorldProvider originalProvider, ICelestialHelper helper) { 19 | return new StellarWorldProviderEnd(world, (WorldProviderEnd)originalProvider, helper); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/ICfgTooltipHandler.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg; 2 | 3 | import net.minecraftforge.common.config.ConfigCategory; 4 | import net.minecraftforge.common.config.Property; 5 | import stellarapi.lib.gui.GuiElement; 6 | import stellarapi.lib.gui.dynamic.tooltip.ITooltipElementController; 7 | 8 | public interface ICfgTooltipHandler { 9 | 10 | public ITooltipElementController defaultTooltip(ConfigCategory category); 11 | public ITooltipElementController defaultTooltip(Property property); 12 | 13 | public GuiElement wrapElement(GuiElement element, String tooltip); 14 | public GuiElement wrapElement(GuiElement element, ITooltipElementController controller); 15 | 16 | public void setWrappedGui(GuiElement spaced); 17 | public GuiElement generateGui(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/property/IPropertyElementType.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.property; 2 | 3 | import net.minecraftforge.common.config.Property; 4 | import stellarium.client.lib.gui.IHierarchyElement; 5 | import stellarium.client.overlay.clientcfg.ICfgHierarchyHandler; 6 | import stellarium.client.overlay.clientcfg.ICfgTooltipHandler; 7 | 8 | public interface IPropertyElementType { 9 | 10 | /** 11 | * Whether this type accepts certain property. 12 | * Type and list will already be checked, so no check needed for that part. 13 | * */ 14 | public boolean accept(Property property); 15 | 16 | /**Use rollable element*/ 17 | public boolean useRollable(); 18 | public IHierarchyElement generate(Property property, ICfgHierarchyHandler handler, ICfgTooltipHandler tooltip); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/ecgrid/EcGridType.java: -------------------------------------------------------------------------------- 1 | package stellarium.display.ecgrid; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarium.display.IDisplayElementType; 6 | import stellarium.display.IDisplayRenderer; 7 | 8 | public class EcGridType implements IDisplayElementType { 9 | 10 | @Override 11 | public EcGridSettings generateSettings() { 12 | return new EcGridSettings(); 13 | } 14 | 15 | @Override 16 | public EcGridCache generateCache() { 17 | return new EcGridCache(); 18 | } 19 | 20 | @SideOnly(Side.CLIENT) 21 | @Override 22 | public IDisplayRenderer getRenderer() { 23 | return new EcGridRenderer(); 24 | } 25 | 26 | @Override 27 | public String getName() { 28 | return "Ecliptic_Coordinate_Grid"; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/CfgConstants.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg; 2 | 3 | public class CfgConstants { 4 | 5 | public static final float ELEMENT_SIZE = 20.0f; 6 | public static final float SPACING = 2.0f; 7 | public static final float BACKGROUND_SPACING = 3.0f; 8 | 9 | public static final float SCROLL_BTN_PROG_SIZE = 5.0f; 10 | public static final float SCROLL_BTN_PER_SIZE = 10.0f; 11 | public static final float SCROLL_REGION_SIZE = 10.0f; 12 | public static final float SCROLL_SIZE = 60.0f; 13 | 14 | public static final int WAIT_TIME_ANIMATION = 5; 15 | public static final int WAIT_TIME_FAST_TOOLTIP = 100; 16 | public static final int WAIT_TIME_SLOW_TOOLTIP = 300; 17 | 18 | public static final String SUFFIX_TOOLTIP = ".tooltip"; 19 | public static final String SUFFIX_ENABLED = ".enabled"; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/eqgrid/EqGridType.java: -------------------------------------------------------------------------------- 1 | package stellarium.display.eqgrid; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarium.display.IDisplayElementType; 6 | import stellarium.display.IDisplayRenderer; 7 | 8 | public class EqGridType implements IDisplayElementType { 9 | 10 | @Override 11 | public EqGridSettings generateSettings() { 12 | return new EqGridSettings(); 13 | } 14 | 15 | @Override 16 | public EqGridCache generateCache() { 17 | return new EqGridCache(); 18 | } 19 | 20 | @SideOnly(Side.CLIENT) 21 | @Override 22 | public IDisplayRenderer getRenderer() { 23 | return new EqGridRenderer(); 24 | } 25 | 26 | @Override 27 | public String getName() { 28 | return "Equatorial_Coordinate_Grid"; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/horgrid/HorGridType.java: -------------------------------------------------------------------------------- 1 | package stellarium.display.horgrid; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarium.display.IDisplayElementType; 6 | import stellarium.display.IDisplayRenderer; 7 | 8 | public class HorGridType implements IDisplayElementType { 9 | 10 | @Override 11 | public HorGridSettings generateSettings() { 12 | return new HorGridSettings(); 13 | } 14 | 15 | @Override 16 | public HorGridCache generateCache() { 17 | return new HorGridCache(); 18 | } 19 | 20 | @SideOnly(Side.CLIENT) 21 | @Override 22 | public IDisplayRenderer getRenderer() { 23 | return new HorGridRenderer(); 24 | } 25 | 26 | @Override 27 | public String getName() { 28 | return "Horizontal_Coordinate_Grid"; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/stellarium/sync/StellarNetworkManager.java: -------------------------------------------------------------------------------- 1 | package stellarium.sync; 2 | 3 | import net.minecraftforge.fml.common.network.NetworkRegistry; 4 | import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; 5 | import net.minecraftforge.fml.relauncher.Side; 6 | 7 | public final class StellarNetworkManager { 8 | 9 | private SimpleNetworkWrapper wrapper; 10 | private String id = "stellarskychannel"; 11 | 12 | public StellarNetworkManager() { 13 | this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(this.id); 14 | 15 | wrapper.registerMessage(MessageLockSync.MessageLockSyncHandler.class, 16 | MessageLockSync.class, 0, Side.CLIENT); 17 | } 18 | 19 | public String getID() { 20 | return this.id; 21 | } 22 | 23 | public void sendLockInformation(boolean lock) { 24 | wrapper.sendToAll(new MessageLockSync(lock)); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/layer/IObjRenderCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.layer; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarapi.api.lib.config.IConfigHandler; 6 | import stellarium.client.ClientSettings; 7 | import stellarium.stellars.layer.StellarObject; 8 | import stellarium.stellars.render.ICelestialObjectRenderer; 9 | import stellarium.view.ViewerInfo; 10 | 11 | public interface IObjRenderCache { 12 | 13 | public void updateSettings(ClientSettings settings, C specificSettings, S object); 14 | 15 | /** 16 | * Updates this render cache. 17 | * @param object the object 18 | * @param image the image for this object, can be null 19 | * */ 20 | public void updateCache(S object, ViewerInfo info); 21 | 22 | @SideOnly(Side.CLIENT) 23 | ICelestialObjectRenderer getRenderer(); 24 | 25 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/world/RefractiveSkySet.java: -------------------------------------------------------------------------------- 1 | package stellarium.world; 2 | 3 | import stellarapi.api.lib.math.SpCoord; 4 | import stellarapi.api.optics.Wavelength; 5 | import stellarium.stellars.util.ExtinctionRefraction; 6 | 7 | public class RefractiveSkySet extends NonRefractiveSkySet implements IStellarSkySet { 8 | 9 | public RefractiveSkySet(PerDimensionSettings settings) { 10 | super(settings); 11 | } 12 | 13 | @Override 14 | public void applyAtmRefraction(SpCoord coord) { 15 | ExtinctionRefraction.refraction(coord, true); 16 | } 17 | 18 | @Override 19 | public void disapplyAtmRefraction(SpCoord coord) { 20 | ExtinctionRefraction.refraction(coord, false); 21 | } 22 | 23 | @Override 24 | public float calculateAirmass(SpCoord coord) { 25 | return (float)ExtinctionRefraction.airmass(coord, false); 26 | } 27 | 28 | @Override 29 | public double getSeeing(Wavelength wavelength) { 30 | return 0.002; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/stellarium/util/math/Allocator.java: -------------------------------------------------------------------------------- 1 | package stellarium.util.math; 2 | 3 | import stellarapi.api.lib.math.SpCoord; 4 | import stellarapi.api.lib.math.Vector3; 5 | 6 | public class Allocator { 7 | 8 | public static Vector3[][] createAndInitialize(int nrow, int ncol) { 9 | Vector3[][] vector = new Vector3[nrow][ncol]; 10 | for(int i = 0; i < nrow; i++) 11 | for(int j = 0; j < ncol; j++) 12 | vector[i][j] = new Vector3(); 13 | return vector; 14 | } 15 | 16 | public static Vector3[] createAndInitialize(int n) { 17 | Vector3[] vector = new Vector3[n]; 18 | for(int i = 0; i < n; i++) 19 | vector[i] = new Vector3(); 20 | return vector; 21 | } 22 | 23 | public static SpCoord[][] createAndInitializeSp(int nrow, int ncol) { 24 | SpCoord[][] coord = new SpCoord[nrow][ncol]; 25 | for(int i = 0; i < nrow; i++) 26 | for(int j = 0; j < ncol; j++) 27 | coord[i][j] = new SpCoord(); 28 | return coord; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/stellarium/util/math/CachedGaussianRandom.java: -------------------------------------------------------------------------------- 1 | package stellarium.util.math; 2 | 3 | import java.util.Random; 4 | 5 | public class CachedGaussianRandom { 6 | 7 | private double[] randomValues; 8 | private int currentIndex = 0; 9 | 10 | public CachedGaussianRandom(int numRandoms) { 11 | Random random = new Random(); 12 | this.generateRandomValues(numRandoms, random); 13 | } 14 | 15 | public CachedGaussianRandom(int numRandoms, long seed) { 16 | Random random = new Random(seed); 17 | this.generateRandomValues(numRandoms, random); 18 | } 19 | 20 | private void generateRandomValues(int numRandoms, Random random) { 21 | this.randomValues = new double[numRandoms]; 22 | for(int i = 0; i < numRandoms; i++) 23 | randomValues[i] = random.nextGaussian(); 24 | } 25 | 26 | public double nextGaussian() { 27 | this.currentIndex = (this.currentIndex + 1) % randomValues.length; 28 | return randomValues[this.currentIndex++]; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/PlanetRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | import stellarium.render.stellars.access.EnumStellarPass; 4 | import stellarium.render.stellars.layer.LayerRHelper; 5 | import stellarium.stellars.OpticsHelper; 6 | import stellarium.stellars.render.ICelestialObjectRenderer; 7 | 8 | public enum PlanetRenderer implements ICelestialObjectRenderer { 9 | 10 | INSTANCE; 11 | 12 | @Override 13 | public void render(PlanetRenderCache cache, EnumStellarPass pass, LayerRHelper info) { 14 | if(pass != EnumStellarPass.Source || !cache.shouldRender) 15 | return; 16 | 17 | // TODO Render planet properly 18 | float multiplier = OpticsHelper.getMultFromArea(info.pointArea()); 19 | 20 | info.beginPoint(); 21 | info.renderPoint(cache.pos, LayerRHelper.DEEP_DEPTH, 22 | cache.brightness * multiplier, cache.brightness * multiplier, cache.brightness * multiplier); 23 | info.endPoint(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/stellarium/api/SkyRenderTypeSurface.java: -------------------------------------------------------------------------------- 1 | package stellarium.api; 2 | 3 | import net.minecraftforge.client.IRenderHandler; 4 | import net.minecraftforge.fml.relauncher.Side; 5 | import net.minecraftforge.fml.relauncher.SideOnly; 6 | import stellarapi.api.SAPIReferences; 7 | import stellarapi.api.render.IAdaptiveRenderer; 8 | import stellarapi.api.world.worldset.WorldSet; 9 | import stellarapi.api.world.worldset.WorldSets; 10 | import stellarium.render.adapt.SkyRendererSurface; 11 | 12 | public enum SkyRenderTypeSurface implements ISkyRenderType { 13 | INSTANCE; 14 | 15 | @Override 16 | public String getName() { 17 | return "Overworld Sky"; 18 | } 19 | 20 | @Override 21 | public boolean acceptFor(WorldSet worldSet) { 22 | return worldSet != WorldSets.endType(); 23 | } 24 | 25 | @Override 26 | @SideOnly(Side.CLIENT) 27 | public IAdaptiveRenderer createSkyRenderer(IRenderHandler subRenderer) { 28 | return new SkyRendererSurface(subRenderer); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/EnumLockBtnPosition.java: -------------------------------------------------------------------------------- 1 | package stellarium.client; 2 | 3 | public enum EnumLockBtnPosition { 4 | UPRIGHT("upright", 5, 12), 5 | DOWNLEFT("downleft", -155, 48-6); 6 | 7 | private final String name; 8 | private final int offsetX, offsetY; 9 | 10 | public static String[] names = {"upright", "downleft"}; 11 | 12 | EnumLockBtnPosition(String name, int offsetX, int offsetY) { 13 | this.name = name; 14 | this.offsetX = offsetX; 15 | this.offsetY = offsetY; 16 | } 17 | 18 | public String getName() { 19 | return this.name; 20 | } 21 | 22 | public int getPosX(int width) { 23 | return width / 2 + this.offsetX; 24 | } 25 | 26 | public int getPosY(int height) { 27 | return height / 6 + this.offsetY; 28 | } 29 | 30 | public static EnumLockBtnPosition getModeForName(String name) { 31 | for(EnumLockBtnPosition mode : EnumLockBtnPosition.values()) 32 | if(mode.name.equals(name)) 33 | return mode; 34 | return null; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/DisplayRenderInfo.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.renderer.BufferBuilder; 5 | import net.minecraft.client.renderer.Tessellator; 6 | 7 | 8 | public class DisplayRenderInfo { 9 | public final Minecraft mc; 10 | public final Tessellator tessellator; 11 | public final BufferBuilder builder; 12 | public final float partialTicks; 13 | 14 | /** 15 | * Render pass which display is rendered. 16 | * To accept this as false, the depth should be farther than {@link EnumRenderPass#getDeepDepth()}. 17 | * */ 18 | public final boolean isPostCelesitals; 19 | 20 | public DisplayRenderInfo(Minecraft mc, Tessellator tessellator, BufferBuilder worldRenderer, float partialTicks, boolean isPostCelesitals) { 21 | this.mc = mc; 22 | this.tessellator = tessellator; 23 | this.builder = worldRenderer; 24 | this.partialTicks = partialTicks; 25 | this.isPostCelesitals = isPostCelesitals; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/SkyRI.java: -------------------------------------------------------------------------------- 1 | package stellarium.render; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.multiplayer.WorldClient; 5 | import net.minecraft.client.renderer.BufferBuilder; 6 | import net.minecraft.client.renderer.Tessellator; 7 | import stellarium.view.ViewerInfo; 8 | 9 | public class SkyRI { 10 | public final Minecraft minecraft; 11 | public final WorldClient world; 12 | public final Tessellator tessellator; 13 | public final BufferBuilder worldRenderer; 14 | public final float partialTicks; 15 | 16 | public final ViewerInfo info; 17 | public final double screenSize; 18 | 19 | public SkyRI(Minecraft mc, WorldClient theWorld, float partialTicks, ViewerInfo viewer) { 20 | this.minecraft = mc; 21 | this.world = theWorld; 22 | this.tessellator = Tessellator.getInstance(); 23 | this.worldRenderer = tessellator.getBuffer(); 24 | this.partialTicks = partialTicks; 25 | 26 | this.info = viewer; 27 | this.screenSize = mc.displayHeight; 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/layer/StellarObject.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.layer; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | import stellarapi.api.CelestialPeriod; 5 | import stellarapi.api.celestials.CelestialObject; 6 | import stellarapi.api.celestials.EnumObjectType; 7 | import stellarapi.api.view.ICCoordinates; 8 | 9 | public abstract class StellarObject extends CelestialObject { 10 | private final String identifier; 11 | 12 | public StellarObject(String id, ResourceLocation nameIn, EnumObjectType typeIn) { 13 | super(nameIn, typeIn); 14 | this.identifier = id; 15 | } 16 | 17 | @Override 18 | public CelestialPeriod getHorizontalPeriod(ICCoordinates coords) { 19 | return coords.getPeriod(); 20 | } 21 | 22 | @Override 23 | public int hashCode() { 24 | return this.identifier.hashCode(); 25 | } 26 | 27 | @Override 28 | public boolean equals(Object obj) { 29 | if(obj instanceof StellarObject) 30 | return ((StellarObject) obj).identifier.equals(this.identifier); 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/lib/gui/IRollHelper.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.lib.gui; 2 | 3 | import stellarapi.lib.gui.IRenderer; 4 | 5 | public interface IRollHelper { 6 | 7 | public boolean isDirectionInverted(boolean isHorizontal); 8 | 9 | public boolean rollToRight(); 10 | public boolean rollToDown(); 11 | 12 | public boolean hasRollButton(); 13 | public float rollBtnSize(); 14 | 15 | public void setupRollBtnRenderer(boolean isHorizontal, boolean mouseOver, IRenderer renderer); 16 | public String setupRollBtnOverlay(boolean isHorizontal, boolean mouseOver, IRenderer renderer); 17 | public String setupRollBtnMain(boolean isHorizontal, boolean mouseOver, IRenderer renderer); 18 | 19 | public void setupSpacingBtnRenderer(boolean isHorizontal, boolean mouseOver, IRenderer renderer); 20 | public String setupSpacingBtnOverlay(boolean isHorizontal, boolean mouseOver, IRenderer renderer); 21 | public String setupSpacingBtnMain(boolean isHorizontal, boolean mouseOver, IRenderer renderer); 22 | 23 | public long hoverUpdateDelay(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/stellarium/world/StellarPack.java: -------------------------------------------------------------------------------- 1 | package stellarium.world; 2 | 3 | import net.minecraft.world.World; 4 | import stellarapi.api.lib.config.INBTConfig; 5 | import stellarapi.api.pack.ICelestialPack; 6 | import stellarapi.api.pack.ICelestialScene; 7 | import stellarapi.api.world.worldset.WorldSet; 8 | import stellarium.StellarSky; 9 | 10 | public enum StellarPack implements ICelestialPack { 11 | INSTANCE; 12 | 13 | @Override 14 | public String getPackName() { 15 | return "Stellar Sky"; 16 | } 17 | 18 | @Override 19 | public ICelestialScene getScene(WorldSet worldSet, World world, boolean isDefault) { 20 | // Load settings 21 | PerDimensionSettings settings; 22 | if(isDefault) { 23 | settings = new PerDimensionSettings(worldSet); 24 | settings.setPropsAsDefault(); 25 | settings.setFlagsForDefault(); 26 | } else { 27 | settings = (PerDimensionSettings) ((INBTConfig) StellarSky.PROXY.getDimensionSettings().getSubConfig(worldSet.name)).copy(); 28 | } 29 | 30 | return new StellarScene(world, worldSet, settings); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/star/LayerBgStar.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.star; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | import net.minecraftforge.fml.relauncher.Side; 5 | import net.minecraftforge.fml.relauncher.SideOnly; 6 | import stellarapi.api.celestials.EnumCollectionType; 7 | import stellarapi.api.lib.config.IConfigHandler; 8 | import stellarapi.api.lib.config.INBTConfig; 9 | import stellarium.stellars.layer.StellarLayer; 10 | import stellarium.stellars.render.ICelestialLayerRenderer; 11 | 12 | public abstract class LayerBgStar 13 | extends StellarLayer { 14 | 15 | public LayerBgStar(ResourceLocation nameIn, int order) { 16 | super(nameIn, EnumCollectionType.Stars, order); 17 | } 18 | 19 | public static int renderIndex = -1; 20 | public static int renderStarIndex = -1; 21 | 22 | @SideOnly(Side.CLIENT) 23 | @Override 24 | public ICelestialLayerRenderer getLayerRenderer() { 25 | return LayerStarRenderer.INSTANCE; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/ICfgHierarchyHandler.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg; 2 | 3 | import net.minecraftforge.common.config.ConfigCategory; 4 | import net.minecraftforge.common.config.Property; 5 | import stellarapi.lib.gui.IRenderer; 6 | import stellarium.client.lib.gui.IHierarchyElement; 7 | 8 | public interface ICfgHierarchyHandler { 9 | 10 | /** 11 | * Parent can be null when the 'parent' should be configuration itself. 12 | * Though the category can be child of another category on the case, too. 13 | * */ 14 | public boolean accept(ConfigCategory parent, ConfigCategory category); 15 | public IHierarchyElement generate(ConfigCategory category, ICfgTooltipHandler tooltip); 16 | 17 | public boolean accept(Property property); 18 | public IHierarchyElement generate(Property property, ICfgTooltipHandler tooltip); 19 | 20 | public IHierarchyElement spacing(float size); 21 | 22 | 23 | public String setupBackground(boolean isHorizontal, IRenderer renderer); 24 | public void setupMainRenderer(boolean isHorizontal, IRenderer renderer); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/stellarium/util/MCUtil.java: -------------------------------------------------------------------------------- 1 | package stellarium.util; 2 | 3 | import java.lang.invoke.MethodHandle; 4 | import java.lang.invoke.MethodHandles; 5 | import java.lang.reflect.Method; 6 | 7 | import net.minecraft.client.renderer.EntityRenderer; 8 | import net.minecraftforge.fml.relauncher.ReflectionHelper; 9 | 10 | public class MCUtil { 11 | private static final Method GET_FOV_MODIFIER = ReflectionHelper.findMethod(EntityRenderer.class, 12 | "getFOVModifier", "func_78481_a", float.class, boolean.class); 13 | private static final MethodHandle GFM_HANDLE; 14 | 15 | static { 16 | MethodHandle handle = null; 17 | try { 18 | handle = MethodHandles.lookup().unreflect(GET_FOV_MODIFIER); 19 | } catch (IllegalAccessException e) { 20 | e.printStackTrace(); 21 | } 22 | 23 | GFM_HANDLE = handle; 24 | } 25 | 26 | public static float getFOVModifier(EntityRenderer renderer, float partialTicks, boolean useFOVSetting) { 27 | try { 28 | return (float) GFM_HANDLE.invokeExact(renderer, partialTicks, useFOVSetting); 29 | } catch (Throwable e) { 30 | throw new RuntimeException(e); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/layer/StellarLayerRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.layer; 2 | 3 | import org.apache.commons.lang3.tuple.Pair; 4 | 5 | import stellarium.render.stellars.access.EnumStellarPass; 6 | import stellarium.stellars.layer.StellarObject; 7 | import stellarium.stellars.render.ICelestialLayerRenderer; 8 | import stellarium.stellars.render.ICelestialObjectRenderer; 9 | 10 | public enum StellarLayerRenderer { 11 | INSTANCE; 12 | 13 | public void render(StellarLayerModel model, EnumStellarPass pass, LayerRHelper info) { 14 | ICelestialLayerRenderer layerRenderer = model.getLayerType().getLayerRenderer(); 15 | 16 | if(!layerRenderer.acceptPass(pass)) 17 | return; 18 | 19 | layerRenderer.preRender(pass, info); 20 | 21 | for(Pair pair : model.getRenderCaches()) { 22 | IObjRenderCache cache = pair.getRight(); 23 | ICelestialObjectRenderer objRenderer = cache.getRenderer(); 24 | objRenderer.render(cache, pass, info); 25 | } 26 | 27 | if(layerRenderer != null) 28 | layerRenderer.postRender(pass, info); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/UtilShaders.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars; 2 | 3 | import stellarium.StellarSkyResources; 4 | import stellarium.render.shader.IShaderObject; 5 | import stellarium.render.shader.ShaderHelper; 6 | 7 | public class UtilShaders { 8 | private IShaderObject point = null, texture = null; 9 | 10 | public void reloadShaders() { 11 | this.point = ShaderHelper.getInstance().buildShader( 12 | "point", StellarSkyResources.vertexPoint, StellarSkyResources.fragmentPoint); 13 | this.texture = ShaderHelper.getInstance().buildShader("texture", 14 | StellarSkyResources.vertexTexured, StellarSkyResources.fragmentTextured); 15 | texture.getField("texture").setInteger(0); 16 | 17 | if(this.point == null || this.texture == null) 18 | throw new RuntimeException("There was an error preparing shader programs"); 19 | } 20 | 21 | public void bindPointShader() { 22 | point.bindShader(); 23 | } 24 | 25 | public void bindTextureShader() { 26 | texture.bindShader(); 27 | } 28 | 29 | public void releaseShader() { 30 | ShaderHelper.getInstance().releaseCurrentShader(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/QualitySettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraftforge.common.config.Configuration; 6 | import stellarapi.api.lib.config.SimpleConfigHandler; 7 | import stellarapi.api.lib.config.property.ConfigPropertyBoolean; 8 | 9 | public class QualitySettings extends SimpleConfigHandler { 10 | public static final String KEY = "quality"; 11 | 12 | public QualitySettings() { } 13 | 14 | @Override 15 | public void setupConfig(Configuration config, String category) { 16 | config.setCategoryComment(category, "Configurations for quality vs performance."); 17 | config.setCategoryLanguageKey(category, "config.category.quality"); 18 | config.setCategoryRequiresMcRestart(category, false); 19 | 20 | super.setupConfig(config, category); 21 | } 22 | 23 | @Override 24 | public void loadFromConfig(Configuration config, String category) { 25 | super.loadFromConfig(config, category); 26 | } 27 | 28 | @Override 29 | public void saveToConfig(Configuration config, String category) { 30 | super.saveToConfig(config, category); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/postprocess/sky_to_queried.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D texture; 4 | uniform vec3 relative; 5 | 6 | vec4 encode(vec4 color) 7 | { 8 | vec4 vEncoded; 9 | float maxComponent = max(max(color.r, color.g), color.b ); 10 | float fExp = ceil( log2(maxComponent) ); 11 | vEncoded = color / exp2(fExp); 12 | vEncoded.a = (fExp + 128) / 255; 13 | return vEncoded; 14 | } 15 | 16 | vec4 decode(vec4 rgbe) 17 | { 18 | vec4 vDecoded; 19 | float fExp = rgbe.a * 255 - 128; 20 | vDecoded = rgbe * exp2(fExp); 21 | return vDecoded; 22 | } 23 | 24 | void main() 25 | { 26 | // Get the actual vector to Multiply (cosO)^3 (Square from latitude, single from longitude) 27 | vec3 coord = gl_TexCoord[0].xyz - vec3(0.5, 0.5, 0.0); 28 | coord.z = 1.0; 29 | coord *= relative; 30 | float size = length(coord); 31 | 32 | vec4 fragColor = decode(texture2D(texture, gl_TexCoord[0].st)); 33 | float brightness = fragColor.r * 0.2126 + fragColor.g * 0.7152 + fragColor.b * 0.0722; 34 | // Cap the brightness 35 | gl_FragColor.r = min(brightness, 400000.0) / (1000 * size * size * size); 36 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/api/ISkyRenderType.java: -------------------------------------------------------------------------------- 1 | package stellarium.api; 2 | 3 | import net.minecraftforge.client.IRenderHandler; 4 | import net.minecraftforge.fml.relauncher.Side; 5 | import net.minecraftforge.fml.relauncher.SideOnly; 6 | import stellarapi.api.render.IAdaptiveRenderer; 7 | import stellarapi.api.world.worldset.WorldSet; 8 | 9 | /** 10 | * Sky renderer type, there is overworld and end type by default.

11 | * This type can be chosen on Configuration for each world. 12 | * */ 13 | public interface ISkyRenderType { 14 | 15 | /** 16 | * Name for this type. Will be used on configuration. 17 | * */ 18 | public String getName(); 19 | 20 | /** 21 | * Whether or not this type accepts certain world 22 | * @param worldSet the worldSet the worlds are in. 23 | * @return false if this type is incompatible with the world, true otherwise 24 | * */ 25 | public boolean acceptFor(WorldSet worldSet); 26 | 27 | /** 28 | * Creates new SkyRenderer. 29 | * @param renderer the celestial renderer which renders. 30 | * */ 31 | @SideOnly(Side.CLIENT) 32 | public IAdaptiveRenderer createSkyRenderer(IRenderHandler celestialRenderer); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/config/StellarConfigScreen.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.config; 2 | 3 | import java.util.List; 4 | 5 | import com.google.common.collect.Lists; 6 | 7 | import net.minecraft.client.gui.GuiScreen; 8 | import net.minecraftforge.common.config.ConfigElement; 9 | import net.minecraftforge.common.config.Configuration; 10 | import net.minecraftforge.fml.client.config.GuiConfig; 11 | import net.minecraftforge.fml.client.config.IConfigElement; 12 | import stellarium.StellarSky; 13 | import stellarium.StellarSkyReferences; 14 | 15 | public class StellarConfigScreen extends GuiConfig { 16 | 17 | public StellarConfigScreen(GuiScreen parentScreen) { 18 | super(parentScreen, getConfigElement(), StellarSkyReferences.MODID, false, false, "Stellar Sky"); 19 | } 20 | 21 | private static List getConfigElement() { 22 | Configuration config = StellarSky.INSTANCE.getCelestialConfigManager().getConfig(); 23 | 24 | List retList = Lists.newArrayList(); 25 | for(String category : config.getCategoryNames()) 26 | if(!category.contains(Configuration.CATEGORY_SPLITTER)) 27 | retList.add(new ConfigElement(config.getCategory(category))); 28 | return retList; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/stellarium/common/DimensionSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.common; 2 | 3 | import net.minecraftforge.common.config.Configuration; 4 | import stellarapi.api.lib.config.HierarchicalConfig; 5 | import stellarapi.api.world.worldset.WorldSet; 6 | import stellarapi.api.world.worldset.WorldSets; 7 | import stellarium.world.PerDimensionSettings; 8 | 9 | public class DimensionSettings extends HierarchicalConfig { 10 | @Override 11 | public void setupConfig(Configuration config, String category) { 12 | config.setCategoryComment(category, "Configurations for Dimension Settings."); 13 | config.setCategoryLanguageKey(category, "config.category.dimension"); 14 | config.setCategoryRequiresWorldRestart(category, true); 15 | 16 | for(WorldSet worldSet : WorldSets.getAllWorldSets()) { 17 | if(worldSet.hasSky().isFalse) 18 | continue; 19 | 20 | if(!this.hasSubConfig(worldSet.name)) 21 | this.putSubConfig(worldSet.name, new PerDimensionSettings(worldSet)); 22 | } 23 | 24 | config.getCategory(category).remove("the end"); 25 | config.getCategory(category).remove("Applied_Dimensions"); 26 | super.setupConfig(config, category); 27 | } 28 | 29 | @Override 30 | public void loadFromConfig(Configuration config, String category) { 31 | super.loadFromConfig(config, category); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/postprocess/linear_to_srgb.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D texture; 4 | 5 | vec4 encode(vec4 color) 6 | { 7 | vec4 vEncoded; 8 | float maxComponent = max(max(color.r, color.g), color.b ); 9 | float fExp = ceil( log2(maxComponent) ); 10 | vEncoded = color / exp2(fExp); 11 | vEncoded.a = (fExp + 128) / 255; 12 | return vEncoded; 13 | } 14 | 15 | vec4 decode(vec4 rgbe) 16 | { 17 | vec4 vDecoded; 18 | float fExp = rgbe.a * 255 - 128; 19 | vDecoded = rgbe * exp2(fExp); 20 | return vDecoded; 21 | } 22 | /* 23 | float sRGB(float x) { 24 | // Complex calculation which is 'right' 25 | if (x <= 0.00031308) 26 | return 12.92 * x; 27 | else 28 | return 1.055 * pow(x, (1.0 / 2.4)) - 0.055; 29 | // Simpler Approximation 30 | //return pow(x, (1.0 / 2.2)); 31 | } 32 | */ 33 | 34 | // Equation which 'works' 35 | vec3 sRGB(vec3 RGB) { 36 | vec3 S1 = sqrt(RGB); 37 | vec3 S2 = sqrt(S1); 38 | vec3 S3 = sqrt(S2); 39 | return 0.585122381 * S1 + 0.783140355 * S2 - 0.368262736 * S3; 40 | } 41 | 42 | vec4 sRGB(vec4 c) { 43 | return vec4(sRGB(c.xyz), c.w); 44 | } 45 | 46 | void main() 47 | { 48 | vec4 linear = decode(texture2D(texture, gl_TexCoord[0].st)); 49 | gl_FragColor = sRGB(linear); 50 | } -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/atmosphere/atmosphere_refraction.vsh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform float pitch; 4 | uniform float preRotated; 5 | uniform vec3 relative; 6 | 7 | void main() { 8 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 9 | 10 | // Calculates the screen coord 11 | vec3 sCoord = gl_MultiTexCoord0.xyz - vec3(0.5, 0.5, 0.0); 12 | sCoord.z = 1.0; 13 | sCoord *= relative; 14 | 15 | // Pitch up to find the world coord 16 | vec3 wCoord = vec3(sCoord); 17 | float c = cos(pitch); 18 | float s = sin(pitch); 19 | wCoord.y = sCoord.y * c + sCoord.z * s; 20 | wCoord.z = - sCoord.y * s + sCoord.z * c; 21 | 22 | // Get unrefracted position for this point and apply it 23 | float h = asin(wCoord.y / length(wCoord)); 24 | float ref = radians(1.0 / 60.0) / tan(radians(degrees(h) + 7.31/(degrees(h) + 4.4))) - preRotated; 25 | float d = atan(wCoord.x, wCoord.z); 26 | vec3 wPos = vec3(cos(h-ref) * sin(d), sin(h-ref), cos(h-ref) * cos(d)); 27 | 28 | // Pitch down to find the screen coord 29 | vec3 sPos = vec3(wPos); 30 | sPos.y = wPos.y * c - wPos.z * s; 31 | sPos.z = wPos.y * s + wPos.z * c; 32 | 33 | // De-normalize 34 | sPos = sPos / sPos.z; 35 | sPos /= relative; 36 | sPos += vec3(0.5, 0.5, 0.0); 37 | 38 | gl_TexCoord[0].xy = sPos.xy; 39 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/sync/MessageLockSync.java: -------------------------------------------------------------------------------- 1 | package stellarium.sync; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 5 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 6 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 7 | import stellarium.StellarSky; 8 | import stellarium.stellars.StellarManager; 9 | 10 | public class MessageLockSync implements IMessage { 11 | 12 | private boolean locked; 13 | 14 | public MessageLockSync() { } 15 | 16 | public MessageLockSync(boolean locked) { 17 | this.locked = locked; 18 | } 19 | 20 | @Override 21 | public void fromBytes(ByteBuf buf) { 22 | this.locked = buf.readBoolean(); 23 | } 24 | 25 | @Override 26 | public void toBytes(ByteBuf buf) { 27 | buf.writeBoolean(this.locked); 28 | } 29 | 30 | public static class MessageLockSyncHandler implements IMessageHandler { 31 | 32 | @Override 33 | public IMessage onMessage(final MessageLockSync message, MessageContext ctx) { 34 | StellarSky.PROXY.addScheduledTask(new Runnable() { 35 | @Override 36 | public void run() { 37 | StellarManager.getManager(StellarSky.PROXY.getDefWorld()).setLocked(message.locked); 38 | } 39 | }); 40 | return null; 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/util/FloatVertexFormats.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.util; 2 | 3 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 4 | import net.minecraft.client.renderer.vertex.VertexFormat; 5 | import net.minecraft.client.renderer.vertex.VertexFormatElement; 6 | 7 | public class FloatVertexFormats { 8 | public static final VertexFormat POSITION_COLOR_F = new VertexFormat(); 9 | public static final VertexFormat POSITION_TEX_COLOR_F = new VertexFormat(); 10 | public static final VertexFormat POSITION_TEX_COLOR_F_NORMAL = new VertexFormat(); 11 | 12 | public static final VertexFormatElement COLOR_4F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.COLOR, 4); 13 | 14 | static { 15 | POSITION_COLOR_F.addElement(DefaultVertexFormats.POSITION_3F); 16 | POSITION_COLOR_F.addElement(COLOR_4F); 17 | POSITION_TEX_COLOR_F.addElement(DefaultVertexFormats.POSITION_3F); 18 | POSITION_TEX_COLOR_F.addElement(DefaultVertexFormats.TEX_2F); 19 | POSITION_TEX_COLOR_F.addElement(COLOR_4F); 20 | POSITION_TEX_COLOR_F_NORMAL.addElement(DefaultVertexFormats.POSITION_3F); 21 | POSITION_TEX_COLOR_F_NORMAL.addElement(DefaultVertexFormats.TEX_2F); 22 | POSITION_TEX_COLOR_F_NORMAL.addElement(COLOR_4F); 23 | POSITION_TEX_COLOR_F_NORMAL.addElement(DefaultVertexFormats.NORMAL_3B); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/deepsky/DSObjectRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.deepsky; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.renderer.GlStateManager; 6 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 7 | import stellarium.render.stellars.access.EnumStellarPass; 8 | import stellarium.render.stellars.layer.LayerRHelper; 9 | import stellarium.stellars.render.ICelestialObjectRenderer; 10 | 11 | public enum DSObjectRenderer implements ICelestialObjectRenderer { 12 | 13 | INSTANCE; 14 | 15 | @Override 16 | public void render(DeepSkyObjectCache cache, EnumStellarPass pass, LayerRHelper info) { 17 | if(!cache.shouldRender) 18 | return; 19 | 20 | // MAYBE Searching for this should be hard objective 21 | info.bindTexture(cache.location); 22 | 23 | GlStateManager.color(cache.surfBr * 1.0f, cache.surfBr * 1.0f, cache.surfBr * 1.0f); 24 | 25 | info.builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); 26 | 27 | info.builder.pos(cache.coords[0]).tex(1, 0).endVertex(); 28 | info.builder.pos(cache.coords[1]).tex(0, 0).endVertex(); 29 | info.builder.pos(cache.coords[2]).tex(0, 1).endVertex(); 30 | info.builder.pos(cache.coords[3]).tex(1, 1).endVertex(); 31 | 32 | info.builder.finishDrawing(); 33 | info.renderer.draw(info.builder); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/stellarium/util/RenderUtil.java: -------------------------------------------------------------------------------- 1 | package stellarium.util; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.renderer.BufferBuilder; 6 | import net.minecraft.client.renderer.GlStateManager; 7 | import net.minecraft.client.renderer.Tessellator; 8 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 9 | 10 | public class RenderUtil { 11 | public static void renderFullQuad() { 12 | Tessellator tess = Tessellator.getInstance(); 13 | BufferBuilder buff = tess.getBuffer(); 14 | 15 | GlStateManager.matrixMode(GL11.GL_PROJECTION); 16 | GlStateManager.pushMatrix(); 17 | GlStateManager.loadIdentity(); 18 | GlStateManager.matrixMode(GL11.GL_MODELVIEW); 19 | GlStateManager.pushMatrix(); 20 | GlStateManager.loadIdentity(); 21 | 22 | GlStateManager.disableCull(); 23 | 24 | buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); 25 | buff.pos(-1.0, 1.0, 0.0).tex(0.0, 1.0).endVertex(); 26 | buff.pos(-1.0, -1.0, 0.0).tex(0.0, 0.0).endVertex(); 27 | buff.pos(1.0, -1.0, 0.0).tex(1.0, 0.0).endVertex(); 28 | buff.pos(1.0, 1.0, 0.0).tex(1.0, 1.0).endVertex(); 29 | tess.draw(); 30 | 31 | GlStateManager.enableCull(); 32 | 33 | GlStateManager.matrixMode(GL11.GL_PROJECTION); 34 | GlStateManager.popMatrix(); 35 | GlStateManager.matrixMode(GL11.GL_MODELVIEW); 36 | GlStateManager.popMatrix(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/lib/gui/IHierarchyElement.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.lib.gui; 2 | 3 | import java.util.List; 4 | 5 | import stellarapi.lib.gui.GuiElement; 6 | import stellarapi.lib.gui.IRenderer; 7 | 8 | public interface IHierarchyElement { 9 | 10 | public List generateChildElements(); 11 | 12 | public GuiElement generateGui(boolean isHorizontal, IRollHelper helper); 13 | 14 | public boolean hasRoll(); 15 | 16 | /** 17 | * Size of this element, specifically the main region where generated gui will be on. 18 | * Should be constant. 19 | * */ 20 | public float getSize(); 21 | 22 | /** 23 | * Size of spacing on roll, not the element itself. 24 | * */ 25 | public float rollSpacingSize(); 26 | 27 | /** Duration of rolling */ 28 | public int rollDuration(); 29 | public boolean checkSettingsChanged(); 30 | public boolean needUpdate(); 31 | 32 | /** 33 | * Setup background of the container of sub-elements. 34 | * This is only for elements with sub-elements. 35 | * */ 36 | public String setupBackground(boolean isHorizontal, IRenderer renderer); 37 | 38 | /** 39 | * Whether spacing should handle click in the element or not. 40 | * */ 41 | @Deprecated 42 | public boolean handleSpacingInElement(); 43 | 44 | public boolean updateRollOnSpacing(boolean isRolled, boolean clicked, boolean hovering); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/EnumViewMode.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock; 2 | 3 | public enum EnumViewMode { 4 | 5 | HHMM("hhmm", true, false, 135), 6 | TICK("tick", true, true, 150), 7 | AMPM("ampm", true, false, 140); 8 | 9 | private String name; 10 | private boolean showOnHUD; 11 | private boolean showTick; 12 | private int guiWidth; 13 | 14 | public static String[] names = {"hhmm", "tick", "ampm"}; 15 | 16 | EnumViewMode(String name, boolean showOnHUD, boolean showTick, int guiWidth) { 17 | this.name = name; 18 | this.showOnHUD = showOnHUD; 19 | this.showTick = showTick; 20 | this.guiWidth = guiWidth; 21 | } 22 | 23 | public String getName() { 24 | return this.name; 25 | } 26 | 27 | public boolean showOnHUD() { 28 | return this.showOnHUD; 29 | } 30 | 31 | public boolean showTick() { 32 | return this.showTick; 33 | } 34 | 35 | public int getGuiWidth() { 36 | return this.guiWidth; 37 | } 38 | 39 | public EnumViewMode nextMode() { 40 | int ordinal = this.ordinal() + 1; 41 | EnumViewMode[] values = EnumViewMode.values(); 42 | ordinal %= values.length; 43 | return values[ordinal]; 44 | } 45 | 46 | public static EnumViewMode getModeForName(String name) { 47 | for(EnumViewMode mode : EnumViewMode.values()) 48 | if(mode.name.equals(name)) 49 | return mode; 50 | return null; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/milkyway/LayerMilkyway.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.milkyway; 2 | 3 | import java.io.IOException; 4 | 5 | import net.minecraft.util.ResourceLocation; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | import stellarapi.api.celestials.EnumCollectionType; 9 | import stellarapi.api.lib.config.IConfigHandler; 10 | import stellarapi.api.lib.config.INBTConfig; 11 | import stellarium.StellarSkyReferences; 12 | import stellarium.stellars.layer.StellarCollection; 13 | import stellarium.stellars.layer.StellarLayer; 14 | import stellarium.stellars.render.ICelestialLayerRenderer; 15 | 16 | public class LayerMilkyway extends StellarLayer { 17 | public LayerMilkyway() { 18 | super(new ResourceLocation(StellarSkyReferences.MODID, "milkyway"), 19 | EnumCollectionType.DeepSkyObjects, 3); 20 | } 21 | 22 | @Override 23 | public void initializeCommon(INBTConfig config, StellarCollection container) throws IOException { 24 | Milkyway milkyway = new Milkyway(); 25 | container.loadObject("Milkyway", milkyway); 26 | container.addRenderCache(milkyway, new MilkywayRenderCache()); 27 | } 28 | 29 | @SideOnly(Side.CLIENT) 30 | @Override 31 | public ICelestialLayerRenderer getLayerRenderer() { 32 | return MilkywayLayerRenderer.INSTANCE; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/deepsky/PositionUtil.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.deepsky; 2 | 3 | import stellarium.util.math.StellarMath; 4 | 5 | public class PositionUtil { 6 | 7 | public static double getDegreeFromDMS(String dms) { 8 | double sign = dms.startsWith("-")? -1 : 1; 9 | double value = 0.0; 10 | dms.replaceAll("(-|\\+)", ""); 11 | 12 | String[] splitted = dms.split("(?<=(d|m|s))"); 13 | for(String split : splitted) { 14 | double val = StellarMath.StrtoD(split.substring(0, split.length()-1)); 15 | if(split.endsWith("d")) 16 | value += val; 17 | else if(split.endsWith("m")) 18 | value += val / 60.0; 19 | else value += val / 3600.0; 20 | } 21 | return sign * value; 22 | } 23 | 24 | public static double getDegreeFromHMS(String hms) { 25 | double sign = hms.startsWith("-")? -1 : 1; 26 | double value = 0.0; 27 | hms.replaceAll("(-|\\+)", ""); 28 | String[] splitted = hms.split("(?<=(h|m|s))"); 29 | for(String split : splitted) { 30 | double val = StellarMath.StrtoD(split.substring(0, split.length()-1)); 31 | if(split.endsWith("h")) 32 | value += val * 15.0; 33 | else if(split.endsWith("m")) 34 | value += val / 4.0; 35 | else value += val / 240.0; 36 | } 37 | return sign * value; 38 | } 39 | 40 | public static double getMagnitude(String asString) { 41 | return Double.parseDouble(asString.replaceAll("V", "")); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/stellarium/command/CommandLock.java: -------------------------------------------------------------------------------- 1 | package stellarium.command; 2 | 3 | import net.minecraft.command.CommandBase; 4 | import net.minecraft.command.CommandException; 5 | import net.minecraft.command.ICommandSender; 6 | import net.minecraft.server.MinecraftServer; 7 | import stellarium.StellarSky; 8 | import stellarium.stellars.StellarManager; 9 | 10 | public class CommandLock extends CommandBase { 11 | 12 | @Override 13 | public String getName() { 14 | return "locksky"; 15 | } 16 | 17 | @Override 18 | public int getRequiredPermissionLevel() 19 | { 20 | return 3; 21 | } 22 | 23 | @Override 24 | public boolean checkPermission(MinecraftServer server, ICommandSender sender) 25 | { 26 | if(server != null && server.isSinglePlayer()) 27 | return true; 28 | else return super.checkPermission(server, sender); 29 | } 30 | 31 | @Override 32 | public String getUsage(ICommandSender p_71518_1_) { 33 | return "stellarsky.command.lock.usage"; 34 | } 35 | 36 | @Override 37 | public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { 38 | boolean lock = true; 39 | 40 | if(args.length >= 1) 41 | lock = parseBoolean(args[0]); 42 | 43 | StellarManager manager = StellarManager.getManager(server.getEntityWorld()); 44 | manager.setLocked(lock); 45 | StellarSky.INSTANCE.getNetworkManager().sendLockInformation(lock); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/resources/assets/stellarium/shaders/atmosphere/atmosphere_single.psh: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform vec3 lightDir; // Direction vector to the light source 4 | uniform float g; // Factor g 5 | uniform vec4 rayleighFactor; 6 | uniform vec4 mieFactor; 7 | 8 | varying vec4 scatteringColor4; 9 | varying vec3 v3Direction; 10 | 11 | float getRayleighPhase(float cos2) { 12 | return 3.0 / 4.0 * (1.0 + cos2); 13 | } 14 | 15 | float powHalfThree(float x) { 16 | return x * sqrt(x); 17 | } 18 | 19 | float getMiePhase(float cos, float cos2, float g, float g2) { 20 | return 3.0 * (1.0 - g2) / (2.0 * (2.0 + g2)) * (1.0 + cos2) / powHalfThree(1.0 + g2 - 2.0 * g * cos); 21 | } 22 | 23 | vec3 linear(vec3 sRGB) { 24 | return 0.012522878 * sRGB + 25 | 0.682171111 * sRGB * sRGB + 26 | 0.305306011 * sRGB * sRGB * sRGB; 27 | } 28 | 29 | vec4 linear(vec4 sRGB) { 30 | return vec4(linear(sRGB.xyz), sRGB.w); 31 | } 32 | 33 | void main() 34 | { 35 | float fCos = dot(lightDir, v3Direction); 36 | float fCos2 = fCos * fCos; 37 | 38 | gl_FragColor = scatteringColor4 * (getRayleighPhase(fCos2) * rayleighFactor + getMiePhase(fCos, fCos2, g, g*g) * mieFactor); 39 | 40 | //vec4 fogColor = linear(gl_Fog.color); 41 | //float fogFactor = gl_FogFragCoord; 42 | //fogFactor = clamp(fogFactor, 0.0, 1.0); 43 | //gl_FragColor = mix(gl_FragColor, 220.0 * fogColor, fogFactor); 44 | 45 | gl_FragColor.a = 1.0; 46 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/StellarRI.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.multiplayer.WorldClient; 5 | import stellarapi.api.lib.math.Spmath; 6 | import stellarium.render.SkyRI; 7 | import stellarium.render.stellars.access.IDominateRenderer; 8 | import stellarium.util.MCUtil; 9 | import stellarium.view.ViewerInfo; 10 | 11 | public class StellarRI { 12 | public final Minecraft minecraft; 13 | public final WorldClient world; 14 | public final float partialTicks; 15 | 16 | public final ViewerInfo info; 17 | public final double screenSize; 18 | public final double relativeWidth, relativeHeight; 19 | private IDominateRenderer dominater; 20 | 21 | public StellarRI(SkyRI info) { 22 | this.minecraft = info.minecraft; 23 | this.world = info.world; 24 | this.partialTicks = info.partialTicks; 25 | 26 | this.info = info.info; 27 | this.screenSize = info.screenSize; 28 | 29 | this.relativeHeight = 2 * Math.tan(0.5 * 30 | Math.toRadians(MCUtil.getFOVModifier(info.minecraft.entityRenderer, info.partialTicks, true))); 31 | this.relativeWidth = (this.relativeHeight * info.minecraft.displayWidth) / info.minecraft.displayHeight; 32 | } 33 | 34 | public void setDominateRenderer(IDominateRenderer renderer) { 35 | this.dominater = renderer; 36 | } 37 | 38 | public IDominateRenderer getDominateRenderer() { 39 | return this.dominater; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/GenericSkyRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.render; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.multiplayer.WorldClient; 5 | import net.minecraft.entity.Entity; 6 | import net.minecraftforge.client.IRenderHandler; 7 | import stellarapi.api.SAPICapabilities; 8 | import stellarapi.api.view.IAtmosphereEffect; 9 | import stellarapi.api.view.ICCoordinates; 10 | import stellarapi.api.world.ICelestialWorld; 11 | import stellarium.StellarSky; 12 | import stellarium.client.ClientSettings; 13 | import stellarium.view.ViewerInfo; 14 | 15 | public class GenericSkyRenderer extends IRenderHandler { 16 | 17 | private final SkyModel model; 18 | 19 | public GenericSkyRenderer(SkyModel model) { 20 | this.model = model; 21 | } 22 | 23 | @Override 24 | public void render(float partialTicks, WorldClient world, Minecraft mc) { 25 | Entity viewer = mc.getRenderViewEntity(); 26 | 27 | ICelestialWorld cWorld = world.getCapability( 28 | SAPICapabilities.CELESTIAL_CAPABILITY, null); 29 | ICCoordinates coordinate = cWorld.getCoordinate(); 30 | IAtmosphereEffect sky = cWorld.getSkyEffect(); 31 | 32 | SkyRI info = new SkyRI(mc, world, partialTicks, 33 | new ViewerInfo(coordinate, sky, viewer, partialTicks)); 34 | 35 | ClientSettings settings = StellarSky.PROXY.getClientSettings(); 36 | SkyRenderer.INSTANCE.preRender(settings, info); 37 | SkyRenderer.INSTANCE.render(this.model, info); 38 | } 39 | 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/model/ModelMain.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.model; 2 | 3 | import java.util.Map; 4 | 5 | import com.google.common.collect.Maps; 6 | 7 | import net.minecraft.client.renderer.BufferBuilder; 8 | import net.minecraft.client.renderer.Tessellator; 9 | import net.minecraft.client.renderer.texture.TextureManager; 10 | import stellarapi.lib.gui.IRectangleBound; 11 | import stellarapi.lib.gui.IRenderModel; 12 | 13 | public class ModelMain implements IRenderModel { 14 | 15 | public static final String SEPARATOR = "\n"; 16 | 17 | private Map subModels = Maps.newHashMap(); 18 | 19 | public void addSubModel(String name, IRenderModel model) { 20 | subModels.put(name, model); 21 | } 22 | 23 | @Override 24 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 25 | BufferBuilder worldRenderer, TextureManager textureManager, float[] colors) { 26 | int index = info.lastIndexOf(SEPARATOR); 27 | if(index == -1) { 28 | if(subModels.containsKey(info)) 29 | subModels.get(info).renderModel("", totalBound, clipBound, tessellator, worldRenderer, textureManager, colors); 30 | } else if(subModels.containsKey(info.substring(0, index))) 31 | subModels.get(info.substring(0, index)).renderModel( 32 | info.substring(index+1), totalBound, clipBound, tessellator, worldRenderer, textureManager, colors); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/OverlayClockType.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock; 2 | 3 | import stellarapi.api.gui.overlay.IOverlayType; 4 | import stellarapi.api.gui.overlay.IRawHandler; 5 | import stellarapi.api.gui.pos.EnumHorizontalPos; 6 | import stellarapi.api.gui.pos.EnumVerticalPos; 7 | 8 | public class OverlayClockType implements IOverlayType { 9 | 10 | @Override 11 | public OverlayClock generateElement() { 12 | return new OverlayClock(); 13 | } 14 | 15 | @Override 16 | public ClockSettings generateSettings() { 17 | return new ClockSettings(); 18 | } 19 | 20 | @Override 21 | public String getName() { 22 | return "Clock"; 23 | } 24 | 25 | @Override 26 | public EnumHorizontalPos defaultHorizontalPos() { 27 | return EnumHorizontalPos.LEFT; 28 | } 29 | 30 | @Override 31 | public EnumVerticalPos defaultVerticalPos() { 32 | return EnumVerticalPos.UP; 33 | } 34 | 35 | 36 | @Override 37 | public boolean accepts(EnumHorizontalPos horizontal, EnumVerticalPos vertical) { 38 | return vertical == EnumVerticalPos.UP; 39 | } 40 | 41 | 42 | @Override 43 | public IRawHandler generateRawHandler() { 44 | return null; 45 | } 46 | 47 | @Override 48 | public String overlayType() { 49 | return "Time"; 50 | } 51 | 52 | @Override 53 | public boolean isUniversal() { 54 | return false; 55 | } 56 | 57 | @Override 58 | public boolean isOnMain() { 59 | return true; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/stellarium/StellarForgeEventHook.java: -------------------------------------------------------------------------------- 1 | package stellarium; 2 | 3 | import net.minecraft.world.World; 4 | import net.minecraftforge.event.AttachCapabilitiesEvent; 5 | import net.minecraftforge.fml.client.event.ConfigChangedEvent; 6 | import net.minecraftforge.fml.common.eventhandler.EventPriority; 7 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 8 | import stellarium.stellars.StellarManager; 9 | import stellarium.stellars.layer.CelestialManager; 10 | 11 | public class StellarForgeEventHook { 12 | @SubscribeEvent(priority = EventPriority.HIGHEST) 13 | public void preAttachCapabilities(AttachCapabilitiesEvent event) { 14 | World world = event.getObject(); 15 | // Check if it's initial 16 | if(!world.isRemote && world.provider.getDimension() != 0) 17 | return; 18 | 19 | // Now setup StellarManager here 20 | StellarManager manager = StellarManager.loadOrCreateManager(world); 21 | if(!world.isRemote) 22 | manager.setup(new CelestialManager(false)); 23 | // On client - load default before the packet arrives 24 | manager.handleServerWithoutMod(); 25 | if(manager.getCelestialManager() == null) 26 | manager.setup(StellarSky.PROXY.getClientCelestialManager().copyFromClient()); 27 | } 28 | 29 | @SubscribeEvent 30 | public void onSyncConfig(ConfigChangedEvent.OnConfigChangedEvent event) { 31 | if(StellarSkyReferences.MODID.equals(event.getModID())) 32 | StellarSky.INSTANCE.getCelestialConfigManager().syncFromGUI(); 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/world/landscape/LandscapeModel.java: -------------------------------------------------------------------------------- 1 | package stellarium.world.landscape; 2 | 3 | import stellarapi.api.lib.math.SpCoord; 4 | import stellarapi.api.lib.math.Vector3; 5 | import stellarium.client.ClientSettings; 6 | import stellarium.util.math.Allocator; 7 | import stellarium.world.StellarScene; 8 | 9 | public class LandscapeModel { 10 | protected Vector3[][] displayvec = null; 11 | protected int latn, longn; 12 | protected boolean rendered; 13 | 14 | public void initializeSettings(ClientSettings settings) { 15 | settings.putSubConfig(LandscapeClientSettings.KEY, new LandscapeClientSettings()); 16 | } 17 | 18 | public void updateSettings(ClientSettings settings) { 19 | if(!this.rendered) 20 | return; 21 | 22 | LandscapeClientSettings layerSettings = (LandscapeClientSettings) settings.getSubConfig(LandscapeClientSettings.KEY); 23 | this.latn = layerSettings.displayFrag; 24 | this.longn = 2*layerSettings.displayFrag; 25 | this.displayvec = Allocator.createAndInitialize(longn, latn+1); 26 | } 27 | 28 | public void dimensionLoad(StellarScene dimManager) { 29 | this.rendered = dimManager.getSettings().isLandscapeEnabled(); 30 | } 31 | 32 | public void updateCache() { 33 | if(!this.rendered) 34 | return; 35 | 36 | for(int longc=0; longc { 9 | 10 | @Override 11 | public OverlayClientSettings generateElement() { 12 | return new OverlayClientSettings(); 13 | } 14 | 15 | @Override 16 | public SettingsOverlaySettings generateSettings() { 17 | return new SettingsOverlaySettings(); 18 | } 19 | 20 | @Override 21 | public String getName() { 22 | return "Settings"; 23 | } 24 | 25 | @Override 26 | public String overlayType() { 27 | return "Configuration"; 28 | } 29 | 30 | @Override 31 | public EnumHorizontalPos defaultHorizontalPos() { 32 | return EnumHorizontalPos.LEFT; 33 | } 34 | 35 | @Override 36 | public EnumVerticalPos defaultVerticalPos() { 37 | return EnumVerticalPos.DOWN; 38 | } 39 | 40 | @Override 41 | public boolean accepts(EnumHorizontalPos horizontal, EnumVerticalPos vertical) { 42 | return horizontal == EnumHorizontalPos.LEFT; 43 | } 44 | 45 | @Override 46 | public IRawHandler generateRawHandler() { 47 | return null; 48 | } 49 | 50 | @Override 51 | public boolean isUniversal() { 52 | return false; 53 | } 54 | 55 | @Override 56 | public boolean isOnMain() { 57 | return true; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/model/ModelClick.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelClick implements IRenderModel { 14 | 15 | private static final ModelClick instance = new ModelClick(); 16 | 17 | public static ModelClick getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 22 | private ModelSimpleTextured clickedModel; 23 | 24 | public ModelClick() { 25 | this.clickedModel = new ModelSimpleTextured(StellarSkyResources.clicked); 26 | } 27 | 28 | @Override 29 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 30 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 31 | 32 | GlStateManager.pushMatrix(); 33 | if(info.contains("select")) { 34 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 35 | color[3] *= 0.15f; 36 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 37 | } 38 | GlStateManager.popMatrix(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/model/ModelScrollRegion.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.Tessellator; 5 | import net.minecraft.client.renderer.texture.TextureManager; 6 | import stellarapi.lib.gui.IRectangleBound; 7 | import stellarapi.lib.gui.IRenderModel; 8 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 10 | import stellarium.StellarSkyResources; 11 | 12 | public class ModelScrollRegion implements IRenderModel { 13 | 14 | private static final ModelScrollRegion instance = new ModelScrollRegion(); 15 | 16 | public static ModelScrollRegion getInstance() { 17 | return instance; 18 | } 19 | 20 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 21 | private ModelSimpleTextured scrollregion; 22 | 23 | public ModelScrollRegion() { 24 | this.scrollregion = new ModelSimpleTextured(StellarSkyResources.scrollregion); 25 | } 26 | 27 | @Override 28 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 29 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 30 | if(info.equals("select")) { 31 | color[3] *= 0.2f; 32 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 33 | } else if(info.equals("region")) { 34 | scrollregion.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/SettingsOverlaySettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg; 2 | 3 | import net.minecraftforge.common.config.Configuration; 4 | import stellarapi.api.gui.overlay.PerOverlaySettings; 5 | import stellarapi.api.lib.config.property.ConfigPropertyBoolean; 6 | 7 | /**Naming is somewhat screwed ={*/ 8 | public class SettingsOverlaySettings extends PerOverlaySettings { 9 | 10 | boolean isFixed = false; 11 | 12 | private ConfigPropertyBoolean propFixed; 13 | 14 | public SettingsOverlaySettings() { 15 | this.propFixed = new ConfigPropertyBoolean("Fixed", "", this.isFixed); 16 | 17 | this.addConfigProperty(this.propFixed); 18 | } 19 | 20 | @Override 21 | public void setupConfig(Configuration config, String category) { 22 | config.setCategoryComment(category, "Clock Overlay Settings."); 23 | config.setCategoryLanguageKey(category, "config.category.gui.clock"); 24 | config.setCategoryRequiresMcRestart(category, false); 25 | 26 | super.setupConfig(config, category); 27 | 28 | propFixed.setComment("Determine if client settings will be fixed on HUD or not."); 29 | propFixed.setRequiresMcRestart(false); 30 | //propFixed.setLanguageKey("config.property.gui.clock.fixed"); 31 | } 32 | 33 | @Override 34 | public void loadFromConfig(Configuration config, String category) { 35 | super.loadFromConfig(config, category); 36 | this.isFixed = propFixed.getBoolean(); 37 | } 38 | 39 | @Override 40 | public void saveToConfig(Configuration config, String category) { 41 | propFixed.setBoolean(this.isFixed); 42 | 43 | super.saveToConfig(config, category); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/util/StarColor.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.util; 2 | 3 | public enum StarColor { 4 | @Deprecated 5 | INSTANCE; 6 | 7 | public short r; 8 | public short g; 9 | public short b; 10 | 11 | StarColor(){ 12 | this.r = 255; 13 | this.g = 255; 14 | this.b = 255; 15 | } 16 | 17 | static short color[]= 18 | {155, 178, 255, 19 | 158, 181, 255, 20 | 163, 185, 255, 21 | 170, 191, 255, 22 | 178, 197, 255, 23 | 187, 204, 255, 24 | 196, 210, 255, 25 | 204, 216, 255, 26 | 211, 221, 255, 27 | 218, 226, 255, 28 | 223, 229, 255, 29 | 228, 233, 255, 30 | 233, 236, 255, 31 | 238, 239, 255, 32 | 243, 242, 255, 33 | 248, 246, 255, 34 | 254, 249, 255, 35 | 255, 249, 251, 36 | 255, 247, 245, 37 | 255, 245, 239, 38 | 255, 243, 234, 39 | 255, 241, 229, 40 | 255, 239, 224, 41 | 255, 237, 219, 42 | 255, 235, 214, 43 | 255, 233, 210, 44 | 255, 232, 206, 45 | 255, 230, 202, 46 | 255, 229, 198, 47 | 255, 227, 195, 48 | 255, 226, 191, 49 | 255, 224, 187, 50 | 255, 223, 184, 51 | 255, 221, 180, 52 | 255, 219, 176, 53 | 255, 218, 173, 54 | 255, 216, 169, 55 | 255, 214, 165, 56 | 255, 213, 161, 57 | 255, 210, 156, 58 | 255, 208, 150, 59 | 255, 204, 143, 60 | 255, 200, 133, 61 | 255, 193, 120, 62 | 255, 183, 101, 63 | 255, 169, 75, 64 | 255, 149, 35, 65 | 255, 123, 0, 66 | 255, 82, 0}; 67 | 68 | public static final StarColor getColor(double B_V){ 69 | int k = (int)((B_V+0.4)*20.0); 70 | k = Math.max(0, Math.min(48, k)); 71 | 72 | StarColor c = StarColor.INSTANCE; 73 | c.r=(short)(color[k*3]); 74 | c.g=(short)(color[k*3+1]); 75 | c.b=(short)(color[k*3+2]); 76 | 77 | return c; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/SolarSystemClientSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | import java.util.List; 4 | 5 | import com.google.common.collect.Lists; 6 | 7 | import net.minecraftforge.common.config.Configuration; 8 | import net.minecraftforge.common.config.Property; 9 | import stellarapi.api.lib.config.IConfigHandler; 10 | 11 | public class SolarSystemClientSettings implements IConfigHandler { 12 | 13 | public int imgFrac; 14 | 15 | private Property propMoonFrac; 16 | 17 | @Override 18 | public void setupConfig(Configuration config, String category) { 19 | config.setCategoryComment(category, "Configurations for solar system."); 20 | config.setCategoryLanguageKey(category, "config.category.solarsystem"); 21 | config.setCategoryRequiresWorldRestart(category, false); 22 | 23 | List propNameList = Lists.newArrayList(); 24 | 25 | propMoonFrac=config.get(category, "Moon_Fragments_Number", 16); 26 | propMoonFrac.setComment("Surfaces of Sun & Moon is drawn with fragments\n" + 27 | "Less fragments will increase FPS, but the moon will become more defective"); 28 | propMoonFrac.setRequiresMcRestart(false); 29 | propMoonFrac.setLanguageKey("config.property.client.moonfrac"); 30 | propMoonFrac.setMinValue(4).setMaxValue(64); 31 | propNameList.add(propMoonFrac.getName()); 32 | 33 | config.setCategoryPropertyOrder(category, propNameList); 34 | } 35 | 36 | @Override 37 | public void loadFromConfig(Configuration config, String category) { 38 | this.imgFrac = propMoonFrac.getInt(); 39 | } 40 | 41 | @Override 42 | public void saveToConfig(Configuration config, String category) { } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/model/ModelScrollButton.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelScrollButton implements IRenderModel { 14 | 15 | private static final ModelScrollButton instance = new ModelScrollButton(); 16 | 17 | public static ModelScrollButton getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 22 | private ModelSimpleTextured scrollbtn; 23 | 24 | public ModelScrollButton() { 25 | this.scrollbtn = new ModelSimpleTextured(StellarSkyResources.scrollbtn); 26 | } 27 | 28 | @Override 29 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 30 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 31 | GlStateManager.pushMatrix(); 32 | if(info.equals("select")) { 33 | GlStateManager.scale(0.5f, 0.5f, 0.5f); 34 | color[3] *= 0.2f; 35 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 36 | } else if(info.equals("button")) { 37 | scrollbtn.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 38 | } 39 | GlStateManager.popMatrix(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/model/ModelCfgScrollButton.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelCfgScrollButton implements IRenderModel { 14 | 15 | private static final ModelCfgScrollButton instance = new ModelCfgScrollButton(); 16 | 17 | public static ModelCfgScrollButton getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 22 | private ModelSimpleTextured scrollbtn; 23 | 24 | public ModelCfgScrollButton() { 25 | this.scrollbtn = new ModelSimpleTextured(StellarSkyResources.scrollbtn); 26 | } 27 | 28 | @Override 29 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 30 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 31 | GlStateManager.pushMatrix(); 32 | if(info.equals("select")) { 33 | GlStateManager.scale(0.5f, 0.5f, 0.5f); 34 | color[3] *= 0.2f; 35 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 36 | } else if(info.equals("button")) { 37 | scrollbtn.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 38 | } 39 | GlStateManager.popMatrix(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/stellarium/world/landscape/LandscapeClientSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.world.landscape; 2 | 3 | import java.util.List; 4 | 5 | import com.google.common.collect.Lists; 6 | 7 | import net.minecraftforge.common.config.Configuration; 8 | import net.minecraftforge.common.config.Property; 9 | import stellarapi.api.lib.config.IConfigHandler; 10 | 11 | public class LandscapeClientSettings implements IConfigHandler { 12 | 13 | public int displayFrag; 14 | 15 | private Property propDisplayFrag; 16 | 17 | public static String KEY = "landscape"; 18 | 19 | @Override 20 | public void setupConfig(Configuration config, String category) { 21 | config.setCategoryComment(category, "Configurations for Landscape."); 22 | config.setCategoryLanguageKey(category, "config.category.landscape"); 23 | config.setCategoryRequiresMcRestart(category, false); 24 | 25 | List propNameList = Lists.newArrayList(); 26 | 27 | propDisplayFrag=config.get(category, "Landscape_Fragments_Number", 16); 28 | propDisplayFrag.setComment("Number of fragments of landscape in direction of height." 29 | + "Less fragments will increase FPS, but the landscape will become more defective"); 30 | propDisplayFrag.setRequiresMcRestart(false); 31 | propDisplayFrag.setLanguageKey("config.property.landscape.fragments"); 32 | propDisplayFrag.setMinValue(4).setMaxValue(64); 33 | propNameList.add(propDisplayFrag.getName()); 34 | 35 | config.setCategoryPropertyOrder(category, propNameList); 36 | } 37 | 38 | @Override 39 | public void loadFromConfig(Configuration config, String category) { 40 | this.displayFrag = propDisplayFrag.getInt(); 41 | } 42 | 43 | @Override 44 | public void saveToConfig(Configuration config, String category) { } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/deepsky/DeepSkyTexture.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.deepsky; 2 | 3 | import com.google.gson.JsonArray; 4 | import com.google.gson.JsonObject; 5 | 6 | import net.minecraft.util.ResourceLocation; 7 | import stellarapi.api.lib.math.Vector3; 8 | 9 | public class DeepSkyTexture { 10 | 11 | private ResourceLocation textureLocation; 12 | private double width, height; 13 | private String attribution; 14 | private double brightness; 15 | 16 | public DeepSkyTexture(JsonObject textureInfo) { 17 | this.textureLocation = new ResourceLocation(textureInfo.get("location").getAsString()); 18 | JsonArray size = textureInfo.get("size").getAsJsonArray(); 19 | this.width = Math.toRadians(PositionUtil.getDegreeFromDMS(size.get(0).getAsString())); 20 | this.height = Math.toRadians(PositionUtil.getDegreeFromDMS(size.get(1).getAsString())); 21 | this.attribution = textureInfo.get("attribution").getAsString(); 22 | this.brightness = textureInfo.get("brightness").getAsDouble(); 23 | // TODO Texture sRGB -> linear conversion 24 | } 25 | 26 | public void fill(Vector3 center, Vector3 dirWidth, Vector3 dirHeight, Vector3[] points) { 27 | dirWidth.scale(this.width); 28 | dirHeight.scale(this.height); 29 | points[0].set(center).add(dirWidth).add(dirHeight); //1,0 30 | points[1].set(center).sub(dirWidth).add(dirHeight); //0,0 31 | points[2].set(center).sub(dirWidth).sub(dirHeight); //0,1 32 | points[3].set(center).add(dirWidth).sub(dirHeight); //1,1 33 | } 34 | 35 | public ResourceLocation getTextureLocation() { 36 | return this.textureLocation; 37 | } 38 | 39 | /** 40 | * Equivalent angular size in (rad)^2 41 | * */ 42 | public double equivalentSize() { 43 | // Applies sRGB -> linear correction 44 | return this.width * this.height * Math.pow(this.brightness, 2.2); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/stellarium/IProxy.java: -------------------------------------------------------------------------------- 1 | package stellarium; 2 | 3 | import java.io.IOException; 4 | 5 | import net.minecraft.entity.Entity; 6 | import net.minecraft.world.World; 7 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 8 | import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; 9 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 10 | import stellarapi.api.lib.config.ConfigManager; 11 | import stellarapi.api.lib.config.HierarchicalConfig; 12 | import stellarapi.api.render.IAdaptiveRenderer; 13 | import stellarapi.api.world.worldset.WorldSet; 14 | import stellarium.client.ClientSettings; 15 | import stellarium.common.ServerSettings; 16 | import stellarium.stellars.StellarManager; 17 | import stellarium.stellars.layer.CelestialManager; 18 | import stellarium.world.StellarScene; 19 | 20 | public interface IProxy { 21 | 22 | public void preInit(FMLPreInitializationEvent event); 23 | 24 | public void load(FMLInitializationEvent event) throws IOException; 25 | 26 | public void postInit(FMLPostInitializationEvent event); 27 | 28 | public World getDefWorld(); 29 | public Entity getDefViewerEntity(); 30 | 31 | public void setupCelestialConfigManager(ConfigManager manager); 32 | 33 | public ClientSettings getClientSettings(); 34 | public ServerSettings getServerSettings(); 35 | public HierarchicalConfig getDimensionSettings(); 36 | 37 | public CelestialManager getClientCelestialManager(); 38 | 39 | public IAdaptiveRenderer setupSkyRenderer(World world, WorldSet worldSet, String option); 40 | 41 | public void updateTick(); 42 | 43 | public void addScheduledTask(Runnable runnable); 44 | public float getScreenWidth(); 45 | 46 | public void setupStellarLoad(StellarManager manager); 47 | public void setupDimensionLoad(StellarScene dimManager); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/star/StarRenderCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.star; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarapi.api.lib.config.IConfigHandler; 6 | import stellarapi.api.lib.math.SpCoord; 7 | import stellarapi.api.lib.math.Vector3; 8 | import stellarium.client.ClientSettings; 9 | import stellarium.render.stellars.layer.IObjRenderCache; 10 | import stellarium.render.stellars.layer.LayerRHelper; 11 | import stellarium.stellars.OpticsHelper; 12 | import stellarium.stellars.render.ICelestialObjectRenderer; 13 | import stellarium.stellars.util.StarColor; 14 | import stellarium.view.ViewerInfo; 15 | 16 | public class StarRenderCache implements IObjRenderCache { 17 | protected SpCoord appPos = new SpCoord(); 18 | protected Vector3 pos = new Vector3(); 19 | protected float red, green, blue; 20 | protected Vector3 ref = new Vector3(); 21 | 22 | @Override 23 | public void updateSettings(ClientSettings settings, IConfigHandler config, BgStar star) { } 24 | 25 | @Override 26 | public void updateCache(BgStar object, ViewerInfo info) { 27 | ref.set(object.pos); 28 | info.coordinate.getProjectionToGround().transform(this.ref); 29 | pos.set(this.ref); 30 | pos.scale(LayerRHelper.DEEP_DEPTH); 31 | 32 | // TODO AA Mark object size to some buffer 33 | StarColor starColor = StarColor.getColor(object.B_V); 34 | 35 | double alpha = OpticsHelper.getBrightnessFromMag(OpticsHelper.turbulance() + object.mag); 36 | this.red = (float) (alpha * starColor.r / 255.0); 37 | this.green = (float) (alpha * starColor.g / 255.0); 38 | this.blue = (float) (alpha * starColor.b / 255.0); 39 | } 40 | 41 | @SideOnly(Side.CLIENT) 42 | @Override 43 | public ICelestialObjectRenderer getRenderer() { 44 | return StarRenderer.INSTANCE; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/model/ModelHourFormat.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarapi.lib.gui.model.font.ModelFont; 12 | import stellarium.StellarSkyResources; 13 | 14 | public class ModelHourFormat implements IRenderModel { 15 | 16 | private static final ModelHourFormat instance = new ModelHourFormat(); 17 | 18 | public static ModelHourFormat getInstance() { 19 | return instance; 20 | } 21 | 22 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 23 | private ModelSimpleTextured clickedModel; 24 | private ModelFont font; 25 | 26 | public ModelHourFormat() { 27 | this.clickedModel = new ModelSimpleTextured(StellarSkyResources.clicked); 28 | this.font = new ModelFont(true); 29 | } 30 | 31 | @Override 32 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 33 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 34 | GlStateManager.pushMatrix(); 35 | if(info.equals("select")) { 36 | GlStateManager.scale(0.9f, 0.8f, 0.9f); 37 | color[3] *= 0.2f; 38 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 39 | } else { 40 | color[0] *= 0.8f; 41 | color[2] += 0.2f; 42 | font.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 43 | } 44 | GlStateManager.popMatrix(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/SolarSystemSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | import net.minecraftforge.common.config.Configuration; 4 | import stellarapi.api.lib.config.INBTConfig; 5 | import stellarapi.api.lib.config.SimpleNBTConfig; 6 | import stellarapi.api.lib.config.property.ConfigPropertyDouble; 7 | 8 | public class SolarSystemSettings extends SimpleNBTConfig { 9 | 10 | public ConfigPropertyDouble propMoonSize, propMoonBrightness; 11 | 12 | public SolarSystemSettings() { 13 | this.propMoonSize = new ConfigPropertyDouble("Moon_Size", "moonSize", 1.0); 14 | this.propMoonBrightness = new ConfigPropertyDouble("Moon_Brightness", "moonBrightness", 1.0); 15 | 16 | this.addConfigProperty(this.propMoonSize); 17 | this.addConfigProperty(this.propMoonBrightness); 18 | } 19 | 20 | @Override 21 | public void setupConfig(Configuration config, String category) { 22 | config.setCategoryComment(category, "Configurations for solar system."); 23 | config.setCategoryLanguageKey(category, "config.category.solarsystem"); 24 | config.setCategoryRequiresWorldRestart(category, true); 25 | 26 | super.setupConfig(config, category); 27 | 28 | propMoonSize.setComment("Size of moon. (Default size is 1.0)\n" 29 | + "Note that the default size is 4 times bigger than realistic size."); 30 | propMoonSize.setRequiresWorldRestart(true); 31 | propMoonSize.setLanguageKey("config.property.server.moonsize"); 32 | 33 | propMoonBrightness.setComment("Brightness of moon. (Default brightness is 1.0)"); 34 | propMoonBrightness.setRequiresWorldRestart(true); 35 | propMoonBrightness.setLanguageKey("config.property.server.moonbrightness"); 36 | } 37 | 38 | @Override 39 | public INBTConfig copy() { 40 | SolarSystemSettings settings = new SolarSystemSettings(); 41 | super.applyCopy(settings); 42 | return settings; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/PlanetRenderCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarapi.api.lib.config.IConfigHandler; 6 | import stellarapi.api.lib.math.SpCoord; 7 | import stellarapi.api.lib.math.Vector3; 8 | import stellarium.client.ClientSettings; 9 | import stellarium.render.stellars.layer.IObjRenderCache; 10 | import stellarium.render.stellars.layer.LayerRHelper; 11 | import stellarium.stellars.OpticsHelper; 12 | import stellarium.stellars.render.ICelestialObjectRenderer; 13 | import stellarium.view.ViewerInfo; 14 | 15 | public class PlanetRenderCache implements IObjRenderCache { 16 | 17 | protected boolean shouldRender, shouldRenderSurface; 18 | protected SpCoord appCoord = new SpCoord(); 19 | protected Vector3 pos = new Vector3(); 20 | protected float brightness; 21 | protected float size; 22 | 23 | @Override 24 | public void updateSettings(ClientSettings settings, IConfigHandler specificSettings, Planet object) { 25 | 26 | } 27 | 28 | @Override 29 | public void updateCache(Planet object, ViewerInfo info) { 30 | pos.set(object.earthPos); 31 | info.coordinate.getProjectionToGround().transform(this.pos); 32 | pos.normalize(); 33 | pos.scale(LayerRHelper.DEEP_DEPTH); 34 | 35 | // TODO Calculation fix, venus shouldn't be as high as -5.7 mag 36 | this.brightness = OpticsHelper.getBrightnessFromMag(object.currentMag); 37 | 38 | this.size = (float) (object.radius / object.earthPos.size()); 39 | 40 | this.shouldRender = true; 41 | this.shouldRenderSurface = this.shouldRender && false; 42 | // MAYBE planet rendering, which needs over 100x multiplier 43 | this.brightness *= 0.5f; 44 | } 45 | 46 | @SideOnly(Side.CLIENT) 47 | @Override 48 | public ICelestialObjectRenderer getRenderer() { 49 | return PlanetRenderer.INSTANCE; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/DisplayRegistry.java: -------------------------------------------------------------------------------- 1 | package stellarium.display; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | 5 | import stellarapi.api.lib.config.SimpleHierarchicalConfig; 6 | import stellarium.client.ClientSettings; 7 | import stellarium.display.ecgrid.EcGridType; 8 | import stellarium.display.eqgrid.EqGridType; 9 | import stellarium.display.horgrid.HorGridType; 10 | 11 | public class DisplayRegistry { 12 | 13 | private static final DisplayRegistry instance = new DisplayRegistry(); 14 | 15 | public static DisplayRegistry getInstance() { 16 | return instance; 17 | } 18 | 19 | static { 20 | // MAYBE Interaction with existing objects 21 | instance.register(new HorGridType()); 22 | instance.register(new EqGridType()); 23 | instance.register(new EcGridType()); 24 | } 25 | 26 | private ImmutableList.Builder builder = ImmutableList.builder(); 27 | 28 | public > 29 | void register(IDisplayElementType type) { 30 | builder.add(new RegistryDelegate(type)); 31 | } 32 | 33 | public void setupDisplay(ClientSettings settings, IDisplayInjectable injectable) { 34 | SimpleHierarchicalConfig displaySettings = injectable.getSubSettings(settings); 35 | for(RegistryDelegate delegate : builder.build()) 36 | delegate.inject(displaySettings, injectable); 37 | } 38 | 39 | private static class RegistryDelegate> { 40 | private RegistryDelegate(IDisplayElementType input) { 41 | this.type = input; 42 | } 43 | 44 | private IDisplayElementType type; 45 | 46 | public void inject(SimpleHierarchicalConfig settings, IDisplayInjectable injectable) { 47 | Cfg perDisplay = type.generateSettings(); 48 | settings.putSubConfig(type.getName(), perDisplay); 49 | injectable.injectDisplay(this.type, perDisplay); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/layer/StellarLayer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.layer; 2 | 3 | import java.io.IOException; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | import java.util.Set; 7 | 8 | import net.minecraft.util.ResourceLocation; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | import stellarapi.api.celestials.CelestialObject; 12 | import stellarapi.api.celestials.EnumCollectionType; 13 | import stellarapi.api.lib.config.IConfigHandler; 14 | import stellarapi.api.lib.config.INBTConfig; 15 | import stellarapi.api.observe.SearchRegion; 16 | import stellarium.stellars.render.ICelestialLayerRenderer; 17 | 18 | public class StellarLayer { 19 | final ResourceLocation name; 20 | final EnumCollectionType type; 21 | final int searchOrder; 22 | 23 | public StellarLayer(ResourceLocation nameIn, EnumCollectionType typeIn, int order) { 24 | this.name = nameIn; 25 | this.type = typeIn; 26 | this.searchOrder = order; 27 | } 28 | 29 | public void initializeClient(L config, StellarCollection container) throws IOException { } 30 | public void initializeCommon(M config, StellarCollection container) throws IOException { } 31 | public void updateLayer(StellarCollection container, double currentYear) { } 32 | 33 | public Set findIn(StellarCollection container, SearchRegion region, float efficiency, float multPower) { 34 | return Collections.emptySet(); 35 | } 36 | 37 | 38 | /** 39 | * Gets layer renderer, which should be static. 40 | * */ 41 | @SideOnly(Side.CLIENT) 42 | public ICelestialLayerRenderer getLayerRenderer() { return null; } 43 | 44 | public Collection getSuns(StellarCollection container) { return Collections.emptySet(); } 45 | public Collection getMoons(StellarCollection container) { return Collections.emptySet(); } 46 | 47 | public void initialUpdate(StellarCollection container) { } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/stellars/phased/StellarRenderModel.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.stellars.phased; 2 | 3 | import java.util.List; 4 | 5 | import com.google.common.collect.Lists; 6 | 7 | import net.minecraft.world.World; 8 | import stellarium.client.ClientSettings; 9 | import stellarium.render.stellars.access.ICheckedAtmModel; 10 | import stellarium.render.stellars.layer.StellarLayerModel; 11 | import stellarium.stellars.StellarManager; 12 | import stellarium.stellars.layer.CelestialManager; 13 | import stellarium.stellars.layer.StellarLayerRegistry; 14 | import stellarium.stellars.layer.StellarCollection; 15 | import stellarium.view.ViewerInfo; 16 | import stellarium.world.StellarScene; 17 | 18 | public class StellarRenderModel { 19 | //Models for client-only layered objects. 20 | private List baseModels = Lists.newArrayList(); 21 | 22 | //Models for in-game objects. 23 | List layerModels = Lists.newArrayList(); 24 | 25 | public StellarRenderModel(CelestialManager celManager, ICheckedAtmModel atmModel) { 26 | for(StellarCollection layer : celManager.getLayers()) { 27 | StellarLayerModel layerModel = new StellarLayerModel(layer); 28 | baseModels.add(layerModel); 29 | } 30 | } 31 | 32 | public void initializeSettings(ClientSettings settings) { 33 | StellarLayerRegistry.getInstance().composeSettings(settings); 34 | } 35 | 36 | public void updateSettings(ClientSettings settings) { 37 | for(StellarLayerModel model : this.layerModels) 38 | model.updateSettings(settings); 39 | } 40 | 41 | public void onStellarLoad(StellarManager manager) { 42 | layerModels.clear(); 43 | for(int i = 0; i < baseModels.size(); i++) { 44 | CelestialManager celestialWorld = manager.getCelestialManager(); 45 | layerModels.add(baseModels.get(i).copy(celestialWorld.getLayers().get(i))); 46 | } 47 | } 48 | 49 | public void onTick(World world, ViewerInfo update) { 50 | for(StellarLayerModel model : this.layerModels) 51 | model.onStellarTick(update); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/ClientSettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.client; 2 | 3 | import net.minecraftforge.common.config.Configuration; 4 | import stellarapi.api.lib.config.SimpleHierarchicalConfig; 5 | import stellarapi.api.lib.config.property.ConfigPropertyDouble; 6 | 7 | public class ClientSettings extends SimpleHierarchicalConfig { 8 | 9 | public float mag_Limit; 10 | 11 | private ConfigPropertyDouble propMagLimit; 12 | 13 | private boolean isDirty = false; 14 | 15 | public ClientSettings() { 16 | this.propMagLimit = new ConfigPropertyDouble("Mag_Limit", "", 4.5); 17 | 18 | this.addConfigProperty(this.propMagLimit); 19 | } 20 | 21 | @Override 22 | public void setupConfig(Configuration config, String category) { 23 | config.setCategoryComment(category, "Configurations for client modifications.\n" 24 | + "Most of them are for rendering/view."); 25 | config.setCategoryLanguageKey(category, "config.category.client"); 26 | config.setCategoryRequiresMcRestart(category, false); 27 | 28 | super.setupConfig(config, category); 29 | 30 | propMagLimit.setComment("Limit of magnitude can be seen on naked eye.\n" + 31 | "If you want to increase FPS, lower the Mag_Limit.\n" + 32 | "(Realistic = 6.5, Default = 4.5)\n" + 33 | "The lower you set it, the fewer stars you will see\n" + 34 | "but the better FPS you will get"); 35 | propMagLimit.setRequiresMcRestart(true); 36 | propMagLimit.setLanguageKey("config.property.client.maglimit"); 37 | propMagLimit.setMinValue(3.0); 38 | propMagLimit.setMaxValue(7.0); 39 | } 40 | 41 | @Override 42 | public void loadFromConfig(Configuration config, String category) { 43 | super.loadFromConfig(config, category); 44 | 45 | this.mag_Limit=(float)propMagLimit.getDouble(); 46 | this.isDirty = true; 47 | } 48 | 49 | @Override 50 | public void saveToConfig(Configuration config, String category) { 51 | super.saveToConfig(config, category); 52 | } 53 | 54 | public boolean checkDirty() { 55 | boolean flag = this.isDirty; 56 | this.isDirty = false; 57 | return flag; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/stellarium/world/landscape/LandscapeRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.world.landscape; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.renderer.GlStateManager; 6 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 7 | import stellarium.StellarSkyResources; 8 | import stellarium.render.SkyRI; 9 | import stellarium.render.stellars.layer.LayerRHelper; 10 | 11 | public enum LandscapeRenderer { 12 | INSTANCE; 13 | 14 | public void render(LandscapeModel model, SkyRI info) { 15 | if(!model.rendered) 16 | return; 17 | 18 | info.minecraft.renderEngine.bindTexture(StellarSkyResources.resourceLandscape.getLocation()); 19 | info.worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); 20 | 21 | GlStateManager.pushMatrix(); 22 | GlStateManager.scale(LayerRHelper.DEEP_DEPTH, LayerRHelper.DEEP_DEPTH, LayerRHelper.DEEP_DEPTH); 23 | 24 | for(int longc=0; longc displayList = Lists.newArrayList(); 17 | 18 | @Override 19 | public > void injectDisplay( 20 | IDisplayElementType type, Cfg settings) { 21 | displayList.add(new Delegate(type, settings)); 22 | } 23 | 24 | @Override 25 | public SimpleHierarchicalConfig getSubSettings(ClientSettings settings) { 26 | DisplayOverallSettings displaySettings = new DisplayOverallSettings(); 27 | settings.putSubConfig("Display", displaySettings); 28 | return displaySettings; 29 | } 30 | 31 | public void initializeSettings(ClientSettings settings) { 32 | DisplayRegistry.getInstance().setupDisplay(settings, this); 33 | } 34 | 35 | public void updateSettings(ClientSettings settings) { 36 | for(Delegate delegate : this.displayList) 37 | delegate.cache.initialize(settings, delegate.settings); 38 | } 39 | 40 | public void stellarLoad(StellarManager manager) { } 41 | 42 | public void dimensionLoad(StellarScene dimManager) { } 43 | 44 | public void onTick(World world, ViewerInfo update) { 45 | DisplayCacheInfo info = new DisplayCacheInfo(update.coordinate, update.sky); 46 | for(Delegate delegate : this.displayList) 47 | delegate.cache.updateCache(info); 48 | } 49 | 50 | static class Delegate> { 51 | public Delegate(IDisplayElementType type, Cfg settings) { 52 | this.type = type; 53 | this.settings = settings; 54 | this.cache = type.generateCache(); 55 | this.renderer = type.getRenderer(); 56 | } 57 | 58 | private IDisplayElementType type; 59 | Cache cache; 60 | private Cfg settings; 61 | IDisplayRenderer renderer; 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/milkyway/MilkywayRenderCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.milkyway; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarapi.api.lib.math.Matrix3; 6 | import stellarapi.api.lib.math.SpCoord; 7 | import stellarapi.api.lib.math.Vector3; 8 | import stellarium.client.ClientSettings; 9 | import stellarium.render.stellars.layer.IObjRenderCache; 10 | import stellarium.stellars.OpticsHelper; 11 | import stellarium.stellars.render.ICelestialObjectRenderer; 12 | import stellarium.util.math.Allocator; 13 | import stellarium.view.ViewerInfo; 14 | 15 | public class MilkywayRenderCache implements IObjRenderCache { 16 | 17 | //Zero-time axial tilt 18 | public static final double e=0.4090926; 19 | public static final Matrix3 EqtoEc = new Matrix3(); 20 | 21 | static { 22 | EqtoEc.setAsRotation(1.0, 0.0, 0.0, -e); 23 | } 24 | 25 | protected Vector3[][] milkywayNormal; 26 | protected int latn, longn; 27 | protected double[] color = new double[3]; 28 | protected float surfBr; 29 | protected boolean rendered; 30 | private Vector3 buffer = new Vector3(); 31 | 32 | @Override 33 | public void updateSettings(ClientSettings settings, MilkywaySettings specificSettings, Milkyway dummy) { 34 | this.latn = specificSettings.imgFracMilkyway; 35 | this.longn = 2*specificSettings.imgFracMilkyway; 36 | this.milkywayNormal = Allocator.createAndInitialize(longn, latn+1); 37 | this.surfBr = specificSettings.brightness * OpticsHelper.getBrightnessFromMag(4.5); 38 | } 39 | 40 | @Override 41 | public void updateCache(Milkyway object, ViewerInfo info) { 42 | for(int longc=0; longc { 21 | private StellarCollection container; 22 | 23 | private List> caches = new ArrayList<>(); 24 | 25 | public StellarLayerModel(StellarCollection container) { 26 | this.container = container; 27 | container.bindRenderModel(this); 28 | } 29 | 30 | public StellarLayer getLayerType() { 31 | return container.getType(); 32 | } 33 | 34 | public void addRenderCache(Obj object, IObjRenderCache renderCache) { 35 | Validate.notNull(object); 36 | Validate.notNull(renderCache); 37 | caches.add(Pair.of(object, renderCache)); 38 | } 39 | 40 | public void updateSettings(ClientSettings settings) { 41 | for(Map.Entry entry : this.caches) 42 | entry.getValue().updateSettings(settings, this.getSubSettings(settings), entry.getKey()); 43 | } 44 | 45 | public void onStellarTick(ViewerInfo update) { 46 | for(Map.Entry entry : this.caches) 47 | entry.getValue().updateCache(entry.getKey(), update); 48 | } 49 | 50 | public Iterable> getRenderCaches() { 51 | return this.caches; 52 | } 53 | 54 | private IConfigHandler getSubSettings(ClientSettings settings) { 55 | return settings.getSubConfig(container.getConfigName()); 56 | } 57 | 58 | public StellarLayerModel copy(StellarCollection copied) { 59 | StellarLayerModel model = new StellarLayerModel(copied); 60 | model.caches = Lists.newArrayList(this.caches); 61 | return model; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/model/ModelLockButton.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelLockButton implements IRenderModel { 14 | 15 | private static final ModelLockButton instance = new ModelLockButton(); 16 | 17 | public static ModelLockButton getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 22 | private ModelSimpleTextured clickedModel; 23 | private ModelSimpleTextured lockTextureModel, unlockTextureModel; 24 | 25 | public ModelLockButton() { 26 | this.clickedModel = new ModelSimpleTextured(StellarSkyResources.clicked); 27 | this.lockTextureModel = new ModelSimpleTextured(StellarSkyResources.lock); 28 | this.unlockTextureModel = new ModelSimpleTextured(StellarSkyResources.unlock); 29 | } 30 | 31 | @Override 32 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 33 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 34 | GlStateManager.pushMatrix(); 35 | if(info.equals("select")) { 36 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 37 | color[3] *= 0.2f; 38 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 39 | } else if(info.equals("locked")) { 40 | color[1] *= 0.9f; 41 | color[2] *= 0.9f; 42 | lockTextureModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 43 | } else { 44 | color[1] *= 0.9f; 45 | color[2] *= 0.9f; 46 | unlockTextureModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 47 | } 48 | GlStateManager.popMatrix(); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/model/ModelFixButton.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelFixButton implements IRenderModel { 14 | 15 | private static final ModelFixButton instance = new ModelFixButton(); 16 | 17 | public static ModelFixButton getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 22 | private ModelSimpleTextured clickedModel; 23 | private ModelSimpleTextured fixTextureModel; 24 | 25 | public ModelFixButton() { 26 | this.clickedModel = new ModelSimpleTextured(StellarSkyResources.clicked); 27 | this.fixTextureModel = new ModelSimpleTextured(StellarSkyResources.fix); 28 | } 29 | 30 | @Override 31 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 32 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 33 | GlStateManager.pushMatrix(); 34 | if(info.equals("select")) { 35 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 36 | color[3] *= 0.2f; 37 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 38 | } else if(info.equals("fixed")) { 39 | clickedModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 40 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 41 | fixTextureModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 42 | } else { 43 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 44 | GlStateManager.rotate(-90.0f, 0.0f, 0.0f, 1.0f); 45 | fixTextureModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 46 | } 47 | GlStateManager.popMatrix(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/model/ModelCfgFixButton.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelCfgFixButton implements IRenderModel { 14 | 15 | private static final ModelCfgFixButton INSTANCE = new ModelCfgFixButton(); 16 | 17 | public static ModelCfgFixButton getInstance() { 18 | return INSTANCE; 19 | } 20 | 21 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 22 | private ModelSimpleTextured clickedModel; 23 | private ModelSimpleTextured fixTextureModel; 24 | 25 | public ModelCfgFixButton() { 26 | this.clickedModel = new ModelSimpleTextured(StellarSkyResources.clicked); 27 | this.fixTextureModel = new ModelSimpleTextured(StellarSkyResources.fix); 28 | } 29 | 30 | @Override 31 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 32 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 33 | GlStateManager.pushMatrix(); 34 | if(info.equals("select")) { 35 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 36 | color[3] *= 0.2f; 37 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 38 | } else if(info.equals("fixed")) { 39 | clickedModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 40 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 41 | fixTextureModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 42 | } else { 43 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 44 | GlStateManager.rotate(-90.0f, 0.0f, 0.0f, 1.0f); 45 | fixTextureModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 46 | } 47 | GlStateManager.popMatrix(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/SkyModel.java: -------------------------------------------------------------------------------- 1 | package stellarium.render; 2 | 3 | import net.minecraft.world.World; 4 | import stellarium.client.ClientSettings; 5 | import stellarium.display.DisplayModel; 6 | import stellarium.render.stellars.StellarModel; 7 | import stellarium.stellars.StellarManager; 8 | import stellarium.stellars.layer.CelestialManager; 9 | import stellarium.util.OpenGlUtil; 10 | import stellarium.view.ViewerInfo; 11 | import stellarium.world.StellarScene; 12 | import stellarium.world.landscape.LandscapeModel; 13 | 14 | public class SkyModel { 15 | 16 | final StellarModel stellarModel; 17 | final DisplayModel displayModel; 18 | final LandscapeModel landscapeModel; 19 | 20 | public SkyModel(CelestialManager clientCelestialManager) { 21 | if(!OpenGlUtil.FRAMEBUFFER_SUPPORTED) 22 | System.err.println("FBO isn't supported, Stellar Sky can't operate in this case."); 23 | 24 | this.stellarModel = new StellarModel(clientCelestialManager); 25 | this.displayModel = new DisplayModel(); 26 | this.landscapeModel = new LandscapeModel(); 27 | } 28 | 29 | public void initializeSettings(ClientSettings settings) { 30 | stellarModel.initializeSettings(settings); 31 | displayModel.initializeSettings(settings); 32 | landscapeModel.initializeSettings(settings); 33 | } 34 | 35 | public void updateSettings(ClientSettings settings) { 36 | stellarModel.updateSettings(settings); 37 | displayModel.updateSettings(settings); 38 | landscapeModel.updateSettings(settings); 39 | } 40 | 41 | /** 42 | * Called directly after the celestial manager is evaluated, 43 | * to initialize the state of render models. 44 | * */ 45 | public void stellarLoad(StellarManager manager) { 46 | stellarModel.stellarLoad(manager); 47 | displayModel.stellarLoad(manager); 48 | } 49 | 50 | /** 51 | * Called directly after all the collections are collected, 52 | * to initialize the state of render models. 53 | * */ 54 | public void dimensionLoad(StellarScene dimManager) { 55 | stellarModel.dimensionLoad(dimManager); 56 | displayModel.dimensionLoad(dimManager); 57 | landscapeModel.dimensionLoad(dimManager); 58 | } 59 | 60 | public void onTick(World world, ViewerInfo update) { 61 | stellarModel.onTick(world, update); 62 | displayModel.onTick(world, update); 63 | landscapeModel.updateCache(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/milkyway/MilkywaySettings.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.milkyway; 2 | 3 | import java.util.List; 4 | 5 | import com.google.common.collect.Lists; 6 | 7 | import net.minecraftforge.common.config.Configuration; 8 | import net.minecraftforge.common.config.Property; 9 | import stellarapi.api.lib.config.IConfigHandler; 10 | 11 | public class MilkywaySettings implements IConfigHandler { 12 | 13 | public float brightness; 14 | public int imgFracMilkyway; 15 | 16 | private Property propMilkywayFrac, propMilkywayBrightness; 17 | 18 | @Override 19 | public void setupConfig(Configuration config, String category) { 20 | config.setCategoryComment(category, "Configurations for milky way."); 21 | config.setCategoryLanguageKey(category, "config.category.milkyway"); 22 | config.setCategoryRequiresMcRestart(category, false); 23 | 24 | List propNameList = Lists.newArrayList(); 25 | 26 | propMilkywayBrightness=config.get(category, "Milkyway_Brightness", 1.0); 27 | propMilkywayBrightness.setComment("Brightness of milky way.\n" 28 | + "For real world it should be much lower than 1.0, but default is set to 1.0 for visual effect."); 29 | propMilkywayBrightness.setRequiresMcRestart(false); 30 | propMilkywayBrightness.setLanguageKey("config.property.client.milkywaybrightness"); 31 | propMilkywayBrightness.setMinValue(0.0).setMaxValue(5.0); 32 | propNameList.add(propMilkywayBrightness.getName()); 33 | 34 | propMilkywayFrac=config.get(category, "Milkyway_Fragments_Number", 16); 35 | propMilkywayFrac.setComment("Milky way is drawn with fragments\n" + 36 | "Less fragments will increase FPS, but the milky way will become more defective"); 37 | 38 | propMilkywayFrac.setRequiresMcRestart(false); 39 | propMilkywayFrac.setLanguageKey("config.property.client.milkywayfrac"); 40 | propMilkywayFrac.setMinValue(4).setMaxValue(64); 41 | propNameList.add(propMilkywayFrac.getName()); 42 | 43 | config.setCategoryPropertyOrder(category, propNameList); 44 | } 45 | 46 | @Override 47 | public void loadFromConfig(Configuration config, String category) { 48 | this.brightness = (float) propMilkywayBrightness.getDouble(); 49 | this.imgFracMilkyway = propMilkywayFrac.getInt(); 50 | } 51 | 52 | @Override 53 | public void saveToConfig(Configuration config, String category) { } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/model/ModelBackground.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.Tessellator; 5 | import net.minecraft.client.renderer.texture.TextureManager; 6 | import stellarapi.lib.gui.IRectangleBound; 7 | import stellarapi.lib.gui.IRenderModel; 8 | import stellarapi.lib.gui.RectangleBound; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleTexturedTransformed; 10 | import stellarapi.lib.gui.model.basic.SimpleBoundTransformer; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelBackground implements IRenderModel { 14 | 15 | private static final ModelBackground instance = new ModelBackground(); 16 | 17 | public static ModelBackground getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleTexturedTransformed parallel; 22 | 23 | private RectangleBound temporal = new RectangleBound(0,0,0,0); 24 | private RectangleBound temporalClip = new RectangleBound(0,0,0,0); 25 | 26 | private SimpleBoundTransformer transformer = new SimpleBoundTransformer(); 27 | 28 | public ModelBackground() { 29 | this.parallel = new ModelSimpleTexturedTransformed(StellarSkyResources.background); 30 | } 31 | 32 | /** 33 | * @param info the direction of unrolling. 34 | * */ 35 | @Override 36 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 37 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 38 | if(info.equals("down") || info.equals("up")) { 39 | if(info.equals("down")) { 40 | parallel.setTransformer(transformer.setRotated()); 41 | } else { 42 | parallel.setTransformer(transformer.setRotated().setReflectedY()); 43 | } 44 | 45 | parallel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 46 | } else if(info.equals("right") || info.equals("left")) { 47 | if(info.equals("left")) { 48 | parallel.setTransformer(transformer.setReflectedX()); 49 | } else { 50 | parallel.setTransformer(this.transformer); 51 | } 52 | 53 | parallel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 54 | } 55 | 56 | transformer.reset(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/model/ModelTextShadowButton.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarapi.lib.gui.model.font.ModelFont; 12 | import stellarapi.lib.gui.model.font.TextStyle; 13 | import stellarium.StellarSkyResources; 14 | 15 | public class ModelTextShadowButton implements IRenderModel { 16 | 17 | private static final ModelTextShadowButton instance = new ModelTextShadowButton(); 18 | 19 | public static ModelTextShadowButton getInstance() { 20 | return instance; 21 | } 22 | 23 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 24 | private ModelSimpleTextured clickedModel; 25 | private ModelFont font; 26 | private TextStyle style = new TextStyle(); 27 | 28 | public ModelTextShadowButton() { 29 | this.clickedModel = new ModelSimpleTextured(StellarSkyResources.clicked); 30 | this.font = new ModelFont(true); 31 | } 32 | 33 | @Override 34 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 35 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 36 | GlStateManager.pushMatrix(); 37 | if(info.equals("select")) { 38 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 39 | color[3] *= 0.2f; 40 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 41 | } else if(info.equals("shadow")) { 42 | font.setStyle(style.setShaded(true)); 43 | clickedModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 44 | font.renderModel("T", totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 45 | } else { 46 | font.setStyle(style.setShaded(false)); 47 | font.renderModel("T", totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 48 | } 49 | GlStateManager.popMatrix(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/model/ModelRowBackground.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.Tessellator; 5 | import net.minecraft.client.renderer.texture.TextureManager; 6 | import stellarapi.lib.gui.IRectangleBound; 7 | import stellarapi.lib.gui.IRenderModel; 8 | import stellarapi.lib.gui.RectangleBound; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleTexturedTransformed; 10 | import stellarapi.lib.gui.model.basic.SimpleBoundTransformer; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelRowBackground implements IRenderModel { 14 | 15 | private static final ModelRowBackground instance = new ModelRowBackground(); 16 | 17 | public static ModelRowBackground getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleTexturedTransformed parallel; 22 | 23 | private RectangleBound temporal = new RectangleBound(0,0,0,0); 24 | private RectangleBound temporalClip = new RectangleBound(0,0,0,0); 25 | 26 | private SimpleBoundTransformer transformer = new SimpleBoundTransformer(); 27 | 28 | public ModelRowBackground() { 29 | this.parallel = new ModelSimpleTexturedTransformed(StellarSkyResources.rollparallel); 30 | } 31 | 32 | /** 33 | * @param info the direction of unrolling. 34 | * */ 35 | @Override 36 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 37 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 38 | if(info.equals("down") || info.equals("up")) { 39 | if(info.equals("down")) { 40 | parallel.setTransformer(transformer); 41 | } else { 42 | parallel.setTransformer(this.transformer.setReflectedY()); 43 | } 44 | 45 | parallel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 46 | } else if(info.equals("right") || info.equals("left")) { 47 | if(info.equals("left")) { 48 | parallel.setTransformer(transformer.setRotated()); 49 | } else { 50 | parallel.setTransformer(transformer.setRotated().setReflectedX()); 51 | } 52 | 53 | parallel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 54 | } 55 | 56 | transformer.reset(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/Sun.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | import stellarapi.api.CelestialPeriod; 4 | import stellarapi.api.celestials.EnumObjectType; 5 | import stellarapi.api.lib.math.Vector3; 6 | import stellarapi.api.view.ICCoordinates; 7 | 8 | public class Sun extends SolarObject { 9 | protected double offset; 10 | private double rotation; 11 | private static final double rotationSpeed = 14.7 * 365.2422; 12 | 13 | public Sun(String name, double yearUnit) { 14 | super(name, EnumObjectType.Star, yearUnit); 15 | //Constant for sun 16 | this.currentMag=-26.74; 17 | this.setStandardMagnitude(this.currentMag); 18 | } 19 | 20 | @Override 21 | public void initialUpdate() { 22 | super.initialUpdate(); 23 | this.setAbsolutePeriod(new CelestialPeriod("Year", this.yearUnit, this.absoluteOffset())); 24 | } 25 | 26 | @Override 27 | public CelestialPeriod getHorizontalPeriod(ICCoordinates coords) { 28 | CelestialPeriod dayPeriod = coords.getPeriod(); 29 | double length = 1 / (1 / dayPeriod.getPeriodLength() - 1 / this.yearUnit); 30 | return new CelestialPeriod("Day", length, coords.calculateInitialOffset(this.initialEarthPos, length)); 31 | } 32 | 33 | @Override 34 | public void updatePre(double year) { 35 | super.updatePre(year); 36 | this.rotation = rotationSpeed * year; 37 | } 38 | 39 | @Override 40 | public Vector3 getRelativePos(double year) { 41 | return null; 42 | } 43 | 44 | @Override 45 | public void updatePost(SolarObject earth) { 46 | this.offset = earth.absoluteOffset(); 47 | } 48 | 49 | @Override 50 | protected void updateMagnitude(Vector3 earthFromSun) { } 51 | 52 | public double getMagnitude() { 53 | return this.currentMag; 54 | } 55 | 56 | @Override 57 | public double absoluteOffset() { 58 | return this.offset; 59 | } 60 | 61 | public Vector3 posLocalSun(double longitude, double latitude){ 62 | double longp = Math.toRadians(longitude + this.rotation); 63 | double lat = Math.toRadians(latitude); 64 | Vector3 result = new Vector3(0.0, 0.0, 1.0); 65 | result.scale(Math.sin(lat)); 66 | Vector3 ref = new Vector3(1.0, 0.0, 0.0); 67 | ref.scale(Math.cos(lat)*Math.cos(longp)); 68 | result.add(ref); 69 | ref = new Vector3(0.0, 1.0, 0.0); 70 | ref.scale(Math.cos(lat)*Math.sin(longp)); 71 | result.add(ref); 72 | result.scale(this.radius); 73 | return result; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/system/SunRenderCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.system; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | import stellarapi.api.lib.math.SpCoord; 6 | import stellarapi.api.lib.math.Vector3; 7 | import stellarium.client.ClientSettings; 8 | import stellarium.render.stellars.layer.IObjRenderCache; 9 | import stellarium.stellars.render.ICelestialObjectRenderer; 10 | import stellarium.util.math.Allocator; 11 | import stellarium.view.ViewerInfo; 12 | 13 | public class SunRenderCache implements IObjRenderCache { 14 | protected SpCoord appCoord = new SpCoord(); 15 | protected Vector3 appPos = new Vector3(); 16 | protected float size; 17 | protected int latn, longn; 18 | 19 | protected SpCoord cache = new SpCoord(); 20 | protected Vector3 sunPos[][]; 21 | protected Vector3 sunNormal[][]; 22 | 23 | private Vector3 buf = new Vector3(); 24 | 25 | @Override 26 | public void updateSettings(ClientSettings settings, SolarSystemClientSettings specificSettings, Sun object) { 27 | this.latn = specificSettings.imgFrac; 28 | this.longn = 2*specificSettings.imgFrac; 29 | 30 | this.sunPos = Allocator.createAndInitialize(longn, latn+1); 31 | this.sunNormal = Allocator.createAndInitialize(longn, latn+1); 32 | } 33 | 34 | @Override 35 | public void updateCache(Sun object, ViewerInfo info) { 36 | appPos.set(object.earthPos); 37 | info.coordinate.getProjectionToGround().transform(this.appPos); 38 | appPos.normalize(); 39 | 40 | this.size = (float) (object.radius / object.earthPos.size()); 41 | 42 | int latc, longc; 43 | for(longc=0; longc texture; 24 | 25 | public DeepSkyObject(String objectId, JsonObject object) throws IOException { 26 | super(objectId, new ResourceLocation(StellarSkyReferences.MODID, object.get("name").getAsString()), 27 | EnumObjectType.DeepSkyObject); 28 | this.name = object.get("name").getAsString(); 29 | this.magnitude = PositionUtil.getMagnitude(object.get("magnitude").getAsString()); 30 | this.setStandardMagnitude(this.magnitude); 31 | 32 | JsonArray size = object.get("size").getAsJsonArray(); 33 | this.width = Math.toRadians(PositionUtil.getDegreeFromDMS(size.get(0).getAsString())); 34 | this.height = Math.toRadians(PositionUtil.getDegreeFromDMS(size.get(1).getAsString())); 35 | 36 | JsonArray pos = object.get("position").getAsJsonArray(); 37 | double ra = PositionUtil.getDegreeFromHMS(pos.get(0).getAsString()); 38 | double dec = PositionUtil.getDegreeFromDMS(pos.get(1).getAsString()); 39 | this.centerPos = new SpCoord(ra, dec).getVec(); 40 | 41 | this.setPos(this.centerPos); 42 | 43 | if(object.has("textures")) 44 | this.texture = Optional.of(new DeepSkyTexture(object.get("textures").getAsJsonObject())); 45 | else this.texture = Optional.absent(); 46 | } 47 | 48 | @Override 49 | public CelestialPeriod getHorizontalPeriod(ICCoordinates coords) { 50 | return new CelestialPeriod(String.format("Day; for %s", this.name), 51 | coords.getPeriod().getPeriodLength(), 52 | coords.calculateInitialOffset(this.centerPos, coords.getPeriod().getPeriodLength())); 53 | } 54 | 55 | public Optional getTexture() { 56 | return this.texture; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clientcfg/ConfigElementSimple.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clientcfg; 2 | 3 | import java.util.List; 4 | 5 | import com.google.common.collect.Lists; 6 | 7 | import net.minecraftforge.common.config.ConfigCategory; 8 | import net.minecraftforge.common.config.Configuration; 9 | import stellarapi.lib.gui.GuiElement; 10 | import stellarapi.lib.gui.IRenderer; 11 | import stellarium.client.lib.gui.IHierarchyElement; 12 | import stellarium.client.lib.gui.IRollHelper; 13 | 14 | public class ConfigElementSimple implements IHierarchyElement { 15 | private Configuration config; 16 | private ICfgHierarchyHandler handler; 17 | private ICfgTooltipHandler tooltip; 18 | 19 | public ConfigElementSimple(Configuration config, ICfgHierarchyHandler handler, ICfgTooltipHandler tooltip) { 20 | this.config = config; 21 | this.handler = handler; 22 | this.tooltip = tooltip; 23 | } 24 | 25 | @Override 26 | public List generateChildElements() { 27 | List childs = Lists.newArrayList(); 28 | 29 | for(String name : config.getCategoryNames()) 30 | if(handler.accept(null, config.getCategory(name))) { 31 | ConfigCategory category = config.getCategory(name); 32 | childs.add(handler.generate(category, this.tooltip)); 33 | } 34 | 35 | return childs; 36 | } 37 | 38 | @Override 39 | public GuiElement generateGui(boolean isHorizontal, IRollHelper helper) { 40 | return null; 41 | } 42 | 43 | @Override 44 | public boolean hasRoll() { 45 | return false; 46 | } 47 | 48 | @Override 49 | public float getSize() { 50 | return CfgConstants.ELEMENT_SIZE; 51 | } 52 | 53 | @Override 54 | public int rollDuration() { 55 | return 0; 56 | } 57 | 58 | @Override 59 | public boolean needUpdate() { 60 | // MAYBE update handling 61 | return false; 62 | } 63 | 64 | @Override 65 | public boolean checkSettingsChanged() { 66 | return false; 67 | } 68 | 69 | @Override 70 | public String setupBackground(boolean isHorizontal, IRenderer renderer) { 71 | return handler.setupBackground(isHorizontal, renderer); 72 | } 73 | 74 | @Override 75 | public float rollSpacingSize() { 76 | return CfgConstants.SPACING; 77 | } 78 | 79 | @Override 80 | public boolean handleSpacingInElement() { 81 | return true; 82 | } 83 | 84 | @Override 85 | public boolean updateRollOnSpacing(boolean isRolled, boolean clicked, boolean hovering) { 86 | return isRolled; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/stellarium/render/util/VertexDirect.java: -------------------------------------------------------------------------------- 1 | package stellarium.render.util; 2 | 3 | import java.nio.ByteBuffer; 4 | import java.util.List; 5 | 6 | import org.lwjgl.opengl.GL11; 7 | 8 | import net.minecraft.client.renderer.BufferBuilder; 9 | import net.minecraft.client.renderer.GlStateManager; 10 | import net.minecraft.client.renderer.vertex.VertexFormat; 11 | import net.minecraft.client.renderer.vertex.VertexFormatElement; 12 | 13 | /** 14 | * Vertex non-buffer which directly draws buffer data 15 | * */ 16 | public class VertexDirect implements IVertexBuffer { 17 | private VertexFormat vertexFormat; 18 | private ByteBuffer data; 19 | private int mode, count; 20 | 21 | /** Shorthand method for uploading and drawing arrays */ 22 | public void draw(BufferBuilder builder) { 23 | this.upload(builder); 24 | this.drawArrays(); 25 | } 26 | 27 | @Override 28 | public void upload(BufferBuilder builder) { 29 | this.vertexFormat = builder.getVertexFormat(); 30 | this.data = builder.getByteBuffer(); 31 | this.mode = builder.getDrawMode(); 32 | this.count = builder.getVertexCount(); 33 | 34 | builder.reset(); 35 | } 36 | 37 | @Override 38 | public void drawArrays() { 39 | if(this.count > 0) { 40 | this.preDraw(); 41 | GlStateManager.glDrawArrays(this.mode, 0, this.count); 42 | this.postDraw(); 43 | } 44 | } 45 | 46 | @Override 47 | public void drawElements(EnumIndexType type, ByteBuffer indices) { 48 | if(this.count > 0) { 49 | this.preDraw(); 50 | indices.position(0); 51 | GL11.glDrawElements(this.mode, indices.limit() / type.size, type.type, indices); 52 | this.postDraw(); 53 | } 54 | } 55 | 56 | private void preDraw() { 57 | int stride = vertexFormat.getSize(); 58 | List list = vertexFormat.getElements(); 59 | 60 | for(int element = 0; element < list.size(); ++element) 61 | { 62 | VertexFormatElement vfElement = list.get(element); 63 | data.position(vertexFormat.getOffset(element)); 64 | 65 | vfElement.getUsage().preDraw(this.vertexFormat, element, stride, this.data); 66 | } 67 | } 68 | 69 | private void postDraw() { 70 | int stride = vertexFormat.getSize(); 71 | List list = vertexFormat.getElements(); 72 | 73 | for(int element = 0; element < list.size(); ++element) 74 | { 75 | VertexFormatElement vfElement = list.get(element); 76 | vfElement.getUsage().postDraw(this.vertexFormat, element, stride, this.data); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/stellarium/client/overlay/clock/model/ModelViewMode.java: -------------------------------------------------------------------------------- 1 | package stellarium.client.overlay.clock.model; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.client.renderer.texture.TextureManager; 7 | import stellarapi.lib.gui.IRectangleBound; 8 | import stellarapi.lib.gui.IRenderModel; 9 | import stellarapi.lib.gui.model.basic.ModelSimpleRect; 10 | import stellarapi.lib.gui.model.basic.ModelSimpleTextured; 11 | import stellarium.StellarSkyResources; 12 | 13 | public class ModelViewMode implements IRenderModel { 14 | 15 | private static final ModelViewMode instance = new ModelViewMode(); 16 | 17 | public static ModelViewMode getInstance() { 18 | return instance; 19 | } 20 | 21 | private ModelSimpleRect selectModel = ModelSimpleRect.getInstance(); 22 | private ModelSimpleTextured clickedModel; 23 | private ModelSimpleTextured hhmmModel, tickModel, ampmModel; 24 | 25 | public ModelViewMode() { 26 | this.clickedModel = new ModelSimpleTextured(StellarSkyResources.clicked); 27 | this.hhmmModel = new ModelSimpleTextured(StellarSkyResources.hhmm); 28 | this.tickModel = new ModelSimpleTextured(StellarSkyResources.tick); 29 | this.ampmModel = new ModelSimpleTextured(StellarSkyResources.ampm); 30 | } 31 | 32 | @Override 33 | public void renderModel(String info, IRectangleBound totalBound, IRectangleBound clipBound, Tessellator tessellator, 34 | BufferBuilder worldRenderer, TextureManager textureManager, float[] color) { 35 | GlStateManager.pushMatrix(); 36 | if(info.equals("select")) { 37 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 38 | color[3] *= 0.2f; 39 | selectModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 40 | } else if(info.equals("hhmm")) { 41 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 42 | hhmmModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 43 | } else if(info.equals("tick")) { 44 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 45 | tickModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 46 | } else if(info.equals("ampm")) { 47 | GlStateManager.scale(0.9f, 0.9f, 0.9f); 48 | ampmModel.renderModel(info, totalBound, clipBound, tessellator, worldRenderer, textureManager, color); 49 | } 50 | GlStateManager.popMatrix(); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/stellarium/world/NonRefractiveSkySet.java: -------------------------------------------------------------------------------- 1 | package stellarium.world; 2 | 3 | import com.google.common.collect.ImmutableMap; 4 | 5 | import stellarapi.api.lib.math.SpCoord; 6 | import stellarapi.api.optics.WaveIntensive; 7 | import stellarapi.api.optics.Wavelength; 8 | import stellarium.stellars.OpticsHelper; 9 | 10 | public class NonRefractiveSkySet implements IStellarSkySet { 11 | 12 | private boolean hideObjectsUnderHorizon; 13 | private float lightPollutionFactor, dispersionFactor, minimumSkyRenderBrightness; 14 | 15 | private WaveIntensive interpolation; 16 | 17 | public NonRefractiveSkySet(PerDimensionSettings settings) { 18 | this.hideObjectsUnderHorizon = settings.hideObjectsUnderHorizon(); 19 | this.dispersionFactor = (float) settings.getSkyDispersionRate(); 20 | this.lightPollutionFactor = (float) settings.getLightPollutionRate(); 21 | this.minimumSkyRenderBrightness = (float) settings.getMinimumSkyRenderBrightness(); 22 | 23 | double[] rates = settings.extinctionRates(); 24 | this.interpolation = new WaveIntensive( 25 | ImmutableMap.of( 26 | Wavelength.red, OpticsHelper.getMultFromMag(rates[0]), 27 | Wavelength.V, OpticsHelper.getMultFromMag(rates[1]), 28 | Wavelength.B, OpticsHelper.getMultFromMag(rates[2])) 29 | ); 30 | } 31 | 32 | @Override 33 | public void applyAtmRefraction(SpCoord coord) { } 34 | 35 | @Override 36 | public void disapplyAtmRefraction(SpCoord coord) { } 37 | 38 | @Override 39 | public float calculateAirmass(SpCoord coord) { 40 | return 0.0f; 41 | } 42 | 43 | @Override 44 | public boolean hideObjectsUnderHorizon() { 45 | return this.hideObjectsUnderHorizon; 46 | } 47 | 48 | @Override 49 | public float getAbsorptionFactor(float partialTicks) { 50 | //Assume that there is no absorption. 51 | return 0.0f; 52 | } 53 | 54 | @Override 55 | public float getDispersionFactor(Wavelength wavelength, float partialTicks) { 56 | return this.dispersionFactor; 57 | } 58 | 59 | @Override 60 | public float getExtinctionRate(Wavelength wavelength) { 61 | return (float) OpticsHelper.getMagFromMult(interpolation.apply(wavelength).doubleValue()); 62 | } 63 | 64 | @Override 65 | public float getLightPollutionFactor(Wavelength wavelength, float partialTicks) { 66 | return this.lightPollutionFactor; 67 | } 68 | 69 | @Override 70 | public double getSeeing(Wavelength wavelength) { 71 | return 0.0; 72 | } 73 | 74 | @Override 75 | public float minimumSkyRenderBrightness() { 76 | return this.minimumSkyRenderBrightness; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/stellarium/stellars/milkyway/MilkywayRenderer.java: -------------------------------------------------------------------------------- 1 | package stellarium.stellars.milkyway; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.renderer.GlStateManager; 6 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 7 | import stellarium.StellarSkyResources; 8 | import stellarium.render.stellars.access.EnumStellarPass; 9 | import stellarium.render.stellars.layer.LayerRHelper; 10 | import stellarium.stellars.render.ICelestialObjectRenderer; 11 | 12 | public enum MilkywayRenderer implements ICelestialObjectRenderer { 13 | 14 | INSTANCE; 15 | 16 | @Override 17 | public void render(MilkywayRenderCache cache, EnumStellarPass pass, LayerRHelper info) { 18 | info.bindTexture(StellarSkyResources.resourceMilkyway.getLocation()); 19 | // TODO Proper milky way texture filtering 20 | GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); 21 | GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); 22 | 23 | GlStateManager.color(cache.surfBr, cache.surfBr, cache.surfBr); 24 | 25 | info.builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); 26 | 27 | for(int longc=0; longcNUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /src/main/java/stellarium/display/horgrid/HorGridCache.java: -------------------------------------------------------------------------------- 1 | package stellarium.display.horgrid; 2 | 3 | import stellarapi.api.lib.math.SpCoord; 4 | import stellarapi.api.lib.math.Vector3; 5 | import stellarium.client.ClientSettings; 6 | import stellarium.display.DisplayCacheInfo; 7 | import stellarium.display.IDisplayCache; 8 | import stellarium.util.math.Allocator; 9 | 10 | public class HorGridCache implements IDisplayCache { 11 | 12 | private Vector3 baseColor, heightColor, azimuthColor; 13 | protected Vector3[][] displayvec = null; 14 | protected Vector3[] horizon = null; 15 | protected Vector3[][] colorvec = null; 16 | protected int latn, longn; 17 | protected boolean enabled, horizonEnabled, gridEnabled; 18 | protected float brightness; 19 | 20 | private int renderId; 21 | 22 | @Override 23 | public void initialize(ClientSettings settings, HorGridSettings specificSettings) { 24 | this.latn = specificSettings.displayFrag; 25 | this.longn = 2*specificSettings.displayFrag; 26 | this.enabled = specificSettings.displayEnabled; 27 | this.gridEnabled = specificSettings.gridEnabled; 28 | this.horizonEnabled = specificSettings.horizonEnabled; 29 | if(this.enabled) { 30 | if(this.gridEnabled) { 31 | this.displayvec = Allocator.createAndInitialize(longn, latn+1); 32 | this.colorvec = Allocator.createAndInitialize(longn, latn+1); 33 | } 34 | 35 | if(this.horizonEnabled) 36 | this.horizon = Allocator.createAndInitialize(longn); 37 | } 38 | this.brightness = (float) specificSettings.displayAlpha; 39 | this.baseColor = new Vector3(specificSettings.displayBaseColor); 40 | this.heightColor = new Vector3(specificSettings.displayHeightColor); 41 | this.azimuthColor = new Vector3(specificSettings.displayAzimuthColor); 42 | heightColor.sub(this.baseColor); 43 | azimuthColor.sub(this.baseColor); 44 | } 45 | 46 | @Override 47 | public void updateCache(DisplayCacheInfo info) { 48 | if(!this.enabled) 49 | return; 50 | 51 | for(int longc=0; longc