Exemple #1
0
    private void OnGUI()
    {
        InitStyles();
        ComputeMeshPaintWaterPipe waterSimulation = FindObjectOfType <ComputeMeshPaintWaterPipe>();

        if (waterSimulation != null)
        {
            GUILayout.Label("Pipe water simulation script found! (" + waterSimulation.name + ")", titleStyle);

            // Draw Flux
            DrawFlux(waterSimulation);

            // Draw water and terrain texture
            DrawWaterTerrainVelocity(waterSimulation);

            if (!EditorApplication.isPlaying)
            {
                GUILayout.Label("The render textures are only shown in Play-Mode!");
            }
        }
        else
        {
            GUILayout.Label("No Pipe model script found! You made everything wrong! :D", titleStyle);
        }
    }
Exemple #2
0
    private void DrawFlux(ComputeMeshPaintWaterPipe waterSimulation)
    {
        float size = EditorGUIUtility.currentViewWidth / 4.3f;

        EditorGUILayout.BeginHorizontal();
        ShowImage("Flux Left:", waterSimulation.FluxLeft, size, size);
        ShowImage("Flux Right:", waterSimulation.FluxRight, size, size);
        ShowImage("Flux Top:", waterSimulation.FluxTop, size, size);
        ShowImage("Flux Bottom:", waterSimulation.FluxBottom, size, size);
        EditorGUILayout.EndHorizontal();
    }
Exemple #3
0
    private void DrawWaterTerrainVelocity(ComputeMeshPaintWaterPipe waterSimulation)
    {
        float size = EditorGUIUtility.currentViewWidth / 4.3f;

        EditorGUILayout.BeginHorizontal();
        ShowImage("Water:", waterSimulation.WaterHeight, size, size);
        ShowImage("Terrain:", waterSimulation.TerrainHeight, size, size);

        ShowImage("Velocity X:", waterSimulation.VelocityX, size, size);
        ShowImage("Velocity Y:", waterSimulation.VelocityY, size, size);
        EditorGUILayout.EndHorizontal();
    }
Exemple #4
0
    private void Initialize()
    {
        waterPipeSimulation = FindObjectOfType <ComputeMeshPaintWaterPipe>();
        if (waterPipeSimulation == null)
        {
            Debug.LogError("Water sources only work in combination with ComputeMeshPaintWaterPipe script! Check if this script is in the scene.");
        }

        collisionLayer = LayerMask.NameToLayer(collisionLayerName);

        // Register at the water simulation
        waterPipeSimulation.AddWaterSource(this);
    }
Exemple #5
0
    protected override void Start()
    {
        pipeSimulation    = FindObjectOfType <ComputeMeshPaintWaterPipe>();
        terrainSimulation = FindObjectOfType <ComputeHeightmapPainter>();

        if (pipeSimulation == null)
        {
            Debug.LogError("No water simulation in scene!");
        }
        if (terrainSimulation == null)
        {
            Debug.LogError("No terrain simulation in scene!");
        }

        base.Start();
    }