ProceduralPlanets
ProceduralPlanets.GasPlanet Class Reference

Component used by gas planets. Planets are created by using the Inspector on the PlanetManager or via the static public method

See also
PlanetManager.CreatePlanet(Vector3, int, string, string)

in PlanetManager. More...

Properties

override bool IsBuildingTextures [get]
 Gets if the planet is currently generating any procedural textures. Public so any script can query if planet is currently processing textures. More...
 
- Properties inherited from ProceduralPlanets.Planet
abstract bool IsBuildingTextures [get]
 

Public Member Functions

override void SetPlanetBlueprint (int _index=-1, bool _leaveOverride=false, bool _setProperties=true)
 Sets the planet blueprint based on the index value (order of the GameObject of under the PlanetManager gameobject). Defaults to seed selected index. Optionally leave overridden values as is. Public because Manager calls this when creating a new planet. More...
 
void UpdateLODTextureIfNeeded (bool _force=false)
 Updates Level of Detail (LOD) Texture if needed. This is queried every frame via Update(). Public because PlanetManager updates textures if necessary. More...
 
bool RebuildTexturesNeeded ()
 Determines if any procedural texture needs to be rebuilt based on flags. Public because the editor script calls this as well. More...
 
void RebuildTextures (bool _force=false)
 Rebuilds textures for procedural materials where properties have been changed (or alternatively all texture if force parameter is set to true). Public because the editor script calls this as well. More...
 
override void UpdateProceduralTexture (string _textureName)
 Updates procedural textures. Array of float values for the texture is included as well as reference to the (this) object that the texture should be sent to. Public becasue PlanetManagerEditor needs to access this method to force updating of procedural textures. More...
 
override void CacheProceduralProperty (string _property, bool _value)
 
Texture2D [] GetBakedTextures ()
 Gets baked textures - used by editor script to bake planet to prefab with PNG textures More...
 
- Public Member Functions inherited from ProceduralPlanets.Planet
virtual void AddListener (GameObject _gameObject)
 
virtual float SetPropertyFloat (string _key)
 Sets a property float to the value determined by the random seed. Public because editor script calls this method. More...
 
virtual Color SetPropertyColor (string _key)
 Sets a property color to the color determined by the random seed. Public because editor script calls this method. More...
 
virtual int SetPropertyMaterial (string _key)
 Sets a property material to the material determined by the random seed. Public because editor script calls this method. More...
 
virtual void OverridePropertyFloat (string _key, float _value, bool _updateSerializedPlanetCache=true)
 Overrides a property value. By default this updates the serialized cache for the planet. Public any script should be able to override a property of the planet (e.g. manually set or animate liquid level etc.) More...
 
virtual bool IsPropertyFloatOverridden (string _key)
 Answers if property float is overridden based on key (returns true/false) Public because any script should be able to find out if a property of the planet is overridden More...
 
virtual float GetPropertyFloat (string _key)
 Gets the float value based on key (returns current value regardless whether it is determined by seed or overridden) Public because any script should be able to find out value of a property of the planet More...
 
virtual void OverridePropertyColor (string _key, Color _color, bool _updateSerializedPlanetCache=true)
 Overrides a property color. By default this updates the serialized cache for the planet. Public because any script should be able to override a property of the planet (e.g. manually set or animate liquid level etc.) More...
 
virtual bool IsPropertyColorOverridden (string _key)
 Answers if property color is overridden based on key (returns true/false) Public any script should be able to find out if a property of the planet is overridden More...
 
virtual Color GetPropertyColor (string _key)
 Gets the color value based on key (returns current value regardless whether it is determined by seed or overridden) Public because any script should be able to find out color of a property of the planet More...
 
virtual void OverridePropertyMaterial (string _key, int _value, bool _updateSerializedPlanetCache=true)
 Overrides a property material. By default this updates the serialized cache for the planet. Public because any script should be able to override a property of the planet (e.g. manually set or animate liquid level etc.) More...
 
virtual bool IsPropertyMaterialOverridden (string _key)
 Answers if property material is overridden based on key (returns true/false) Public any script should be able to find out if a property of the planet is overridden More...
 
virtual int GetPropertyMaterial (string _key)
 Gets the material index integer value based on key (returns current value regardless whether it is determined by seed or overridden) Public because any script should be able to find out color of a property of the planet More...
 
virtual void CreateRing (string _jsonString=null)
 Creates a ring using based on blueprint random values or using optional jSON string. More...
 
virtual bool HasRing ()
 Answers the question whether or not the planet has a planetary ring More...
 
virtual Ring GetRing ()
 Gets the ring component of a planetary ring of this planet. More...
 
virtual void DestroyRing ()
 Destroy ring if planet has one (child object must be named "Ring") More...
 
virtual string ExportToJSON (StringFormat _format=StringFormat.JSON_EASY_READ)
 Exports the planet to JSON string in different formats (easy to read / compact / "escaped" (i.e. slashes are replaced for copy/paste compatibility) and base64 encoding. The planet and variation seed is included in the exported string but also all property values even if they are not overridden (the reason being that if the planet blueprint index hierarchy changes or updates to ProceduralPlanet asset affects the random seed, all values that used to be default seed values will instead be set to override. Public so other scripts can export planet. More...
 
virtual string ImportFromJSON (string _jsonString, bool _createRing=false)
 Import planet properties from JSON string (supports easy to read/compact/escaped/base64 encoded formats). Public so other scripts can call action to import planet settings. More...
 
virtual BlueprintRing GetRingBlueprint ()
 Gets the blueprint for the ring based on the planet blueprint child ring blueprint. More...
 
float GetLODPercent ()
 
void SetSharedMesh (Mesh _mesh)
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
void AnimateFloat (string _key, float _source, float _destination, float _duration, float _delay)
 Animates a float after a delay from a source value to a destination value over the time of duration. More...
 

Protected Member Functions

override void Awake ()
 Creates the planet with serialized parameters (this happens every play/stop in editor) More...
 
override void Update ()
 Updates local star position and checks if any textures need to be rebuilt. This happens every frame. More...
 
override int GetPlanetBlueprintSeededIndex ()
 Gets the planet blueprint index (i.e. the order of a planet blueprint in the blueprint hierarchy of gas planets under the Manager game object based on the random seed. More...
 
override void HandleModifiedTextures (string[] _proceduralTextures)
 Handles any modified textures by examining the string array to see if the array contains reference to one or more procedural texture(s). If there is a reference to a texture it means that it has been modified and the rebuild flag for the texture is set to true. More...
 
- Protected Member Functions inherited from ProceduralPlanets.Planet
virtual void TriggerOnTextureBuildComplete (float _timeTaken)
 
virtual void TriggerOnTextureBuildStart (float _timeStarted)
 
virtual PropertyFloat [] AssembleFloatArray (string _map)
 Assembles array with float values to be sent to Manager to be used during texture building. More...
 
virtual void SetProceduralMaterialFloats (string _map, ProceduralMaterial _proceduralMaterial)
 
virtual void SetDefaultProperties (bool _leaveOverride=false)
 Sets the default properties based on the seed. Optioanally leave or overwrite overridden properties. More...
 
virtual void UpdatePropertyFloatShader (PropertyFloat _propertyFloat)
 Updates the planet shader if affected by the PropertyFloat. More...
 
virtual void UpdatePropertyColorShader (PropertyColor _propertyColor)
 Updates the planet shader if affected by the PropertyColor More...
 
virtual void UpdateDictionariesIfNeeded (bool _force=false)
 Updates the dictionaries to contains the Float,Color,Material values of the property lists. Unity does not support serialized dictionaries so this component need to keep values in the dictionary for the game and in the list for serialization for the custom inspector in the editor script. More...
 
virtual Texture2D GenerateLookupTexture (float _level, int _detail=1024)
 Generates lookup textures with a sharp transition. More...
 
virtual Texture2D GenerateLookupSmoothTexture (float _level, float _lowLimit=-1.0f, float _upLimit=-1.0f)
 Genereates smooth lookup textures with a gradient transition between lowLimit and upLimit. More...
 
virtual void AddPropertyFloat (string _key, string _label, float _minValue, float _maxValue, bool _clamp01, bool _displayAsInt, int _seedOffset, bool _variation, string[] _proceduralTextures, Material _materials, string _shaderProperty=null, PropertyFloat.Method _method=PropertyFloat.Method.VALUE, PropertyFloat.DataType _dataType=PropertyFloat.DataType.FLOAT)
 Adds a float property that affects a single Procedural Material More...
 
virtual void AddPropertyFloat (string _key, string _label, float _minValue, float _maxValue, bool _clamp01, bool _displayAsInt, int _seedOffset, bool _variation, string[] _proceduralTextures=null, Material[] _materials=null, string _shaderProperty=null, PropertyFloat.Method _method=PropertyFloat.Method.VALUE, PropertyFloat.DataType _dataType=PropertyFloat.DataType.FLOAT)
 Adds a float property that affects multiple Procedural Materials. More...
 
virtual void AddPropertyColor (string _key, string _label, Color _baseColor, float _hueRange, float _saturationRange, float _brightnessRange, int _seedOffset, bool _variation, Material _material=null, string _shaderProperty=null)
 Adds a Color property that affects a single Procedural Material. More...
 
virtual void AddPropertyColor (string _key, string _label, Color _baseColor, float _hueRange, float _saturationRange, float _brightnessRange, int _seedOffset, bool _variation, Material[] _materials=null, string _shaderProperty=null)
 Adds a Color property that affects multiple Procedural Materials. More...
 
virtual void AddPropertyMaterial (string _key, string _label, ProceduralMaterial[] _materials, int _seedOffset, string[] _proceduralTextures=null, Material _material=null, string _shaderProperty=null)
 Adds a Material property that affects a single Procedural Material. More...
 
virtual float GetPropertySeededFloat (string _key)
 Gets the property value as determined by the random seed using the key as argument. See GetPropertySeededFloat(PropertyFloat _p) method for details. More...
 
virtual float GetPropertySeededFloat (PropertyFloat _propertyFloat)
 Gets the property value as determined by the random seed using the PropertyFloat as argument. More...
 
virtual Color GetPropertySeededColor (string _key)
 Gets the property color as determined by the random seed using the key as argument. More...
 
virtual int GetPropertySeededMaterial (string _key)
 Gets the property material (integer index) as determined by the random seed using the key as argument. More...
 

Additional Inherited Members

- Public Attributes inherited from ProceduralPlanets.Planet
string serializedPlanetCache
 
string initJSONSettings = ""
 
int planetSeed = 0
 
int variationSeed = 0
 
int planetBlueprintIndex = -1
 
bool planetBlueprintOverride = false
 
BlueprintPlanet blueprint = null
 
int meshLODLevel
 
MeshFilter meshFilter
 
int textureLODLevel = -1
 
int textureProgressiveStep = -1
 
List< PropertyFloatpropertyFloats = new List<PropertyFloat>(0)
 
List< PropertyColorpropertyColors = new List<PropertyColor>(0)
 
List< PropertyMaterialpropertyMaterials = new List<PropertyMaterial>(0)
 
- Protected Attributes inherited from ProceduralPlanets.Planet
const string PLANET_VERSION = "1.0"
 
bool _isBuildingTextures = false
 
float _timerStartBuildingTextures = -1f
 
List< PropertyFloatAnimation.Animation_propertyFloatAnimations = new List<PropertyFloatAnimation.Animation>()
 
List< GameObject > _eventListeners = new List<GameObject>()
 
MeshRenderer _meshRenderer
 
GameObject _externalAtmosphere
 
MeshFilter _externalAtmosphereMeshFilter
 
MeshRenderer _externalAtmosphereRenderer
 
int _shaderID_LocalStarPosition
 
int _shaderID_LocalStarColor
 
int _shaderID_LocalStarIntensity
 
int _shaderID_LocalStarAmbientIntensity
 
LocalStar.ShaderCacheSettings _localStarShaderCacheSettings
 
LocalStar _localStarNearestInstance
 
Dictionary< string, PropertyFloat_dictionaryFloats = new Dictionary<string, PropertyFloat>(0)
 
Dictionary< string, PropertyColor_dictionaryColors = new Dictionary<string, PropertyColor>(0)
 
Dictionary< string, PropertyMaterial_dictionaryMaterials = new Dictionary<string, PropertyMaterial>(0)
 
Vector3 _lastPosition
 

Detailed Description

Component used by gas planets. Planets are created by using the Inspector on the PlanetManager or via the static public method

See also
PlanetManager.CreatePlanet(Vector3, int, string, string)

in PlanetManager.

GasPlanet is derived from the base class Planet. GasPlanet are all planets that are not solid planets.

Version 1.0 - 2018 (c) Imphenzia AB - Author: Stefan Persson

Inheritance diagram for ProceduralPlanets.GasPlanet:
ProceduralPlanets.Planet

The documentation for this class was generated from the following file: