ProceduralPlanets
ProceduralPlanets.Ring Class Reference

This is the class for ring. More...

Public Types

enum  StringFormat {
  JSON_EASY_READ,
  JSON_COMPACT,
  JSON_ESCAPED,
  JSON_BASE64
}
 

Public Member Functions

float SetPropertyFloat (string _key)
 Sets a PropertyFloat based on random seed. More...
 
void OverridePropertyFloat (string _key, float _value, bool _updateSerializedRingCache=true)
 Overrides a property value. By default this updates the serialized cache for the ring. Public any script should be able to override a property of the ring More...
 
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...
 
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...
 
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...
 
float GetPropertySeededFloat (PropertyFloat _p)
 Gets the property value as determined by the random seed using the PropertyFloat as argument. More...
 
int SetPropertyMaterial (string _key)
 Sets a property material to the material determined by the random seed. Public because editor script calls this method. More...
 
void OverridePropertyMaterial (string _key, int _value, bool _updateSerializedRingCache=true)
 Overrides a property material. By default this updates the serialized cache for the ring. Public because any script should be able to override a property of the ring (e.g. manually set or animate.) More...
 
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 ring is overridden More...
 
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...
 
int GetPropertySeededMaterial (string _key)
 Gets the property material (integer index) as determined by the random seed using the key as argument. More...
 
void SetBlueprintRing (BlueprintRing _blueprintRing, int _seed=0, bool _updateProperties=true)
 Sets the ring blueprint. More...
 
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...
 
bool RebuildTexturesNeeded ()
 
void RebuildTextures (bool _force=false)
 
void UpdateProceduralTexture ()
 Updates and rebuilds procedural texture. More...
 
void UpdateProperties ()
 Update properties and set them to their seeded random value More...
 
void CreateMeshes ()
 Create ring meshes. There are two because ring is split into two sections with different sort orders to render in front and behind semitransparent planet atmosphere. More...
 
string ExportToJSON (StringFormat _format=StringFormat.JSON_EASY_READ)
 Exports the ring to JSON string in different formats (easy to read / compact / "escaped" (i.e. slashes are replaced for copy/paste compatibility) and base64 encoding. The ring seed is included in the exported string but also all property values even if they are not overridden (the reason being that if the ring 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 ring. More...
 
string ImportFromJSON (string _jsonString)
 Import ring properties from JSON string (supports easy to read/compact/escaped/base64 encoded formats). Public so other scripts can call action to import ring settings. More...
 
float GetPropertyFloatLerp (string _key)
 
Texture2D GetBakedTexture ()
 Gets the baked texture - used by editor script to bake planet to prefab with PNG textures More...
 

Public Attributes

string serializedRingCache = null
 
List< PropertyMaterialpropertyMaterials = new List<PropertyMaterial>(0)
 
List< PropertyFloatpropertyFloats = new List<PropertyFloat>(0)
 
ProceduralMaterial proceduralMaterial
 
int seed
 
BlueprintRing blueprintRing
 
bool rebuildTextures = false
 
bool rebuildRingNeeded = false
 

Protected Member Functions

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 SetProceduralMaterialFloats (string _map, ProceduralMaterial _proceduralMaterial)
 Gets the procedural material floats, sends them to the procedural material to update graph parameters. More...
 

Detailed Description

This is the class for ring.

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

Inheritance diagram for ProceduralPlanets.Ring:

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