public override void OnNodeGUI()
        {
            int i = 0;

            EditorGUIUtility.labelWidth = 80;
            materializer = (MaterializerType)EditorGUILayout.EnumPopup("Materializer", materializer);

            EditorGUILayout.LabelField("Output maps in chunk");
            EditorGUIUtility.labelWidth = 66;
            EditorGUILayout.BeginHorizontal();
            foreach (var outputMap in outputMaps)
            {
                i++;
                outputMap.active = EditorGUILayout.Toggle(outputMap.name, outputMap.active);
                if (i % 2 == 0)
                {
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.BeginHorizontal();
                }
            }
            EditorGUILayout.EndHorizontal();

            if (terrainOutput.albedoMaps != null)
            {
                PWGUI.Texture2DArrayPreview(terrainOutput.albedoMaps, needUpdate);
            }
        }
        public void UpdateTerrainMaterializer(MaterializerType materializerType)
        {
            if (terrainBase == null)
            {
                return;
            }

            terrainBase.DestroyAllChunks();
            var go = terrainBase.gameObject;

            GameObject.DestroyImmediate(terrainBase);
            terrainBase = go.AddComponent(materializerTypes[materializerType]) as TerrainGenericBase;
        }
Esempio n. 3
0
        public void DrawTerrainSettings(Rect settingsRect, MaterializerType type)
        {
            if (terrain == null)
            {
                var go = GameObject.FindObjectOfType <PWTerrainGenericBase>();
                terrain = (go);
            }

            if (terrain == null)
            {
                return;
            }

            terrainReference = terrain;

            Type expectedType = materializerTypes[type];

            if (terrainReference.GetType() != expectedType)
            {
                GameObject go = terrainReference.gameObject;
                GameObject.DestroyImmediate(terrainReference);
                terrainReference = go.AddComponent(expectedType) as PWTerrainGenericBase;
            }

            if (terrainReference.terrainStorage == null)
            {
                terrainReference.terrainStorage = Resources.Load <PWTerrainStorage>(PWConstants.memoryTerrainStorageAsset);
            }

            terrain.renderDistance = EditorGUILayout.IntSlider("chunk Render distance", terrain.renderDistance, 0, 24);

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Generate terrain"))
                {
                    ReloadChunks();
                }
            }
            EditorGUILayout.EndHorizontal();
        }