diff options
Diffstat (limited to 'Runtime/Terrain/ScriptBindings')
-rw-r--r-- | Runtime/Terrain/ScriptBindings/TerrainDataBindings.txt | 406 | ||||
-rw-r--r-- | Runtime/Terrain/ScriptBindings/Terrains.txt | 675 | ||||
-rw-r--r-- | Runtime/Terrain/ScriptBindings/WindZoneBindings.txt | 183 |
3 files changed, 1264 insertions, 0 deletions
diff --git a/Runtime/Terrain/ScriptBindings/TerrainDataBindings.txt b/Runtime/Terrain/ScriptBindings/TerrainDataBindings.txt new file mode 100644 index 0000000..c14d84a --- /dev/null +++ b/Runtime/Terrain/ScriptBindings/TerrainDataBindings.txt @@ -0,0 +1,406 @@ +C++RAW +#include "UnityPrefix.h" +#include "Runtime/Terrain/Heightmap.h" +#include "Runtime/Filters/Mesh/LodMesh.h" +#include "Runtime/Terrain/DetailDatabase.h" +#include "Runtime/Terrain/SplatDatabase.h" +#include "Runtime/Terrain/TerrainData.h" +#include "Runtime/Terrain/TerrainInstance.h" +#include "Runtime/Mono/MonoBehaviour.h" +#include "Runtime/BaseClasses/GameObject.h" +#include "Runtime/Terrain/TerrainRenderer.h" +#include "Runtime/Camera/Light.h" +#include "Runtime/Terrain/DetailRenderer.h" +#include "Runtime/Terrain/ImposterRenderTexture.h" +#include "Runtime/Terrain/TreeRenderer.h" +#include "Runtime/Terrain/Wind.h" +#include "Runtime/Terrain/Tree.h" +#include "Runtime/Scripting/Scripting.h" +#include "Runtime/Scripting/ScriptingUtility.h" +#include "Runtime/Scripting/ScriptingExportUtility.h" + +using namespace Unity; +using namespace std; + +CSRAW + +#if ENABLE_TERRAIN + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Collections; +using System.Collections.Generic; + +namespace UnityEngine +{ + +CSRAW [StructLayout (LayoutKind.Sequential)] +CONDITIONAL ENABLE_TERRAIN +CLASS TreePrototype + CSRAW internal GameObject m_Prefab; + CSRAW internal float m_BendFactor; + + CSRAW public GameObject prefab { get { return m_Prefab; } set { m_Prefab = value; } } + + CSRAW public float bendFactor { get { return m_BendFactor; } set { m_BendFactor = value; } } +END + +ENUM DetailRenderMode + GrassBillboard = 0, + VertexLit = 1, + Grass = 2 +END + +CSRAW [StructLayout (LayoutKind.Sequential)] +CONDITIONAL ENABLE_TERRAIN +CLASS DetailPrototype + CSRAW GameObject m_Prototype = null; + CSRAW Texture2D m_PrototypeTexture = null; + CSRAW Color m_HealthyColor = new Color (67/255F, 249/255F, 42/255F, 1 ); + CSRAW Color m_DryColor = new Color (205/255.0F, 188/255.0F, 26/255.0F, 1.0F ) ; + CSRAW float m_MinWidth = 1.0F; + CSRAW float m_MaxWidth = 2.0F; + CSRAW float m_MinHeight = 1F; + CSRAW float m_MaxHeight = 2F; + CSRAW float m_NoiseSpread = 0.1F; + CSRAW float m_BendFactor = 0.1F; + CSRAW int m_RenderMode = 2; + CSRAW int m_UsePrototypeMesh = 0; + + CSRAW public GameObject prototype { get { return m_Prototype; } set { m_Prototype = value; } } + + CSRAW public Texture2D prototypeTexture { get { return m_PrototypeTexture; } set { m_PrototypeTexture = value; } } + + CSRAW public float minWidth { get { return m_MinWidth; } set { m_MinWidth = value; } } + + CSRAW public float maxWidth { get { return m_MaxWidth; } set { m_MaxWidth = value; } } + + CSRAW public float minHeight { get { return m_MinHeight; } set { m_MinHeight = value; } } + + CSRAW public float maxHeight { get { return m_MaxHeight; } set { m_MaxHeight = value; } } + + CSRAW public float noiseSpread { get { return m_NoiseSpread; } set { m_NoiseSpread = value; } } + + CSRAW public float bendFactor { get { return m_BendFactor; } set { m_BendFactor = value; } } + + CSRAW public Color healthyColor { get { return m_HealthyColor; } set { m_HealthyColor = value; } } + + CSRAW public Color dryColor { get { return m_DryColor; } set { m_DryColor = value; } } + + CSRAW public DetailRenderMode renderMode { get { return (DetailRenderMode)m_RenderMode; } set { m_RenderMode = (int)value; } } + + CSRAW public bool usePrototypeMesh { get { return m_UsePrototypeMesh != 0; } set { m_UsePrototypeMesh = value ? 1 : 0; } } +END + +CSRAW [StructLayout (LayoutKind.Sequential)] +CONDITIONAL ENABLE_TERRAIN +CLASS SplatPrototype + CSRAW Texture2D m_Texture; + CSRAW Texture2D m_NormalMap; + CSRAW Vector2 m_TileSize = new Vector2 (15,15); + CSRAW Vector2 m_TileOffset = new Vector2 (0, 0); + + CSRAW public Texture2D texture { get { return m_Texture; } set { m_Texture = value; } } + + CSRAW public Texture2D normalMap { get { return m_NormalMap; } set { m_NormalMap = value; } } + + CSRAW public Vector2 tileSize { get { return m_TileSize; } set { m_TileSize = value; } } + + CSRAW public Vector2 tileOffset { get { return m_TileOffset; } set { m_TileOffset = value; } } +END + + +CONDITIONAL ENABLE_TERRAIN +STRUCT TreeInstance + CSRAW Vector3 m_Position; + CSRAW float m_WidthScale; + CSRAW float m_HeightScale; + CSRAW Color32 m_Color; + CSRAW Color32 m_LightmapColor; + CSRAW int m_Index; + CSRAW float m_TemporaryDistance; + + public Vector3 position { get { return m_Position; } set { m_Position = value; } } + + public float widthScale { get { return m_WidthScale; } set { m_WidthScale = value; } } + + public float heightScale { get { return m_HeightScale; } set { m_HeightScale = value; } } + + public Color color { get { return m_Color; } set { m_Color = value; } } + + public Color lightmapColor { get { return m_LightmapColor; } set { m_LightmapColor = value; } } + + public int prototypeIndex { get { return m_Index; } set { m_Index = value; } } + + internal float temporaryDistance { get { return m_TemporaryDistance; } set { m_TemporaryDistance = value; } } +END + +CONDITIONAL ENABLE_TERRAIN +CLASS TerrainData : Object + CSRAW public TerrainData () + { + Internal_Create(this); + } + + CUSTOM internal void Internal_Create ([Writable]TerrainData terrainData) + { + TerrainData* td = NEW_OBJECT (TerrainData); + td->Reset(); + + //this is only for ensuring, that HeightMap initialized properly before someone uses TerrainData + if (td) + td->GetHeightmap().SetResolution(0); + + Scripting::ConnectScriptingWrapperToObject (terrainData.GetScriptingObject(), td); + td->AwakeFromLoad(kInstantiateOrCreateFromCodeAwakeFromLoad); + } + + CUSTOM internal bool HasUser (GameObject user) { return self->HasUser (user); } + CUSTOM internal void AddUser (GameObject user) { self->AddUser (user); } + CUSTOM internal void RemoveUser (GameObject user) { self->RemoveUser (user); } + + // HEIGHTMAP INTERFACE + C++RAW #define GETHEIGHT (&(self->GetHeightmap())) + + // ============================================= + C++RAW #define GETDETAIL (&(self->GetDetailDatabase())) + + C++RAW #define GETTREEDATABASE (&(self->GetTreeDatabase())) + + // PhysicMaterial the terrain. + CONDITIONAL ENABLE_PHYSICS + CUSTOM_PROP PhysicMaterial physicMaterial { return Scripting::ScriptingWrapperFor(GETHEIGHT->GetPhysicMaterial ()); } { GETHEIGHT->SetPhysicMaterial (value); } + CUSTOM_PROP int heightmapWidth { return GETHEIGHT->GetWidth (); } + CUSTOM_PROP int heightmapHeight { return GETHEIGHT->GetHeight (); } + + CUSTOM_PROP int heightmapResolution { return GETHEIGHT->GetResolution (); } { GETHEIGHT->SetResolution (value); } + + CUSTOM_PROP Vector3 heightmapScale { return GETHEIGHT->GetScale (); } + + CUSTOM_PROP Vector3 size { return GETHEIGHT->GetSize (); } { GETHEIGHT->SetSize (value); } + + CUSTOM float GetHeight (int x, int y) { return GETHEIGHT->GetHeight (x,y); } + CUSTOM float GetInterpolatedHeight (float x, float y) { return GETHEIGHT->GetInterpolatedHeight (x,y); } + + CUSTOM public float[,] GetHeights (int xBase, int yBase, int width, int height) { + + if(xBase < 0 || yBase < 0 || xBase+width > GETHEIGHT->GetWidth() || yBase+height > GETHEIGHT->GetHeight ()) + { + Scripting::RaiseMonoException ("Trying to access out-of-bounds terrain height information."); + return SCRIPTING_NULL; + } + + ScriptingArrayPtr map = CreateScriptingArray2D<float> (MONO_COMMON.floatSingle, height, width); + GETHEIGHT->GetHeights (xBase, yBase, width, height, &Scripting::GetScriptingArrayElement<float>(map, 0)); + return map; + } + + CSRAW public void SetHeights (int xBase, int yBase, float[,] heights) { + if (heights == null) + { + throw new System.NullReferenceException (); + } + if (xBase+heights.GetLength(1) > heightmapWidth || xBase < 0 || yBase < 0 || yBase+heights.GetLength(0) > heightmapHeight) + { + throw new System.Exception (UnityString.Format ("X or Y base out of bounds. Setting up to {0}x{1} while map size is {2}x{3}", xBase+heights.GetLength(1), yBase+heights.GetLength(0), heightmapWidth, heightmapHeight)); + } + + Internal_SetHeights (xBase, yBase, heights.GetLength(1), heights.GetLength(0), heights); + } + + CUSTOM private void Internal_SetHeights (int xBase, int yBase, int width, int height, float[,] heights) + { + GETHEIGHT->SetHeights(xBase, yBase, width, height, &Scripting::GetScriptingArrayElement<float>(heights, 0), false); + GETTREEDATABASE->RecalculateTreePositions(); + } + + CUSTOM private void Internal_SetHeightsDelayLOD (int xBase, int yBase, int width, int height, float[,] heights) + { + GETHEIGHT->SetHeights(xBase, yBase, width, height, &Scripting::GetScriptingArrayElement<float>(heights, 0), true); + } + + CSRAW internal void SetHeightsDelayLOD (int xBase, int yBase, float[,] heights) + { + Internal_SetHeightsDelayLOD (xBase, yBase, heights.GetLength(1), heights.GetLength(0), heights); + } + + CUSTOM float GetSteepness (float x, float y) { return GETHEIGHT->GetSteepness (x,y); } + + CUSTOM Vector3 GetInterpolatedNormal (float x, float y) { return GETHEIGHT->GetInterpolatedNormal (x,y); } + + + CUSTOM internal int GetAdjustedSize (int size) { return GETHEIGHT->GetAdjustedSize (size); } + + C++RAW #undef GETHEIGHT + + CUSTOM_PROP float wavingGrassStrength { return GETDETAIL->GetWavingGrassStrength(); } { GETDETAIL->SetWavingGrassStrength (value); self->SetDirty(); } + CUSTOM_PROP float wavingGrassAmount { return GETDETAIL->GetWavingGrassAmount(); } { GETDETAIL-> SetWavingGrassAmount (value); self->SetDirty(); } + CUSTOM_PROP float wavingGrassSpeed { return GETDETAIL->GetWavingGrassSpeed(); } { GETDETAIL-> SetWavingGrassSpeed (value); self->SetDirty(); } + CUSTOM_PROP Color wavingGrassTint { return GETDETAIL->GetWavingGrassTint(); } { GETDETAIL-> SetWavingGrassTint (value); self->SetDirty(); } + + CUSTOM_PROP int detailWidth { return GETDETAIL->GetWidth (); } + + CUSTOM_PROP int detailHeight { return GETDETAIL->GetHeight (); } + + CUSTOM void SetDetailResolution (int detailResolution, int resolutionPerPatch) + { + GETDETAIL->SetDetailResolution(detailResolution, resolutionPerPatch); + } + + CUSTOM_PROP int detailResolution { return GETDETAIL->GetResolution (); } + + CUSTOM_PROP internal int detailResolutionPerPatch { return GETDETAIL->GetResolutionPerPatch (); } + + CUSTOM internal void ResetDirtyDetails () { GETDETAIL->ResetDirtyDetails (); } + + CUSTOM void RefreshPrototypes () + { + GETDETAIL->RefreshPrototypes (); + GETTREEDATABASE->RefreshPrototypes (); + } + + CUSTOM_PROP DetailPrototype[] detailPrototypes + { + return VectorToScriptingClassArray<DetailPrototype, MonoDetailPrototype> (GETDETAIL->GetDetailPrototypes(), MONO_COMMON.detailPrototype, DetailPrototypeToMono); + } + { + GETDETAIL->SetDetailPrototypes (ScriptingClassArrayToVector<DetailPrototype, MonoDetailPrototype> (value, DetailPrototypeToCpp)); + } + + CUSTOM int[] GetSupportedLayers (int xBase, int yBase, int totalWidth, int totalHeight) { + int size = GETDETAIL->GetSupportedLayers (xBase, yBase, totalWidth, totalHeight, NULL); // Get the count of layers + ScriptingArrayPtr arr = CreateScriptingArray<int>(MONO_COMMON.int_32, size); + GETDETAIL->GetSupportedLayers (xBase, yBase, totalWidth, totalHeight, &Scripting::GetScriptingArrayElement<int> (arr, 0)); + return arr; + } + + CUSTOM int[,] GetDetailLayer (int xBase, int yBase, int width, int height, int layer) { + ScriptingArrayPtr map = CreateScriptingArray2D<int> (MONO_COMMON.int_32, height, width); + GETDETAIL->GetLayer (xBase, yBase, width, height, layer, &Scripting::GetScriptingArrayElement<int> (map, 0)); + return map; + } + + CSRAW public void SetDetailLayer (int xBase, int yBase, int layer, int[,] details) { + Internal_SetDetailLayer (xBase, yBase, details.GetLength(1), details.GetLength(0), layer, details); + } + + CUSTOM private void Internal_SetDetailLayer (int xBase, int yBase, int totalWidth, int totalHeight, int detailIndex, int[,] data) + { + GETDETAIL->SetLayer (xBase, yBase, totalWidth, totalHeight, detailIndex, &Scripting::GetScriptingArrayElement<int> (data, 0)); + } + + CUSTOM_PROP TreeInstance[] treeInstances + { + return CreateScriptingArray(&GETTREEDATABASE->GetInstances()[0], GETTREEDATABASE->GetInstances().size(), MONO_COMMON.treeInstance); + } + { + Scripting::RaiseIfNull((ScriptingObjectPtr)value); + TreeInstance *first = &Scripting::GetScriptingArrayElement<TreeInstance> (value, 0); + GETTREEDATABASE->GetInstances().assign (first, first + GetScriptingArraySize(value)); + GETTREEDATABASE->UpdateTreeInstances(); + } + CUSTOM_PROP TreePrototype[] treePrototypes + { return VectorToScriptingClassArray<TreePrototype, MonoTreePrototype> (GETTREEDATABASE->GetTreePrototypes(), MONO_COMMON.treePrototype, TreePrototypeToMono); } + { GETTREEDATABASE->SetTreePrototypes (ScriptingClassArrayToVector<TreePrototype, MonoTreePrototype> (value, TreePrototypeToCpp)); } + + CUSTOM internal void RemoveTreePrototype (int index) + { + GETTREEDATABASE->RemoveTreePrototype (index); + } + + CUSTOM internal void RecalculateTreePositions () + { + GETTREEDATABASE->RecalculateTreePositions (); + } + + CUSTOM internal void RemoveDetailPrototype (int index) + { + GETDETAIL->RemoveDetailPrototype (index); + } + + C++RAW #undef GETDETAIL + + + // OLD SPLAT DATABASE + // ============================================= + C++RAW #define GETSPLAT (&(self->GetSplatDatabase())) + + CUSTOM_PROP int alphamapLayers { return GETSPLAT->GetDepth(); } + CUSTOM public float[,,] GetAlphamaps (int x, int y, int width, int height) { + ScriptingArrayPtr map = CreateScriptingArray3D<float> (MONO_COMMON.floatSingle, height, width, GETSPLAT->GetDepth ()); + GETSPLAT->GetAlphamaps (x, y, width, height, &Scripting::GetScriptingArrayElement<float>(map, 0)); + return map; + } + + CUSTOM_PROP int alphamapResolution { return GETSPLAT->GetAlphamapResolution(); } { return GETSPLAT->SetAlphamapResolution(value); } + CUSTOM_PROP int alphamapWidth { return GETSPLAT->GetAlphamapResolution(); } + CUSTOM_PROP int alphamapHeight { return GETSPLAT->GetAlphamapResolution(); } + CUSTOM_PROP int baseMapResolution { return GETSPLAT->GetBaseMapResolution(); } { return GETSPLAT->SetBaseMapResolution(value); } + + CSRAW public void SetAlphamaps (int x, int y, float[,,] map) + { + if (map.GetLength(2) != alphamapLayers) { + throw new System.Exception (UnityString.Format ("Float array size wrong (layers should be {0})", alphamapLayers)); + } + // TODO: crop the map or throw if outside, + + Internal_SetAlphamaps (x,y, map.GetLength(1), map.GetLength(0), map); + } + CUSTOM private void Internal_SetAlphamaps (int x, int y, int width, int height, float[,,] map) + { + GETSPLAT->SetAlphamaps (x, y, width, height, &Scripting::GetScriptingArrayElement<float>(map, 0)); + } + + CUSTOM internal void RecalculateBasemapIfDirty() + { + GETSPLAT->RecalculateBasemapIfDirty(); + } + + CUSTOM internal void SetBasemapDirty(bool dirty) + { + GETSPLAT->SetBasemapDirty(dirty); + } + + CUSTOM private Texture2D GetAlphamapTexture(int index) { + return Scripting::ScriptingWrapperFor (GETSPLAT->GetAlphaTexture(index)); + } + + CUSTOM_PROP private int alphamapTextureCount { + return GETSPLAT->GetAlphaTextureCount(); + } + + CSRAW internal Texture2D[] alphamapTextures + { + get { + Texture2D[] splatTextures = new Texture2D[alphamapTextureCount]; + for (int i=0;i<splatTextures.Length;i++) + splatTextures[i] = GetAlphamapTexture(i); + return splatTextures; + } + } + + CUSTOM_PROP SplatPrototype[] splatPrototypes + { return VectorToScriptingClassArray<SplatPrototype, MonoSplatPrototype> (GETSPLAT->GetSplatPrototypes(), MONO_COMMON.splatPrototype, SplatPrototypeToMono); } + { GETSPLAT->SetSplatPrototypes (ScriptingClassArrayToVector<SplatPrototype, MonoSplatPrototype> (value, SplatPrototypeToCpp)); } + C++RAW #undef GET + + CUSTOM internal bool HasTreeInstances () + { + return !self->GetTreeDatabase().GetInstances().empty(); + } + + CUSTOM internal void AddTree (out TreeInstance tree) + { + self->GetTreeDatabase().AddTree (*tree); + } + + CUSTOM internal int RemoveTrees (Vector2 position, float radius, int prototypeIndex) + { + return self->GetTreeDatabase().RemoveTrees (position, radius, prototypeIndex); + } +END + +CSRAW +} +#endif // ENABLE_TERRAIN diff --git a/Runtime/Terrain/ScriptBindings/Terrains.txt b/Runtime/Terrain/ScriptBindings/Terrains.txt new file mode 100644 index 0000000..4335595 --- /dev/null +++ b/Runtime/Terrain/ScriptBindings/Terrains.txt @@ -0,0 +1,675 @@ +C++RAW +#include "UnityPrefix.h" +#include "Runtime/Terrain/Heightmap.h" +#include "Runtime/Filters/Mesh/LodMesh.h" +#include "Runtime/Terrain/DetailDatabase.h" +#include "Runtime/Terrain/SplatDatabase.h" +#include "Runtime/Terrain/TerrainData.h" +#include "Runtime/Terrain/TerrainInstance.h" +#include "Runtime/Mono/MonoBehaviour.h" +#include "Runtime/BaseClasses/GameObject.h" +#include "Runtime/Terrain/TerrainRenderer.h" +#include "Runtime/Camera/Light.h" +#include "Runtime/Terrain/DetailRenderer.h" +#include "Runtime/Terrain/ImposterRenderTexture.h" +#include "Runtime/Terrain/TreeRenderer.h" +#include "Runtime/Terrain/Wind.h" +#include "Runtime/Terrain/Tree.h" +#include "Runtime/Scripting/GetComponent.h" +#include "Runtime/Scripting/Scripting.h" +#include "Runtime/Scripting/ScriptingUtility.h" +#include "Runtime/Scripting/ScriptingExportUtility.h" +#include "Runtime/Scripting/Backend/ScriptingInvocation.h" +#include "Runtime/Scripting/Backend/ScriptingTypeRegistry.h" +#include "Runtime/Interfaces/ITerrainManager.h" + +using namespace Unity; +using namespace std; + +CSRAW + +#if ENABLE_TERRAIN + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Collections; +using System.Collections.Generic; + +namespace UnityEngine +{ + +// List of changes done to the terrain for OnTerrainChanged +// OnTerrainChanged is called with a bitfield of these items telling it what was changed. +CSRAW +[Flags] +internal enum TerrainChangedFlags +{ + NoChange = 0, + Heightmap = 1, + TreeInstances = 2, + DelayedHeightmapUpdate = 4, + FlushEverythingImmediately = 8, + RemoveDirtyDetailsImmediately = 16, + WillBeDestroyed = 256, +} + +ENUM TerrainRenderFlags + heightmap = 1, + trees = 2, + details = 4, + all = heightmap | trees | details +END + +CSRAW +CONDITIONAL ENABLE_TERRAIN +[AddComponentMenu("")] +[ExecuteInEditMode] +CLASS Terrain : MonoBehaviour + CSRAW + [SerializeField] + private TerrainData m_TerrainData; + [SerializeField] + float m_TreeDistance = 5000.0F; + [SerializeField] + float m_TreeBillboardDistance = 50.0F; + [SerializeField] + float m_TreeCrossFadeLength = 5.0F; + [SerializeField] + int m_TreeMaximumFullLODCount = 50; + [SerializeField] + float m_DetailObjectDistance = 80.0F; + [SerializeField] + float m_DetailObjectDensity = 1.0f; + [SerializeField] + float m_HeightmapPixelError = 5.0F; + [SerializeField] + float m_SplatMapDistance = 1000.0F; + [SerializeField] + int m_HeightmapMaximumLOD = 0; + [SerializeField] + bool m_CastShadows = true; + [SerializeField] + int m_LightmapIndex = -1; + [SerializeField] + int m_LightmapSize = 1024; + [SerializeField] + bool m_DrawTreesAndFoliage = true; + [SerializeField] + Material m_MaterialTemplate; + + [System.NonSerialized] + IntPtr m_TerrainInstance; + + // Since the terrain object can be disabled on being loaded, there is + // no way to reliably initialize the TerrainInstance after loaded. + // So initialization is moved here. + private IntPtr InstanceObject + { + get + { + if (m_TerrainInstance == IntPtr.Zero) + { + m_TerrainInstance = Construct(); + Internal_SetTerrainData(m_TerrainInstance, m_TerrainData); + Internal_SetTreeDistance(m_TerrainInstance, m_TreeDistance); + Internal_SetTreeBillboardDistance(m_TerrainInstance, m_TreeBillboardDistance); + Internal_SetTreeCrossFadeLength(m_TerrainInstance, m_TreeCrossFadeLength); + Internal_SetTreeMaximumFullLODCount(m_TerrainInstance, m_TreeMaximumFullLODCount); + Internal_SetDetailObjectDistance(m_TerrainInstance, m_DetailObjectDistance); + Internal_SetDetailObjectDensity(m_TerrainInstance, m_DetailObjectDensity); + Internal_SetHeightmapPixelError(m_TerrainInstance, m_HeightmapPixelError); + Internal_SetBasemapDistance(m_TerrainInstance, m_SplatMapDistance); + Internal_SetHeightmapMaximumLOD(m_TerrainInstance, m_HeightmapMaximumLOD); + Internal_SetCastShadows(m_TerrainInstance, m_CastShadows); + Internal_SetLightmapIndex(m_TerrainInstance, m_LightmapIndex); + Internal_SetLightmapSize(m_TerrainInstance, m_LightmapSize); + Internal_SetDrawTreesAndFoliage(m_TerrainInstance, m_DrawTreesAndFoliage); + Internal_SetMaterialTemplate(m_TerrainInstance, m_MaterialTemplate); + } + return m_TerrainInstance; + } + set + { + m_TerrainInstance = value; + } + } + + private void OnDestroy() + { + OnDisable(); + + // Using InstanceObject potentially creates the object then immediately destroy it + Cleanup(m_TerrainInstance); + } + + CUSTOM private void Cleanup(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + UNITY_DELETE(ti, kMemTerrain); + } + + CSRAW public TerrainRenderFlags editorRenderFlags + { + get { return (TerrainRenderFlags)GetEditorRenderFlags(InstanceObject); } + set { SetEditorRenderFlags(InstanceObject, (int)value); } + } + CUSTOM private int GetEditorRenderFlags(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetEditorRenderFlags(); + } + CUSTOM private void SetEditorRenderFlags(IntPtr terrainInstance, int flags) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetEditorRenderFlags((TerrainInstance::RenderFlags)flags); + } + + CSRAW public TerrainData terrainData + { + get { m_TerrainData = Internal_GetTerrainData(InstanceObject); return m_TerrainData; } + set { m_TerrainData = value; Internal_SetTerrainData(InstanceObject, value); } + } + CUSTOM private TerrainData Internal_GetTerrainData(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return Scripting::ScriptingWrapperFor(ti->GetTerrainData()); + } + CUSTOM private void Internal_SetTerrainData(IntPtr terrainInstance, TerrainData value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetTerrainData(value); + } + + CSRAW public float treeDistance + { + get { m_TreeDistance = Internal_GetTreeDistance(InstanceObject); return m_TreeDistance; } + set { m_TreeDistance = value; Internal_SetTreeDistance(InstanceObject, value); } + } + CUSTOM private float Internal_GetTreeDistance(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetTreeDistance(); + } + CUSTOM private void Internal_SetTreeDistance(IntPtr terrainInstance, float value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetTreeDistance(value); + } + + CSRAW public float treeBillboardDistance + { + get { m_TreeBillboardDistance = Internal_GetTreeBillboardDistance(InstanceObject); return m_TreeBillboardDistance; } + set { m_TreeBillboardDistance = value; Internal_SetTreeBillboardDistance(InstanceObject, value); } + } + CUSTOM private float Internal_GetTreeBillboardDistance(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetTreeBillboardDistance(); + } + CUSTOM private void Internal_SetTreeBillboardDistance(IntPtr terrainInstance, float value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetTreeBillboardDistance(value); + } + + CSRAW public float treeCrossFadeLength + { + get { m_TreeCrossFadeLength = Internal_GetTreeCrossFadeLength(InstanceObject); return m_TreeCrossFadeLength; } + set { m_TreeCrossFadeLength = value; Internal_SetTreeCrossFadeLength(InstanceObject, value); } + } + CUSTOM private float Internal_GetTreeCrossFadeLength(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetTreeCrossFadeLength(); + } + CUSTOM private void Internal_SetTreeCrossFadeLength(IntPtr terrainInstance, float value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetTreeCrossFadeLength(value); + } + + CSRAW public int treeMaximumFullLODCount + { + get { m_TreeMaximumFullLODCount = Internal_GetTreeMaximumFullLODCount(InstanceObject); return m_TreeMaximumFullLODCount; } + set { m_TreeMaximumFullLODCount = value; Internal_SetTreeMaximumFullLODCount(InstanceObject, value); } + } + CUSTOM private int Internal_GetTreeMaximumFullLODCount(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetTreeMaximumFullLODCount(); + } + CUSTOM private void Internal_SetTreeMaximumFullLODCount(IntPtr terrainInstance, int value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetTreeMaximumFullLODCount(value); + } + + CSRAW public float detailObjectDistance + { + get { m_DetailObjectDistance = Internal_GetDetailObjectDistance(InstanceObject); return m_DetailObjectDistance; } + set { m_DetailObjectDistance = value; Internal_SetDetailObjectDistance(InstanceObject, value); } + } + CUSTOM private float Internal_GetDetailObjectDistance(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetDetailObjectDistance(); + } + CUSTOM private void Internal_SetDetailObjectDistance(IntPtr terrainInstance, float value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetDetailObjectDistance(value); + } + + CSRAW public float detailObjectDensity + { + get { m_DetailObjectDensity = Internal_GetDetailObjectDensity(InstanceObject); return m_DetailObjectDensity; } + set { m_DetailObjectDensity = value; Internal_SetDetailObjectDensity(InstanceObject, value); } + } + CUSTOM private float Internal_GetDetailObjectDensity(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetDetailObjectDensity(); + } + CUSTOM private void Internal_SetDetailObjectDensity(IntPtr terrainInstance, float value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetDetailObjectDensity(value); + } + + CSRAW public float heightmapPixelError + { + get { m_HeightmapPixelError = Internal_GetHeightmapPixelError(InstanceObject); return m_HeightmapPixelError; } + set { m_HeightmapPixelError = value; Internal_SetHeightmapPixelError(InstanceObject, value); } + } + CUSTOM private float Internal_GetHeightmapPixelError(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetHeightmapPixelError(); + } + CUSTOM private void Internal_SetHeightmapPixelError(IntPtr terrainInstance, float value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetHeightmapPixelError(value); + } + + CSRAW public int heightmapMaximumLOD + { + get { m_HeightmapMaximumLOD = Internal_GetHeightmapMaximumLOD(InstanceObject); return m_HeightmapMaximumLOD; } + set { m_HeightmapMaximumLOD = value; Internal_SetHeightmapMaximumLOD(InstanceObject, value); } + } + CUSTOM private int Internal_GetHeightmapMaximumLOD(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetHeightmapMaximumLOD(); + } + CUSTOM private void Internal_SetHeightmapMaximumLOD(IntPtr terrainInstance, int value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetHeightmapMaximumLOD(value); + } + + CSRAW public float basemapDistance + { + get { m_SplatMapDistance = Internal_GetBasemapDistance(InstanceObject); return m_SplatMapDistance; } + set { m_SplatMapDistance = value; Internal_SetBasemapDistance(InstanceObject, value); } + } + CUSTOM private float Internal_GetBasemapDistance(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetBasemapDistance(); + } + CUSTOM private void Internal_SetBasemapDistance(IntPtr terrainInstance, float value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetBasemapDistance(value); + } + + OBSOLETE error use basemapDistance + CSRAW public float splatmapDistance + { + get { return basemapDistance; } + set { basemapDistance = value; } + } + + CSRAW public int lightmapIndex + { + get { m_LightmapIndex = Internal_GetLightmapIndex(InstanceObject); return m_LightmapIndex; } + set { m_LightmapIndex = value; Internal_SetLightmapIndex(InstanceObject, value); } + } + CSRAW private void SetLightmapIndex(int value) + { + lightmapIndex = value; + } + CSRAW private void ShiftLightmapIndex(int offset) + { + lightmapIndex += offset; + } + CUSTOM private int Internal_GetLightmapIndex(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetLightmapIndex(); + } + CUSTOM private void Internal_SetLightmapIndex(IntPtr terrainInstance, int value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetLightmapIndex(value); + } + + CSRAW internal int lightmapSize + { + get { m_LightmapSize = Internal_GetLightmapSize(InstanceObject); return m_LightmapSize; } + set { m_LightmapSize = value; Internal_SetLightmapSize(InstanceObject, value); } + } + CUSTOM private int Internal_GetLightmapSize(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetLightmapSize(); + } + CUSTOM private void Internal_SetLightmapSize(IntPtr terrainInstance, int value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetLightmapSize(value); + } + + CSRAW public bool castShadows + { + get { m_CastShadows = Internal_GetCastShadows(InstanceObject); return m_CastShadows; } + set { m_CastShadows = value; Internal_SetCastShadows(InstanceObject, value); } + } + CUSTOM private bool Internal_GetCastShadows(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetCastShadows(); + } + CUSTOM private void Internal_SetCastShadows(IntPtr terrainInstance, bool value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetCastShadows(value); + } + + CSRAW public Material materialTemplate + { + get { m_MaterialTemplate = Internal_GetMaterialTemplate(InstanceObject); return m_MaterialTemplate; } + set { m_MaterialTemplate = value; Internal_SetMaterialTemplate(InstanceObject, value); } + } + CUSTOM private Material Internal_GetMaterialTemplate(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return Scripting::ScriptingWrapperFor(const_cast<Material*>(ti->GetMaterialTemplate())); + } + CUSTOM private void Internal_SetMaterialTemplate(IntPtr terrainInstance, Material value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetMaterialTemplate(value); + } + + CSRAW internal bool drawTreesAndFoliage + { + get { m_DrawTreesAndFoliage = Internal_GetDrawTreesAndFoliage(InstanceObject); return m_DrawTreesAndFoliage; } + set { m_DrawTreesAndFoliage = value; Internal_SetDrawTreesAndFoliage(InstanceObject, value); } + } + CUSTOM private bool Internal_GetDrawTreesAndFoliage(IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetDrawTreesAndFoliage(); + } + CUSTOM private void Internal_SetDrawTreesAndFoliage(IntPtr terrainInstance, bool value) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->SetDrawTreesAndFoliage(value); + } + + CSRAW public float SampleHeight(Vector3 worldPosition) + { + return Internal_SampleHeight(InstanceObject, worldPosition); + } + CUSTOM private float Internal_SampleHeight (IntPtr terrainInstance, Vector3 worldPosition) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->SampleHeight(worldPosition); + } + + CSRAW internal void ApplyDelayedHeightmapModification() + { + Internal_ApplyDelayedHeightmapModification(InstanceObject); + } + CUSTOM internal void Internal_ApplyDelayedHeightmapModification (IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->ApplyDelayedHeightmapModification(); + } + + CSRAW public void AddTreeInstance(TreeInstance instance) + { + Internal_AddTreeInstance(InstanceObject, instance); + } + CUSTOM private void Internal_AddTreeInstance (IntPtr terrainInstance, TreeInstance instance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->AddTreeInstance(instance); + } + + CSRAW public void SetNeighbors (Terrain left, Terrain top, Terrain right, Terrain bottom) + { + Internal_SetNeighbors(InstanceObject, + left != null ? left.InstanceObject : IntPtr.Zero, + top != null ? top.InstanceObject : IntPtr.Zero, + right != null ? right.InstanceObject : IntPtr.Zero, + bottom != null ? bottom.InstanceObject : IntPtr.Zero); + } + CUSTOM private void Internal_SetNeighbors (IntPtr terrainInstance, IntPtr left, IntPtr top, IntPtr right, IntPtr bottom) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + TerrainInstance* leftInstance = static_cast<TerrainInstance*>(left); + TerrainInstance* topInstance = static_cast<TerrainInstance*>(top); + TerrainInstance* rightInstance = static_cast<TerrainInstance*>(right); + TerrainInstance* bottomInstance = static_cast<TerrainInstance*>(bottom); + ti->SetNeighbors(leftInstance, topInstance, rightInstance, bottomInstance); + } + + CSRAW public Vector3 GetPosition () + { + return Internal_GetPosition(InstanceObject); + } + CUSTOM private Vector3 Internal_GetPosition (IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + return ti->GetPosition(); + } + + CSRAW public void Flush () + { + Internal_Flush(InstanceObject); + } + CUSTOM private void Internal_Flush (IntPtr terrainInstance) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->Flush(); + } + + CSRAW internal void RemoveTrees (Vector2 position, float radius, int prototypeIndex) + { + Internal_RemoveTrees(InstanceObject, position, radius, prototypeIndex); + } + CUSTOM private void Internal_RemoveTrees (IntPtr terrainInstance, Vector2 position, float radius, int prototypeIndex) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->RemoveTrees(position, radius, prototypeIndex); + } + + CSRAW private void OnTerrainChanged (TerrainChangedFlags flags) + { + Internal_OnTerrainChanged(InstanceObject, flags); + } + + CUSTOM private void Internal_OnTerrainChanged (IntPtr terrainInstance, TerrainChangedFlags flags) + { + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + Assert(ti != NULL); + ti->OnTerrainChanged(flags); + } + + CUSTOM private IntPtr Construct () + { + SET_ALLOC_OWNER(self->GetGameObjectPtr()); + return UNITY_NEW(TerrainInstance, kMemTerrain)(self->GetGameObjectPtr()); + } + + CSRAW + internal void OnEnable () + { + Internal_OnEnable(InstanceObject); + } + + CUSTOM private void Internal_OnEnable (IntPtr terrainInstance) + { + Assert(terrainInstance != NULL); + + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + ti->OnEnable(); + GetITerrainManager()->AddTerrainAndSetActive(ti); + } + + CSRAW + internal void OnDisable() + { + Internal_OnDisable(InstanceObject); + } + + CUSTOM private void Internal_OnDisable (IntPtr terrainInstance) + { + Assert(terrainInstance != NULL); + + TerrainInstance* ti = static_cast<TerrainInstance*>(terrainInstance); + GetITerrainManager()->RemoveTerrain(ti); + ti->OnDisable(); + ti->Flush(); + } + + C++RAW + ScriptingObjectPtr TerrainInstanceToMonoBehaviour(TerrainInstance* ti) + { + if (!ti) + return SCRIPTING_NULL; + + GameObject* go = ti->GetGameObject(); + Assert(go != NULL); + return ScriptingGetComponentOfType(*go, MONO_COMMON.terrain); + } + + CUSTOM_PROP static Terrain activeTerrain + { + TerrainInstance* ti = GetITerrainManager()->GetActiveTerrain(); + return TerrainInstanceToMonoBehaviour(ti); + } + + CUSTOM_PROP static Terrain[] activeTerrains + { + TerrainList tl = GetITerrainManager()->GetActiveTerrains(); + + ScriptingClassPtr terrainClass = MONO_COMMON.terrain; + ScriptingArrayPtr array = CreateScriptingArray<ScriptingObjectPtr>(terrainClass, tl.size()); + + int index = 0; + for (TerrainList::iterator i = tl.begin(); i != tl.end(); ++i, index++) + Scripting::SetScriptingArrayElement(array, index, TerrainInstanceToMonoBehaviour (*i)); + return array; + } + + CSRAW + public static GameObject CreateTerrainGameObject (TerrainData assignTerrain) + { + // Also create the renderer game object + #if ENABLE_PHYSICS + GameObject go = new GameObject("Terrain", typeof(Terrain), typeof(TerrainCollider)); + #else + GameObject go = new GameObject("Terrain", typeof(Terrain)); + #endif + go.isStatic = true; + Terrain terrain = go.GetComponent(typeof(Terrain)) as Terrain; + #if ENABLE_PHYSICS + TerrainCollider collider = go.GetComponent(typeof(TerrainCollider)) as TerrainCollider; + collider.terrainData = assignTerrain; + #endif + terrain.terrainData = assignTerrain; + + // The terrain already got an OnEnable, but the terrain data had not been set up correctly. + terrain.OnEnable (); + + return go; + } + + // This method is used internally by the engine to reconnect Terrain objects to TerrainData. + private static void ReconnectTerrainData() + { + List<Terrain> activeTerrains = new List<Terrain>(Terrain.activeTerrains); + foreach (Terrain terrain in activeTerrains) + { + // we could delete asset directly - remove it here (we are calling this function on StopAssetEditing + if (terrain.terrainData == null ) + { + terrain.OnDisable(); + continue; + } + + // Check if connection to m_TerrainData has been lost + if (!terrain.terrainData.HasUser(terrain.gameObject)) + { + // destroy and recreate data + terrain.OnDisable(); + terrain.OnEnable(); + } + } + } +END + +CONDITIONAL ENABLE_TERRAIN +CLASS Tree : Component + + AUTO_PTR_PROP ScriptableObject data GetTreeData SetTreeData + +END + +CSRAW +} +#endif // ENABLE_TERRAIN diff --git a/Runtime/Terrain/ScriptBindings/WindZoneBindings.txt b/Runtime/Terrain/ScriptBindings/WindZoneBindings.txt new file mode 100644 index 0000000..b9e98ea --- /dev/null +++ b/Runtime/Terrain/ScriptBindings/WindZoneBindings.txt @@ -0,0 +1,183 @@ +C++RAW +#include "UnityPrefix.h" +#include "Runtime/Terrain/Heightmap.h" +#include "Runtime/Filters/Mesh/LodMesh.h" +#include "Runtime/Terrain/DetailDatabase.h" +#include "Runtime/Terrain/SplatDatabase.h" +#include "Runtime/Terrain/TerrainData.h" +#include "Runtime/Terrain/TerrainInstance.h" +#include "Runtime/Mono/MonoBehaviour.h" +#include "Runtime/BaseClasses/GameObject.h" +#include "Runtime/Terrain/TerrainRenderer.h" +#include "Runtime/Camera/Light.h" +#include "Runtime/Terrain/DetailRenderer.h" +#include "Runtime/Terrain/ImposterRenderTexture.h" +#include "Runtime/Terrain/TreeRenderer.h" +#include "Runtime/Terrain/Wind.h" +#include "Runtime/Terrain/Tree.h" +#include "Runtime/Scripting/ScriptingUtility.h" +#include "Runtime/Scripting/ScriptingExportUtility.h" + +using namespace Unity; +using namespace std; + +CSRAW + +#if ENABLE_TERRAIN + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Collections; +using System.Collections.Generic; + +namespace UnityEngine +{ + +/// Modes a Wind Zone can have, either Spherical or Directional +/// You can have more than one Spherical Wind Zone in a scene, but it does not make much +/// sense to have more than one Directional Wind Zone in your scene as it affects +/// the whole scene. This Wind Zone Mode is used by the WindZone.mode member. +CONDITIONAL ENABLE_TERRAIN +ENUM internal WindZoneMode + /// Wind zone only has an effect inside the radius, and has a falloff from the center towards the edge. + CONVERTEXAMPLE + BEGIN EX + // Creates a Directional Wind Zone that blows wind up. + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Directional; + // transform.rotation = Quaternion.LookRotation(Vector3.up); + } + END EX + /// + Directional = 0, + /// Wind zone affects the entire scene in one direction. + CONVERTEXAMPLE + BEGIN EX + // Creates a Spherical Wind Zone. + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Spherical; + } + END EX + /// + Spherical = 1 +END + +/// Wind Zones add realism to the trees you create by making them wave their branches and leaves as if blown by the wind. +/// +/// __Note:__ This only works with trees created by the tree creator. +CSRAW +CONDITIONAL ENABLE_TERRAIN +CLASS internal WindZone : Component + + /// Defines the type of wind zone to be used (Spherical or Directional). + CONVERTEXAMPLE + BEGIN EX + // Creates a Directional Wind Zone. + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Directional; + } + END EX + /// + AUTO_PROP WindZoneMode mode GetMode SetMode + + /// Radius of the Spherical Wind Zone (only active if the WindZoneMode is set to Spherical). + CONVERTEXAMPLE + BEGIN EX + // Creates a Spherical Wind Zone and sets its radius to 10. + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Spherical; + // wind.radius = 10; + } + END EX + /// + AUTO_PROP float radius GetRadius SetRadius + + /// The primary wind force. + /// It produces a softly changing wind Pressure. + CONVERTEXAMPLE + BEGIN EX + // Creates a wind zone with the effect of a helicopter passing by + // Just place this into an empty game object and move it over a tree + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Spherical; + // wind.radius = 10.0; + // wind.windMain = 3.0; + // wind.windTurbulence = 0.5; + // wind.windPulseMagnitude = 2.0; + // wind.windPulseFrequency = 0.01; + } + END EX + /// + AUTO_PROP float windMain GetWindMain SetWindMain + + /// The turbulence wind force. + /// Produces a rapidly changing wind pressure. + CONVERTEXAMPLE + BEGIN EX + // Creates a wind zone to produce a softly changing general wind + // Just place this into an empty game object + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Directional; + // wind.windMain = 0.70; + // wind.windTurbulence = 0.1; + // wind.windPulseMagnitude = 2.0; + // wind.windPulseFrequency = 0.25; + } + END EX + /// + AUTO_PROP float windTurbulence GetWindTurbulence SetWindTurbulence + + /// Defines ow much the wind changes over time. + CONVERTEXAMPLE + BEGIN EX + // Creates a wind zone with the effect of a helicopter passing by + // Just place this into an empty game object and move it over a tree + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Spherical; + // wind.radius = 10.0; + // wind.windMain = 3.0; + // wind.windTurbulence = 0.5; + // wind.windPulseMagnitude = 2.0; + // wind.windPulseFrequency = 0.01; + } + END EX + /// + AUTO_PROP float windPulseMagnitude GetWindPulseMagnitude SetWindPulseMagnitude + + /// Defines the frequency of the wind changes. + CONVERTEXAMPLE + BEGIN EX + // Creates a wind zone to produce a softly changing general wind + // Just place this into an empty game object + + function Start() { + // var wind : WindZone = gameObject.AddComponent(WindZone); + // wind.mode = WindZoneMode.Directional; + // wind.windMain = 0.70; + // wind.windTurbulence = 0.1; + // wind.windPulseMagnitude = 2.0; + // wind.windPulseFrequency = 0.25; + } + END EX + /// + AUTO_PROP float windPulseFrequency GetWindPulseFrequency SetWindPulseFrequency +END + +CSRAW +} +#endif // ENABLE_TERRAIN |