├── input └── game.input_binding ├── assets ├── raw │ ├── colors.psd │ └── Screen Shot 2021-03-26 at 16.37.20.png ├── fonts │ ├── slkscre.ttf │ └── slkscre.font ├── app_icons │ ├── appicon.ico │ └── appicon.icns ├── gfx │ └── particles │ │ └── stars.png └── particles │ └── stars.tilesource ├── components ├── planets │ ├── star │ │ ├── star.png │ │ ├── star_flares.png │ │ ├── star_blobs.model │ │ ├── star.model │ │ ├── star_flares.model │ │ ├── star.go │ │ ├── star_blobs.go │ │ ├── star_flares.go │ │ ├── star_blobs.material │ │ ├── star.material │ │ ├── star_flares.material │ │ ├── star.collection │ │ ├── stars.script │ │ ├── star_blobs.fp │ │ ├── star.fp │ │ └── star_flares.fp │ ├── dry_terran │ │ ├── dry_terran.png │ │ ├── dry_terran.model │ │ ├── dry_terran.go │ │ ├── dry_terran.collection │ │ ├── dry_terran.material │ │ ├── dry_terran.script │ │ └── dry_terran.fp │ ├── gas_giant │ │ ├── gas_giant_colors.png │ │ ├── gas_giant_dark_colors.png │ │ ├── ring.go │ │ ├── gas_giant.go │ │ ├── ring.model │ │ ├── gas_giant.model │ │ ├── gas_giant.collection │ │ ├── gas_giant.material │ │ ├── ring.material │ │ ├── gas_giant.script │ │ ├── ring.fp │ │ └── gas_giant.fp │ ├── ice_world │ │ ├── lakes.model │ │ ├── lakes.go │ │ ├── ice_word.collection │ │ ├── lakes.material │ │ ├── lakes.fp │ │ └── ice_world.script │ ├── rivers │ │ ├── clouds.model │ │ ├── land.model │ │ ├── land.go │ │ ├── clouds.go │ │ ├── rivers.collection │ │ ├── rivers.script │ │ ├── clouds.material │ │ ├── land_rivers.material │ │ ├── clouds.fp │ │ └── land_rivers.fp │ ├── lava_world │ │ ├── rivers.model │ │ ├── craters.model │ │ ├── planet_under.model │ │ ├── craters.go │ │ ├── rivers.go │ │ ├── planet_under.go │ │ ├── craters.material │ │ ├── lava_world.collection │ │ ├── rivers.material │ │ ├── planet_under.material │ │ ├── lava_world.script │ │ └── rivers.fp │ ├── asteroids │ │ ├── asteroid.model │ │ ├── asteroid.go │ │ ├── asteroid.collection │ │ ├── asteroid.script │ │ ├── asteroid.material │ │ └── asteroid.fp │ ├── land_masses │ │ ├── clouds.model │ │ ├── land.model │ │ ├── water.model │ │ ├── land.go │ │ ├── clouds.go │ │ ├── water.go │ │ ├── land_masses.collection │ │ ├── planet_under.material │ │ ├── land_masses.material │ │ ├── clouds.material │ │ ├── land_masses.script │ │ ├── planet_under.fp │ │ ├── land_masses.fp │ │ └── clouds.fp │ ├── gas_planet │ │ ├── gas_planet.model │ │ ├── clouds.go │ │ ├── gas_planet.go │ │ ├── gas_planet.collection │ │ ├── gas_planet.material │ │ ├── gas_planet.script │ │ └── gas_planet.fp │ ├── no_atmosphere │ │ ├── craters.model │ │ ├── planet_under.model │ │ ├── craters.go │ │ ├── planet_under.go │ │ ├── no_atmosphere.collection │ │ ├── craters.material │ │ ├── no_atmosphere.material │ │ ├── no_atmosphere.script │ │ ├── craters.fp │ │ └── no_atmosphere.fp │ └── planets.vp ├── lowrez │ ├── lowrez.model │ ├── lowrez.go │ ├── controls.material │ ├── lowrez.fp │ ├── lowrez.vp │ └── lowrez.material ├── background │ ├── background.model │ ├── background.go │ ├── background.material │ └── background.fp └── gui │ ├── field_tempalte.gui │ └── slider.gui ├── .gitignore ├── render ├── pixelplanet.render └── pixelplanet.render_script ├── graphics └── pixelplanet.texture_profiles ├── game.project ├── scripts ├── main.script ├── config.lua └── gui │ ├── settings.gui_script │ ├── slider.lua │ └── dropdown.lua ├── .gitattributes ├── README.md ├── vulkan-opengl.appmanifest ├── vulkan.appmanifest └── main └── main.collection /input/game.input_binding: -------------------------------------------------------------------------------- 1 | mouse_trigger { 2 | input: MOUSE_BUTTON_LEFT 3 | action: "touch" 4 | } 5 | -------------------------------------------------------------------------------- /assets/raw/colors.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/assets/raw/colors.psd -------------------------------------------------------------------------------- /assets/fonts/slkscre.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/assets/fonts/slkscre.ttf -------------------------------------------------------------------------------- /assets/app_icons/appicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/assets/app_icons/appicon.ico -------------------------------------------------------------------------------- /assets/app_icons/appicon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/assets/app_icons/appicon.icns -------------------------------------------------------------------------------- /assets/gfx/particles/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/assets/gfx/particles/stars.png -------------------------------------------------------------------------------- /components/planets/star/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/components/planets/star/star.png -------------------------------------------------------------------------------- /components/planets/star/star_flares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/components/planets/star/star_flares.png -------------------------------------------------------------------------------- /components/planets/dry_terran/dry_terran.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/components/planets/dry_terran/dry_terran.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.internal 2 | /build 3 | .externalToolBuilders 4 | .DS_Store 5 | Thumbs.db 6 | .lock-wscript 7 | *.pyc 8 | .project 9 | .cproject 10 | builtins -------------------------------------------------------------------------------- /assets/raw/Screen Shot 2021-03-26 at 16.37.20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/assets/raw/Screen Shot 2021-03-26 at 16.37.20.png -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/components/planets/gas_giant/gas_giant_colors.png -------------------------------------------------------------------------------- /render/pixelplanet.render: -------------------------------------------------------------------------------- 1 | script: "/render/pixelplanet.render_script" 2 | materials { 3 | name: "lowrez" 4 | material: "/components/lowrez/lowrez.material" 5 | } 6 | -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant_dark_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selimanac/defold-pixel-planets/HEAD/components/planets/gas_giant/gas_giant_dark_colors.png -------------------------------------------------------------------------------- /components/lowrez/lowrez.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad_2x2.dae" 2 | material: "/components/lowrez/lowrez.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/background/background.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/background/background.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/ice_world/lakes.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/ice_world/lakes.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/rivers/clouds.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/rivers/clouds.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/rivers/land.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/rivers/land_rivers.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/star/star_blobs.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/star/star_blobs.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/lava_world/rivers.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/lava_world/rivers.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/asteroids/asteroid.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/asteroids/asteroid.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/land_masses/clouds.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/land_masses/clouds.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/land_masses/land.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/land_masses/land_masses.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/lava_world/craters.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/lava_world/craters.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/gas_planet/gas_planet.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/gas_planet/gas_planet.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/land_masses/water.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/land_masses/planet_under.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/craters.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/no_atmosphere/craters.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/lava_world/planet_under.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/lava_world/planet_under.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/planet_under.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/no_atmosphere/no_atmosphere.material" 3 | skeleton: "" 4 | animations: "" 5 | default_animation: "" 6 | name: "unnamed" 7 | -------------------------------------------------------------------------------- /components/planets/star/star.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/star/star.material" 3 | textures: "/components/planets/star/star.png" 4 | skeleton: "" 5 | animations: "" 6 | default_animation: "" 7 | name: "unnamed" 8 | -------------------------------------------------------------------------------- /components/planets/star/star_flares.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/star/star_flares.material" 3 | textures: "/components/planets/star/star_flares.png" 4 | skeleton: "" 5 | animations: "" 6 | default_animation: "" 7 | name: "unnamed" 8 | -------------------------------------------------------------------------------- /components/lowrez/lowrez.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "lowrez" 3 | component: "/components/lowrez/lowrez.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/star/star.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "star" 3 | component: "/components/planets/star/star.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/dry_terran/dry_terran.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/dry_terran/dry_terran.material" 3 | textures: "/components/planets/dry_terran/dry_terran.png" 4 | skeleton: "" 5 | animations: "" 6 | default_animation: "" 7 | name: "unnamed" 8 | -------------------------------------------------------------------------------- /components/planets/rivers/land.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "land" 3 | component: "/components/planets/rivers/land.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/gas_giant/ring.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "ring" 3 | component: "/components/planets/gas_giant/ring.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/rivers/clouds.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "clouds" 3 | component: "/components/planets/rivers/clouds.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/background/background.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "background" 3 | component: "/components/background/background.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/ice_world/lakes.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "lakes" 3 | component: "/components/planets/ice_world/lakes.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/land_masses/land.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "land" 3 | component: "/components/planets/land_masses/land.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/land_masses/clouds.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "clouds" 3 | component: "/components/planets/land_masses/clouds.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/lava_world/craters.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "craters" 3 | component: "/components/planets/lava_world/craters.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/lava_world/rivers.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "rivers" 3 | component: "/components/planets/lava_world/rivers.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/star/star_blobs.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "star_blobs" 3 | component: "/components/planets/star/star_blobs.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/star/star_flares.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "star_flares" 3 | component: "/components/planets/star/star_flares.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/asteroids/asteroid.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "asteroid" 3 | component: "/components/planets/asteroids/asteroid.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "gas_giant" 3 | component: "/components/planets/gas_giant/gas_giant.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/gas_planet/clouds.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "clouds" 3 | component: "/components/planets/gas_planet/gas_planet.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/land_masses/water.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "planet_under" 3 | component: "/components/planets/land_masses/water.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/dry_terran/dry_terran.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "dry_terran" 3 | component: "/components/planets/dry_terran/dry_terran.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/gas_planet/gas_planet.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "gas_planet" 3 | component: "/components/planets/gas_planet/gas_planet.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/craters.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "craters" 3 | component: "/components/planets/no_atmosphere/craters.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/lava_world/planet_under.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "planet_under" 3 | component: "/components/planets/lava_world/planet_under.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/planet_under.go: -------------------------------------------------------------------------------- 1 | components { 2 | id: "planet_under" 3 | component: "/components/planets/no_atmosphere/planet_under.model" 4 | position { 5 | x: 0.0 6 | y: 0.0 7 | z: 0.0 8 | } 9 | rotation { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 1.0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/lowrez/controls.material: -------------------------------------------------------------------------------- 1 | name: "controls" 2 | tags: "controls" 3 | vertex_program: "/builtins/materials/gui.vp" 4 | fragment_program: "/builtins/materials/gui.fp" 5 | vertex_constants { 6 | name: "view_proj" 7 | type: CONSTANT_TYPE_VIEWPROJ 8 | value { 9 | x: 0.0 10 | y: 0.0 11 | z: 0.0 12 | w: 0.0 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /components/planets/gas_giant/ring.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/gas_giant/ring.material" 3 | textures: "/components/planets/gas_giant/gas_giant_colors.png" 4 | textures: "/components/planets/gas_giant/gas_giant_dark_colors.png" 5 | skeleton: "" 6 | animations: "" 7 | default_animation: "" 8 | name: "unnamed" 9 | -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant.model: -------------------------------------------------------------------------------- 1 | mesh: "/builtins/assets/meshes/quad.dae" 2 | material: "/components/planets/gas_giant/gas_giant.material" 3 | textures: "/components/planets/gas_giant/gas_giant_colors.png" 4 | textures: "/components/planets/gas_giant/gas_giant_dark_colors.png" 5 | skeleton: "" 6 | animations: "" 7 | default_animation: "" 8 | name: "unnamed" 9 | -------------------------------------------------------------------------------- /components/planets/planets.vp: -------------------------------------------------------------------------------- 1 | attribute highp vec4 position; 2 | attribute mediump vec2 texcoord0; 3 | 4 | uniform mediump mat4 mtx_worldview; 5 | uniform mediump mat4 mtx_proj; 6 | 7 | varying mediump vec2 var_texcoord0; 8 | 9 | void main() 10 | { 11 | vec4 p = mtx_worldview * vec4(position.xyz, 1.0); 12 | var_texcoord0 = texcoord0; 13 | gl_Position = mtx_proj * p; 14 | } 15 | -------------------------------------------------------------------------------- /assets/fonts/slkscre.font: -------------------------------------------------------------------------------- 1 | font: "/assets/fonts/slkscre.ttf" 2 | material: "/builtins/fonts/font.material" 3 | size: 17 4 | antialias: 0 5 | alpha: 1.0 6 | outline_alpha: 0.0 7 | outline_width: 0.0 8 | shadow_alpha: 0.0 9 | shadow_blur: 0 10 | shadow_x: 0.0 11 | shadow_y: 0.0 12 | extra_characters: "" 13 | output_format: TYPE_BITMAP 14 | all_chars: false 15 | cache_width: 0 16 | cache_height: 0 17 | render_mode: MODE_SINGLE_LAYER 18 | -------------------------------------------------------------------------------- /graphics/pixelplanet.texture_profiles: -------------------------------------------------------------------------------- 1 | path_settings { 2 | path: "**" 3 | profile: "Default" 4 | } 5 | profiles { 6 | name: "Default" 7 | platforms { 8 | os: OS_ID_GENERIC 9 | formats { 10 | format: TEXTURE_FORMAT_RGBA 11 | compression_level: BEST 12 | compression_type: COMPRESSION_TYPE_DEFAULT 13 | } 14 | mipmaps: false 15 | max_texture_size: 0 16 | premultiply_alpha: true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /components/lowrez/lowrez.fp: -------------------------------------------------------------------------------- 1 | varying mediump vec4 var_position; 2 | varying mediump vec3 var_normal; 3 | varying mediump vec2 var_texcoord0; 4 | 5 | uniform lowp sampler2D DIFFUSE_TEXTURE; 6 | uniform lowp vec4 tint; 7 | 8 | void main() 9 | { 10 | // Pre-multiply alpha since all runtime textures already are 11 | vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w); 12 | vec4 color = texture2D(DIFFUSE_TEXTURE, var_texcoord0.xy) * tint_pm; 13 | gl_FragColor = vec4(color.rgb,1.0); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /components/lowrez/lowrez.vp: -------------------------------------------------------------------------------- 1 | 2 | // positions are in world space 3 | attribute mediump vec4 position; 4 | attribute mediump vec2 texcoord0; 5 | attribute mediump vec3 normal; 6 | 7 | uniform mediump mat4 mtx_view; 8 | uniform mediump mat4 mtx_proj; 9 | uniform mediump mat4 mtx_normal; 10 | 11 | varying mediump vec4 var_position; 12 | varying mediump vec3 var_normal; 13 | varying mediump vec2 var_texcoord0; 14 | 15 | void main() 16 | { 17 | vec4 p = mtx_view * vec4(position.xyz, 1.0); 18 | var_position = p; 19 | var_texcoord0 = texcoord0; 20 | var_normal = normalize((mtx_normal * vec4(normal, 0.0)).xyz); 21 | gl_Position = mtx_proj * p; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /components/background/background.material: -------------------------------------------------------------------------------- 1 | name: "Background" 2 | tags: "background" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/background/background.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "time" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 0.0 31 | y: 0.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /components/background/background.fp: -------------------------------------------------------------------------------- 1 | 2 | 3 | varying mediump vec2 var_texcoord0; 4 | 5 | lowp vec2 offset = vec2(0.0); 6 | uniform mediump vec4 time; 7 | 8 | float rand(vec2 coord) 9 | { 10 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453); 11 | } 12 | 13 | vec2 rotate(vec2 coord, float angle) 14 | { 15 | coord -= 0.5; 16 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 17 | return coord + 0.5; 18 | } 19 | 20 | void main() 21 | { 22 | vec2 uv = rotate(var_texcoord0, time.x * 0.2); 23 | vec4 col = vec4(1.0) + rand(var_texcoord0 + vec2(time.x * 0.0000001, 0.0)) * 0.03; 24 | 25 | col = col * vec4(abs(sin(uv.x * cos(offset.x) + time.x * 0.105)), 26 | abs(sin((cos(uv.x + uv.y) + cos(offset.x + offset.y) + time.x * 0.059))), 27 | abs(cos(uv.y * sin(offset.y) + time.x * 0.0253)), 1.0); 28 | 29 | col = mix(col, vec4(0.0, 0.0, 0.0, 1.0), 0.88); 30 | 31 | gl_FragColor = col; 32 | } 33 | -------------------------------------------------------------------------------- /components/planets/asteroids/asteroid.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "asteroid" 4 | prototype: "/components/planets/asteroids/asteroid.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | embedded_instances { 24 | id: "scripts" 25 | data: "components {\n" 26 | " id: \"planet\"\n" 27 | " component: \"/components/planets/asteroids/asteroid.script\"\n" 28 | " position {\n" 29 | " x: 0.0\n" 30 | " y: 0.0\n" 31 | " z: 0.0\n" 32 | " }\n" 33 | " rotation {\n" 34 | " x: 0.0\n" 35 | " y: 0.0\n" 36 | " z: 0.0\n" 37 | " w: 1.0\n" 38 | " }\n" 39 | "}\n" 40 | "" 41 | position { 42 | x: 0.0 43 | y: 0.0 44 | z: 0.0 45 | } 46 | rotation { 47 | x: 0.0 48 | y: 0.0 49 | z: 0.0 50 | w: 1.0 51 | } 52 | scale3 { 53 | x: 1.0 54 | y: 1.0 55 | z: 1.0 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /components/planets/dry_terran/dry_terran.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "dry_terran" 4 | prototype: "/components/planets/dry_terran/dry_terran.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | scale_along_z: 0 23 | embedded_instances { 24 | id: "scripts" 25 | data: "components {\n" 26 | " id: \"dry_terran\"\n" 27 | " component: \"/components/planets/dry_terran/dry_terran.script\"\n" 28 | " position {\n" 29 | " x: 0.0\n" 30 | " y: 0.0\n" 31 | " z: 0.0\n" 32 | " }\n" 33 | " rotation {\n" 34 | " x: 0.0\n" 35 | " y: 0.0\n" 36 | " z: 0.0\n" 37 | " w: 1.0\n" 38 | " }\n" 39 | "}\n" 40 | "" 41 | position { 42 | x: 0.0 43 | y: 0.0 44 | z: 0.0 45 | } 46 | rotation { 47 | x: 0.0 48 | y: 0.0 49 | z: 0.0 50 | w: 1.0 51 | } 52 | scale3 { 53 | x: 1.0 54 | y: 1.0 55 | z: 1.0 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /components/lowrez/lowrez.material: -------------------------------------------------------------------------------- 1 | name: "lowrez" 2 | tags: "lowrez" 3 | vertex_program: "/components/lowrez/lowrez.vp" 4 | fragment_program: "/components/lowrez/lowrez.fp" 5 | vertex_space: VERTEX_SPACE_WORLD 6 | vertex_constants { 7 | name: "mtx_view" 8 | type: CONSTANT_TYPE_VIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | vertex_constants { 27 | name: "mtx_normal" 28 | type: CONSTANT_TYPE_NORMAL 29 | value { 30 | x: 0.0 31 | y: 0.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "tint" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 1.0 41 | y: 1.0 42 | z: 1.0 43 | w: 1.0 44 | } 45 | } 46 | samplers { 47 | name: "DIFFUSE_TEXTURE" 48 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 49 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 50 | filter_min: FILTER_MODE_MIN_NEAREST 51 | filter_mag: FILTER_MODE_MAG_NEAREST 52 | } 53 | -------------------------------------------------------------------------------- /components/planets/asteroids/asteroid.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | 5 | local function set_seed() 6 | go.set(planet, "generic.x", config.rseed) 7 | end 8 | 9 | local function set_pixel() 10 | go.set(planet, "transform.y", config.rpixel) 11 | end 12 | 13 | local function set_rotation() 14 | go.set(planet, "transform.z", config.rrot) 15 | end 16 | 17 | local function set_light() 18 | go.set(planet, "lights.x", config.rlight.x) 19 | go.set(planet, "lights.y", config.rlight.y) 20 | end 21 | 22 | function init(self) 23 | planet = msg.url("asteroid#asteroid") 24 | set_seed() 25 | set_pixel() 26 | set_rotation() 27 | end 28 | 29 | function on_message(self, message_id, message, sender) 30 | if message_id == config.msg.set_planet_seed then 31 | set_seed() 32 | elseif message_id == config.msg.set_planet_pixel then 33 | set_pixel() 34 | elseif message_id == config.msg.set_planet_rotation then 35 | set_rotation() 36 | elseif message_id == config.msg.set_planet_light then 37 | set_light() 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /assets/particles/stars.tilesource: -------------------------------------------------------------------------------- 1 | image: "/assets/gfx/particles/stars.png" 2 | tile_width: 9 3 | tile_height: 9 4 | tile_margin: 0 5 | tile_spacing: 0 6 | collision: "" 7 | material_tag: "tile" 8 | collision_groups: "default" 9 | animations { 10 | id: "anim" 11 | start_tile: 1 12 | end_tile: 1 13 | playback: PLAYBACK_ONCE_FORWARD 14 | fps: 1 15 | flip_horizontal: 0 16 | flip_vertical: 0 17 | } 18 | animations { 19 | id: "anim1" 20 | start_tile: 2 21 | end_tile: 2 22 | playback: PLAYBACK_ONCE_FORWARD 23 | fps: 1 24 | flip_horizontal: 0 25 | flip_vertical: 0 26 | } 27 | animations { 28 | id: "anim2" 29 | start_tile: 3 30 | end_tile: 3 31 | playback: PLAYBACK_ONCE_FORWARD 32 | fps: 1 33 | flip_horizontal: 0 34 | flip_vertical: 0 35 | } 36 | animations { 37 | id: "anim3" 38 | start_tile: 4 39 | end_tile: 4 40 | playback: PLAYBACK_ONCE_FORWARD 41 | fps: 1 42 | flip_horizontal: 0 43 | flip_vertical: 0 44 | } 45 | animations { 46 | id: "anim4" 47 | start_tile: 5 48 | end_tile: 5 49 | playback: PLAYBACK_ONCE_FORWARD 50 | fps: 1 51 | flip_horizontal: 0 52 | flip_vertical: 0 53 | } 54 | extrude_borders: 2 55 | inner_padding: 0 56 | sprite_trim_mode: SPRITE_TRIM_MODE_OFF 57 | -------------------------------------------------------------------------------- /components/planets/star/star_blobs.material: -------------------------------------------------------------------------------- 1 | name: "Star Blobs" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/star/star_blobs.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 4.93 31 | y: 200.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 3.078 41 | y: 0.0 42 | z: 0.05 43 | w: 4.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "circles" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 2.0 51 | y: 1.0 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "color" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 1.0 61 | y: 1.0 62 | z: 0.89 63 | w: 1.0 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /components/planets/star/star.material: -------------------------------------------------------------------------------- 1 | name: "Star" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/star/star.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 4.463 31 | y: 100.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 4.837 41 | y: 51.877 42 | z: 0.05 43 | w: 0.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "extras" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.0 51 | y: 0.0 52 | z: 0.0 53 | w: 1.0 54 | } 55 | } 56 | samplers { 57 | name: "colorramp" 58 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 59 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 60 | filter_min: FILTER_MODE_MIN_NEAREST 61 | filter_mag: FILTER_MODE_MAG_NEAREST 62 | } 63 | -------------------------------------------------------------------------------- /components/planets/dry_terran/dry_terran.material: -------------------------------------------------------------------------------- 1 | name: "Dry Terrain" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/dry_terran/dry_terran.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 8.0 31 | y: 100.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 1.175 41 | y: 0.0 42 | z: 0.1 43 | w: 3.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "lights" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.4 51 | y: 0.3 52 | z: 0.362 53 | w: 0.525 54 | } 55 | } 56 | samplers { 57 | name: "tex0" 58 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 59 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 60 | filter_min: FILTER_MODE_MIN_NEAREST 61 | filter_mag: FILTER_MODE_MAG_NEAREST 62 | } 63 | -------------------------------------------------------------------------------- /components/planets/rivers/rivers.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "land" 4 | prototype: "/components/planets/rivers/land.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "clouds" 24 | prototype: "/components/planets/rivers/clouds.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.1 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 100.0 38 | y: 100.0 39 | z: 1.0 40 | } 41 | } 42 | scale_along_z: 0 43 | embedded_instances { 44 | id: "scripts" 45 | data: "components {\n" 46 | " id: \"rivers\"\n" 47 | " component: \"/components/planets/rivers/rivers.script\"\n" 48 | " position {\n" 49 | " x: 0.0\n" 50 | " y: 0.0\n" 51 | " z: 0.0\n" 52 | " }\n" 53 | " rotation {\n" 54 | " x: 0.0\n" 55 | " y: 0.0\n" 56 | " z: 0.0\n" 57 | " w: 1.0\n" 58 | " }\n" 59 | "}\n" 60 | "" 61 | position { 62 | x: 0.0 63 | y: 0.0 64 | z: 0.0 65 | } 66 | rotation { 67 | x: 0.0 68 | y: 0.0 69 | z: 0.0 70 | w: 1.0 71 | } 72 | scale3 { 73 | x: 1.0 74 | y: 1.0 75 | z: 1.0 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant.collection: -------------------------------------------------------------------------------- 1 | name: "gas_giant" 2 | instances { 3 | id: "gas_giant" 4 | prototype: "/components/planets/gas_giant/gas_giant.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "ring" 24 | prototype: "/components/planets/gas_giant/ring.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.1 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 300.0 38 | y: 300.0 39 | z: 1.0 40 | } 41 | } 42 | scale_along_z: 0 43 | embedded_instances { 44 | id: "scripts" 45 | data: "components {\n" 46 | " id: \"gas_giant\"\n" 47 | " component: \"/components/planets/gas_giant/gas_giant.script\"\n" 48 | " position {\n" 49 | " x: 0.0\n" 50 | " y: 0.0\n" 51 | " z: 0.0\n" 52 | " }\n" 53 | " rotation {\n" 54 | " x: 0.0\n" 55 | " y: 0.0\n" 56 | " z: 0.0\n" 57 | " w: 1.0\n" 58 | " }\n" 59 | "}\n" 60 | "" 61 | position { 62 | x: 0.0 63 | y: 0.0 64 | z: 0.0 65 | } 66 | rotation { 67 | x: 0.0 68 | y: 0.0 69 | z: 0.0 70 | w: 1.0 71 | } 72 | scale3 { 73 | x: 1.0 74 | y: 1.0 75 | z: 1.0 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /game.project: -------------------------------------------------------------------------------- 1 | [project] 2 | title = defold-pixel-planets 3 | version = 1.0 4 | dependencies = https://github.com/selimanac/defold-random/archive/master.zip 5 | bundle_exclude_resources = assets/raw 6 | developer = Selim Anac 7 | 8 | [bootstrap] 9 | main_collection = /main/main.collectionc 10 | render = /render/pixelplanet.renderc 11 | 12 | [input] 13 | game_binding = /input/game.input_bindingc 14 | use_accelerometer = 0 15 | 16 | [display] 17 | width = 640 18 | height = 360 19 | high_dpi = 0 20 | display_device_info = 1 21 | vsync = 1 22 | 23 | [script] 24 | shared_state = 1 25 | 26 | [windows] 27 | app_icon = /assets/app_icons/appicon.ico 28 | 29 | [osx] 30 | app_icon = /assets/app_icons/appicon.icns 31 | 32 | [android] 33 | input_method = HiddenInputField 34 | 35 | [physics] 36 | gravity_y = -1000.0 37 | scale = 0.01 38 | 39 | [graphics] 40 | default_texture_min_filter = nearest 41 | default_texture_mag_filter = nearest 42 | texture_profiles = /graphics/pixelplanet.texture_profiles 43 | max_debug_vertices = 100000 44 | 45 | [sprite] 46 | subpixels = 0 47 | 48 | [render] 49 | clear_color_red = 0.17 50 | clear_color_green = 0.21 51 | clear_color_blue = 0.3 52 | clear_color_alpha = 0.0 53 | 54 | [native_extension] 55 | app_manifest = /vulkan.appmanifest 56 | 57 | [shader] 58 | output_spirv = 1 59 | 60 | [profiler] 61 | track_cpu = 0 62 | 63 | [html5] 64 | scale_mode = fit 65 | cssfile = /builtins/manifests/web/dark_theme.css 66 | 67 | -------------------------------------------------------------------------------- /components/planets/gas_planet/gas_planet.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "gas_planet" 4 | prototype: "/components/planets/gas_planet/gas_planet.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "clouds" 24 | prototype: "/components/planets/gas_planet/clouds.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.1 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 100.0 38 | y: 100.0 39 | z: 1.0 40 | } 41 | } 42 | scale_along_z: 0 43 | embedded_instances { 44 | id: "scripts" 45 | data: "components {\n" 46 | " id: \"gas_planet\"\n" 47 | " component: \"/components/planets/gas_planet/gas_planet.script\"\n" 48 | " position {\n" 49 | " x: 0.0\n" 50 | " y: 0.0\n" 51 | " z: 0.0\n" 52 | " }\n" 53 | " rotation {\n" 54 | " x: 0.0\n" 55 | " y: 0.0\n" 56 | " z: 0.0\n" 57 | " w: 1.0\n" 58 | " }\n" 59 | "}\n" 60 | "" 61 | position { 62 | x: 0.0 63 | y: 0.0 64 | z: 0.0 65 | } 66 | rotation { 67 | x: 0.0 68 | y: 0.0 69 | z: 0.0 70 | w: 1.0 71 | } 72 | scale3 { 73 | x: 1.0 74 | y: 1.0 75 | z: 1.0 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/no_atmosphere.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "planet_under" 4 | prototype: "/components/planets/no_atmosphere/planet_under.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "craters" 24 | prototype: "/components/planets/no_atmosphere/craters.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.1 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 100.0 38 | y: 100.0 39 | z: 1.0 40 | } 41 | } 42 | scale_along_z: 0 43 | embedded_instances { 44 | id: "scripts" 45 | data: "components {\n" 46 | " id: \"no_atmosphere\"\n" 47 | " component: \"/components/planets/no_atmosphere/no_atmosphere.script\"\n" 48 | " position {\n" 49 | " x: 0.0\n" 50 | " y: 0.0\n" 51 | " z: 0.0\n" 52 | " }\n" 53 | " rotation {\n" 54 | " x: 0.0\n" 55 | " y: 0.0\n" 56 | " z: 0.0\n" 57 | " w: 1.0\n" 58 | " }\n" 59 | "}\n" 60 | "" 61 | position { 62 | x: 0.0 63 | y: 0.0 64 | z: 0.0 65 | } 66 | rotation { 67 | x: 0.0 68 | y: 0.0 69 | z: 0.0 70 | w: 1.0 71 | } 72 | scale3 { 73 | x: 1.0 74 | y: 1.0 75 | z: 1.0 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /scripts/main.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local background = msg.url("main", "/background", "background") 4 | local paricles = msg.url("main", "/particles", "stars") 5 | local background_time = vmath.vector4() 6 | local target_pos = vmath.vector3() 7 | local planet_ids = {} 8 | 9 | local function load_collection(id) 10 | if config.planets[config.current_planet].collection then 11 | go.delete_all(config.planets[config.current_planet].collection) 12 | end 13 | 14 | config.current_planet = id 15 | 16 | local name = "/collections#planet_" .. id 17 | 18 | config.planets[id].collection = collectionfactory.create(name, target_pos, nil, nil, vmath.vector3(2.5, 2.5, 1)) 19 | config.target_script = config.planets[config.current_planet].collection[hash("/scripts")] 20 | end 21 | 22 | function init(self) 23 | msg.post(".", "acquire_input_focus") 24 | msg.post("@render:", "set_size", {width = 640, height = 360}) 25 | 26 | particlefx.play(paricles) 27 | 28 | --profiler.enable_ui(true) 29 | 30 | config.main_url = msg.url() 31 | target_pos = go.get_position("target") 32 | end 33 | 34 | function on_message(self, message_id, message, sender) 35 | if message_id == config.msg.load_planet then 36 | load_collection(message.id) 37 | end 38 | end 39 | 40 | function update(self, dt) 41 | background_time.x = background_time.x + dt 42 | go.set(background, "time", background_time) 43 | end 44 | -------------------------------------------------------------------------------- /components/planets/star/star_flares.material: -------------------------------------------------------------------------------- 1 | name: "Star Flares" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/star/star_flares.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 1.6 31 | y: 200.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 3.078 41 | y: 0.0 42 | z: 0.05 43 | w: 4.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "modify" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.0 51 | y: 0.0 52 | z: 0.0 53 | w: 1.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "circles" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 2.0 61 | y: 1.0 62 | z: 0.3 63 | w: 0.0 64 | } 65 | } 66 | samplers { 67 | name: "colorramp" 68 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 69 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 70 | filter_min: FILTER_MODE_MIN_NEAREST 71 | filter_mag: FILTER_MODE_MAG_NEAREST 72 | } 73 | -------------------------------------------------------------------------------- /components/planets/dry_terran/dry_terran.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local planet_size = 0.0 5 | local planet_time_speed = 0.0 6 | local time = 1000.0 7 | 8 | local function set_seed() 9 | go.set(planet, "generic.x", config.rseed) 10 | end 11 | 12 | local function set_pixel() 13 | go.set(planet, "transform.y", config.rpixel) 14 | end 15 | 16 | local function set_rotation() 17 | go.set(planet, "transform.z", config.rrot) 18 | end 19 | 20 | local function set_light() 21 | go.set(planet, "lights.x", config.rlight.x) 22 | go.set(planet, "lights.y", config.rlight.y) 23 | end 24 | 25 | function init(self) 26 | planet = msg.url("dry_terran#dry_terran") 27 | set_seed() 28 | set_pixel() 29 | set_rotation() 30 | 31 | planet_size = go.get(planet, "transform.x") 32 | planet_time_speed = go.get(planet, "generic.z") 33 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 34 | end 35 | 36 | function update(self, dt) 37 | time = time + dt 38 | go.set(planet, "generic.y", time * planet_size * 0.02) 39 | end 40 | 41 | function on_message(self, message_id, message, sender) 42 | if message_id == config.msg.set_planet_seed then 43 | set_seed() 44 | elseif message_id == config.msg.set_planet_pixel then 45 | set_pixel() 46 | elseif message_id == config.msg.set_planet_rotation then 47 | set_rotation() 48 | elseif message_id == config.msg.set_planet_light then 49 | set_light() 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Defold Protocol Buffer Text Files (https://github.com/github/linguist/issues/5091) 2 | *.animationset linguist-language=JSON5 3 | *.atlas linguist-language=JSON5 4 | *.camera linguist-language=JSON5 5 | *.collection linguist-language=JSON5 6 | *.collectionfactory linguist-language=JSON5 7 | *.collectionproxy linguist-language=JSON5 8 | *.collisionobject linguist-language=JSON5 9 | *.cubemap linguist-language=JSON5 10 | *.display_profiles linguist-language=JSON5 11 | *.factory linguist-language=JSON5 12 | *.font linguist-language=JSON5 13 | *.gamepads linguist-language=JSON5 14 | *.go linguist-language=JSON5 15 | *.gui linguist-language=JSON5 16 | *.input_binding linguist-language=JSON5 17 | *.label linguist-language=JSON5 18 | *.material linguist-language=JSON5 19 | *.mesh linguist-language=JSON5 20 | *.model linguist-language=JSON5 21 | *.particlefx linguist-language=JSON5 22 | *.render linguist-language=JSON5 23 | *.sound linguist-language=JSON5 24 | *.sprite linguist-language=JSON5 25 | *.spinemodel linguist-language=JSON5 26 | *.spinescene linguist-language=JSON5 27 | *.texture_profiles linguist-language=JSON5 28 | *.tilemap linguist-language=JSON5 29 | *.tilesource linguist-language=JSON5 30 | 31 | # Defold JSON Files 32 | *.buffer linguist-language=JSON 33 | 34 | # Defold GLSL Shaders 35 | *.fp linguist-language=GLSL 36 | *.vp linguist-language=GLSL 37 | 38 | # Defold Lua Files 39 | *.editor_script linguist-language=Lua 40 | *.render_script linguist-language=Lua 41 | *.script linguist-language=Lua 42 | *.gui_script linguist-language=Lua 43 | -------------------------------------------------------------------------------- /components/planets/asteroids/asteroid.material: -------------------------------------------------------------------------------- 1 | name: "Asteroid" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/asteroids/asteroid.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 5.294 31 | y: 100.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 1.567 41 | y: 0.0 42 | z: 0.4 43 | w: 2.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "lights" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.0 51 | y: 0.0 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "color1" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.64 61 | y: 0.65 62 | z: 0.76 63 | w: 1.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "color2" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.3 71 | y: 0.41 72 | z: 0.52 73 | w: 1.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "color3" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.23 81 | y: 0.25 82 | z: 0.37 83 | w: 1.0 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /components/planets/lava_world/craters.material: -------------------------------------------------------------------------------- 1 | name: "Craters Lava World" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/no_atmosphere/craters.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | 27 | fragment_constants { 28 | name: "transform" 29 | type: CONSTANT_TYPE_USER 30 | value { 31 | x: 3.5 32 | y: 100.0 33 | z: 0.0 34 | w: 0.0 35 | } 36 | } 37 | fragment_constants { 38 | name: "generic" 39 | type: CONSTANT_TYPE_USER 40 | value { 41 | x: 1.561 42 | y: 0.0 43 | z: 0.2 44 | w: 0.0 45 | } 46 | } 47 | fragment_constants { 48 | name: "lights" 49 | type: CONSTANT_TYPE_USER 50 | value { 51 | x: 0.3 52 | y: 0.3 53 | z: 0.0 54 | w: 0.0 55 | } 56 | } 57 | fragment_constants { 58 | name: "border" 59 | type: CONSTANT_TYPE_USER 60 | value { 61 | x: 0.4 62 | y: 0.0 63 | z: 0.0 64 | w: 0.0 65 | } 66 | } 67 | fragment_constants { 68 | name: "color1" 69 | type: CONSTANT_TYPE_USER 70 | value { 71 | x: 0.32 72 | y: 0.2 73 | z: 0.25 74 | w: 1.0 75 | } 76 | } 77 | fragment_constants { 78 | name: "color2" 79 | type: CONSTANT_TYPE_USER 80 | value { 81 | x: 0.24 82 | y: 0.16 83 | z: 0.21 84 | w: 1.0 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/craters.material: -------------------------------------------------------------------------------- 1 | name: "Craters" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/no_atmosphere/craters.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | 27 | fragment_constants { 28 | name: "transform" 29 | type: CONSTANT_TYPE_USER 30 | value { 31 | x: 5.0 32 | y: 87.419 33 | z: 0.0 34 | w: 0.0 35 | } 36 | } 37 | fragment_constants { 38 | name: "generic" 39 | type: CONSTANT_TYPE_USER 40 | value { 41 | x: 4.517 42 | y: 0.0 43 | z: 0.001 44 | w: 0.0 45 | } 46 | } 47 | fragment_constants { 48 | name: "lights" 49 | type: CONSTANT_TYPE_USER 50 | value { 51 | x: 0.25 52 | y: 0.25 53 | z: 0.0 54 | w: 0.0 55 | } 56 | } 57 | fragment_constants { 58 | name: "border" 59 | type: CONSTANT_TYPE_USER 60 | value { 61 | x: 0.465 62 | y: 0.0 63 | z: 0.0 64 | w: 0.0 65 | } 66 | } 67 | fragment_constants { 68 | name: "color1" 69 | type: CONSTANT_TYPE_USER 70 | value { 71 | x: 0.3 72 | y: 0.41 73 | z: 0.52 74 | w: 1.0 75 | } 76 | } 77 | fragment_constants { 78 | name: "color2" 79 | type: CONSTANT_TYPE_USER 80 | value { 81 | x: 0.23 82 | y: 0.25 83 | z: 0.37 84 | w: 1.0 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant.material: -------------------------------------------------------------------------------- 1 | name: "Gas Giant" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/gas_giant/gas_giant.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 10.961 31 | y: 100.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 6.314 41 | y: 0.0 42 | z: 0.05 43 | w: 3.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "border" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.0 51 | y: 0.0 52 | z: 0.892 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "lights" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: -0.1 61 | y: 0.3 62 | z: 0.0 63 | w: 0.0 64 | } 65 | } 66 | samplers { 67 | name: "colorscheme" 68 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 69 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 70 | filter_min: FILTER_MODE_MIN_NEAREST 71 | filter_mag: FILTER_MODE_MAG_NEAREST 72 | } 73 | samplers { 74 | name: "dark_colorscheme" 75 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 76 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 77 | filter_min: FILTER_MODE_MIN_NEAREST 78 | filter_mag: FILTER_MODE_MAG_NEAREST 79 | } 80 | -------------------------------------------------------------------------------- /components/planets/star/star.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "star" 4 | prototype: "/components/planets/star/star.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.1 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "star_blobs" 24 | prototype: "/components/planets/star/star_blobs.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.0 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 200.0 38 | y: 200.0 39 | z: 1.0 40 | } 41 | } 42 | instances { 43 | id: "star_flares" 44 | prototype: "/components/planets/star/star_flares.go" 45 | position { 46 | x: 0.0 47 | y: 0.0 48 | z: 0.2 49 | } 50 | rotation { 51 | x: 0.0 52 | y: 0.0 53 | z: 0.0 54 | w: 1.0 55 | } 56 | scale3 { 57 | x: 200.0 58 | y: 200.0 59 | z: 1.0 60 | } 61 | } 62 | scale_along_z: 0 63 | embedded_instances { 64 | id: "scripts" 65 | data: "components {\n" 66 | " id: \"stars\"\n" 67 | " component: \"/components/planets/star/stars.script\"\n" 68 | " position {\n" 69 | " x: 0.0\n" 70 | " y: 0.0\n" 71 | " z: 0.0\n" 72 | " }\n" 73 | " rotation {\n" 74 | " x: 0.0\n" 75 | " y: 0.0\n" 76 | " z: 0.0\n" 77 | " w: 1.0\n" 78 | " }\n" 79 | "}\n" 80 | "" 81 | position { 82 | x: 0.0 83 | y: 0.0 84 | z: 0.0 85 | } 86 | rotation { 87 | x: 0.0 88 | y: 0.0 89 | z: 0.0 90 | w: 1.0 91 | } 92 | scale3 { 93 | x: 1.0 94 | y: 1.0 95 | z: 1.0 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pixel Planets 2 | ![](https://raw.githubusercontent.com/selimanac/defold-pixel-planets/master/assets/raw/Screen%20Shot%202021-03-26%20at%2016.37.20.png) 3 | 4 | 5 | 6 | Pixel Planet shaders originally created by [Deep-Fold](https://deep-fold.itch.io/), ported to [Defold](https://defold.com/) game engine by [me](https://twitter.com/selimanac). 7 | 8 | See it in action: https://selimanac.itch.io/defold-pixel-planet-generator 9 | 10 | Please visit his itch.io project page here: https://deep-fold.itch.io/pixel-planet-generator 11 | All credit goes to [Deep-Fold](https://deep-fold.itch.io/) 12 | Thanks to [@britz](https://twitter.com/bjornritzl) for [lowrez](https://github.com/britzl/lowrezjam-template) template. 13 | 14 | ### Uniforms 15 | No logic here... 16 | 17 | ```glsl 18 | /* 19 | x = size 20 | y = pixels 21 | z = rotation 22 | w = stretch 23 | */ 24 | uniform lowp vec4 transform; 25 | 26 | /* 27 | x = seed 28 | y = time 29 | z = time_speed 30 | w = OCTAVES 31 | */ 32 | uniform lowp vec4 generic; 33 | 34 | /* 35 | x = light_border_1 36 | y = light_border_2 37 | z = bands 38 | w = 39 | */ 40 | uniform lowp vec4 border; 41 | 42 | /* 43 | x = cover (cloud) 44 | y = curve (cloud) 45 | z = dither_size 46 | w = scale (scale_rel_to_planet) 47 | */ 48 | uniform lowp vec4 modify; 49 | 50 | 51 | /* 52 | x = light_origin.x 53 | y = light_origin.y 54 | z = light_distance1 55 | w = light_distance2 56 | */ 57 | uniform lowp vec4 lights; 58 | 59 | /* 60 | x = ring_width 61 | y = ring_perspective 62 | z = cutoff (lake_cutoff / land_cutoff / river_cutoff) 63 | w = TILES 64 | */ 65 | uniform lowp vec4 extras; 66 | 67 | /* 68 | x = circle_amount 69 | y = circle_size 70 | z = storm_width 71 | w = storm_dither_width 72 | */ 73 | uniform lowp vec4 circles; 74 | 75 | ``` -------------------------------------------------------------------------------- /components/planets/ice_world/ice_word.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "planet_under" 4 | prototype: "/components/planets/land_masses/water.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "clouds" 24 | prototype: "/components/planets/land_masses/clouds.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.2 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 100.0 38 | y: 100.0 39 | z: 1.0 40 | } 41 | } 42 | instances { 43 | id: "lakes" 44 | prototype: "/components/planets/ice_world/lakes.go" 45 | position { 46 | x: 0.0 47 | y: 0.0 48 | z: 0.1 49 | } 50 | rotation { 51 | x: 0.0 52 | y: 0.0 53 | z: 0.0 54 | w: 1.0 55 | } 56 | scale3 { 57 | x: 100.0 58 | y: 100.0 59 | z: 1.0 60 | } 61 | } 62 | scale_along_z: 0 63 | embedded_instances { 64 | id: "scripts" 65 | data: "components {\n" 66 | " id: \"ice_world\"\n" 67 | " component: \"/components/planets/ice_world/ice_world.script\"\n" 68 | " position {\n" 69 | " x: 0.0\n" 70 | " y: 0.0\n" 71 | " z: 0.0\n" 72 | " }\n" 73 | " rotation {\n" 74 | " x: 0.0\n" 75 | " y: 0.0\n" 76 | " z: 0.0\n" 77 | " w: 1.0\n" 78 | " }\n" 79 | "}\n" 80 | "" 81 | position { 82 | x: 64.0 83 | y: 49.0 84 | z: 0.0 85 | } 86 | rotation { 87 | x: 0.0 88 | y: 0.0 89 | z: 0.0 90 | w: 1.0 91 | } 92 | scale3 { 93 | x: 1.0 94 | y: 1.0 95 | z: 1.0 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /components/planets/land_masses/land_masses.collection: -------------------------------------------------------------------------------- 1 | name: "land_masses" 2 | instances { 3 | id: "water" 4 | prototype: "/components/planets/land_masses/water.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "land" 24 | prototype: "/components/planets/land_masses/land.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.1 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 100.0 38 | y: 100.0 39 | z: 1.0 40 | } 41 | } 42 | instances { 43 | id: "clouds" 44 | prototype: "/components/planets/land_masses/clouds.go" 45 | position { 46 | x: 0.0 47 | y: 0.0 48 | z: 0.2 49 | } 50 | rotation { 51 | x: 0.0 52 | y: 0.0 53 | z: 0.0 54 | w: 1.0 55 | } 56 | scale3 { 57 | x: 100.0 58 | y: 100.0 59 | z: 1.0 60 | } 61 | } 62 | scale_along_z: 0 63 | embedded_instances { 64 | id: "scripts" 65 | data: "components {\n" 66 | " id: \"land_masses\"\n" 67 | " component: \"/components/planets/land_masses/land_masses.script\"\n" 68 | " position {\n" 69 | " x: 0.0\n" 70 | " y: 0.0\n" 71 | " z: 0.0\n" 72 | " }\n" 73 | " rotation {\n" 74 | " x: 0.0\n" 75 | " y: 0.0\n" 76 | " z: 0.0\n" 77 | " w: 1.0\n" 78 | " }\n" 79 | "}\n" 80 | "" 81 | position { 82 | x: 0.0 83 | y: 0.0 84 | z: 0.0 85 | } 86 | rotation { 87 | x: 0.0 88 | y: 0.0 89 | z: 0.0 90 | w: 1.0 91 | } 92 | scale3 { 93 | x: 1.0 94 | y: 1.0 95 | z: 1.0 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /components/planets/lava_world/lava_world.collection: -------------------------------------------------------------------------------- 1 | name: "default" 2 | instances { 3 | id: "planet_under" 4 | prototype: "/components/planets/lava_world/planet_under.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 100.0 18 | y: 100.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "craters" 24 | prototype: "/components/planets/lava_world/craters.go" 25 | position { 26 | x: 0.0 27 | y: 0.0 28 | z: 0.1 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 100.0 38 | y: 100.0 39 | z: 1.0 40 | } 41 | } 42 | instances { 43 | id: "rivers" 44 | prototype: "/components/planets/lava_world/rivers.go" 45 | position { 46 | x: 0.0 47 | y: 0.0 48 | z: 0.2 49 | } 50 | rotation { 51 | x: 0.0 52 | y: 0.0 53 | z: 0.0 54 | w: 1.0 55 | } 56 | scale3 { 57 | x: 100.0 58 | y: 100.0 59 | z: 1.0 60 | } 61 | } 62 | scale_along_z: 0 63 | embedded_instances { 64 | id: "scripts" 65 | data: "components {\n" 66 | " id: \"lava_world\"\n" 67 | " component: \"/components/planets/lava_world/lava_world.script\"\n" 68 | " position {\n" 69 | " x: 0.0\n" 70 | " y: 0.0\n" 71 | " z: 0.0\n" 72 | " }\n" 73 | " rotation {\n" 74 | " x: 0.0\n" 75 | " y: 0.0\n" 76 | " z: 0.0\n" 77 | " w: 1.0\n" 78 | " }\n" 79 | "}\n" 80 | "" 81 | position { 82 | x: 0.0 83 | y: 0.0 84 | z: 0.0 85 | } 86 | rotation { 87 | x: 0.0 88 | y: 0.0 89 | z: 0.0 90 | w: 1.0 91 | } 92 | scale3 { 93 | x: 1.0 94 | y: 1.0 95 | z: 1.0 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /scripts/config.lua: -------------------------------------------------------------------------------- 1 | local config = {} 2 | 3 | config.mouse_click = hash("touch") 4 | config.seed = 0 5 | 6 | config.rseed = 0 7 | config.rpixel = 100 8 | config.rrot = 0 9 | config.rlight = {x = 0, y = 0} 10 | 11 | config.msg = { 12 | load_planet = hash("load_planet"), 13 | set_planet_light = hash("set_planet_light"), 14 | set_planet_seed = hash("set_planet_seed"), 15 | set_planet_pixel = hash("set_planet_pixel"), 16 | set_planet_rotation = hash("set_planet_rotation") 17 | } 18 | 19 | config.main_url = msg.url() 20 | config.target_script = hash("/scripts") 21 | config.current_planet = 1 22 | 23 | config.planets = { 24 | [1] = { 25 | name = "TERRAN WET", 26 | nodes = {} 27 | }, 28 | [2] = { 29 | name = "TERRAN DRY", 30 | nodes = {} 31 | }, 32 | [3] = { 33 | name = "ISLAND", 34 | nodes = {} 35 | }, 36 | [4] = { 37 | name = "NO ATMOSPHERE", 38 | nodes = {} 39 | }, 40 | [5] = { 41 | name = "GAS GIANT 1", 42 | nodes = {} 43 | }, 44 | [6] = { 45 | name = "GAS GIANT 2", 46 | nodes = {} 47 | }, 48 | [7] = { 49 | name = "ICE WORLD", 50 | nodes = {} 51 | }, 52 | [8] = { 53 | name = "LAVA WORLD", 54 | nodes = {} 55 | }, 56 | [9] = { 57 | name = "ASTEROID", 58 | nodes = {} 59 | }, 60 | 61 | [10] = { 62 | name = "STAR", 63 | nodes = {} 64 | } 65 | } 66 | 67 | function config.set_seed(s) 68 | config.seed = s 69 | config.rseed = s % 1000 / 100.0 70 | end 71 | function config.set_light(_x, _y) 72 | config.rlight.x = (_x / 360) 73 | config.rlight.y = 1.0 - (_y / 360) 74 | end 75 | 76 | config.round = function(n) 77 | return n >= 0.0 and n - n % -1 or n - n % 1 78 | end 79 | 80 | 81 | return config 82 | -------------------------------------------------------------------------------- /components/planets/gas_giant/ring.material: -------------------------------------------------------------------------------- 1 | name: "Ring" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/gas_giant/ring.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 15.0 31 | y: 300.0 32 | z: 0.732 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 8.461 41 | y: 0.0 42 | z: 0.2 43 | w: 4.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "lights" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: -0.1 51 | y: 0.3 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "modify" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.0 61 | y: 0.0 62 | z: 0.0 63 | w: 6.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "extras" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.127 71 | y: 6.0 72 | z: 0.0 73 | w: 0.0 74 | } 75 | } 76 | samplers { 77 | name: "colorscheme" 78 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 79 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 80 | filter_min: FILTER_MODE_MIN_NEAREST 81 | filter_mag: FILTER_MODE_MAG_NEAREST 82 | } 83 | samplers { 84 | name: "dark_colorscheme" 85 | wrap_u: WRAP_MODE_CLAMP_TO_EDGE 86 | wrap_v: WRAP_MODE_CLAMP_TO_EDGE 87 | filter_min: FILTER_MODE_MIN_NEAREST 88 | filter_mag: FILTER_MODE_MAG_NEAREST 89 | } 90 | -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local ring = msg.url() 5 | 6 | local planet_size = 0.0 7 | local planet_time_speed = 0.0 8 | local time = 1000.0 9 | 10 | local function set_seed() 11 | go.set(planet, "generic.x", config.rseed) 12 | go.set(ring, "generic.x", config.rseed) 13 | end 14 | 15 | local function set_pixel() 16 | go.set(planet, "transform.y", config.rpixel) 17 | go.set(ring, "transform.y", config.rpixel*3.0) 18 | 19 | end 20 | 21 | local function set_rotation() 22 | go.set(planet, "transform.z", config.rrot) 23 | go.set(ring, "transform.z", config.rrot+0.7) 24 | end 25 | 26 | local function set_light() 27 | go.set(planet, "lights.x", config.rlight.x) 28 | go.set(planet, "lights.y", config.rlight.y) 29 | 30 | go.set(ring, "lights.x", config.rlight.x) 31 | go.set(ring, "lights.y", config.rlight.y) 32 | end 33 | 34 | function init(self) 35 | planet = msg.url("gas_giant#gas_giant") 36 | ring = msg.url("ring#ring") 37 | 38 | set_seed() 39 | set_pixel() 40 | set_rotation() 41 | 42 | planet_size = go.get(planet, "transform.x") 43 | planet_time_speed = go.get(planet, "generic.z") 44 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 45 | end 46 | 47 | function update(self, dt) 48 | time = time + dt 49 | go.set(planet, "generic.y", time * planet_size * 0.004) 50 | go.set(ring, "generic.y", time * 314.15 * 0.004) 51 | end 52 | 53 | function on_message(self, message_id, message, sender) 54 | if message_id == config.msg.set_planet_seed then 55 | set_seed() 56 | elseif message_id == config.msg.set_planet_pixel then 57 | set_pixel() 58 | elseif message_id == config.msg.set_planet_rotation then 59 | set_rotation() 60 | elseif message_id == config.msg.set_planet_light then 61 | set_light() 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /components/planets/ice_world/lakes.material: -------------------------------------------------------------------------------- 1 | name: "Lakes" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/ice_world/lakes.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 10.0 31 | y: 100.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 1.14 41 | y: 0.0 42 | z: 0.2 43 | w: 3.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "border" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.024 51 | y: 0.047 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "extras" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.0 61 | y: 0.0 62 | z: 0.55 63 | w: 0.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "lights" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.3 71 | y: 0.3 72 | z: 0.0 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "color1" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.31 81 | y: 0.64 82 | z: 0.72 83 | w: 1.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "color2" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.3 91 | y: 0.41 92 | z: 0.52 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "color3" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.23 101 | y: 0.25 102 | z: 0.37 103 | w: 1.0 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /components/planets/lava_world/rivers.material: -------------------------------------------------------------------------------- 1 | name: "Rivers" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/lava_world/rivers.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 10.0 31 | y: 100.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 2.527 41 | y: 0.0 42 | z: 0.2 43 | w: 4.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "lights" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.3 51 | y: 0.3 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "border" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.019 61 | y: 0.036 62 | z: 0.0 63 | w: 0.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "extras" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.0 71 | y: 0.0 72 | z: 0.579 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "color1" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 1.0 81 | y: 0.54 82 | z: 0.2 83 | w: 1.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "color2" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.9 91 | y: 0.27 92 | z: 0.22 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "color3" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.68 101 | y: 0.18 102 | z: 0.27 103 | w: 1.0 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /components/planets/land_masses/planet_under.material: -------------------------------------------------------------------------------- 1 | name: "Planet Under" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/land_masses/planet_under.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 5.228 31 | y: 100.0 32 | z: 0.0 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 10.0 41 | y: 0.0 42 | z: 0.1 43 | w: 3.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "lights" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.39 51 | y: 0.39 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "border" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.4 61 | y: 0.6 62 | z: 0.0 63 | w: 0.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "modify" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.0 71 | y: 0.0 72 | z: 2.0 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "color1" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.57 81 | y: 0.91 82 | z: 0.75 83 | w: 1.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "color2" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.31 91 | y: 0.64 92 | z: 0.72 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "color3" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.17 101 | y: 0.21 102 | z: 0.3 103 | w: 1.0 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /components/planets/lava_world/planet_under.material: -------------------------------------------------------------------------------- 1 | name: "Planet Under Lava World" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/no_atmosphere/no_atmosphere.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | 27 | fragment_constants { 28 | name: "transform" 29 | type: CONSTANT_TYPE_USER 30 | value { 31 | x: 10.0 32 | y: 100.0 33 | z: 0.0 34 | w: 0.0 35 | } 36 | } 37 | fragment_constants { 38 | name: "generic" 39 | type: CONSTANT_TYPE_USER 40 | value { 41 | x: 1.551 42 | y: 0.0 43 | z: 0.2 44 | w: 3.0 45 | } 46 | } 47 | fragment_constants { 48 | name: "lights" 49 | type: CONSTANT_TYPE_USER 50 | value { 51 | x: 0.3 52 | y: 0.3 53 | z: 0.0 54 | w: 0.0 55 | } 56 | } 57 | fragment_constants { 58 | name: "border" 59 | type: CONSTANT_TYPE_USER 60 | value { 61 | x: 0.4 62 | y: 0.6 63 | z: 0.0 64 | w: 0.0 65 | } 66 | } 67 | fragment_constants { 68 | name: "modify" 69 | type: CONSTANT_TYPE_USER 70 | value { 71 | x: 0.0 72 | y: 0.0 73 | z: 2.0 74 | w: 0.0 75 | } 76 | } 77 | fragment_constants { 78 | name: "color1" 79 | type: CONSTANT_TYPE_USER 80 | value { 81 | x: 0.56 82 | y: 0.3 83 | z: 0.34 84 | w: 1.0 85 | } 86 | } 87 | fragment_constants { 88 | name: "color2" 89 | type: CONSTANT_TYPE_USER 90 | value { 91 | x: 0.32 92 | y: 0.2 93 | z: 0.25 94 | w: 1.0 95 | } 96 | } 97 | fragment_constants { 98 | name: "color3" 99 | type: CONSTANT_TYPE_USER 100 | value { 101 | x: 0.24 102 | y: 0.16 103 | z: 0.21 104 | w: 1.0 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/no_atmosphere.material: -------------------------------------------------------------------------------- 1 | name: "No Atmosphere" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/no_atmosphere/no_atmosphere.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | 27 | fragment_constants { 28 | name: "transform" 29 | type: CONSTANT_TYPE_USER 30 | value { 31 | x: 8.0 32 | y: 100.0 33 | z: 0.0 34 | w: 0.0 35 | } 36 | } 37 | fragment_constants { 38 | name: "generic" 39 | type: CONSTANT_TYPE_USER 40 | value { 41 | x: 1.012 42 | y: 0.0 43 | z: 0.4 44 | w: 4.0 45 | } 46 | } 47 | fragment_constants { 48 | name: "lights" 49 | type: CONSTANT_TYPE_USER 50 | value { 51 | x: 0.25 52 | y: 0.25 53 | z: 0.0 54 | w: 0.0 55 | } 56 | } 57 | fragment_constants { 58 | name: "border" 59 | type: CONSTANT_TYPE_USER 60 | value { 61 | x: 0.615 62 | y: 0.729 63 | z: 0.0 64 | w: 0.0 65 | } 66 | } 67 | fragment_constants { 68 | name: "modify" 69 | type: CONSTANT_TYPE_USER 70 | value { 71 | x: 0.0 72 | y: 0.0 73 | z: 2.0 74 | w: 0.0 75 | } 76 | } 77 | fragment_constants { 78 | name: "color1" 79 | type: CONSTANT_TYPE_USER 80 | value { 81 | x: 0.64 82 | y: 0.65 83 | z: 0.76 84 | w: 1.0 85 | } 86 | } 87 | fragment_constants { 88 | name: "color2" 89 | type: CONSTANT_TYPE_USER 90 | value { 91 | x: 0.3 92 | y: 0.41 93 | z: 0.52 94 | w: 1.0 95 | } 96 | } 97 | fragment_constants { 98 | name: "color3" 99 | type: CONSTANT_TYPE_USER 100 | value { 101 | x: 0.23 102 | y: 0.25 103 | z: 0.37 104 | w: 1.0 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /scripts/gui/settings.gui_script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | local dropdown = require("scripts.gui.dropdown") 3 | local slider = require("scripts.gui.slider") 4 | local rnd_btn 5 | local rnd_label 6 | local pixel_slider = {} 7 | local pixel_slider_label 8 | local rotation_slider = {} 9 | 10 | local light_zone 11 | 12 | local set_light = false 13 | 14 | local function set_seed(is_init) 15 | config.set_seed(rnd.number()) 16 | gui.set_text(rnd_label, config.seed) 17 | if is_init then 18 | return 19 | end 20 | 21 | msg.post(config.target_script, config.msg.set_planet_seed) 22 | end 23 | 24 | local function set_pixel(pixel) 25 | pixel = math.floor(pixel) 26 | gui.set_text(pixel_slider_label, "PIXELS: " .. pixel .. "X" .. pixel) 27 | config.rpixel = pixel 28 | msg.post(config.target_script, config.msg.set_planet_pixel) 29 | end 30 | 31 | local function set_rotation(rot) 32 | config.rrot = rot 33 | msg.post(config.target_script, config.msg.set_planet_rotation) 34 | end 35 | 36 | local function set_lights(_x, _y) 37 | config.set_light(_x, _y) 38 | msg.post(config.target_script, config.msg.set_planet_light) 39 | end 40 | 41 | function init(self) 42 | msg.post(".", "acquire_input_focus") 43 | 44 | rnd_btn = gui.get_node("rnd_btn") 45 | rnd_label = gui.get_node("seed_txt") 46 | light_zone = gui.get_node("light_zone") 47 | pixel_slider_label = gui.get_node("pixel_slider/label") 48 | 49 | set_seed(true) 50 | 51 | pixel_slider = slider.new(100, "pixel_slider", 16, 100, set_pixel) 52 | rotation_slider = slider.new(0, "rotation_slider", 0, 6.28, set_rotation) 53 | 54 | dropdown.init(1) 55 | end 56 | 57 | function on_input(self, action_id, action) 58 | dropdown.update(action, action_id) 59 | pixel_slider:update(action, action_id) 60 | rotation_slider:update(action, action_id) 61 | 62 | if action_id == config.mouse_click and action.pressed then 63 | if gui.pick_node(rnd_btn, action.x, action.y) then 64 | set_seed() 65 | end 66 | end 67 | 68 | if action_id == config.mouse_click and gui.pick_node(light_zone, action.x, action.y) then 69 | set_lights(action.x, action.y) 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /components/planets/rivers/rivers.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local clouds = msg.url() 5 | 6 | local planet_size = 0.0 7 | local planet_time_speed = 0.0 8 | 9 | local cloud_size = 0.0 10 | local cloud_time_speed = 0 11 | 12 | local time = 1000.0 13 | 14 | local function set_seed() 15 | go.set(planet, "generic.x", config.rseed) 16 | go.set(clouds, "generic.x", config.rseed) 17 | go.set(clouds, "modify.x", rnd.double_range(0.35, 0.6)) 18 | end 19 | 20 | local function set_pixel() 21 | go.set(planet, "transform.y", config.rpixel) 22 | go.set(clouds, "transform.y", config.rpixel) 23 | end 24 | 25 | local function set_rotation() 26 | go.set(planet, "transform.z", config.rrot) 27 | go.set(clouds, "transform.z", config.rrot) 28 | end 29 | 30 | local function set_light() 31 | go.set(planet, "lights.x", config.rlight.x) 32 | go.set(planet, "lights.y", config.rlight.y) 33 | 34 | go.set(clouds, "lights.x", config.rlight.x) 35 | go.set(clouds, "lights.y", config.rlight.y) 36 | end 37 | 38 | 39 | function init(self) 40 | planet = msg.url("land#land") 41 | clouds = msg.url("clouds#clouds") 42 | 43 | set_seed() 44 | set_pixel() 45 | set_rotation() 46 | 47 | planet_size = go.get(planet, "transform.x") 48 | planet_time_speed = go.get(planet, "generic.z") 49 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 50 | 51 | cloud_size = go.get(clouds, "transform.x") 52 | cloud_time_speed = go.get(clouds, "generic.z") 53 | cloud_size = config.round(cloud_size * 2.0) / cloud_time_speed 54 | end 55 | 56 | function update(self, dt) 57 | time = time + dt 58 | go.set(planet, "generic.y", time * planet_size * 0.02) 59 | go.set(clouds, "generic.y", time * cloud_size * 0.01) 60 | end 61 | 62 | function on_message(self, message_id, message, sender) 63 | if message_id == config.msg.set_planet_seed then 64 | set_seed() 65 | elseif message_id == config.msg.set_planet_pixel then 66 | set_pixel() 67 | elseif message_id == config.msg.set_planet_rotation then 68 | set_rotation() 69 | elseif message_id == config.msg.set_planet_light then 70 | set_light() 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /components/planets/land_masses/land_masses.material: -------------------------------------------------------------------------------- 1 | name: "Land Masses" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/land_masses/land_masses.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 4.292 31 | y: 100.0 32 | z: 0.2 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "lights" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 0.39 41 | y: 0.39 42 | z: 0.0 43 | w: 0.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "generic" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 7.947 51 | y: 0.0 52 | z: 0.2 53 | w: 6.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "border" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.32 61 | y: 0.534 62 | z: 0.0 63 | w: 0.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "extras" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.0 71 | y: 0.0 72 | z: 0.633 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "col1" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.78 81 | y: 0.83 82 | z: 0.36 83 | w: 1.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "col2" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.39 91 | y: 0.67 92 | z: 0.25 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "col3" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.18 101 | y: 0.34 102 | z: 0.33 103 | w: 1.0 104 | } 105 | } 106 | fragment_constants { 107 | name: "col4" 108 | type: CONSTANT_TYPE_USER 109 | value { 110 | x: 0.16 111 | y: 0.21 112 | z: 0.25 113 | w: 1.0 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /components/planets/rivers/clouds.material: -------------------------------------------------------------------------------- 1 | name: "Clouds" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/rivers/clouds.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 7.315 31 | y: 100.0 32 | z: 0.0 33 | w: 2.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 5.939 41 | y: 0.0 42 | z: 0.1 43 | w: 2.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "border" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.52 51 | y: 0.52 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "modify" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.47 61 | y: 1.3 62 | z: 0.0 63 | w: 0.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "lights" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.39 71 | y: 0.39 72 | z: 0.0 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "base_color" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.96 81 | y: 1.0 82 | z: 0.91 83 | w: 1.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "outline_color" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.87 91 | y: 0.88 92 | z: 0.91 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "shadow_base_color" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.41 101 | y: 0.41 102 | z: 0.6 103 | w: 1.0 104 | } 105 | } 106 | fragment_constants { 107 | name: "shadow_outline_color" 108 | type: CONSTANT_TYPE_USER 109 | value { 110 | x: 0.25 111 | y: 0.29 112 | z: 0.45 113 | w: 1.0 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /components/planets/land_masses/clouds.material: -------------------------------------------------------------------------------- 1 | name: "Clouds" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/land_masses/clouds.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 7.745 31 | y: 100.0 32 | z: 0.0 33 | w: 2.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 5.939 41 | y: 0.0 42 | z: 0.47 43 | w: 2.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "border" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.52 51 | y: 0.62 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "modify" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.415 61 | y: 1.3 62 | z: 0.0 63 | w: 0.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "lights" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.39 71 | y: 0.39 72 | z: 0.0 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "base_color" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.87 81 | y: 0.88 82 | z: 0.91 83 | w: 1.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "outline_color" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.64 91 | y: 0.65 92 | z: 0.76 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "shadow_base_color" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.41 101 | y: 0.44 102 | z: 0.6 103 | w: 1.0 104 | } 105 | } 106 | fragment_constants { 107 | name: "shadow_outline_color" 108 | type: CONSTANT_TYPE_USER 109 | value { 110 | x: 0.25 111 | y: 0.29 112 | z: 0.45 113 | w: 1.0 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /components/planets/gas_planet/gas_planet.material: -------------------------------------------------------------------------------- 1 | name: "Gas Planet" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/gas_planet/gas_planet.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 9.0 31 | y: 100.0 32 | z: 0.0 33 | w: 1.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "modify" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 0.0 41 | y: 1.3 42 | z: 0.0 43 | w: 0.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "lights" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 100.0 51 | y: 0.0 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "generic" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 5.939 61 | y: 0.0 62 | z: 0.7 63 | w: 5.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "border" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.692 71 | y: 0.666 72 | z: 0.0 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "base_color" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.23 81 | y: 0.13 82 | z: 0.15 83 | w: 1.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "outline_color" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.23 91 | y: 0.13 92 | z: 0.15 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "shadow_base_color" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.13 101 | y: 0.09 102 | z: 0.11 103 | w: 1.0 104 | } 105 | } 106 | fragment_constants { 107 | name: "shadow_outline_color" 108 | type: CONSTANT_TYPE_USER 109 | value { 110 | x: 0.13 111 | y: 0.09 112 | z: 0.11 113 | w: 1.0 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/no_atmosphere.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local craters = msg.url() 5 | local lakes = msg.url() 6 | 7 | local planet_size = 0.0 8 | local planet_time_speed = 0.0 9 | 10 | local crater_size = 0.0 11 | local crater_time_speed = 0 12 | 13 | local lakes_size = 0.0 14 | local lakes_time_speed = 0 15 | 16 | local time = 1000.0 17 | 18 | local function set_seed() 19 | go.set(planet, "generic.x", config.rseed) 20 | go.set(craters, "generic.x", config.rseed) 21 | end 22 | 23 | local function set_pixel() 24 | go.set(planet, "transform.y", config.rpixel) 25 | go.set(craters, "transform.y", config.rpixel) 26 | end 27 | 28 | local function set_rotation() 29 | go.set(planet, "transform.z", config.rrot) 30 | go.set(craters, "transform.z", config.rrot) 31 | end 32 | 33 | local function set_light() 34 | go.set(planet, "lights.x", config.rlight.x) 35 | go.set(planet, "lights.y", config.rlight.y) 36 | 37 | go.set(craters, "lights.x", config.rlight.x) 38 | go.set(craters, "lights.y", config.rlight.y) 39 | end 40 | 41 | function init(self) 42 | planet = msg.url("planet_under#planet_under") 43 | craters = msg.url("craters#craters") 44 | 45 | set_seed() 46 | set_pixel() 47 | set_rotation() 48 | 49 | planet_size = go.get(planet, "transform.x") 50 | planet_time_speed = go.get(planet, "generic.z") 51 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 52 | 53 | crater_size = go.get(craters, "transform.x") 54 | crater_time_speed = go.get(craters, "generic.z") 55 | crater_size = config.round(crater_size * 2.0) / crater_time_speed 56 | end 57 | 58 | function update(self, dt) 59 | time = time + dt 60 | go.set(planet, "generic.y", time * planet_size * 0.02) 61 | go.set(craters, "generic.y", time * crater_size * 0.02) 62 | end 63 | 64 | function on_message(self, message_id, message, sender) 65 | if message_id == config.msg.set_planet_seed then 66 | set_seed() 67 | elseif message_id == config.msg.set_planet_pixel then 68 | set_pixel() 69 | elseif message_id == config.msg.set_planet_rotation then 70 | set_rotation() 71 | elseif message_id == config.msg.set_planet_light then 72 | set_light() 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/craters.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 lights; 7 | uniform lowp vec4 border; 8 | 9 | uniform vec4 color1; 10 | uniform vec4 color2; 11 | 12 | float rand(vec2 coord) 13 | { 14 | coord = mod(coord, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 15 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 15.5453 * generic.x); 16 | } 17 | 18 | // by Leukbaars from https://www.shadertoy.com/view/4tK3zR 19 | float circleNoise(vec2 uv) 20 | { 21 | float uv_y = floor(uv.y); 22 | uv.x += uv_y * .31; 23 | vec2 f = fract(uv); 24 | float h = rand(vec2(floor(uv.x), floor(uv_y))); 25 | float m = (length(f - 0.25 - (h * 0.5))); 26 | float r = h * 0.25; 27 | return m = smoothstep(r - .10 * r, r, m); 28 | } 29 | 30 | float crater(vec2 uv) 31 | { 32 | float c = 1.0; 33 | for (int i = 0; i < 2; i++) 34 | { 35 | c *= circleNoise((uv * transform.x) + (float(i + 1) + 10.) + vec2(generic.y * generic.z, 0.0)); 36 | } 37 | return 1.0 - c; 38 | } 39 | 40 | vec2 spherify(vec2 uv) 41 | { 42 | vec2 centered = uv * 2.0 - 1.0; 43 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 44 | vec2 sphere = centered / (z + 1.0); 45 | return sphere * 0.5 + 0.5; 46 | } 47 | 48 | vec2 rotate(vec2 coord, float angle) 49 | { 50 | coord -= 0.5; 51 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 52 | return coord + 0.5; 53 | } 54 | 55 | void main() 56 | { 57 | 58 | // pixelize uv 59 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 60 | uv.y = 1.0 - uv.y; 61 | 62 | // check distance from center & distance to light 63 | float d_circle = distance(uv, vec2(0.5)); 64 | float d_light = distance(uv, vec2(lights.xy)); 65 | // cut out a circle 66 | float a = step(d_circle, 0.5); 67 | 68 | uv = rotate(uv, transform.z); 69 | uv = spherify(uv); 70 | 71 | float c1 = crater(uv); 72 | float c2 = crater(uv + (lights.xy - 0.5) * 0.03); 73 | vec3 col = color1.rgb; 74 | 75 | a *= step(0.5, c1); 76 | 77 | col = mix(col, color2.rgb, float(c2 < c1 - (0.5 - d_light) * 2.0)); 78 | col = mix(col, color2.rgb, float(d_light > border.x)); 79 | 80 | // cut out a circle 81 | a *= step(d_circle, 0.5); 82 | gl_FragColor = vec4(col, a); 83 | } 84 | -------------------------------------------------------------------------------- /components/planets/star/stars.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local star_blobs = msg.url() 5 | local star_flares = msg.url() 6 | 7 | local planet_size = 0.0 8 | local planet_time_speed = 0.0 9 | 10 | local star_blobs_size = 0.0 11 | local star_blobs_speed = 0 12 | 13 | local star_flares_size = 0.0 14 | local star_flares_time_speed = 0 15 | 16 | local time = 1000.0 17 | 18 | local function set_seed() 19 | go.set(planet, "generic.x", config.rseed) 20 | go.set(star_blobs, "generic.x", config.rseed) 21 | go.set(star_flares, "generic.x", config.rseed) 22 | end 23 | 24 | local function set_pixel() 25 | go.set(planet, "transform.y", config.rpixel) 26 | go.set(star_blobs, "transform.y", config.rpixel * 1.0) 27 | go.set(star_flares, "transform.y", config.rpixel* 1.0) 28 | end 29 | 30 | local function set_rotation() 31 | go.set(planet, "transform.z", config.rrot) 32 | go.set(star_blobs, "transform.z", config.rrot) 33 | go.set(star_flares, "transform.z", config.rrot) 34 | end 35 | 36 | local function set_light() 37 | 38 | end 39 | 40 | 41 | function init(self) 42 | planet = msg.url("star#star") 43 | star_blobs = msg.url("star_blobs#star_blobs")-- StarBackground 44 | star_flares = msg.url("star_flares#star_flares") 45 | 46 | set_seed() 47 | set_pixel() 48 | set_rotation() 49 | 50 | planet_size = go.get(planet, "transform.x") 51 | planet_time_speed = go.get(planet, "generic.z") 52 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 53 | 54 | star_blobs_size = go.get(star_blobs, "transform.x") 55 | star_blobs_speed = go.get(star_blobs, "generic.z") 56 | star_blobs_size = config.round(star_blobs_size * 2.0) / star_blobs_speed 57 | 58 | star_flares_size = go.get(star_flares, "transform.x") 59 | star_flares_time_speed = go.get(star_flares, "generic.z") 60 | star_flares_size = config.round(star_flares_size * 2.0) / star_flares_time_speed 61 | end 62 | 63 | function update(self, dt) 64 | time = time + dt 65 | go.set(planet, "generic.y", time * planet_size * 0.001) 66 | go.set(star_blobs, "generic.y", time * star_blobs_size * 0.01) 67 | go.set(star_flares, "generic.y", time * star_flares_size * 0.015) 68 | end 69 | 70 | function on_message(self, message_id, message, sender) 71 | if message_id == config.msg.set_planet_seed then 72 | set_seed() 73 | elseif message_id == config.msg.set_planet_pixel then 74 | set_pixel() 75 | elseif message_id == config.msg.set_planet_rotation then 76 | set_rotation() 77 | elseif message_id == config.msg.set_planet_light then 78 | set_light() 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /scripts/gui/slider.lua: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local slider = {} 4 | 5 | function slider:update(action, action_id) 6 | if action_id == config.mouse_click and action.pressed and gui.pick_node(self.node, action.x, action.y) then 7 | self.is_draging = true 8 | self.drag_start_x = action.x 9 | elseif action.released and self.is_draging then 10 | self.is_draging = false 11 | self.current_x = -self.position.x 12 | end 13 | 14 | if self.is_draging == true then 15 | self.position.x = ((self.current_x + self.drag_start_x) - action.x) * -1 16 | 17 | if self.position.x > self.slider_width then 18 | self.position.x = self.slider_width 19 | elseif self.position.x < 0 then 20 | self.position.x = 0 21 | end 22 | 23 | self.value = ((self.position.x / self.slider_width) * self.range) + self.min 24 | 25 | self.callback(self.value) 26 | gui.set_position(self.node, self.position) 27 | self.slider_field_node_size.x = self.position.x 28 | gui.set_size(self.slider_field_node, self.slider_field_node_size) 29 | end 30 | end 31 | 32 | ---@param _initial_value integer 33 | ---@param _node_name string 34 | ---@param _min integer 35 | ---@param _max integer 36 | ---@param _callback function 37 | function slider.new(_initial_value, _node_name, _min, _max, _callback) 38 | local dragger = gui.get_node(_node_name .. "/button") 39 | local dragger_pos = gui.get_position(dragger) 40 | local dragger_size = gui.get_size(dragger) 41 | local slider_field = gui.get_node(_node_name .. "/box") 42 | local slider_field_size = gui.get_size(slider_field) 43 | 44 | local slider_width = gui.get_size(gui.get_node(_node_name .. "/slider")).x 45 | 46 | local slider_range = _max - _min 47 | local value = _initial_value - _min 48 | local init_x = ((slider_width - dragger_size.x) / slider_range) * value 49 | 50 | dragger_pos.x = init_x 51 | gui.set_position(dragger, dragger_pos) 52 | slider_field_size.x = init_x 53 | gui.set_size(slider_field, slider_field_size) 54 | _callback(_initial_value) 55 | local state = { 56 | min = _min, 57 | max = _max, 58 | is_draging = false, 59 | drag_start_x = dragger_pos.x, 60 | current_x = -dragger_pos.x, 61 | node = dragger, 62 | position = dragger_pos, 63 | slider_width = slider_width - dragger_size.x, 64 | value = _initial_value, 65 | range = slider_range, 66 | callback = _callback, 67 | slider_field_node = slider_field, 68 | slider_field_node_size = slider_field_size 69 | } 70 | return setmetatable(state, {__index = slider}) 71 | end 72 | 73 | return slider 74 | -------------------------------------------------------------------------------- /components/planets/rivers/land_rivers.material: -------------------------------------------------------------------------------- 1 | name: "Land Rivers" 2 | tags: "model" 3 | vertex_program: "/components/planets/planets.vp" 4 | fragment_program: "/components/planets/rivers/land_rivers.fp" 5 | vertex_space: VERTEX_SPACE_LOCAL 6 | vertex_constants { 7 | name: "mtx_worldview" 8 | type: CONSTANT_TYPE_WORLDVIEW 9 | value { 10 | x: 0.0 11 | y: 0.0 12 | z: 0.0 13 | w: 0.0 14 | } 15 | } 16 | vertex_constants { 17 | name: "mtx_proj" 18 | type: CONSTANT_TYPE_PROJECTION 19 | value { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 0.0 24 | } 25 | } 26 | fragment_constants { 27 | name: "transform" 28 | type: CONSTANT_TYPE_USER 29 | value { 30 | x: 4.6 31 | y: 100.0 32 | z: 0.2 33 | w: 0.0 34 | } 35 | } 36 | fragment_constants { 37 | name: "generic" 38 | type: CONSTANT_TYPE_USER 39 | value { 40 | x: 8.98 41 | y: 0.0 42 | z: 0.1 43 | w: 6.0 44 | } 45 | } 46 | fragment_constants { 47 | name: "lights" 48 | type: CONSTANT_TYPE_USER 49 | value { 50 | x: 0.39 51 | y: 0.39 52 | z: 0.0 53 | w: 0.0 54 | } 55 | } 56 | fragment_constants { 57 | name: "modify" 58 | type: CONSTANT_TYPE_USER 59 | value { 60 | x: 0.0 61 | y: 0.0 62 | z: 3.951 63 | w: 0.0 64 | } 65 | } 66 | fragment_constants { 67 | name: "border" 68 | type: CONSTANT_TYPE_USER 69 | value { 70 | x: 0.287 71 | y: 0.476 72 | z: 0.0 73 | w: 0.0 74 | } 75 | } 76 | fragment_constants { 77 | name: "extras" 78 | type: CONSTANT_TYPE_USER 79 | value { 80 | x: 0.0 81 | y: 0.0 82 | z: 0.476 83 | w: 0.0 84 | } 85 | } 86 | fragment_constants { 87 | name: "col1" 88 | type: CONSTANT_TYPE_USER 89 | value { 90 | x: 0.39 91 | y: 0.67 92 | z: 0.25 93 | w: 1.0 94 | } 95 | } 96 | fragment_constants { 97 | name: "col2" 98 | type: CONSTANT_TYPE_USER 99 | value { 100 | x: 0.23 101 | y: 0.49 102 | z: 0.31 103 | w: 1.0 104 | } 105 | } 106 | fragment_constants { 107 | name: "col3" 108 | type: CONSTANT_TYPE_USER 109 | value { 110 | x: 0.18 111 | y: 0.34 112 | z: 0.33 113 | w: 1.0 114 | } 115 | } 116 | fragment_constants { 117 | name: "col4" 118 | type: CONSTANT_TYPE_USER 119 | value { 120 | x: 0.16 121 | y: 0.21 122 | z: 0.25 123 | w: 1.0 124 | } 125 | } 126 | fragment_constants { 127 | name: "river_col" 128 | type: CONSTANT_TYPE_USER 129 | value { 130 | x: 0.31 131 | y: 0.64 132 | z: 0.72 133 | w: 1.0 134 | } 135 | } 136 | fragment_constants { 137 | name: "river_col_dark" 138 | type: CONSTANT_TYPE_USER 139 | value { 140 | x: 0.25 141 | y: 0.29 142 | z: 0.45 143 | w: 1.0 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /components/planets/lava_world/lava_world.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local craters = msg.url() 5 | local lakes = msg.url() 6 | 7 | local planet_size = 0.0 8 | local planet_time_speed = 0.0 9 | 10 | local crater_size = 0.0 11 | local crater_time_speed = 0 12 | 13 | local lakes_size = 0.0 14 | local lakes_time_speed = 0 15 | 16 | local time = 1000.0 17 | 18 | local function set_seed() 19 | go.set(planet, "generic.x", config.rseed) 20 | go.set(craters, "generic.x", config.rseed) 21 | go.set(lakes, "generic.x", config.rseed) 22 | end 23 | 24 | local function set_pixel() 25 | go.set(planet, "transform.y", config.rpixel) 26 | go.set(craters, "transform.y", config.rpixel) 27 | go.set(lakes, "transform.y", config.rpixel) 28 | end 29 | 30 | local function set_rotation() 31 | go.set(planet, "transform.z", config.rrot) 32 | go.set(craters, "transform.z", config.rrot) 33 | go.set(lakes, "transform.z", config.rrot) 34 | end 35 | 36 | local function set_light() 37 | go.set(planet, "lights.x", config.rlight.x) 38 | go.set(planet, "lights.y", config.rlight.y) 39 | 40 | go.set(craters, "lights.x", config.rlight.x) 41 | go.set(craters, "lights.y", config.rlight.y) 42 | 43 | go.set(lakes, "lights.x", config.rlight.x) 44 | go.set(lakes, "lights.y", config.rlight.y) 45 | end 46 | 47 | function init(self) 48 | planet = msg.url("planet_under#planet_under") 49 | craters = msg.url("craters#craters") 50 | lakes = msg.url("rivers#rivers") 51 | 52 | set_seed() 53 | set_pixel() 54 | set_rotation() 55 | 56 | planet_size = go.get(planet, "transform.x") 57 | planet_time_speed = go.get(planet, "generic.z") 58 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 59 | 60 | crater_size = go.get(craters, "transform.x") 61 | crater_time_speed = go.get(craters, "generic.z") 62 | crater_size = config.round(crater_size * 2.0) / crater_time_speed 63 | 64 | lakes_size = go.get(lakes, "transform.x") 65 | lakes_time_speed = go.get(lakes, "generic.z") 66 | lakes_size = config.round(lakes_size * 2.0) / lakes_time_speed 67 | end 68 | 69 | function update(self, dt) 70 | time = time + dt 71 | go.set(planet, "generic.y", time * planet_size * 0.02) 72 | go.set(craters, "generic.y", time * crater_size * 0.02) 73 | go.set(lakes, "generic.y", time * lakes_size * 0.02) 74 | end 75 | 76 | function on_message(self, message_id, message, sender) 77 | if message_id == config.msg.set_planet_seed then 78 | set_seed() 79 | elseif message_id == config.msg.set_planet_pixel then 80 | set_pixel() 81 | elseif message_id == config.msg.set_planet_rotation then 82 | set_rotation() 83 | elseif message_id == config.msg.set_planet_light then 84 | set_light() 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /components/planets/land_masses/land_masses.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local clouds = msg.url() 5 | local lakes = msg.url() 6 | 7 | local planet_size = 0.0 8 | local planet_time_speed = 0.0 9 | 10 | local cloud_size = 0.0 11 | local cloud_time_speed = 0 12 | 13 | local lakes_size = 0.0 14 | local lakes_time_speed = 0 15 | 16 | local time = 1000.0 17 | 18 | local function set_seed() 19 | go.set(planet, "generic.x", config.rseed) 20 | go.set(clouds, "generic.x", config.rseed) 21 | go.set(lakes, "generic.x", config.rseed) 22 | 23 | go.set(clouds, "modify.x", rnd.double_range(0.35, 0.6)) 24 | end 25 | 26 | local function set_pixel() 27 | go.set(planet, "transform.y", config.rpixel) 28 | go.set(clouds, "transform.y", config.rpixel) 29 | go.set(lakes, "transform.y", config.rpixel) 30 | end 31 | 32 | local function set_rotation() 33 | go.set(planet, "transform.z", config.rrot) 34 | go.set(clouds, "transform.z", config.rrot) 35 | go.set(lakes, "transform.z", config.rrot) 36 | end 37 | 38 | local function set_light() 39 | go.set(planet, "lights.x", config.rlight.x) 40 | go.set(planet, "lights.y", config.rlight.y) 41 | 42 | go.set(clouds, "lights.x", config.rlight.x) 43 | go.set(clouds, "lights.y", config.rlight.y) 44 | 45 | go.set(lakes, "lights.x", config.rlight.x) 46 | go.set(lakes, "lights.y", config.rlight.y) 47 | end 48 | 49 | function init(self) 50 | planet = msg.url("land#land") 51 | clouds = msg.url("clouds#clouds") 52 | lakes = msg.url("water#planet_under") 53 | 54 | set_seed() 55 | set_pixel() 56 | set_rotation() 57 | 58 | planet_size = go.get(planet, "transform.x") 59 | planet_time_speed = go.get(planet, "generic.z") 60 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 61 | 62 | cloud_size = go.get(clouds, "transform.x") 63 | cloud_time_speed = go.get(clouds, "generic.z") 64 | cloud_size = config.round(cloud_size * 2.0) / cloud_time_speed 65 | 66 | lakes_size = go.get(lakes, "transform.x") 67 | lakes_time_speed = go.get(lakes, "generic.z") 68 | lakes_size = config.round(lakes_size * 2.0) / lakes_time_speed 69 | end 70 | 71 | function update(self, dt) 72 | time = time + dt 73 | go.set(planet, "generic.y", time * planet_size * 0.02) 74 | go.set(clouds, "generic.y", time * cloud_size * 0.01) 75 | go.set(lakes, "generic.y", time * lakes_size * 0.02) 76 | end 77 | 78 | function on_message(self, message_id, message, sender) 79 | if message_id == config.msg.set_planet_seed then 80 | set_seed() 81 | elseif message_id == config.msg.set_planet_pixel then 82 | set_pixel() 83 | elseif message_id == config.msg.set_planet_rotation then 84 | set_rotation() 85 | elseif message_id == config.msg.set_planet_light then 86 | set_light() 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /vulkan-opengl.appmanifest: -------------------------------------------------------------------------------- 1 | # App manifest generated Sun Mar 21 2021 20:40:09 GMT+0300 (GMT+03:00) 2 | # Settings: Vulkan,OpenGL 3 | platforms: 4 | x86_64-osx: 5 | context: 6 | excludeLibs: [] 7 | excludeSymbols: [] 8 | symbols: ["GraphicsAdapterVulkan"] 9 | libs: ["graphics_vulkan","MoltenVK"] 10 | frameworks: ["Metal","IOSurface","QuartzCore"] 11 | linkFlags: [] 12 | 13 | x86_64-linux: 14 | context: 15 | excludeLibs: [] 16 | excludeSymbols: [] 17 | symbols: ["GraphicsAdapterVulkan"] 18 | libs: ["graphics_vulkan","X11-xcb"] 19 | linkFlags: [] 20 | 21 | js-web: 22 | context: 23 | excludeLibs: [] 24 | excludeJsLibs: [] 25 | excludeSymbols: [] 26 | symbols: [] 27 | libs: [] 28 | linkFlags: [] 29 | 30 | wasm-web: 31 | context: 32 | excludeLibs: [] 33 | excludeJsLibs: [] 34 | excludeSymbols: [] 35 | symbols: [] 36 | libs: [] 37 | linkFlags: [] 38 | 39 | x86-win32: 40 | context: 41 | excludeLibs: [] 42 | excludeSymbols: [] 43 | symbols: ["GraphicsAdapterVulkan"] 44 | libs: ["libgraphics_vulkan.lib","vulkan-1.lib"] 45 | linkFlags: [] 46 | 47 | x86_64-win32: 48 | context: 49 | excludeLibs: [] 50 | excludeSymbols: [] 51 | symbols: ["GraphicsAdapterVulkan"] 52 | libs: ["libgraphics_vulkan.lib","vulkan-1.lib"] 53 | linkFlags: [] 54 | 55 | armv7-android: 56 | context: 57 | excludeLibs: [] 58 | excludeJars: [] 59 | excludeSymbols: [] 60 | symbols: ["GraphicsAdapterVulkan"] 61 | libs: ["graphics_vulkan"] 62 | linkFlags: [] 63 | 64 | arm64-android: 65 | context: 66 | excludeLibs: [] 67 | excludeJars: [] 68 | excludeSymbols: [] 69 | symbols: ["GraphicsAdapterVulkan"] 70 | libs: ["graphics_vulkan"] 71 | linkFlags: [] 72 | 73 | armv7-ios: 74 | context: 75 | excludeLibs: [] 76 | excludeSymbols: [] 77 | symbols: [] 78 | libs: [] 79 | frameworks: [] 80 | linkFlags: [] 81 | 82 | arm64-ios: 83 | context: 84 | excludeLibs: [] 85 | excludeSymbols: [] 86 | symbols: ["GraphicsAdapterVulkan"] 87 | libs: ["graphics_vulkan","MoltenVK"] 88 | frameworks: ["Metal","QuartzCore"] 89 | linkFlags: [] 90 | 91 | x86_64-ios: 92 | context: 93 | excludeLibs: [] 94 | excludeSymbols: [] 95 | symbols: [] 96 | libs: [] 97 | frameworks: [] 98 | linkFlags: [] 99 | 100 | -------------------------------------------------------------------------------- /components/planets/ice_world/lakes.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 border; 7 | uniform lowp vec4 extras; 8 | uniform lowp vec4 lights; 9 | 10 | uniform vec4 color1; 11 | uniform vec4 color2; 12 | uniform vec4 color3; 13 | 14 | const lowp vec2 dir_x = vec2(1.0, 0.0); 15 | const lowp vec2 dir_y = vec2(0.0, 1.0); 16 | const lowp vec2 dir_z = vec2(1.0, 1.0); 17 | 18 | float rand(vec2 coord) 19 | { 20 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 21 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 22 | } 23 | 24 | float noise(vec2 coord) 25 | { 26 | vec2 i = floor(coord); 27 | vec2 f = fract(coord); 28 | 29 | float a = rand(i); 30 | float b = rand(i + dir_x); 31 | float c = rand(i + dir_y); 32 | float d = rand(i + dir_z); 33 | 34 | vec2 cubic = f * f * (3.0 - 2.0 * f); 35 | 36 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 37 | } 38 | 39 | float fbm(vec2 coord) 40 | { 41 | float value = 0.0; 42 | float scale = 0.5; 43 | 44 | for (int i = 0; i < int(generic.w); i++) 45 | { 46 | value += noise(coord) * scale; 47 | coord *= 2.0; 48 | scale *= 0.5; 49 | } 50 | return value; 51 | } 52 | 53 | vec2 spherify(vec2 uv) 54 | { 55 | vec2 centered = uv * 2.0 - 1.0; 56 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 57 | vec2 sphere = centered / (z + 1.0); 58 | return sphere * 0.5 + 0.5; 59 | } 60 | 61 | vec2 rotate(vec2 coord, float angle) 62 | { 63 | coord -= 0.5; 64 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 65 | return coord + 0.5; 66 | } 67 | 68 | bool dither(vec2 uv1, vec2 uv2) 69 | { 70 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 71 | } 72 | 73 | void main() 74 | { 75 | // pixelize uv 76 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 77 | uv.y = 1.0 - uv.y; 78 | /* 79 | vec2 newTCoord = uv; 80 | newTCoord.y = 1.0 - newTCoord.y; 81 | uv = newTCoord; 82 | */ 83 | float d_light = distance(uv, lights.xy); 84 | 85 | // give planet a tilt 86 | uv = rotate(uv, transform.z); 87 | 88 | // // map to sphere 89 | uv = spherify(uv); 90 | 91 | // some scrolling noise for landmasses 92 | float fbm1 = fbm(uv * transform.x + vec2(generic.y * generic.z, 0.0)); 93 | float lake = fbm(uv * transform.x + vec2(generic.y * generic.z, 0.0)); 94 | 95 | // increase contrast on d_light 96 | d_light = pow(d_light, 2.0) * 0.4; 97 | d_light -= d_light * lake; 98 | 99 | lowp vec3 c = color3.rgb * float(d_light >= border.y) + 100 | color2.rgb * float(d_light >= border.x && d_light < border.y) + 101 | color1.rgb * float(d_light < border.x); 102 | 103 | float a = step(extras.z, lake); 104 | a *= step(distance(vec2(0.5), uv), 0.5); 105 | gl_FragColor = vec4(c, a); 106 | } 107 | -------------------------------------------------------------------------------- /components/planets/no_atmosphere/no_atmosphere.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 lights; 7 | uniform lowp vec4 border; 8 | uniform lowp vec4 modify; 9 | 10 | uniform vec4 color1; 11 | uniform vec4 color2; 12 | uniform vec4 color3; 13 | 14 | const lowp vec2 dir_x = vec2(1.0, 0.0); 15 | const lowp vec2 dir_y = vec2(0.0, 1.0); 16 | const lowp vec2 dir_z = vec2(1.0, 1.0); 17 | 18 | float rand(vec2 coord) 19 | { 20 | coord = mod(coord, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 21 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 22 | } 23 | 24 | float noise(vec2 coord) 25 | { 26 | vec2 i = floor(coord); 27 | vec2 f = fract(coord); 28 | 29 | float a = rand(i); 30 | float b = rand(i + dir_x); 31 | float c = rand(i + dir_y); 32 | float d = rand(i + dir_z); 33 | 34 | vec2 cubic = f * f * (3.0 - 2.0 * f); 35 | 36 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 37 | } 38 | 39 | float fbm(vec2 coord) 40 | { 41 | float value = 0.0; 42 | float scale = 0.5; 43 | 44 | for (int i = 0; i < int(generic.w); i++) 45 | { 46 | value += noise(coord) * scale; 47 | coord *= 2.0; 48 | scale *= 0.5; 49 | } 50 | return value; 51 | } 52 | 53 | bool dither(vec2 uv1, vec2 uv2) 54 | { 55 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 56 | } 57 | 58 | vec2 rotate(vec2 coord, float angle) 59 | { 60 | coord -= 0.5; 61 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 62 | return coord + 0.5; 63 | } 64 | 65 | void main() 66 | { 67 | 68 | // pixelize uv 69 | 70 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 71 | uv.y = 1.0 - uv.y; 72 | 73 | // check distance from center & distance to light 74 | float d_circle = distance(uv, vec2(0.5)); 75 | float d_light = distance(uv, vec2(lights.xy)); 76 | 77 | bool dith = dither(uv, var_texcoord0); 78 | uv = rotate(uv, transform.z); 79 | 80 | // cut out a circle 81 | float a = step(d_circle, 0.5); 82 | 83 | // get a noise value with light distance added 84 | // this creates a moving dynamic shape 85 | float fbm1 = fbm(uv); 86 | d_light += fbm(uv * transform.x + fbm1 + vec2(generic.y * generic.z, 0.0)) * 87 | 0.3; // change the magic 0.3 here for different light strengths 88 | 89 | // size of edge in which colors should be dithered 90 | float dither_border = (1.0 / transform.y) * modify.z; 91 | 92 | lowp vec3 c = color3.rgb * float(d_light >= border.y) + 93 | color2.rgb * float(d_light >= border.x && d_light < border.y) + 94 | color1.rgb * float(d_light < border.x); 95 | 96 | c = mix(c, color1.rgb, float(d_light > border.x && d_light < border.x + dither_border && dith)); 97 | c = mix(c, color2.rgb, float(d_light > border.y && d_light < border.y + dither_border && dith)); 98 | 99 | gl_FragColor = vec4(c, a); 100 | } 101 | -------------------------------------------------------------------------------- /components/planets/star/star_blobs.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 circles; 7 | 8 | uniform lowp vec4 color; 9 | 10 | const lowp vec2 dir_x = vec2(1.0, 0.0); 11 | const lowp vec2 dir_y = vec2(0.0, 1.0); 12 | const lowp vec2 dir_z = vec2(1.0, 1.0); 13 | 14 | float rand(vec2 co) 15 | { 16 | co = mod(co, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 17 | return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 15.5453 * generic.x); 18 | } 19 | 20 | vec2 rotate(vec2 vec, float angle) 21 | { 22 | vec -= vec2(0.5); 23 | vec *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 24 | vec += vec2(0.5); 25 | return vec; 26 | } 27 | 28 | float circle(vec2 uv) 29 | { 30 | float invert = 1.0 / circles.x; 31 | 32 | uv.x = (uv.x + invert * 0.5) * float(mod(uv.y, invert * 2.0) < invert); 33 | 34 | vec2 rand_co = floor(uv * circles.x) / circles.x; 35 | uv = mod(uv, invert) * circles.x; 36 | 37 | float r = rand(rand_co); 38 | r = clamp(r, invert, 1.0 - invert); 39 | float circle = distance(uv, vec2(r)); 40 | return smoothstep(circle, circle + 0.5, invert * circles.y * rand(rand_co * 1.5)); 41 | } 42 | 43 | float noise(vec2 coord) 44 | { 45 | vec2 i = floor(coord); 46 | vec2 f = fract(coord); 47 | 48 | float a = rand(i); 49 | float b = rand(i + dir_x); 50 | float c = rand(i + dir_y); 51 | float d = rand(i + dir_z); 52 | 53 | vec2 cubic = f * f * (3.0 - 2.0 * f); 54 | 55 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 56 | } 57 | 58 | float fbm(vec2 coord) 59 | { 60 | float value = 0.0; 61 | float scl = 0.5; 62 | 63 | for (int i = 0; i < int(generic.w); i++) 64 | { 65 | value += noise(coord) * scl; 66 | coord *= 2.0; 67 | scl *= 0.5; 68 | } 69 | return value; 70 | } 71 | 72 | bool dither(vec2 uv1, vec2 uv2) 73 | { 74 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 75 | } 76 | 77 | vec2 spherify(vec2 uv) 78 | { 79 | vec2 centered = uv * 2.0 - 1.0; 80 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 81 | vec2 sphere = centered / (z + 1.0); 82 | return sphere * 0.5 + 0.5; 83 | } 84 | 85 | void main() 86 | { 87 | vec2 pixelized = floor(var_texcoord0 * transform.y) / transform.y; 88 | pixelized.y = 1.0 - pixelized.y; 89 | bool dith = dither(var_texcoord0, pixelized); 90 | 91 | vec2 uv = rotate(pixelized, transform.z); 92 | 93 | // angle from centered uv's 94 | float angle = atan(uv.x - 0.5, uv.y - 0.5); 95 | float d = distance(pixelized, vec2(0.5)); 96 | 97 | float c = 0.0; 98 | for (int i = 0; i < 15; i++) 99 | { 100 | float r = rand(vec2(float(i))); 101 | vec2 circleUV = vec2(d, angle); 102 | c += circle(circleUV * transform.x - generic.y * generic.z - (1.0 / d) * 0.1 + r); 103 | } 104 | 105 | c *= 0.37 - d; 106 | c = step(0.07, c - d); 107 | 108 | gl_FragColor = vec4(vec3(color.rgb), c); 109 | } 110 | -------------------------------------------------------------------------------- /components/planets/lava_world/rivers.fp: -------------------------------------------------------------------------------- 1 | varying mediump vec2 var_texcoord0; 2 | 3 | uniform lowp vec4 transform; 4 | uniform lowp vec4 generic; 5 | uniform lowp vec4 lights; 6 | uniform lowp vec4 border; 7 | uniform lowp vec4 extras; 8 | uniform lowp vec4 color1; 9 | uniform lowp vec4 color2; 10 | uniform lowp vec4 color3; 11 | 12 | const lowp vec2 circle_v = vec2(0.5); 13 | const lowp vec2 dir_x = vec2(1.0, 0.0); 14 | const lowp vec2 dir_y = vec2(0.0, 1.0); 15 | const lowp vec2 dir_z = vec2(1.0, 1.0); 16 | 17 | float rand(vec2 coord) 18 | { 19 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 20 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 15.5453 * generic.x); 21 | } 22 | 23 | float noise(vec2 coord) 24 | { 25 | vec2 i = floor(coord); 26 | vec2 f = fract(coord); 27 | 28 | float a = rand(i); 29 | float b = rand(i + dir_x); 30 | float c = rand(i + dir_y); 31 | float d = rand(i + dir_z); 32 | 33 | vec2 cubic = f * f * (3.0 - 2.0 * f); 34 | 35 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 36 | } 37 | 38 | float fbm(vec2 coord) 39 | { 40 | lowp float value = 0.0; 41 | lowp float scale = 0.5; 42 | 43 | for (int i = 0; i < int(generic.w); i++) 44 | { 45 | value += noise(coord) * scale; 46 | coord *= 2.0; 47 | scale *= 0.5; 48 | } 49 | return value; 50 | } 51 | 52 | vec2 spherify(vec2 uv) 53 | { 54 | vec2 centered = uv * 2.0 - 1.0; 55 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 56 | vec2 sphere = centered / (z + 1.0); 57 | return sphere * 0.5 + 0.5; 58 | } 59 | 60 | vec2 rotate(vec2 coord, float angle) 61 | { 62 | coord -= 0.5; 63 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 64 | return coord + 0.5; 65 | } 66 | 67 | bool dither(vec2 uv1, vec2 uv2) 68 | { 69 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 70 | } 71 | 72 | void main() 73 | { 74 | // pixelize uv 75 | lowp vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 76 | uv.y = 1.0 - uv.y; 77 | 78 | lowp float d_light = distance(uv, lights.xy); 79 | 80 | // cut out a circle 81 | lowp float d_circle = distance(uv, circle_v); 82 | lowp float a = step(d_circle, 0.5); 83 | 84 | // give planet a tilt 85 | uv = rotate(uv, transform.z); 86 | 87 | // map to sphere 88 | uv = spherify(uv); 89 | 90 | // some scrolling noise for landmasses 91 | lowp float fbm1 = fbm(uv * transform.x + vec2(generic.y * generic.z, 0.0)); 92 | lowp float river_fbm = fbm(uv + fbm1 * 2.5); 93 | 94 | // increase contrast on d_light 95 | d_light = pow(d_light, 2.0) * 0.4; 96 | d_light -= d_light * river_fbm; 97 | 98 | river_fbm = step(extras.z, river_fbm); 99 | 100 | a *= step(extras.z, river_fbm); 101 | 102 | lowp vec3 c = color3.rgb * float(d_light >= border.y) + 103 | color2.rgb * float(d_light >= border.x && d_light < border.y) + 104 | color1.rgb * float(d_light < border.x); 105 | 106 | gl_FragColor = vec4(c, a); 107 | } 108 | -------------------------------------------------------------------------------- /vulkan.appmanifest: -------------------------------------------------------------------------------- 1 | # App manifest generated Sun Mar 21 2021 20:39:24 GMT+0300 (GMT+03:00) 2 | # Settings: Vulkan 3 | platforms: 4 | x86_64-osx: 5 | context: 6 | excludeLibs: ["graphics"] 7 | excludeSymbols: ["GraphicsAdapterOpenGL"] 8 | symbols: ["GraphicsAdapterVulkan"] 9 | libs: ["graphics_vulkan","MoltenVK"] 10 | frameworks: ["Metal","IOSurface","QuartzCore"] 11 | linkFlags: [] 12 | 13 | x86_64-linux: 14 | context: 15 | excludeLibs: ["graphics"] 16 | excludeSymbols: ["GraphicsAdapterOpenGL"] 17 | symbols: ["GraphicsAdapterVulkan"] 18 | libs: ["graphics_vulkan","X11-xcb"] 19 | linkFlags: [] 20 | 21 | js-web: 22 | context: 23 | excludeLibs: [] 24 | excludeJsLibs: [] 25 | excludeSymbols: [] 26 | symbols: [] 27 | libs: [] 28 | linkFlags: [] 29 | 30 | wasm-web: 31 | context: 32 | excludeLibs: [] 33 | excludeJsLibs: [] 34 | excludeSymbols: [] 35 | symbols: [] 36 | libs: [] 37 | linkFlags: [] 38 | 39 | x86-win32: 40 | context: 41 | excludeLibs: ["libgraphics"] 42 | excludeSymbols: ["GraphicsAdapterOpenGL"] 43 | symbols: ["GraphicsAdapterVulkan"] 44 | libs: ["libgraphics_vulkan.lib","vulkan-1.lib"] 45 | linkFlags: [] 46 | 47 | x86_64-win32: 48 | context: 49 | excludeLibs: ["libgraphics"] 50 | excludeSymbols: ["GraphicsAdapterOpenGL"] 51 | symbols: ["GraphicsAdapterVulkan"] 52 | libs: ["libgraphics_vulkan.lib","vulkan-1.lib"] 53 | linkFlags: [] 54 | 55 | armv7-android: 56 | context: 57 | excludeLibs: ["graphics"] 58 | excludeJars: [] 59 | excludeSymbols: ["GraphicsAdapterOpenGL"] 60 | symbols: ["GraphicsAdapterVulkan"] 61 | libs: ["graphics_vulkan"] 62 | linkFlags: [] 63 | 64 | arm64-android: 65 | context: 66 | excludeLibs: ["graphics"] 67 | excludeJars: [] 68 | excludeSymbols: ["GraphicsAdapterOpenGL"] 69 | symbols: ["GraphicsAdapterVulkan"] 70 | libs: ["graphics_vulkan"] 71 | linkFlags: [] 72 | 73 | armv7-ios: 74 | context: 75 | excludeLibs: [] 76 | excludeSymbols: [] 77 | symbols: [] 78 | libs: [] 79 | frameworks: [] 80 | linkFlags: [] 81 | 82 | arm64-ios: 83 | context: 84 | excludeLibs: ["graphics"] 85 | excludeSymbols: ["GraphicsAdapterOpenGL"] 86 | symbols: ["GraphicsAdapterVulkan"] 87 | libs: ["graphics_vulkan","MoltenVK"] 88 | frameworks: ["Metal","QuartzCore"] 89 | linkFlags: [] 90 | 91 | x86_64-ios: 92 | context: 93 | excludeLibs: [] 94 | excludeSymbols: [] 95 | symbols: [] 96 | libs: [] 97 | frameworks: [] 98 | linkFlags: [] 99 | 100 | -------------------------------------------------------------------------------- /components/planets/dry_terran/dry_terran.fp: -------------------------------------------------------------------------------- 1 | varying mediump vec2 var_texcoord0; 2 | uniform sampler2D tex0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 lights; 7 | 8 | const lowp vec2 dir_x = vec2(1.0, 0.0); 9 | const lowp vec2 dir_y = vec2(0.0, 1.0); 10 | const lowp vec2 dir_z = vec2(1.0, 1.0); 11 | 12 | float rand(vec2 coord) 13 | { 14 | // land has to be tiled 15 | // tiling only works for integer values, thus the rounding 16 | // it would probably be better to only allow integer transform.xs 17 | // multiply by vec2(2,1) to simulate planet having another side 18 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 19 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 20 | } 21 | 22 | float noise(vec2 coord) 23 | { 24 | vec2 i = floor(coord); 25 | vec2 f = fract(coord); 26 | 27 | float a = rand(i); 28 | float b = rand(i + dir_x); 29 | float c = rand(i + dir_y); 30 | float d = rand(i + dir_z); 31 | 32 | vec2 cubic = f * f * (3.0 - 2.0 * f); 33 | 34 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 35 | } 36 | 37 | float fbm(vec2 coord) 38 | { 39 | float value = 0.0; 40 | float scale = 0.5; 41 | 42 | for (int i = 0; i < int(generic.w); i++) 43 | { 44 | value += noise(coord) * scale; 45 | coord *= 2.0; 46 | scale *= 0.5; 47 | } 48 | return value; 49 | } 50 | 51 | bool dither(vec2 uv1, vec2 uv2) 52 | { 53 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 54 | } 55 | 56 | vec2 rotate(vec2 coord, float angle) 57 | { 58 | coord -= 0.5; 59 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 60 | return coord + 0.5; 61 | } 62 | 63 | vec2 spherify(vec2 uv) 64 | { 65 | vec2 centered = uv * 2.0 - 1.0; 66 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 67 | vec2 sphere = centered / (z + 1.0); 68 | return sphere * 0.5 + 0.5; 69 | } 70 | 71 | void main() 72 | { 73 | 74 | // pixelize uv 75 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 76 | uv.y = 1.0 - uv.y; 77 | 78 | bool dith = dither(uv, var_texcoord0); 79 | 80 | uv = spherify(uv); 81 | 82 | // check distance from center & distance to light 83 | float d_circle = distance(uv, vec2(0.5)); 84 | float d_light = distance(uv, vec2(lights.xy)); 85 | 86 | uv = rotate(uv, transform.z); 87 | 88 | // cut out a circle 89 | float a = step(d_circle, 0.5); 90 | 91 | // noise 92 | float f = fbm(uv * transform.x + vec2(generic.y * generic.z, 0.0)); 93 | 94 | // remap light 95 | d_light = smoothstep(-0.3, 1.2, d_light); 96 | 97 | d_light = d_light * 0.81 * float(d_light < lights.z || d_light < lights.w) + 98 | d_light * float(d_light > lights.z && d_light > lights.w); 99 | 100 | float c = d_light * pow(f, 0.8) * 3.5; // change the magic nums here for different light strengths 101 | 102 | c = mix(c, ((c + 0.02) * 1.05), float(dith)); 103 | 104 | // now we can assign colors based on distance to light origin 105 | float posterize = floor(c * 4.0) / 4.0; 106 | // vec4 co1l = texture2D(tex0, vec2(posterize, 0.0)); 107 | vec3 col = texture2D(tex0, vec2(posterize, 0.0)).rgb; 108 | 109 | gl_FragColor = vec4(col, a); 110 | } 111 | -------------------------------------------------------------------------------- /components/planets/star/star.fp: -------------------------------------------------------------------------------- 1 | varying mediump vec2 var_texcoord0; 2 | 3 | uniform lowp sampler2D colorramp; 4 | 5 | uniform lowp vec4 transform; 6 | uniform lowp vec4 generic; 7 | uniform lowp vec4 extras; 8 | 9 | const lowp vec2 dir_x = vec2(1.0, 0.0); 10 | const lowp vec2 dir_y = vec2(0.0, 1.0); 11 | const lowp vec2 dir_z = vec2(1.0, 1.0); 12 | 13 | float rand(vec2 co) 14 | { 15 | 16 | co = mod(co, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 17 | return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 15.5453 * generic.x); 18 | } 19 | 20 | vec2 rotate(vec2 vec, float angle) 21 | { 22 | vec -= vec2(0.5); 23 | vec *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 24 | vec += vec2(0.5); 25 | return vec; 26 | } 27 | 28 | float noise(vec2 coord) 29 | { 30 | vec2 i = floor(coord); 31 | vec2 f = fract(coord); 32 | 33 | float a = rand(i); 34 | float b = rand(i + dir_x); 35 | float c = rand(i + dir_y); 36 | float d = rand(i + dir_z); 37 | vec2 cubic = f * f * (3.0 - 2.0 * f); 38 | 39 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 40 | } 41 | 42 | vec2 Hash2(vec2 p) 43 | { 44 | float t = (generic.y + 10.0) * .3; 45 | // p = mod(p, vec2(1.0,1.0)*round(transform.x)); 46 | return vec2(noise(p), noise(p * vec2(.3135 + sin(t), .5813 - cos(t)))); 47 | } 48 | 49 | // Tileable cell noise by Dave_Hoskins from shadertoy: https://www.shadertoy.com/view/4djGRh 50 | float Cells(in vec2 p, in float numCells) 51 | { 52 | p *= numCells; 53 | float d = 1.0e10; 54 | for (int xo = -1; xo <= 1; xo++) 55 | { 56 | for (int yo = -1; yo <= 1; yo++) 57 | { 58 | vec2 tp = floor(p) + vec2(float(xo), float(yo)); 59 | tp = p - tp - Hash2(mod(tp, numCells / extras.w)); 60 | d = min(d, dot(tp, tp)); 61 | } 62 | } 63 | return sqrt(d); 64 | } 65 | 66 | bool dither(vec2 uv1, vec2 uv2) 67 | { 68 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 69 | } 70 | 71 | vec2 spherify(vec2 uv) 72 | { 73 | vec2 centered = uv * 2.0 - 1.0; 74 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 75 | vec2 sphere = centered / (z + 1.0); 76 | return sphere * 0.5 + 0.5; 77 | } 78 | 79 | void main() 80 | { 81 | // pixelize uv 82 | vec2 pixelized = floor(var_texcoord0 * transform.y) / transform.y; 83 | pixelized.y = 1.0 - pixelized.y; 84 | 85 | // use dither val later to mix between colors 86 | bool dith = dither(var_texcoord0, pixelized); 87 | 88 | pixelized = rotate(pixelized, transform.z); 89 | 90 | // spherify has to go after dither 91 | pixelized = spherify(pixelized); 92 | 93 | // use two different transform.xd cells for some variation 94 | // float Cells(in vec2 p, in float numCells) 95 | float n = Cells(pixelized - vec2(generic.y * generic.z * 2.0, 0), 10.0); 96 | n *= Cells(pixelized - vec2(generic.y * generic.z * 2.0, 0), 20.0); 97 | 98 | // adjust cell value to get better looking stuff 99 | n *= 2.; 100 | n = clamp(n, 0.0, 1.0); 101 | n = mix(n, n*1.3, dith); 102 | 103 | // constrain values 4 possibilities and then choose color based on those 104 | float interpolate = floor(n * 3.0) / 3.0; 105 | vec3 c = texture(colorramp, vec2(interpolate, 0.0)).rgb; 106 | 107 | // cut out a circle 108 | float a = step(distance(pixelized, vec2(0.5)), .5); 109 | 110 | gl_FragColor = vec4(c, a); 111 | } 112 | -------------------------------------------------------------------------------- /components/planets/land_masses/planet_under.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 lights; 7 | uniform lowp vec4 border; 8 | uniform lowp vec4 modify; 9 | 10 | uniform vec4 color1; 11 | uniform vec4 color2; 12 | uniform vec4 color3; 13 | 14 | const lowp vec2 dir_x = vec2(1.0, 0.0); 15 | const lowp vec2 dir_y = vec2(0.0, 1.0); 16 | const lowp vec2 dir_z = vec2(1.0, 1.0); 17 | 18 | float rand(vec2 coord) 19 | { 20 | // land has to be tiled 21 | // tiling only works for integer values, thus the rounding 22 | // it would probably be better to only allow integer sizes 23 | // multiply by vec2(2,1) to simulate planet having another side 24 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 25 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 26 | } 27 | 28 | float noise(vec2 coord) 29 | { 30 | vec2 i = floor(coord); 31 | vec2 f = fract(coord); 32 | 33 | float a = rand(i); 34 | float b = rand(i + dir_x); 35 | float c = rand(i + dir_y); 36 | float d = rand(i + dir_z); 37 | 38 | vec2 cubic = f * f * (3.0 - 2.0 * f); 39 | 40 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 41 | } 42 | 43 | float fbm(vec2 coord) 44 | { 45 | float value = 0.0; 46 | float scale = 0.5; 47 | 48 | for (int i = 0; i < int(generic.w); i++) 49 | { 50 | value += noise(coord) * scale; 51 | coord *= 2.0; 52 | scale *= 0.5; 53 | } 54 | return value; 55 | } 56 | 57 | bool dither(vec2 uv1, vec2 uv2) 58 | { 59 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 60 | } 61 | 62 | vec2 rotate(vec2 coord, float angle) 63 | { 64 | coord -= 0.5; 65 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 66 | return coord + 0.5; 67 | } 68 | 69 | vec2 spherify(vec2 uv) 70 | { 71 | vec2 centered = uv * 2.0 - 1.0; 72 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 73 | vec2 sphere = centered / (z + 1.0); 74 | return sphere * 0.5 + 0.5; 75 | } 76 | 77 | void main() 78 | { 79 | // pixelize uv 80 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 81 | uv.y = 1.0 - uv.y; 82 | 83 | bool dith = dither(uv, var_texcoord0); 84 | 85 | uv = spherify(uv); 86 | uv = rotate(uv, transform.z); 87 | // check distance from center & distance to light 88 | float d_circle = distance(uv, vec2(0.5)); 89 | float d_light = distance(uv, vec2(lights.xy)); 90 | 91 | // cut out a circle 92 | float a = step(d_circle, 0.5); 93 | 94 | // get a noise value with light distance added 95 | d_light += fbm(uv * transform.x + vec2(generic.y * generic.z, 0.0)) * 96 | 0.3; // change the magic 0.3 here for different light strengths 97 | 98 | // size of edge in which colors should be dithered 99 | float dither_border = (1.0 / transform.y) * modify.z; 100 | 101 | 102 | 103 | lowp vec3 c = color3.rgb * float(d_light >= border.y) + 104 | color2.rgb * float(d_light >= border.x && d_light < border.y) + 105 | color1.rgb * float(d_light < border.x); 106 | 107 | c = mix(c, color1.rgb, float(d_light > border.x && d_light < border.x + dither_border && dith)); 108 | c = mix(c, color2.rgb, float(d_light > border.y && d_light < border.y + dither_border && dith)); 109 | 110 | gl_FragColor = vec4(c, a); 111 | } 112 | -------------------------------------------------------------------------------- /components/planets/land_masses/land_masses.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 lights; 6 | uniform lowp vec4 generic; 7 | uniform lowp vec4 border; 8 | uniform lowp vec4 extras; 9 | 10 | uniform lowp vec4 col1; 11 | uniform lowp vec4 col2; 12 | uniform lowp vec4 col3; 13 | uniform lowp vec4 col4; 14 | 15 | const lowp vec2 dir_x = vec2(1.0, 0.0); 16 | const lowp vec2 dir_y = vec2(0.0, 1.0); 17 | const lowp vec2 dir_z = vec2(1.0, 1.0); 18 | 19 | float rand(vec2 coord) 20 | { 21 | // land has to be tiled (or the contintents on this planet have to be changing very fast) 22 | // tiling only works for integer values, thus the rounding 23 | // it would probably be better to only allow integer sizes 24 | // multiply by vec2(2,1) to simulate planet having another side 25 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 26 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 27 | } 28 | 29 | float noise(vec2 coord) 30 | { 31 | vec2 i = floor(coord); 32 | vec2 f = fract(coord); 33 | 34 | float a = rand(i); 35 | float b = rand(i + dir_x); 36 | float c = rand(i + dir_y); 37 | float d = rand(i + dir_z); 38 | vec2 cubic = f * f * (3.0 - 2.0 * f); 39 | 40 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 41 | } 42 | 43 | float fbm(vec2 coord) 44 | { 45 | float value = 0.0; 46 | float scale = 0.5; 47 | 48 | for (int i = 0; i < int(generic.w); i++) 49 | { 50 | value += noise(coord) * scale; 51 | coord *= 2.0; 52 | scale *= 0.5; 53 | } 54 | return value; 55 | } 56 | 57 | vec2 spherify(vec2 uv) 58 | { 59 | vec2 centered = uv * 2.0 - 1.0; 60 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 61 | vec2 sphere = centered / (z + 1.0); 62 | return sphere * 0.5 + 0.5; 63 | } 64 | 65 | vec2 rotate(vec2 coord, float angle) 66 | { 67 | coord -= 0.5; 68 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 69 | return coord + 0.5; 70 | } 71 | 72 | void main() 73 | { 74 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 75 | uv.y = 1.0 - uv.y; 76 | 77 | float d_light = distance(uv, lights.xy); 78 | uv = rotate(uv, transform.z); 79 | uv = spherify(uv); 80 | vec2 base_fbm_uv = (uv)*transform.x + vec2(generic.y * generic.z, 0.0); 81 | 82 | float fbm1 = fbm(base_fbm_uv); 83 | float fbm2 = fbm(base_fbm_uv - lights.xy * fbm1); 84 | float fbm3 = fbm(base_fbm_uv - lights.xy * 1.5 * fbm1); 85 | float fbm4 = fbm(base_fbm_uv - lights.xy * 2.0 * fbm1); 86 | 87 | // lots of magic numbers here 88 | // you can mess with them, it changes the color distribution 89 | if (d_light < border.x) 90 | { 91 | fbm4 *= 0.9; 92 | } 93 | if (d_light > border.x) 94 | { 95 | fbm2 *= 1.05; 96 | fbm3 *= 1.05; 97 | fbm4 *= 1.05; 98 | } 99 | if (d_light > border.y) 100 | { 101 | fbm2 *= 1.3; 102 | fbm3 *= 1.4; 103 | fbm4 *= 1.8; 104 | } 105 | 106 | d_light = pow(d_light, 2.0) * 0.1; 107 | 108 | lowp vec3 result = col4.rgb; 109 | result = mix(result, col3.rgb, float(fbm4 + d_light < fbm1)); 110 | result = mix(result, col2.rgb, float(fbm3 + d_light < fbm1)); 111 | result = mix(result, col1.rgb, float(fbm2 + d_light < fbm1)); 112 | 113 | gl_FragColor = vec4(result, step(extras.z, fbm1)); 114 | } 115 | -------------------------------------------------------------------------------- /components/planets/gas_planet/gas_planet.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local clouds = msg.url() 5 | 6 | local planet_size = 0.0 7 | local planet_time_speed = 0.0 8 | 9 | local cloud_size = 0.0 10 | local cloud_time_speed = 0 11 | 12 | local time = 1000.0 13 | 14 | local function set_seed() 15 | go.set(planet, "generic.x", config.rseed) 16 | go.set(clouds, "generic.x", config.rseed) 17 | go.set(clouds, "modify.x", rnd.double_range(0.28, 0.5)) 18 | end 19 | 20 | local function set_pixel() 21 | go.set(planet, "transform.y", config.rpixel) 22 | go.set(clouds, "transform.y", config.rpixel) 23 | end 24 | 25 | local function set_rotation() 26 | go.set(planet, "transform.z", config.rrot) 27 | go.set(clouds, "transform.z", config.rrot) 28 | end 29 | 30 | local function set_light() 31 | go.set(planet, "lights.x", config.rlight.x) 32 | go.set(planet, "lights.y", config.rlight.y) 33 | 34 | go.set(clouds, "lights.x", config.rlight.x) 35 | go.set(clouds, "lights.y", config.rlight.y) 36 | end 37 | 38 | local function planet_init() 39 | go.set(planet, "transform", vmath.vector4(9.0, 100.0, 0.0, 1.0)) 40 | go.set(planet, "generic", vmath.vector4(5.939, 0.0, 0.7, 5.0)) 41 | go.set(planet, "modify", vmath.vector4(0.0, 1.3, 0.0, 0.0)) 42 | go.set(planet, "border", vmath.vector4(0.692, 0.666, 0.0, 0.0)) 43 | go.set(planet, "lights", vmath.vector4(0.25, 0.25, 0.0, 0.0)) 44 | go.set(planet, "base_color", vmath.vector4(0.23, 0.13, 0.15, 1.0)) 45 | go.set(planet, "outline_color", vmath.vector4(0.23, 0.13, 0.15, 1.0)) 46 | go.set(planet, "shadow_base_color", vmath.vector4(0.13, 0.09, 0.11, 1.0)) 47 | go.set(planet, "shadow_outline_color", vmath.vector4(0.13, 0.09, 0.11, 1.0)) 48 | 49 | go.set(clouds, "transform", vmath.vector4(9.0, 100, 0.0, 1.0)) 50 | go.set(clouds, "generic", vmath.vector4(5.939, 0.0, 0.47, 5.0)) 51 | go.set(clouds, "modify", vmath.vector4(0.538, 1.3, 0.0, 0.0)) 52 | go.set(clouds, "border", vmath.vector4(0.439, 0.746, 0.0, 0.0)) 53 | go.set(clouds, "lights", vmath.vector4(0.25, 0.25, 0.0, 0.0)) 54 | go.set(clouds, "base_color", vmath.vector4(0.94, 0.71, 0.25, 1.0)) 55 | go.set(clouds, "outline_color", vmath.vector4(0.81, 0.46, 0.17, 1.0)) 56 | go.set(clouds, "shadow_base_color", vmath.vector4(0.67, 0.32, 0.19, 1.0)) 57 | go.set(clouds, "shadow_outline_color", vmath.vector4(0.49, 0.22, 0.2, 1.0)) 58 | end 59 | 60 | function init(self) 61 | planet = msg.url("gas_planet#gas_planet") 62 | clouds = msg.url("clouds#clouds") 63 | planet_init() 64 | 65 | set_seed() 66 | set_pixel() 67 | set_rotation() 68 | 69 | planet_size = go.get(planet, "transform.x") 70 | planet_time_speed = go.get(planet, "generic.z") 71 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 72 | 73 | cloud_size = go.get(clouds, "transform.x") 74 | cloud_time_speed = go.get(clouds, "generic.z") 75 | cloud_size = config.round(cloud_size * 2.0) / cloud_time_speed 76 | end 77 | 78 | function update(self, dt) 79 | time = time + dt 80 | go.set(planet, "generic.y", time * planet_size * 0.005) 81 | go.set(clouds, "generic.y", time * cloud_size * 0.005) 82 | end 83 | 84 | function on_message(self, message_id, message, sender) 85 | if message_id == config.msg.set_planet_seed then 86 | set_seed() 87 | elseif message_id == config.msg.set_planet_pixel then 88 | set_pixel() 89 | elseif message_id == config.msg.set_planet_rotation then 90 | set_rotation() 91 | elseif message_id == config.msg.set_planet_light then 92 | set_light() 93 | end 94 | end 95 | -------------------------------------------------------------------------------- /components/planets/gas_planet/gas_planet.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 base_color; 5 | uniform lowp vec4 outline_color; 6 | uniform lowp vec4 shadow_base_color; 7 | uniform lowp vec4 shadow_outline_color; 8 | 9 | uniform lowp vec4 transform; 10 | uniform lowp vec4 modify; 11 | uniform lowp vec4 lights; 12 | uniform lowp vec4 generic; 13 | uniform lowp vec4 border; 14 | 15 | const lowp vec2 dir_x = vec2(1.0, 0.0); 16 | const lowp vec2 dir_y = vec2(0.0, 1.0); 17 | const lowp vec2 dir_z = vec2(1.0, 1.0); 18 | 19 | float rand(vec2 coord) 20 | { 21 | coord = mod(coord, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 22 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 23 | } 24 | 25 | float noise(vec2 coord) 26 | { 27 | vec2 i = floor(coord); 28 | vec2 f = fract(coord); 29 | 30 | float a = rand(i); 31 | float b = rand(i + dir_x); 32 | float c = rand(i + dir_y); 33 | float d = rand(i + dir_z); 34 | 35 | vec2 cubic = f * f * (3.0 - 2.0 * f); 36 | 37 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 38 | } 39 | 40 | float fbm(vec2 coord) 41 | { 42 | float value = 0.0; 43 | float scale = 0.5; 44 | 45 | for (int i = 0; i < int(generic.w); i++) 46 | { 47 | value += noise(coord) * scale; 48 | coord *= 2.0; 49 | scale *= 0.5; 50 | } 51 | return value; 52 | } 53 | 54 | // by Leukbaars from https://www.shadertoy.com/view/4tK3zR 55 | float circleNoise(vec2 uv) 56 | { 57 | float uv_y = floor(uv.y); 58 | uv.x += uv_y * .31; 59 | vec2 f = fract(uv); 60 | float h = rand(vec2(floor(uv.x), floor(uv_y))); 61 | float m = (length(f - 0.25 - (h * 0.5))); 62 | float r = h * 0.25; 63 | return smoothstep(0.0, r, m * 0.75); 64 | } 65 | 66 | float cloud_alpha(vec2 uv) 67 | { 68 | float c_noise = 0.0; 69 | 70 | // more iterations for more turbulence 71 | for (int i = 0; i < 9; i++) 72 | { 73 | c_noise += circleNoise((uv * transform.x * 0.3) + (float(i + 1) + 10.) + (vec2(generic.y * generic.z, 0.0))); 74 | } 75 | float fbm = fbm(uv * transform.x + c_noise + vec2(generic.y * generic.z, 0.0)); 76 | 77 | return fbm; // step(a_cutoff, fbm); 78 | } 79 | 80 | bool dither(vec2 uv_pixel, vec2 uv_real) 81 | { 82 | return mod(uv_pixel.x + uv_real.y, 2.0 / transform.y) <= 1.0 / transform.y; 83 | } 84 | 85 | vec2 spherify(vec2 uv) 86 | { 87 | vec2 centered = uv * 2.0 - 1.0; 88 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 89 | vec2 sphere = centered / (z + 1.0); 90 | return sphere * 0.5 + 0.5; 91 | } 92 | 93 | vec2 rotate(vec2 coord, float angle) 94 | { 95 | coord -= 0.5; 96 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 97 | return coord + 0.5; 98 | } 99 | 100 | void main() 101 | { 102 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 103 | uv.y = 1.0 - uv.y; 104 | // distance to light source 105 | float d_light = distance(uv, lights.xy); 106 | 107 | uv = rotate(uv, transform.z); 108 | 109 | // map to sphere 110 | uv = spherify(uv); 111 | 112 | // slightly make uv go down on the right, and up in the left 113 | uv.y += smoothstep(0.0, modify.y, abs(uv.x - 0.4)); 114 | 115 | float c = cloud_alpha(uv * vec2(1.0, transform.w)); 116 | 117 | lowp vec3 result = outline_color.rgb * float(c < modify.x + 0.03) + base_color.rgb * float(c > modify.x + 0.03); 118 | result = mix(result, shadow_base_color.rgb, float(d_light + c * 0.2 > border.x)); 119 | result = mix(result, shadow_outline_color.rgb, float(d_light + c * 0.2 > border.y)); 120 | 121 | gl_FragColor = vec4(result, step(modify.x, c)); 122 | } 123 | -------------------------------------------------------------------------------- /components/gui/field_tempalte.gui: -------------------------------------------------------------------------------- 1 | script: "/scripts/gui/settings.gui_script" 2 | fonts { 3 | name: "slkscre" 4 | font: "/assets/fonts/slkscre.font" 5 | } 6 | background_color { 7 | x: 0.0 8 | y: 0.0 9 | z: 0.0 10 | w: 0.0 11 | } 12 | nodes { 13 | position { 14 | x: 0.0 15 | y: 0.0 16 | z: 0.0 17 | w: 1.0 18 | } 19 | rotation { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 1.0 24 | } 25 | scale { 26 | x: 1.0 27 | y: 1.0 28 | z: 1.0 29 | w: 1.0 30 | } 31 | size { 32 | x: 0.0 33 | y: 0.0 34 | z: 0.0 35 | w: 1.0 36 | } 37 | color { 38 | x: 1.0 39 | y: 1.0 40 | z: 1.0 41 | w: 1.0 42 | } 43 | type: TYPE_BOX 44 | blend_mode: BLEND_MODE_ALPHA 45 | texture: "" 46 | id: "root" 47 | xanchor: XANCHOR_LEFT 48 | yanchor: YANCHOR_TOP 49 | pivot: PIVOT_NW 50 | adjust_mode: ADJUST_MODE_FIT 51 | layer: "gfx" 52 | inherit_alpha: false 53 | slice9 { 54 | x: 0.0 55 | y: 0.0 56 | z: 0.0 57 | w: 0.0 58 | } 59 | clipping_mode: CLIPPING_MODE_NONE 60 | clipping_visible: true 61 | clipping_inverted: false 62 | alpha: 0.0 63 | template_node_child: false 64 | size_mode: SIZE_MODE_MANUAL 65 | } 66 | nodes { 67 | position { 68 | x: 0.0 69 | y: 0.0 70 | z: 0.0 71 | w: 1.0 72 | } 73 | rotation { 74 | x: 0.0 75 | y: 0.0 76 | z: 0.0 77 | w: 1.0 78 | } 79 | scale { 80 | x: 1.0 81 | y: 1.0 82 | z: 1.0 83 | w: 1.0 84 | } 85 | size { 86 | x: 200.0 87 | y: 20.0 88 | z: 0.0 89 | w: 1.0 90 | } 91 | color { 92 | x: 0.0 93 | y: 0.0 94 | z: 0.0 95 | w: 1.0 96 | } 97 | type: TYPE_BOX 98 | blend_mode: BLEND_MODE_ALPHA 99 | texture: "" 100 | id: "planet_name" 101 | xanchor: XANCHOR_LEFT 102 | yanchor: YANCHOR_TOP 103 | pivot: PIVOT_NW 104 | adjust_mode: ADJUST_MODE_FIT 105 | parent: "root" 106 | layer: "dropdown_field" 107 | inherit_alpha: false 108 | slice9 { 109 | x: 0.0 110 | y: 0.0 111 | z: 0.0 112 | w: 0.0 113 | } 114 | clipping_mode: CLIPPING_MODE_NONE 115 | clipping_visible: true 116 | clipping_inverted: false 117 | alpha: 1.0 118 | template_node_child: false 119 | size_mode: SIZE_MODE_MANUAL 120 | } 121 | nodes { 122 | position { 123 | x: 12.0 124 | y: -3.0 125 | z: 0.0 126 | w: 1.0 127 | } 128 | rotation { 129 | x: 0.0 130 | y: 0.0 131 | z: 0.0 132 | w: 1.0 133 | } 134 | scale { 135 | x: 1.0 136 | y: 1.0 137 | z: 1.0 138 | w: 1.0 139 | } 140 | size { 141 | x: 200.0 142 | y: 15.0 143 | z: 0.0 144 | w: 1.0 145 | } 146 | color { 147 | x: 1.0 148 | y: 1.0 149 | z: 1.0 150 | w: 1.0 151 | } 152 | type: TYPE_TEXT 153 | blend_mode: BLEND_MODE_ALPHA 154 | text: "FIELD TITLE" 155 | font: "slkscre" 156 | id: "planet_name_txt" 157 | xanchor: XANCHOR_LEFT 158 | yanchor: YANCHOR_TOP 159 | pivot: PIVOT_NW 160 | outline { 161 | x: 0.0 162 | y: 1.0 163 | z: 0.0 164 | w: 1.0 165 | } 166 | shadow { 167 | x: 1.0 168 | y: 1.0 169 | z: 1.0 170 | w: 1.0 171 | } 172 | adjust_mode: ADJUST_MODE_FIT 173 | line_break: false 174 | parent: "planet_name" 175 | layer: "dropdown_txt" 176 | inherit_alpha: false 177 | alpha: 1.0 178 | outline_alpha: 0.0 179 | shadow_alpha: 0.0 180 | template_node_child: false 181 | text_leading: 1.0 182 | text_tracking: -0.05 183 | } 184 | layers { 185 | name: "gfx" 186 | } 187 | layers { 188 | name: "text" 189 | } 190 | layers { 191 | name: "dropdown" 192 | } 193 | layers { 194 | name: "dropdown_field" 195 | } 196 | layers { 197 | name: "dropdown_txt" 198 | } 199 | material: "/builtins/materials/gui.material" 200 | adjust_reference: ADJUST_REFERENCE_PARENT 201 | max_nodes: 512 202 | -------------------------------------------------------------------------------- /components/planets/gas_giant/ring.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform sampler2D colorscheme; 5 | uniform sampler2D dark_colorscheme; 6 | 7 | uniform lowp vec4 transform; 8 | uniform lowp vec4 generic; 9 | uniform lowp vec4 lights; 10 | uniform lowp vec4 modify; 11 | uniform lowp vec4 extras; 12 | 13 | const lowp vec2 dir_x = vec2(1.0, 0.0); 14 | const lowp vec2 dir_y = vec2(0.0, 1.0); 15 | const lowp vec2 dir_z = vec2(1.0, 1.0); 16 | 17 | float rand(vec2 coord) 18 | { 19 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 20 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 21 | } 22 | 23 | float noise(vec2 coord) 24 | { 25 | vec2 i = floor(coord); 26 | vec2 f = fract(coord); 27 | 28 | float a = rand(i); 29 | float b = rand(i + dir_x); 30 | float c = rand(i + dir_y); 31 | float d = rand(i + dir_z); 32 | 33 | vec2 cubic = f * f * (3.0 - 2.0 * f); 34 | 35 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 36 | } 37 | 38 | float fbm(vec2 coord) 39 | { 40 | float value = 0.0; 41 | float scale = 0.5; 42 | 43 | for (int i = 0; i < int(generic.w); i++) 44 | { 45 | value += noise(coord) * scale; 46 | coord *= 2.0; 47 | scale *= 0.5; 48 | } 49 | return value; 50 | } 51 | 52 | // by Leukbaars from https://www.shadertoy.com/view/4tK3zR 53 | float circleNoise(vec2 uv) 54 | { 55 | float uv_y = floor(uv.y); 56 | uv.x += uv_y * .31; 57 | vec2 f = fract(uv); 58 | float h = rand(vec2(floor(uv.x), floor(uv_y))); 59 | float m = (length(f - 0.25 - (h * 0.5))); 60 | float r = h * 0.25; 61 | return smoothstep(0.0, r, m * 0.75); 62 | } 63 | 64 | bool dither(vec2 uv_pixel, vec2 uv_real) 65 | { 66 | return mod(uv_pixel.x + uv_real.y, 2.0 / transform.y) <= 1.0 / transform.y; 67 | } 68 | 69 | vec2 spherify(vec2 uv) 70 | { 71 | vec2 centered = uv * 2.0 - 1.0; 72 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 73 | vec2 sphere = centered / (z + 1.0); 74 | return sphere * 0.5 + 0.5; 75 | } 76 | 77 | vec2 rotate(vec2 coord, float angle) 78 | { 79 | coord -= 0.5; 80 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 81 | return coord + 0.5; 82 | } 83 | 84 | void main() 85 | { 86 | // pixelize uv 87 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 88 | uv.y = 1.0 - uv.y; 89 | // we use this value later to dither between colors 90 | bool dith = dither(var_texcoord0, uv); 91 | 92 | float light_d = distance(uv, lights.xy); 93 | uv = rotate(uv, transform.z); 94 | 95 | // center is used to determine ring position 96 | vec2 uv_center = uv - vec2(0.0, 0.5); 97 | 98 | // tilt ring 99 | uv_center *= vec2(1.0, extras.y); 100 | float center_d = distance(uv_center, vec2(0.5, 0.0)); 101 | 102 | // cut out 2 circles of different transform.xs and only intersection of the 2. 103 | float ring = smoothstep(0.5 - extras.x * 2.0, 0.5 - extras.x, center_d); 104 | ring *= smoothstep(center_d - extras.x, center_d, 0.4); 105 | 106 | ring = mix(ring, ring * step(1.0 / modify.w, distance(uv, vec2(0.5))), float(uv.y < 0.5)); 107 | 108 | // rotate material in the ring 109 | uv_center = rotate(uv_center + vec2(0, 0.5), generic.y * generic.z); 110 | // some noise 111 | ring *= fbm(uv_center * transform.x); 112 | 113 | // apply some colors based on final value 114 | float posterized = floor((ring + pow(light_d, 2.0) * 2.0) * 4.0) / 4.0; 115 | 116 | vec3 col = texture2D(dark_colorscheme, vec2(posterized - 1.0, uv.y)).rgb; 117 | col = mix(col, texture2D(colorscheme, vec2(posterized, uv.y)).rgb, float(posterized <= 1.0)); 118 | 119 | float ring_a = step(0.28, ring); 120 | gl_FragColor = vec4(col, ring_a); 121 | } 122 | -------------------------------------------------------------------------------- /components/planets/asteroids/asteroid.fp: -------------------------------------------------------------------------------- 1 | varying mediump vec2 var_texcoord0; 2 | 3 | uniform lowp vec4 transform; 4 | uniform lowp vec4 generic; 5 | uniform lowp vec4 lights; 6 | uniform lowp vec4 color1; 7 | uniform lowp vec4 color2; 8 | uniform lowp vec4 color3; 9 | 10 | const lowp vec2 dir_x = vec2(1.0, 0.0); 11 | const lowp vec2 dir_y = vec2(0.0, 1.0); 12 | const lowp vec2 dir_z = vec2(1.0, 1.0); 13 | 14 | float rand(vec2 coord) 15 | { 16 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 17 | } 18 | 19 | float noise(vec2 coord) 20 | { 21 | vec2 i = floor(coord); 22 | vec2 f = fract(coord); 23 | 24 | float a = rand(i); 25 | float b = rand(i + dir_x); 26 | float c = rand(i + dir_y); 27 | float d = rand(i + dir_z); 28 | 29 | vec2 cubic = f * f * (3.0 - 2.0 * f); 30 | 31 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 32 | } 33 | 34 | float fbm(vec2 coord) 35 | { 36 | float value = 0.0; 37 | float scale = 0.5; 38 | 39 | for (int i = 0; i < int(generic.w); i++) 40 | { 41 | value += noise(coord) * scale; 42 | coord *= 2.0; 43 | scale *= 0.5; 44 | } 45 | 46 | return value; 47 | } 48 | 49 | bool dither(vec2 uv1, vec2 uv2) 50 | { 51 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 52 | } 53 | 54 | vec2 rotate(vec2 coord, float angle) 55 | { 56 | coord -= 0.5; 57 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 58 | return coord + 0.5; 59 | } 60 | 61 | // by Leukbaars from https://www.shadertoy.com/view/4tK3zR 62 | float circleNoise(vec2 uv) 63 | { 64 | float uv_y = floor(uv.y); 65 | uv.x += uv_y * .31; 66 | vec2 f = fract(uv); 67 | float h = rand(vec2(floor(uv.x), floor(uv_y))); 68 | float m = (length(f - 0.25 - (h * 0.5))); 69 | float r = h * 0.25; 70 | return m = smoothstep(r - .10 * r, r, m); 71 | } 72 | 73 | float crater(vec2 uv) 74 | { 75 | float c = 1.0; 76 | for (int i = 0; i < 2; i++) 77 | { 78 | c *= circleNoise((uv * transform.x) + (float(i + 1) + 10.)); 79 | } 80 | return 1.0 - c; 81 | } 82 | 83 | void main() 84 | { 85 | 86 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 87 | uv.y = 1.0 - uv.y; 88 | 89 | // we use this val later to interpolate between shades 90 | bool dith = dither(uv, var_texcoord0); 91 | 92 | // distance from center 93 | float d = distance(uv, vec2(0.5)); 94 | 95 | // optional transform.z, do this after the dither or the dither will look very messed up 96 | uv = rotate(uv, transform.z); 97 | 98 | // two noise values with one slightly offset according to light source, to create shadows later 99 | float n = fbm(uv * transform.x); 100 | float n2 = fbm(uv * transform.x + (rotate(lights.xy, transform.z) - 0.5) * 0.5); 101 | 102 | // step noise values to determine where the edge of the asteroid is 103 | // step cutoff value depends on distance from center 104 | float n_step = step(0.2, n - d); 105 | float n2_step = step(0.2, n2 - d); 106 | 107 | // with this val we can determine where the shadows should be 108 | float noise_rel = (n2_step + n2) - (n_step + n); 109 | 110 | // two crater values, again one extra for the shadows 111 | float c1 = crater(uv); 112 | float c2 = crater(uv + (lights.xy - 0.5) * 0.03); 113 | 114 | // now we just assign colors depending on noise values and crater values 115 | // base 116 | 117 | lowp vec3 c = mix(color2.rgb, color1.rgb, float(noise_rel < -0.06 || (noise_rel < -0.04 && dith))); 118 | c = mix(c, color3.rgb, float(noise_rel > 0.05 || (noise_rel > 0.03 && dith))); 119 | // crates 120 | c = mix(c, color2.rgb, float(c1 > 0.4)); 121 | c = mix(c, color3.rgb, float(c2 < c1)); 122 | 123 | gl_FragColor = vec4(c, n_step); 124 | } 125 | -------------------------------------------------------------------------------- /components/planets/land_masses/clouds.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 border; 7 | uniform lowp vec4 modify; 8 | uniform lowp vec4 lights; 9 | 10 | uniform lowp vec4 base_color; 11 | uniform lowp vec4 outline_color; 12 | uniform lowp vec4 shadow_base_color; 13 | uniform lowp vec4 shadow_outline_color; 14 | 15 | const lowp vec2 dir_x = vec2(1.0, 0.0); 16 | const lowp vec2 dir_y = vec2(0.0, 1.0); 17 | const lowp vec2 dir_z = vec2(1.0, 1.0); 18 | 19 | float rand(vec2 coord) 20 | { 21 | coord = mod(coord, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 22 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 23 | } 24 | 25 | float noise(vec2 coord) 26 | { 27 | vec2 i = floor(coord); 28 | vec2 f = fract(coord); 29 | 30 | float a = rand(i); 31 | float b = rand(i + dir_x); 32 | float c = rand(i + dir_y); 33 | float d = rand(i + dir_z); 34 | 35 | vec2 cubic = f * f * (3.0 - 2.0 * f); 36 | 37 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 38 | } 39 | 40 | float fbm(vec2 coord) 41 | { 42 | float value = 0.0; 43 | float scale = 0.5; 44 | 45 | for (int i = 0; i < int(generic.w); i++) 46 | { 47 | value += noise(coord) * scale; 48 | coord *= 2.0; 49 | scale *= 0.5; 50 | } 51 | return value; 52 | } 53 | 54 | // by Leukbaars from https://www.shadertoy.com/view/4tK3zR 55 | float circleNoise(vec2 uv) 56 | { 57 | float uv_y = floor(uv.y); 58 | uv.x += uv_y * .31; 59 | vec2 f = fract(uv); 60 | float h = rand(vec2(floor(uv.x), floor(uv_y))); 61 | float m = (length(f - 0.25 - (h * 0.5))); 62 | float r = h * 0.25; 63 | return smoothstep(0.0, r, m * 0.75); 64 | } 65 | 66 | float cloud_alpha(vec2 uv) 67 | { 68 | float c_noise = 0.0; 69 | 70 | // more iterations for more turbulence 71 | for (int i = 0; i < 9; i++) 72 | { 73 | c_noise += circleNoise((uv * transform.x * 0.3) + (float(i + 1) + 10.) + (vec2(generic.y * generic.z, 0.0))); 74 | } 75 | float fbm = fbm(uv * transform.x + c_noise + vec2(generic.y * generic.z, 0.0)); 76 | 77 | return fbm; // step(a_cutoff, fbm); 78 | } 79 | 80 | bool dither(vec2 uv_pixel, vec2 uv_real) 81 | { 82 | return mod(uv_pixel.x + uv_real.y, 2.0 / transform.y) <= 1.0 / transform.y; 83 | } 84 | 85 | vec2 spherify(vec2 uv) 86 | { 87 | vec2 centered = uv * 2.0 - 1.0; 88 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 89 | vec2 sphere = centered / (z + 1.0); 90 | return sphere * 0.5 + 0.5; 91 | } 92 | 93 | vec2 rotate(vec2 coord, float angle) 94 | { 95 | coord -= 0.5; 96 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 97 | return coord + 0.5; 98 | } 99 | 100 | void main() 101 | { 102 | 103 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 104 | uv.y = 1.0 - uv.y; 105 | 106 | // distance to light source 107 | float d_light = distance(uv, lights.xy); 108 | 109 | float d_to_center = distance(uv, vec2(0.5)); 110 | 111 | uv = rotate(uv, transform.z); 112 | 113 | // map to sphere 114 | uv = spherify(uv); 115 | // slightly make uv go down on the right, and up in the left 116 | uv.y += smoothstep(0.0, modify.y, abs(uv.x - 0.4)); 117 | 118 | float c = cloud_alpha(uv * vec2(1.0, transform.w)); 119 | 120 | // assign some colors based on cloud depth & distance from light 121 | lowp vec3 result = outline_color.rgb * float(c <= modify.x + 0.03) + base_color.rgb * float(c > modify.x + 0.03); 122 | result = mix(result, shadow_base_color.rgb, float(d_light + c * 0.2 > border.x)); 123 | result = mix(result, shadow_outline_color.rgb, float(d_light + c * 0.2 > border.y)); 124 | 125 | c *= step(d_to_center, 0.5); 126 | gl_FragColor = vec4(result, step(modify.x, c)); 127 | } 128 | -------------------------------------------------------------------------------- /components/planets/rivers/clouds.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform lowp vec4 transform; 5 | uniform lowp vec4 generic; 6 | uniform lowp vec4 border; 7 | uniform lowp vec4 modify; 8 | uniform lowp vec4 lights; 9 | 10 | uniform lowp vec4 base_color; 11 | uniform lowp vec4 outline_color; 12 | uniform lowp vec4 shadow_base_color; 13 | uniform lowp vec4 shadow_outline_color; 14 | 15 | const lowp vec2 dir_x = vec2(1.0, 0.0); 16 | const lowp vec2 dir_y = vec2(0.0, 1.0); 17 | const lowp vec2 dir_z = vec2(1.0, 1.0); 18 | 19 | float rand(vec2 coord) 20 | { 21 | coord = mod(coord, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 22 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 15.5453 * generic.x); 23 | } 24 | 25 | float noise(vec2 coord) 26 | { 27 | vec2 i = floor(coord); 28 | vec2 f = fract(coord); 29 | 30 | float a = rand(i); 31 | float b = rand(i + dir_x); 32 | float c = rand(i + dir_y); 33 | float d = rand(i + dir_z); 34 | 35 | vec2 cubic = f * f * (3.0 - 2.0 * f); 36 | 37 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 38 | } 39 | 40 | float fbm(vec2 coord) 41 | { 42 | float value = 0.0; 43 | float scale = 0.5; 44 | 45 | for (int i = 0; i < int(generic.w); i++) 46 | { 47 | value += noise(coord) * scale; 48 | coord *= 2.0; 49 | scale *= 0.5; 50 | } 51 | return value; 52 | } 53 | 54 | // by Leukbaars from https://www.shadertoy.com/view/4tK3zR 55 | float circleNoise(vec2 uv) 56 | { 57 | float uv_y = floor(uv.y); 58 | uv.x += uv_y * .31; 59 | vec2 f = fract(uv); 60 | float h = rand(vec2(floor(uv.x), floor(uv_y))); 61 | float m = (length(f - 0.25 - (h * 0.5))); 62 | float r = h * 0.25; 63 | return smoothstep(0.0, r, m * 0.75); 64 | } 65 | 66 | float cloud_alpha(vec2 uv) 67 | { 68 | float c_noise = 0.0; 69 | 70 | // more iterations for more turbulence 71 | for (int i = 0; i < 9; i++) 72 | { 73 | c_noise += circleNoise((uv * transform.x * 0.3) + (float(i + 1) + 10.) + (vec2(generic.y * generic.z, 0.0))); 74 | } 75 | float fbm = fbm(uv * transform.x + c_noise + vec2(generic.y * generic.z, 0.0)); 76 | 77 | return fbm; // step(a_cutoff, fbm); 78 | } 79 | 80 | bool dither(vec2 uv_pixel, vec2 uv_real) 81 | { 82 | return mod(uv_pixel.x + uv_real.y, 2.0 / transform.y) <= 1.0 / transform.y; 83 | } 84 | 85 | vec2 spherify(vec2 uv) 86 | { 87 | vec2 centered = uv * 2.0 - 1.0; 88 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 89 | vec2 sphere = centered / (z + 1.0); 90 | return sphere * 0.5 + 0.5; 91 | } 92 | 93 | vec2 rotate(vec2 coord, float angle) 94 | { 95 | coord -= 0.5; 96 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 97 | return coord + 0.5; 98 | } 99 | 100 | void main() 101 | { 102 | // pixelize uv 103 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 104 | uv.y = 1.0 - uv.y; 105 | // distance to light source 106 | float d_light = distance(uv, lights.xy); 107 | 108 | // cut out a circle 109 | float d_circle = distance(uv, vec2(0.5)); 110 | float a = step(d_circle, 0.5); 111 | 112 | float d_to_center = distance(uv, vec2(0.5)); 113 | 114 | uv = rotate(uv, transform.z); 115 | 116 | // map to sphere 117 | uv = spherify(uv); 118 | // slightly make uv go down on the right, and up in the left 119 | uv.y += smoothstep(0.0, modify.y, abs(uv.x - 0.4)); 120 | 121 | float c = cloud_alpha(uv * vec2(1.0, transform.w)); 122 | 123 | 124 | 125 | 126 | lowp vec3 result = outline_color.rgb * float(c <= modify.x + 0.03) + base_color.rgb * float(c > modify.x + 0.03); 127 | result = mix(result, shadow_base_color.rgb, float(d_light + c * 0.2 > border.x)); 128 | result = mix(result, shadow_outline_color.rgb, float(d_light + c * 0.2 > border.y)); 129 | 130 | c *= step(d_to_center, 0.5); 131 | gl_FragColor = vec4(result, step(modify.x, c) * a); 132 | } 133 | -------------------------------------------------------------------------------- /components/planets/star/star_flares.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform sampler2D colorramp; 5 | 6 | uniform lowp vec4 transform; 7 | uniform lowp vec4 generic; 8 | uniform lowp vec4 modify; 9 | uniform lowp vec4 circles; 10 | 11 | const lowp vec2 dir_x = vec2(1.0, 0.0); 12 | const lowp vec2 dir_y = vec2(0.0, 1.0); 13 | const lowp vec2 dir_z = vec2(1.0, 1.0); 14 | 15 | float rand(vec2 co) 16 | { 17 | co = mod(co, vec2(1.0, 1.0) * floor(transform.x + 0.5)); 18 | return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 15.5453 * generic.x); 19 | } 20 | 21 | vec2 rotate(vec2 vec, float angle) 22 | { 23 | vec -= vec2(0.5); 24 | vec *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 25 | vec += vec2(0.5); 26 | return vec; 27 | } 28 | 29 | float circle(vec2 uv) 30 | { 31 | float invert = 1.0 / circles.x; 32 | 33 | uv.x = (uv.x + invert * 0.5) * float(mod(uv.y, invert * 2.0) < invert); 34 | 35 | vec2 rand_co = floor(uv * circles.x) / circles.x; 36 | uv = mod(uv, invert) * circles.x; 37 | 38 | float r = rand(rand_co); 39 | r = clamp(r, invert, 1.0 - invert); 40 | float circle = distance(uv, vec2(r)); 41 | return smoothstep(circle, circle + 0.5, invert * circles.y * rand(rand_co * 1.5)); 42 | } 43 | 44 | float noise(vec2 coord) 45 | { 46 | vec2 i = floor(coord); 47 | vec2 f = fract(coord); 48 | 49 | float a = rand(i); 50 | float b = rand(i + dir_x); 51 | float c = rand(i + dir_y); 52 | float d = rand(i + dir_z); 53 | 54 | vec2 cubic = f * f * (3.0 - 2.0 * f); 55 | 56 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 57 | } 58 | 59 | float fbm(vec2 coord) 60 | { 61 | float value = 0.0; 62 | float scl = 0.5; 63 | 64 | for (int i = 0; i < int(generic.w); i++) 65 | { 66 | value += noise(coord) * scl; 67 | coord *= 2.0; 68 | scl *= 0.5; 69 | } 70 | return value; 71 | } 72 | 73 | bool dither(vec2 uv1, vec2 uv2) 74 | { 75 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 76 | } 77 | 78 | vec2 spherify(vec2 uv) 79 | { 80 | vec2 centered = uv * 2.0 - 1.0; 81 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 82 | vec2 sphere = centered / (z + 1.0); 83 | return sphere * 0.5 + 0.5; 84 | } 85 | 86 | void main() 87 | { 88 | // pixelize uv 89 | vec2 pixelized = floor(var_texcoord0 * transform.y) / transform.y; 90 | pixelized.y = 1.0 - pixelized.y; 91 | // use dither val later to interpolate between alpha 92 | bool dith = dither(var_texcoord0, pixelized); 93 | 94 | pixelized = rotate(pixelized, transform.z); 95 | 96 | // counter transform.z against transform.z caused by the way uv's are made later 97 | vec2 uv = pixelized; // rotate(pixelized, -time * time_speed); 98 | 99 | // angle from centered uv's 100 | float angle = atan(uv.x - 0.5, uv.y - 0.5) * 0.4; 101 | // distance from center 102 | float d = distance(pixelized, vec2(0.5)); 103 | 104 | // we make uv circular here to have eternally outward moving stuff 105 | vec2 circleUV = vec2(d, angle); 106 | 107 | // two types of noise values 108 | float n = fbm(circleUV * transform.x - generic.y * generic.z); 109 | float nc = circle(circleUV * modify.w - generic.y * generic.z + n); 110 | 111 | nc *= 1.5; 112 | float n2 = fbm(circleUV * transform.x - generic.y + vec2(100, 100)); 113 | nc -= n2 * 0.1; 114 | 115 | // our alpha, default 0 116 | float a = 0.0; 117 | 118 | a = 1.0 * float((nc > circles.z - circles.w + d && dith) && (1.0 - d > nc)) + 119 | 1.0 * float((nc > circles.z + d) && (1.0 - d > nc)); 120 | 121 | // use our two noise values to assign colors 122 | float interpolate = floor(n2 + nc); 123 | vec3 c = texture(colorramp, vec2(interpolate, 0.0)).rgb; 124 | 125 | // final step to not have everything appear from the center 126 | a *= step(n2 * 0.25, d); 127 | 128 | gl_FragColor = vec4(c, a); 129 | } 130 | -------------------------------------------------------------------------------- /components/planets/ice_world/ice_world.script: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local planet = msg.url() 4 | local clouds = msg.url() 5 | local lakes = msg.url() 6 | 7 | local planet_size = 0.0 8 | local planet_time_speed = 0.0 9 | 10 | local cloud_size = 0.0 11 | local cloud_time_speed = 0 12 | 13 | local lakes_size = 0.0 14 | local lakes_time_speed = 0 15 | 16 | local time = 1000.0 17 | 18 | local function set_seed() 19 | go.set(planet, "generic.x", config.rseed) 20 | go.set(clouds, "generic.x", config.rseed) 21 | go.set(lakes, "generic.x", config.rseed) 22 | end 23 | 24 | local function set_pixel() 25 | go.set(planet, "transform.y", config.rpixel) 26 | go.set(clouds, "transform.y", config.rpixel) 27 | go.set(lakes, "transform.y", config.rpixel) 28 | end 29 | 30 | local function set_rotation() 31 | go.set(planet, "transform.z", config.rrot) 32 | go.set(clouds, "transform.z", config.rrot) 33 | go.set(lakes, "transform.z", config.rrot) 34 | end 35 | 36 | local function set_light() 37 | go.set(planet, "lights.x", config.rlight.x) 38 | go.set(planet, "lights.y", config.rlight.y) 39 | 40 | go.set(clouds, "lights.x", config.rlight.x) 41 | go.set(clouds, "lights.y", config.rlight.y) 42 | 43 | go.set(lakes, "lights.x", config.rlight.x) 44 | go.set(lakes, "lights.y", config.rlight.y) 45 | end 46 | 47 | local function planet_init() 48 | go.set(planet, "transform", vmath.vector4(8.0, 100, 0, 0)) 49 | go.set(planet, "generic", vmath.vector4(1.036, 0.0, 0.25, 2.0)) 50 | go.set(planet, "lights", vmath.vector4(0.3, 0.3, 0.0, 0.0)) 51 | go.set(planet, "modify", vmath.vector4(0.0, 0.0, 2.0, 0.0)) 52 | go.set(planet, "border", vmath.vector4(0.48, 0.632, 0.0, 0.0)) 53 | go.set(planet, "color1", vmath.vector4(0.98, 1.0, 1.0, 1.0)) 54 | go.set(planet, "color2", vmath.vector4(0.78, 0.83, 0.88, 1.0)) 55 | go.set(planet, "color3", vmath.vector4(0.57, 0.56, 0.72, 1.0)) 56 | 57 | go.set(clouds, "transform", vmath.vector4(4, 100, 0, 2.5)) 58 | go.set(clouds, "generic", vmath.vector4(1.14, 0, 0.1, 4)) 59 | go.set(clouds, "border", vmath.vector4(0.566, 0.781, 0, 0)) 60 | go.set(clouds, "modify", vmath.vector4(0.546, 1.3, 0, 0)) 61 | go.set(clouds, "lights", vmath.vector4(0.3, 0.3, 0, 0)) 62 | go.set(clouds, "base_color", vmath.vector4(0.88, 0.95, 1.0, 1.0)) 63 | go.set(clouds, "outline_color", vmath.vector4(0.75, 0.89, 1.0, 1.0)) 64 | go.set(clouds, "shadow_base_color", vmath.vector4(0.37, 0.44, 0.65, 1.0)) 65 | go.set(clouds, "shadow_outline_color", vmath.vector4(0.25, 0.29, 0.45, 1.0)) 66 | end 67 | 68 | function init(self) 69 | planet = msg.url("planet_under#planet_under") 70 | clouds = msg.url("clouds#clouds") 71 | lakes = msg.url("lakes#lakes") 72 | 73 | planet_init() 74 | 75 | set_seed() 76 | set_pixel() 77 | set_rotation() 78 | 79 | planet_size = go.get(planet, "transform.x") 80 | planet_time_speed = go.get(planet, "generic.z") 81 | planet_size = config.round(planet_size * 2.0) / planet_time_speed 82 | 83 | cloud_size = go.get(clouds, "transform.x") 84 | cloud_time_speed = go.get(clouds, "generic.z") 85 | cloud_size = config.round(cloud_size * 2.0) / cloud_time_speed 86 | 87 | lakes_size = go.get(lakes, "transform.x") 88 | lakes_time_speed = go.get(lakes, "generic.z") 89 | lakes_size = config.round(lakes_size * 2.0) / lakes_time_speed 90 | end 91 | 92 | function update(self, dt) 93 | time = time + dt 94 | go.set(planet, "generic.y", time * planet_size * 0.02) 95 | go.set(clouds, "generic.y", time * cloud_size * 0.01) 96 | go.set(lakes, "generic.y", time * lakes_size * 0.02) 97 | end 98 | 99 | function on_message(self, message_id, message, sender) 100 | if message_id == config.msg.set_planet_seed then 101 | set_seed() 102 | elseif message_id == config.msg.set_planet_pixel then 103 | set_pixel() 104 | elseif message_id == config.msg.set_planet_rotation then 105 | set_rotation() 106 | elseif message_id == config.msg.set_planet_light then 107 | set_light() 108 | end 109 | end 110 | -------------------------------------------------------------------------------- /components/planets/gas_giant/gas_giant.fp: -------------------------------------------------------------------------------- 1 | 2 | varying mediump vec2 var_texcoord0; 3 | 4 | uniform sampler2D colorscheme; 5 | uniform sampler2D dark_colorscheme; 6 | 7 | uniform lowp vec4 transform; 8 | uniform lowp vec4 generic; 9 | uniform lowp vec4 border; 10 | uniform lowp vec4 lights; 11 | 12 | const lowp vec2 dir_x = vec2(1.0, 0.0); 13 | const lowp vec2 dir_y = vec2(0.0, 1.0); 14 | const lowp vec2 dir_z = vec2(1.0, 1.0); 15 | 16 | float rand(vec2 coord) 17 | { 18 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 19 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 43758.5453 * generic.x); 20 | } 21 | 22 | float noise(vec2 coord) 23 | { 24 | vec2 i = floor(coord); 25 | vec2 f = fract(coord); 26 | 27 | float a = rand(i); 28 | float b = rand(i + dir_x); 29 | float c = rand(i + dir_y); 30 | float d = rand(i + dir_z); 31 | 32 | vec2 cubic = f * f * (3.0 - 2.0 * f); 33 | 34 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 35 | } 36 | 37 | float fbm(vec2 coord) 38 | { 39 | float value = 0.0; 40 | float scale = 0.5; 41 | 42 | for (int i = 0; i < int(generic.w); i++) 43 | { 44 | value += noise(coord) * scale; 45 | coord *= 2.0; 46 | scale *= 0.5; 47 | } 48 | return value; 49 | } 50 | 51 | // by Leukbaars from https://www.shadertoy.com/view/4tK3zR 52 | float circleNoise(vec2 uv) 53 | { 54 | float uv_y = floor(uv.y); 55 | uv.x += uv_y * .31; 56 | vec2 f = fract(uv); 57 | float h = rand(vec2(floor(uv.x), floor(uv_y))); 58 | float m = (length(f - 0.25 - (h * 0.5))); 59 | float r = h * 0.25; 60 | return smoothstep(0.0, r, m * 0.75); 61 | } 62 | 63 | float turbulence(vec2 uv) 64 | { 65 | float c_noise = 0.0; 66 | 67 | // more iterations for more turbulence 68 | for (int i = 0; i < 10; i++) 69 | { 70 | c_noise += circleNoise((uv * transform.x * 0.3) + (float(i + 1) + 10.) + (vec2(generic.y * generic.z, 0.0))); 71 | } 72 | return c_noise; 73 | } 74 | 75 | bool dither(vec2 uv_pixel, vec2 uv_real) 76 | { 77 | return mod(uv_pixel.x + uv_real.y, 2.0 / transform.y) <= 1.0 / transform.y; 78 | } 79 | 80 | vec2 spherify(vec2 uv) 81 | { 82 | vec2 centered = uv * 2.0 - 1.0; 83 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 84 | vec2 sphere = centered / (z + 1.0); 85 | return sphere * 0.5 + 0.5; 86 | } 87 | 88 | vec2 rotate(vec2 coord, float angle) 89 | { 90 | coord -= 0.5; 91 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 92 | return coord + 0.5; 93 | } 94 | 95 | void main() 96 | { 97 | // pixelize uv 98 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 99 | uv.y = 1.0 - uv.y; 100 | 101 | float light_d = distance(uv, lights.xy); 102 | 103 | // we use this value later to dither between colors 104 | bool dith = dither(uv, var_texcoord0); 105 | uv = rotate(uv, transform.z); 106 | 107 | // map to sphere 108 | uv = spherify(uv); 109 | 110 | // a band is just one dimensional noise 111 | float band = fbm(vec2(0.0, uv.y * transform.x * border.z)); 112 | 113 | // turbulence value is circles on top of each other 114 | float turb = turbulence(uv); 115 | 116 | // by layering multiple noise values & combining with turbulence and bands 117 | // we get some dynamic looking shape 118 | float fbm1 = fbm(uv * transform.x); 119 | float fbm2 = fbm(uv * vec2(1.0, 2.0) * transform.x + fbm1 + vec2(-generic.y * generic.z, 0.0) + turb); 120 | 121 | // all of this is just increasing some contrast & applying light 122 | fbm2 *= pow(band, 2.0) * 7.0; 123 | float light = fbm2 + light_d * 1.8; 124 | fbm2 += pow(light_d, 1.0) - 0.3; 125 | fbm2 = smoothstep(-0.2, 4.0 - fbm2, light); 126 | 127 | fbm2 = mix(fbm2, fbm2 * 1.1, float(dith)); 128 | 129 | // finally add colors 130 | float posterized = floor(fbm2 * 4.0) / 2.0; 131 | vec3 col = texture2D(dark_colorscheme, vec2(posterized - 1.0, uv.y)).rgb; 132 | 133 | col = mix(col, texture2D(colorscheme, vec2(posterized, uv.y)).rgb, float(fbm2 < 0.625) ); 134 | 135 | float a = step(length(uv - vec2(0.5)), 0.5); 136 | gl_FragColor = vec4(col, a); 137 | } 138 | -------------------------------------------------------------------------------- /scripts/gui/dropdown.lua: -------------------------------------------------------------------------------- 1 | local config = require("scripts.config") 2 | 3 | local dropdown = {} 4 | 5 | local dropdown_selector 6 | local dropdown_container 7 | local dropdown_current = 0 8 | local selected_dropdown = 0 9 | local dropdown_label 10 | local color_black = vmath.vector4(0, 0, 0, 1) 11 | local color_white = vmath.vector4(1, 1, 1, 1) 12 | 13 | local function dropdown_field_toggle(item) 14 | local prev_field = config.planets[item].nodes["dropdown_field_template/planet_name"] 15 | gui.set_color(prev_field, color_black) 16 | prev_field = config.planets[item].nodes["dropdown_field_template/planet_name_txt"] 17 | gui.set_color(prev_field, color_white) 18 | end 19 | 20 | local function toggle_selected_field() 21 | if selected_dropdown ~= 0 and selected_dropdown ~= dropdown_current then 22 | dropdown_field_toggle(selected_dropdown) 23 | end 24 | end 25 | 26 | local function toggle_prev_field() 27 | if dropdown_current ~= 0 and dropdown_current ~= selected_dropdown then 28 | dropdown_field_toggle(dropdown_current) 29 | end 30 | end 31 | 32 | local function toggle_dropdown_field(nodes, index) 33 | -- unselect prev 34 | toggle_prev_field() 35 | 36 | -- turn selected 37 | gui.set_color(nodes["dropdown_field_template/planet_name"], color_white) 38 | gui.set_color(nodes["dropdown_field_template/planet_name_txt"], color_black) 39 | 40 | dropdown_current = index 41 | end 42 | 43 | local function toggle_dropdown() 44 | toggle_prev_field() 45 | local set = gui.is_enabled(dropdown_container) == false and true or false 46 | gui.set_enabled(dropdown_container, set) 47 | dropdown_current = 0 48 | end 49 | 50 | local function send_msg() 51 | msg.post(config.main_url, config.msg.load_planet, {id = selected_dropdown}) 52 | end 53 | 54 | function dropdown.init(select) 55 | dropdown_selector = gui.get_node("planet_type") 56 | dropdown_container = gui.get_node("dropdown_container") 57 | dropdown_label = gui.get_node("planet_type_label") 58 | 59 | local dropdown_background = gui.get_node("dropdown_back") 60 | local dropdow_template = gui.get_node("dropdown_field_template/root") 61 | 62 | local field_position = vmath.vector3(0, -4, 0) 63 | local template_clone 64 | 65 | for index, value in ipairs(config.planets) do 66 | template_clone = gui.clone_tree(dropdow_template) 67 | value.nodes = template_clone 68 | 69 | gui.set_text(template_clone[hash("dropdown_field_template/planet_name_txt")], value.name) 70 | gui.set_position(template_clone[hash("dropdown_field_template/root")], field_position) 71 | 72 | field_position.y = field_position.y - 22 73 | end 74 | 75 | local dropdown_background_size = gui.get_size(dropdown_background) 76 | dropdown_background_size.y = field_position.y * -1 77 | 78 | gui.set_size(dropdown_background, dropdown_background_size) 79 | gui.delete_node(dropdow_template) 80 | gui.set_enabled(dropdown_container, false) 81 | 82 | selected_dropdown = select 83 | toggle_dropdown_field(config.planets[select].nodes, select) 84 | gui.set_text(dropdown_label, config.planets[select].name) 85 | send_msg() 86 | end 87 | 88 | function dropdown.update(action, action_id) 89 | if gui.is_enabled(dropdown_container) then 90 | for index, value in ipairs(config.planets) do 91 | if 92 | gui.pick_node(value.nodes["dropdown_field_template/planet_name"], action.x, action.y) and 93 | index ~= dropdown_current 94 | then 95 | toggle_dropdown_field(value.nodes, index) 96 | elseif 97 | gui.pick_node(value.nodes["dropdown_field_template/planet_name"], action.x, action.y) and action.pressed 98 | then 99 | toggle_selected_field() 100 | 101 | selected_dropdown = dropdown_current 102 | gui.set_text(dropdown_label, value.name) 103 | 104 | dropdown_current = 0 105 | send_msg() 106 | end 107 | end 108 | end 109 | 110 | if action_id == config.mouse_click and action.pressed and not gui.pick_node(dropdown_selector, action.x, action.y) then 111 | if gui.is_enabled(dropdown_container) then 112 | toggle_dropdown() 113 | end 114 | elseif gui.pick_node(dropdown_selector, action.x, action.y) and action.pressed then 115 | toggle_dropdown() 116 | end 117 | end 118 | 119 | return dropdown 120 | -------------------------------------------------------------------------------- /components/planets/rivers/land_rivers.fp: -------------------------------------------------------------------------------- 1 | varying mediump vec2 var_texcoord0; 2 | 3 | uniform lowp vec4 transform; 4 | uniform lowp vec4 generic; 5 | uniform lowp vec4 lights; 6 | uniform lowp vec4 modify; 7 | uniform lowp vec4 border; 8 | uniform lowp vec4 extras; 9 | 10 | uniform lowp vec4 col1; 11 | uniform lowp vec4 col2; 12 | uniform lowp vec4 col3; 13 | uniform lowp vec4 col4; 14 | uniform lowp vec4 river_col; 15 | uniform lowp vec4 river_col_dark; 16 | 17 | const lowp vec2 dir_x = vec2(1.0, 0.0); 18 | const lowp vec2 dir_y = vec2(0.0, 1.0); 19 | const lowp vec2 dir_z = vec2(1.0, 1.0); 20 | 21 | float rand(vec2 coord) 22 | { 23 | coord = mod(coord, vec2(2.0, 1.0) * floor(transform.x + 0.5)); 24 | return fract(sin(dot(coord.xy, vec2(12.9898, 78.233))) * 15.5453 * generic.x); 25 | } 26 | 27 | float noise(vec2 coord) 28 | { 29 | vec2 i = floor(coord); 30 | vec2 f = fract(coord); 31 | 32 | float a = rand(i); 33 | float b = rand(i + dir_x); 34 | float c = rand(i + dir_y); 35 | float d = rand(i + dir_z); 36 | 37 | vec2 cubic = f * f * (3.0 - 2.0 * f); 38 | 39 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 40 | } 41 | 42 | float fbm(vec2 coord) 43 | { 44 | float value = 0.0; 45 | float scale = 0.5; 46 | 47 | for (int i = 0; i < int(generic.w); i++) 48 | { 49 | value += noise(coord) * scale; 50 | coord *= 2.0; 51 | scale *= 0.5; 52 | } 53 | return value; 54 | } 55 | 56 | vec2 spherify(vec2 uv) 57 | { 58 | vec2 centered = uv * 2.0 - 1.0; 59 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 60 | // float z = pow(1.0 - dot(centered.xy, centered.xy), 0.5); 61 | vec2 sphere = centered / (z + 1.0); 62 | 63 | return sphere * 0.5 + 0.5; 64 | } 65 | 66 | vec2 rotate(vec2 coord, float angle) 67 | { 68 | coord -= 0.5; 69 | coord *= mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle))); 70 | return coord + 0.5; 71 | } 72 | 73 | bool dither(vec2 uv1, vec2 uv2) 74 | { 75 | return mod(uv1.x + uv2.y, 2.0 / transform.y) <= 1.0 / transform.y; 76 | } 77 | 78 | void main() 79 | { 80 | // pixelize uv 81 | vec2 uv = floor(var_texcoord0 * transform.y) / transform.y; 82 | uv.y = 1.0 - uv.y; 83 | 84 | float d_light = distance(uv, lights.xy); 85 | bool dith = dither(uv, var_texcoord0); 86 | float a = step(distance(vec2(0.5), uv), 0.5); 87 | 88 | // give planet a tilt 89 | uv = rotate(uv, transform.z); 90 | 91 | // map to sphere 92 | uv = spherify(uv); 93 | 94 | // some scrolling noise for landmasses 95 | vec2 base_fbm_uv = (uv)*transform.x + vec2(generic.y * generic.z, 0.0); 96 | 97 | // use multiple fbm's at different places so we can determine what color land 98 | // gets 99 | float fbm1 = fbm(base_fbm_uv); 100 | float fbm2 = fbm(base_fbm_uv - lights.xy * fbm1); 101 | float fbm3 = fbm(base_fbm_uv - lights.xy * 1.5 * fbm1); 102 | float fbm4 = fbm(base_fbm_uv - lights.xy * 2.0 * fbm1); 103 | 104 | float river_fbm = fbm(base_fbm_uv + fbm1 * 6.0); 105 | river_fbm = step(extras.z, river_fbm); 106 | 107 | // transform.x of edge in which colors should be dithered 108 | float dither_border = (1.0 / transform.y) * modify.z; 109 | // lots of magic numbers here 110 | // you can mess with them, it changes the color distribution 111 | 112 | fbm4 = mix(fbm4, fbm4 * 0.9, float(d_light < border.x)); 113 | fbm2 = mix(fbm2, fbm2 * 1.05, float(d_light > border.x)); 114 | fbm3 = mix(fbm3, fbm3 * 1.05, float(d_light > border.x)); 115 | fbm4 = mix(fbm4, fbm4 * 1.05, float(d_light > border.x)); 116 | fbm2 = mix(fbm2, fbm2 * 1.3, float(d_light > border.y)); 117 | fbm3 = mix(fbm3, fbm3 * 1.4, float(d_light > border.y)); 118 | fbm4 = mix(fbm4, fbm4 * 1.8, float(d_light > border.y)); 119 | fbm4 = mix(fbm4, fbm4 * 0.5, float((d_light > border.y) && (d_light < border.y + dither_border && dith))); 120 | 121 | // increase contrast on d_light 122 | d_light = pow(d_light, 2.0) * 0.4; 123 | 124 | vec3 result = col4.rgb; 125 | result = mix(result, col3.rgb, float(fbm4 + d_light < fbm1 * 1.5)); 126 | result = mix(result, col2.rgb, float(fbm3 + d_light < fbm1 * 1.0)); 127 | result = mix(result, col1.rgb, float(fbm2 + d_light < fbm1)); 128 | result = mix(result, river_col_dark.rgb, float(river_fbm < fbm1 * 0.5)); 129 | result = mix(result, river_col.rgb, float((river_fbm < fbm1 * 0.5) && (fbm4 + d_light < fbm1 * 1.5))); 130 | 131 | gl_FragColor = vec4(result, a); 132 | } 133 | -------------------------------------------------------------------------------- /components/gui/slider.gui: -------------------------------------------------------------------------------- 1 | script: "" 2 | fonts { 3 | name: "slkscre" 4 | font: "/assets/fonts/slkscre.font" 5 | } 6 | background_color { 7 | x: 0.0 8 | y: 0.0 9 | z: 0.0 10 | w: 0.0 11 | } 12 | nodes { 13 | position { 14 | x: 0.0 15 | y: 0.0 16 | z: 0.0 17 | w: 1.0 18 | } 19 | rotation { 20 | x: 0.0 21 | y: 0.0 22 | z: 0.0 23 | w: 1.0 24 | } 25 | scale { 26 | x: 1.0 27 | y: 1.0 28 | z: 1.0 29 | w: 1.0 30 | } 31 | size { 32 | x: 0.0 33 | y: 100.0 34 | z: 0.0 35 | w: 1.0 36 | } 37 | color { 38 | x: 1.0 39 | y: 1.0 40 | z: 1.0 41 | w: 1.0 42 | } 43 | type: TYPE_BOX 44 | blend_mode: BLEND_MODE_ALPHA 45 | texture: "" 46 | id: "root" 47 | xanchor: XANCHOR_LEFT 48 | yanchor: YANCHOR_TOP 49 | pivot: PIVOT_NW 50 | adjust_mode: ADJUST_MODE_FIT 51 | layer: "gfx" 52 | inherit_alpha: false 53 | slice9 { 54 | x: 0.0 55 | y: 0.0 56 | z: 0.0 57 | w: 0.0 58 | } 59 | clipping_mode: CLIPPING_MODE_NONE 60 | clipping_visible: true 61 | clipping_inverted: false 62 | alpha: 0.0 63 | template_node_child: false 64 | size_mode: SIZE_MODE_MANUAL 65 | } 66 | nodes { 67 | position { 68 | x: 0.0 69 | y: 0.0 70 | z: 0.0 71 | w: 1.0 72 | } 73 | rotation { 74 | x: 0.0 75 | y: 0.0 76 | z: 0.0 77 | w: 1.0 78 | } 79 | scale { 80 | x: 1.0 81 | y: 1.0 82 | z: 1.0 83 | w: 1.0 84 | } 85 | size { 86 | x: 200.0 87 | y: 20.0 88 | z: 0.0 89 | w: 1.0 90 | } 91 | color { 92 | x: 0.0 93 | y: 0.0 94 | z: 0.0 95 | w: 1.0 96 | } 97 | type: TYPE_BOX 98 | blend_mode: BLEND_MODE_ALPHA 99 | texture: "" 100 | id: "title" 101 | xanchor: XANCHOR_LEFT 102 | yanchor: YANCHOR_TOP 103 | pivot: PIVOT_NW 104 | adjust_mode: ADJUST_MODE_FIT 105 | parent: "root" 106 | layer: "gfx" 107 | inherit_alpha: false 108 | slice9 { 109 | x: 0.0 110 | y: 0.0 111 | z: 0.0 112 | w: 0.0 113 | } 114 | clipping_mode: CLIPPING_MODE_NONE 115 | clipping_visible: true 116 | clipping_inverted: false 117 | alpha: 1.0 118 | template_node_child: false 119 | size_mode: SIZE_MODE_MANUAL 120 | } 121 | nodes { 122 | position { 123 | x: 3.0 124 | y: -3.0 125 | z: 0.0 126 | w: 1.0 127 | } 128 | rotation { 129 | x: 0.0 130 | y: 0.0 131 | z: 0.0 132 | w: 1.0 133 | } 134 | scale { 135 | x: 1.0 136 | y: 1.0 137 | z: 1.0 138 | w: 1.0 139 | } 140 | size { 141 | x: 190.0 142 | y: 15.0 143 | z: 0.0 144 | w: 1.0 145 | } 146 | color { 147 | x: 1.0 148 | y: 1.0 149 | z: 1.0 150 | w: 1.0 151 | } 152 | type: TYPE_TEXT 153 | blend_mode: BLEND_MODE_ALPHA 154 | text: "PIXELS: " 155 | font: "slkscre" 156 | id: "label" 157 | xanchor: XANCHOR_LEFT 158 | yanchor: YANCHOR_TOP 159 | pivot: PIVOT_NW 160 | outline { 161 | x: 1.0 162 | y: 1.0 163 | z: 1.0 164 | w: 1.0 165 | } 166 | shadow { 167 | x: 1.0 168 | y: 1.0 169 | z: 1.0 170 | w: 1.0 171 | } 172 | adjust_mode: ADJUST_MODE_FIT 173 | line_break: false 174 | parent: "title" 175 | layer: "text" 176 | inherit_alpha: true 177 | alpha: 1.0 178 | outline_alpha: 1.0 179 | shadow_alpha: 1.0 180 | template_node_child: false 181 | text_leading: 1.0 182 | text_tracking: 0.0 183 | } 184 | nodes { 185 | position { 186 | x: 0.0 187 | y: -25.0 188 | z: 0.0 189 | w: 1.0 190 | } 191 | rotation { 192 | x: 0.0 193 | y: 0.0 194 | z: 0.0 195 | w: 1.0 196 | } 197 | scale { 198 | x: 1.0 199 | y: 1.0 200 | z: 1.0 201 | w: 1.0 202 | } 203 | size { 204 | x: 200.0 205 | y: 20.0 206 | z: 0.0 207 | w: 1.0 208 | } 209 | color { 210 | x: 0.0 211 | y: 0.0 212 | z: 0.0 213 | w: 1.0 214 | } 215 | type: TYPE_BOX 216 | blend_mode: BLEND_MODE_ALPHA 217 | texture: "" 218 | id: "slider" 219 | xanchor: XANCHOR_LEFT 220 | yanchor: YANCHOR_TOP 221 | pivot: PIVOT_NW 222 | adjust_mode: ADJUST_MODE_FIT 223 | parent: "root" 224 | layer: "gfx" 225 | inherit_alpha: false 226 | slice9 { 227 | x: 0.0 228 | y: 0.0 229 | z: 0.0 230 | w: 0.0 231 | } 232 | clipping_mode: CLIPPING_MODE_NONE 233 | clipping_visible: true 234 | clipping_inverted: false 235 | alpha: 1.0 236 | template_node_child: false 237 | size_mode: SIZE_MODE_MANUAL 238 | } 239 | nodes { 240 | position { 241 | x: 0.0 242 | y: -10.0 243 | z: 0.0 244 | w: 1.0 245 | } 246 | rotation { 247 | x: 0.0 248 | y: 0.0 249 | z: 0.0 250 | w: 1.0 251 | } 252 | scale { 253 | x: 1.0 254 | y: 1.0 255 | z: 1.0 256 | w: 1.0 257 | } 258 | size { 259 | x: 10.0 260 | y: 20.0 261 | z: 0.0 262 | w: 1.0 263 | } 264 | color { 265 | x: 1.0 266 | y: 1.0 267 | z: 1.0 268 | w: 1.0 269 | } 270 | type: TYPE_BOX 271 | blend_mode: BLEND_MODE_ALPHA 272 | texture: "" 273 | id: "button" 274 | xanchor: XANCHOR_LEFT 275 | yanchor: YANCHOR_TOP 276 | pivot: PIVOT_W 277 | adjust_mode: ADJUST_MODE_FIT 278 | parent: "slider" 279 | layer: "gfx" 280 | inherit_alpha: true 281 | slice9 { 282 | x: 0.0 283 | y: 0.0 284 | z: 0.0 285 | w: 0.0 286 | } 287 | clipping_mode: CLIPPING_MODE_NONE 288 | clipping_visible: true 289 | clipping_inverted: false 290 | alpha: 1.0 291 | template_node_child: false 292 | size_mode: SIZE_MODE_MANUAL 293 | } 294 | nodes { 295 | position { 296 | x: 5.0 297 | y: -10.0 298 | z: 0.0 299 | w: 1.0 300 | } 301 | rotation { 302 | x: 0.0 303 | y: 0.0 304 | z: 0.0 305 | w: 1.0 306 | } 307 | scale { 308 | x: 1.0 309 | y: 1.0 310 | z: 1.0 311 | w: 1.0 312 | } 313 | size { 314 | x: 190.0 315 | y: 10.0 316 | z: 0.0 317 | w: 1.0 318 | } 319 | color { 320 | x: 1.0 321 | y: 1.0 322 | z: 1.0 323 | w: 1.0 324 | } 325 | type: TYPE_BOX 326 | blend_mode: BLEND_MODE_ALPHA 327 | texture: "" 328 | id: "box" 329 | xanchor: XANCHOR_LEFT 330 | yanchor: YANCHOR_TOP 331 | pivot: PIVOT_W 332 | adjust_mode: ADJUST_MODE_FIT 333 | parent: "slider" 334 | layer: "gfx" 335 | inherit_alpha: true 336 | slice9 { 337 | x: 0.0 338 | y: 0.0 339 | z: 0.0 340 | w: 0.0 341 | } 342 | clipping_mode: CLIPPING_MODE_NONE 343 | clipping_visible: true 344 | clipping_inverted: false 345 | alpha: 1.0 346 | template_node_child: false 347 | size_mode: SIZE_MODE_MANUAL 348 | } 349 | layers { 350 | name: "gfx" 351 | } 352 | layers { 353 | name: "text" 354 | } 355 | material: "/builtins/materials/gui.material" 356 | adjust_reference: ADJUST_REFERENCE_PARENT 357 | max_nodes: 512 358 | -------------------------------------------------------------------------------- /render/pixelplanet.render_script: -------------------------------------------------------------------------------- 1 | local CLEAR_COLOR = hash("clear_color") 2 | local SET_VIEW_PROJECTION = hash("set_view_projection") 3 | local SET_UPSCALE_MATERIAL = hash("set_upscale_material") 4 | local TOGGLE_SCALE_SNAP = hash("toggle_scale_snap") 5 | local SET_SIZE = hash("set_size") 6 | 7 | local IDENTITY = vmath.matrix4() 8 | 9 | local function setup(self, width, height) 10 | self.width = width 11 | self.height = height 12 | self.lowrez_projection = vmath.matrix4_orthographic(0, width, 0, height, -1, 1) 13 | 14 | -- render target buffer parameters 15 | local color_params = { 16 | format = render.FORMAT_RGBA, 17 | width = width, 18 | height = height, 19 | min_filter = render.FILTER_NEAREST, 20 | mag_filter = render.FILTER_NEAREST, 21 | u_wrap = render.WRAP_CLAMP_TO_EDGE, 22 | v_wrap = render.WRAP_CLAMP_TO_EDGE 23 | } 24 | local depth_params = { 25 | format = render.FORMAT_DEPTH, 26 | width = width, 27 | height = height, 28 | u_wrap = render.WRAP_CLAMP_TO_EDGE, 29 | v_wrap = render.WRAP_CLAMP_TO_EDGE 30 | } 31 | local stencil_params = { 32 | format = render.FORMAT_STENCIL, 33 | width = width, 34 | height = height, 35 | u_wrap = render.WRAP_CLAMP_TO_EDGE, 36 | v_wrap = render.WRAP_CLAMP_TO_EDGE 37 | } 38 | if self.rt then 39 | render.delete_render_target(self.rt) 40 | end 41 | self.rt = 42 | render.render_target( 43 | "lowrez", 44 | { 45 | [render.BUFFER_COLOR_BIT] = color_params, 46 | [render.BUFFER_DEPTH_BIT] = depth_params 47 | -- [render.BUFFER_STENCIL_BIT] = stencil_params 48 | } 49 | ) 50 | end 51 | 52 | function init(self) 53 | self.background_pred = render.predicate({"background"}) 54 | self.tile_pred = render.predicate({"tile"}) 55 | self.model_pred = render.predicate({"model"}) 56 | self.gui_pred = render.predicate({"gui"}) 57 | self.text_pred = render.predicate({"text"}) 58 | self.particle_pred = render.predicate({"particle"}) 59 | self.lowrez_pred = render.predicate({"lowrez"}) 60 | -- self.controls_pred = render.predicate({"controls"}) 61 | 62 | self.view = IDENTITY 63 | 64 | setup(self, 640, 360) 65 | 66 | local clear_color = vmath.vector4(0, 0, 0, 0) 67 | clear_color.x = sys.get_config("render.clear_color_red", 0) 68 | clear_color.y = sys.get_config("render.clear_color_green", 0) 69 | clear_color.z = sys.get_config("render.clear_color_blue", 0) 70 | clear_color.w = sys.get_config("render.clear_color_alpha", 0) 71 | self.clear_buffers = { 72 | [render.BUFFER_COLOR_BIT] = clear_color, 73 | [render.BUFFER_DEPTH_BIT] = 1, 74 | [render.BUFFER_STENCIL_BIT] = 0 75 | } 76 | 77 | self.upscale_material = hash("lowrez") 78 | self.scale_snap = false 79 | end 80 | 81 | local function clear(self, w, h) 82 | -- clear 83 | render.set_view(IDENTITY) 84 | render.set_projection(vmath.matrix4_orthographic(0, w, 0, h, -1, 1)) 85 | render.set_depth_mask(true) 86 | render.set_stencil_mask(0xff) 87 | render.clear(self.clear_buffers) 88 | end 89 | 90 | local function draw_game(self) 91 | clear(self, render.get_window_width(), render.get_window_height()) 92 | 93 | render.set_viewport(0, 0, self.width, self.height) 94 | 95 | -- draw world (sprites, tiles, pfx etc) 96 | render.set_depth_mask(false) 97 | render.disable_state(render.STATE_DEPTH_TEST) 98 | render.disable_state(render.STATE_STENCIL_TEST) 99 | render.disable_state(render.STATE_CULL_FACE) 100 | render.enable_state(render.STATE_BLEND) 101 | render.set_blend_func(render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA) 102 | render.set_view(self.view) 103 | render.set_projection(self.lowrez_projection) 104 | render.draw(self.background_pred) 105 | render.draw(self.tile_pred) 106 | render.draw(self.particle_pred) 107 | 108 | render.set_blend_func(render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA) 109 | 110 | render.enable_state(render.STATE_DEPTH_TEST) 111 | render.set_depth_mask(true) 112 | render.draw(self.model_pred) 113 | 114 | render.disable_state(render.STATE_DEPTH_TEST) 115 | 116 | render.draw_debug3d() 117 | 118 | render.set_view(vmath.matrix4()) 119 | render.set_projection(self.lowrez_projection) 120 | -- render.enable_state(render.STATE_STENCIL_TEST) 121 | -- render.draw(self.text_pred) 122 | -- render.disable_state(render.STATE_STENCIL_TEST) 123 | end 124 | 125 | local function draw_upscaled(self) 126 | -- calculate zoom 127 | local window_width = render.get_window_width() 128 | local window_height = render.get_window_height() 129 | local zoom = math.min(window_width / self.width, window_height / self.height) 130 | if self.scale_snap then 131 | zoom = math.max(1, math.floor(zoom)) 132 | end 133 | 134 | -- positioning 135 | local width = self.width * zoom 136 | local height = self.height * zoom 137 | local offsetx = (window_width - width) / 2 138 | local offsety = (window_height - height) / 2 139 | 140 | -- draw! 141 | render.disable_state(render.STATE_BLEND) 142 | render.set_viewport(offsetx, offsety, width, height) 143 | render.set_view(IDENTITY) 144 | render.set_projection(IDENTITY) 145 | render.enable_texture(0, self.rt, render.BUFFER_COLOR_BIT) 146 | local constants = render.constant_buffer() 147 | constants.sharpness = vmath.vector4(9.9, 1.0, 1.0, 1.0) 148 | constants.texture_size = vmath.vector4(self.width, self.height, 1.0, 1.0) 149 | render.enable_material(self.upscale_material) 150 | render.draw(self.lowrez_pred, constants) 151 | render.disable_material() 152 | render.disable_texture(0, self.rt) 153 | end 154 | 155 | local function draw_controls(self) 156 | render.set_viewport(0, 0, render.get_window_width(), render.get_window_height()) 157 | render.set_view(IDENTITY) 158 | render.set_projection( 159 | vmath.matrix4_orthographic(0, render.get_window_width(), 0, render.get_window_height(), -1, 1) 160 | ) 161 | render.enable_state(render.STATE_BLEND) 162 | render.enable_state(render.STATE_STENCIL_TEST) 163 | 164 | render.draw(self.gui_pred) 165 | 166 | render.disable_state(render.STATE_STENCIL_TEST) 167 | render.disable_state(render.STATE_BLEND) 168 | end 169 | 170 | function update(self) 171 | clear(self, render.get_window_width(), render.get_window_height()) 172 | render.enable_render_target(self.rt) 173 | draw_game(self) 174 | render.disable_render_target(self.rt) 175 | draw_upscaled(self) 176 | draw_controls(self) 177 | end 178 | 179 | function on_message(self, message_id, message) 180 | if message_id == CLEAR_COLOR then 181 | self.clear_buffers[render.BUFFER_COLOR_BIT] = message.color 182 | elseif message_id == SET_VIEW_PROJECTION then 183 | self.view = message.view 184 | self.lowrez_projection = message.projection 185 | elseif message_id == SET_UPSCALE_MATERIAL then 186 | self.upscale_material = message.material 187 | elseif message_id == TOGGLE_SCALE_SNAP then 188 | if self.scale_snap then 189 | self.scale_snap = false 190 | else 191 | self.scale_snap = true 192 | end 193 | elseif message_id == SET_SIZE then 194 | setup(self, message.width, message.height) 195 | end 196 | end 197 | -------------------------------------------------------------------------------- /main/main.collection: -------------------------------------------------------------------------------- 1 | name: "main" 2 | instances { 3 | id: "lowrez" 4 | prototype: "/components/lowrez/lowrez.go" 5 | position { 6 | x: 0.0 7 | y: 0.0 8 | z: 0.0 9 | } 10 | rotation { 11 | x: 0.0 12 | y: 0.0 13 | z: 0.0 14 | w: 1.0 15 | } 16 | scale3 { 17 | x: 1.0 18 | y: 1.0 19 | z: 1.0 20 | } 21 | } 22 | instances { 23 | id: "background" 24 | prototype: "/components/background/background.go" 25 | position { 26 | x: 320.0 27 | y: 180.0 28 | z: 0.0 29 | } 30 | rotation { 31 | x: 0.0 32 | y: 0.0 33 | z: 0.0 34 | w: 1.0 35 | } 36 | scale3 { 37 | x: 640.0 38 | y: 360.0 39 | z: 1.0 40 | } 41 | } 42 | scale_along_z: 0 43 | embedded_instances { 44 | id: "target" 45 | data: "" 46 | position { 47 | x: 190.0 48 | y: 180.0 49 | z: 0.1 50 | } 51 | rotation { 52 | x: 0.0 53 | y: 0.0 54 | z: 0.0 55 | w: 1.0 56 | } 57 | scale3 { 58 | x: 1.0 59 | y: 1.0 60 | z: 1.0 61 | } 62 | } 63 | embedded_instances { 64 | id: "scripts" 65 | data: "components {\n" 66 | " id: \"main\"\n" 67 | " component: \"/scripts/main.script\"\n" 68 | " position {\n" 69 | " x: 0.0\n" 70 | " y: 0.0\n" 71 | " z: 0.0\n" 72 | " }\n" 73 | " rotation {\n" 74 | " x: 0.0\n" 75 | " y: 0.0\n" 76 | " z: 0.0\n" 77 | " w: 1.0\n" 78 | " }\n" 79 | "}\n" 80 | "" 81 | position { 82 | x: 0.0 83 | y: 0.0 84 | z: 0.0 85 | } 86 | rotation { 87 | x: 0.0 88 | y: 0.0 89 | z: 0.0 90 | w: 1.0 91 | } 92 | scale3 { 93 | x: 1.0 94 | y: 1.0 95 | z: 1.0 96 | } 97 | } 98 | embedded_instances { 99 | id: "particles" 100 | data: "components {\n" 101 | " id: \"stars\"\n" 102 | " component: \"/assets/particles/stars.particlefx\"\n" 103 | " position {\n" 104 | " x: 0.0\n" 105 | " y: 0.0\n" 106 | " z: 0.0\n" 107 | " }\n" 108 | " rotation {\n" 109 | " x: 0.0\n" 110 | " y: 0.0\n" 111 | " z: 0.0\n" 112 | " w: 1.0\n" 113 | " }\n" 114 | "}\n" 115 | "" 116 | position { 117 | x: 320.0 118 | y: 180.0 119 | z: 0.0 120 | } 121 | rotation { 122 | x: 0.0 123 | y: 0.0 124 | z: 0.0 125 | w: 1.0 126 | } 127 | scale3 { 128 | x: 1.0 129 | y: 1.0 130 | z: 1.0 131 | } 132 | } 133 | embedded_instances { 134 | id: "gui" 135 | data: "components {\n" 136 | " id: \"settings\"\n" 137 | " component: \"/components/gui/settings.gui\"\n" 138 | " position {\n" 139 | " x: 0.0\n" 140 | " y: 0.0\n" 141 | " z: 0.0\n" 142 | " }\n" 143 | " rotation {\n" 144 | " x: 0.0\n" 145 | " y: 0.0\n" 146 | " z: 0.0\n" 147 | " w: 1.0\n" 148 | " }\n" 149 | "}\n" 150 | "" 151 | position { 152 | x: 0.0 153 | y: 0.0 154 | z: 0.0 155 | } 156 | rotation { 157 | x: 0.0 158 | y: 0.0 159 | z: 0.0 160 | w: 1.0 161 | } 162 | scale3 { 163 | x: 1.0 164 | y: 1.0 165 | z: 1.0 166 | } 167 | } 168 | embedded_instances { 169 | id: "collections" 170 | data: "embedded_components {\n" 171 | " id: \"planet_1\"\n" 172 | " type: \"collectionfactory\"\n" 173 | " data: \"prototype: \\\"/components/planets/rivers/rivers.collection\\\"\\n" 174 | "load_dynamically: false\\n" 175 | "\"\n" 176 | " position {\n" 177 | " x: 0.0\n" 178 | " y: 0.0\n" 179 | " z: 0.0\n" 180 | " }\n" 181 | " rotation {\n" 182 | " x: 0.0\n" 183 | " y: 0.0\n" 184 | " z: 0.0\n" 185 | " w: 1.0\n" 186 | " }\n" 187 | "}\n" 188 | "embedded_components {\n" 189 | " id: \"planet_2\"\n" 190 | " type: \"collectionfactory\"\n" 191 | " data: \"prototype: \\\"/components/planets/dry_terran/dry_terran.collection\\\"\\n" 192 | "load_dynamically: false\\n" 193 | "\"\n" 194 | " position {\n" 195 | " x: 0.0\n" 196 | " y: 0.0\n" 197 | " z: 0.0\n" 198 | " }\n" 199 | " rotation {\n" 200 | " x: 0.0\n" 201 | " y: 0.0\n" 202 | " z: 0.0\n" 203 | " w: 1.0\n" 204 | " }\n" 205 | "}\n" 206 | "embedded_components {\n" 207 | " id: \"planet_4\"\n" 208 | " type: \"collectionfactory\"\n" 209 | " data: \"prototype: \\\"/components/planets/no_atmosphere/no_atmosphere.collection\\\"\\n" 210 | "load_dynamically: false\\n" 211 | "\"\n" 212 | " position {\n" 213 | " x: 0.0\n" 214 | " y: 0.0\n" 215 | " z: 0.0\n" 216 | " }\n" 217 | " rotation {\n" 218 | " x: 0.0\n" 219 | " y: 0.0\n" 220 | " z: 0.0\n" 221 | " w: 1.0\n" 222 | " }\n" 223 | "}\n" 224 | "embedded_components {\n" 225 | " id: \"planet_3\"\n" 226 | " type: \"collectionfactory\"\n" 227 | " data: \"prototype: \\\"/components/planets/land_masses/land_masses.collection\\\"\\n" 228 | "load_dynamically: false\\n" 229 | "\"\n" 230 | " position {\n" 231 | " x: 0.0\n" 232 | " y: 0.0\n" 233 | " z: 0.0\n" 234 | " }\n" 235 | " rotation {\n" 236 | " x: 0.0\n" 237 | " y: 0.0\n" 238 | " z: 0.0\n" 239 | " w: 1.0\n" 240 | " }\n" 241 | "}\n" 242 | "embedded_components {\n" 243 | " id: \"planet_5\"\n" 244 | " type: \"collectionfactory\"\n" 245 | " data: \"prototype: \\\"/components/planets/gas_planet/gas_planet.collection\\\"\\n" 246 | "load_dynamically: false\\n" 247 | "\"\n" 248 | " position {\n" 249 | " x: 0.0\n" 250 | " y: 0.0\n" 251 | " z: 0.0\n" 252 | " }\n" 253 | " rotation {\n" 254 | " x: 0.0\n" 255 | " y: 0.0\n" 256 | " z: 0.0\n" 257 | " w: 1.0\n" 258 | " }\n" 259 | "}\n" 260 | "embedded_components {\n" 261 | " id: \"planet_9\"\n" 262 | " type: \"collectionfactory\"\n" 263 | " data: \"prototype: \\\"/components/planets/asteroids/asteroid.collection\\\"\\n" 264 | "load_dynamically: false\\n" 265 | "\"\n" 266 | " position {\n" 267 | " x: 0.0\n" 268 | " y: 0.0\n" 269 | " z: 0.0\n" 270 | " }\n" 271 | " rotation {\n" 272 | " x: 0.0\n" 273 | " y: 0.0\n" 274 | " z: 0.0\n" 275 | " w: 1.0\n" 276 | " }\n" 277 | "}\n" 278 | "embedded_components {\n" 279 | " id: \"planet_6\"\n" 280 | " type: \"collectionfactory\"\n" 281 | " data: \"prototype: \\\"/components/planets/gas_giant/gas_giant.collection\\\"\\n" 282 | "load_dynamically: false\\n" 283 | "\"\n" 284 | " position {\n" 285 | " x: 0.0\n" 286 | " y: 0.0\n" 287 | " z: 0.0\n" 288 | " }\n" 289 | " rotation {\n" 290 | " x: 0.0\n" 291 | " y: 0.0\n" 292 | " z: 0.0\n" 293 | " w: 1.0\n" 294 | " }\n" 295 | "}\n" 296 | "embedded_components {\n" 297 | " id: \"planet_7\"\n" 298 | " type: \"collectionfactory\"\n" 299 | " data: \"prototype: \\\"/components/planets/ice_world/ice_word.collection\\\"\\n" 300 | "load_dynamically: false\\n" 301 | "\"\n" 302 | " position {\n" 303 | " x: 0.0\n" 304 | " y: 0.0\n" 305 | " z: 0.0\n" 306 | " }\n" 307 | " rotation {\n" 308 | " x: 0.0\n" 309 | " y: 0.0\n" 310 | " z: 0.0\n" 311 | " w: 1.0\n" 312 | " }\n" 313 | "}\n" 314 | "embedded_components {\n" 315 | " id: \"planet_8\"\n" 316 | " type: \"collectionfactory\"\n" 317 | " data: \"prototype: \\\"/components/planets/lava_world/lava_world.collection\\\"\\n" 318 | "load_dynamically: false\\n" 319 | "\"\n" 320 | " position {\n" 321 | " x: 0.0\n" 322 | " y: 0.0\n" 323 | " z: 0.0\n" 324 | " }\n" 325 | " rotation {\n" 326 | " x: 0.0\n" 327 | " y: 0.0\n" 328 | " z: 0.0\n" 329 | " w: 1.0\n" 330 | " }\n" 331 | "}\n" 332 | "embedded_components {\n" 333 | " id: \"planet_10\"\n" 334 | " type: \"collectionfactory\"\n" 335 | " data: \"prototype: \\\"/components/planets/star/star.collection\\\"\\n" 336 | "load_dynamically: false\\n" 337 | "\"\n" 338 | " position {\n" 339 | " x: 0.0\n" 340 | " y: 0.0\n" 341 | " z: 0.0\n" 342 | " }\n" 343 | " rotation {\n" 344 | " x: 0.0\n" 345 | " y: 0.0\n" 346 | " z: 0.0\n" 347 | " w: 1.0\n" 348 | " }\n" 349 | "}\n" 350 | "" 351 | position { 352 | x: 0.0 353 | y: 0.0 354 | z: 0.0 355 | } 356 | rotation { 357 | x: 0.0 358 | y: 0.0 359 | z: 0.0 360 | w: 1.0 361 | } 362 | scale3 { 363 | x: 1.0 364 | y: 1.0 365 | z: 1.0 366 | } 367 | } 368 | --------------------------------------------------------------------------------