Esempio n. 1
0
        override public void OnSceneGUI(Terrain currentTerrain, IOnSceneGUI editContext)
        {
            Terrain terrain   = currentTerrain;
            float   brushSize = editContext.brushSize;

            BrushTransform brushXform      = TerrainPaintUtility.CalculateBrushTransform(terrain, editContext.raycastHit.textureCoord, brushSize, 0.0f);
            PaintContext   ctx             = TerrainPaintUtility.BeginPaintHeightmap(terrain, brushXform.GetBrushXYBounds(), 1);
            Material       brushPreviewMat = BrushUtilities.GetDefaultBrushPreviewMaterial();

            brushPreviewMat.color = bridgeBrushColor;
            BrushUtilities.DrawBrushPreview(ctx, BrushUtilities.BrushPreview.SourceRenderTexture, editContext.brushTexture, brushXform, brushPreviewMat, 0);
            TerrainPaintUtility.ReleaseContextResources(ctx);
        }
Esempio n. 2
0
        public void OnSceneGUI(Terrain currentTerrain, IOnSceneGUI editContext, BrushSettings brushSettings)
        {
            if (m_StartTerrain != null && m_StartPoint != null)
            {
                // anchor is placed on the start terrain, independent of the active one; needed for multi-tiles
                Terrain terrain = m_StartTerrain;

                BrushTransform anchorBrushXform = TerrainPaintUtility.CalculateBrushTransform(terrain, m_StartPoint, brushSettings.brushSize, brushSettings.brushRotationDegrees);
                PaintContext   anchorCtx        = TerrainPaintUtility.BeginPaintHeightmap(terrain, anchorBrushXform.GetBrushXYBounds(), 1);
                Material       brushPreviewMat  = BrushUtilities.GetDefaultBrushPreviewMaterial();
                brushPreviewMat.color = anchorBrushColor;
                BrushUtilities.DrawBrushPreview(anchorCtx, BrushUtilities.BrushPreview.SourceRenderTexture, editContext.brushTexture, anchorBrushXform, brushPreviewMat, 0);
                TerrainPaintUtility.ReleaseContextResources(anchorCtx);
            }
        }
Esempio n. 3
0
        override public void OnSceneGUI(Terrain currentTerrain, IOnSceneGUI editContext, BrushSettings brushSettings)
        {
            if (editContext.hitValidTerrain)
            {
                Terrain terrain = currentTerrain;

                // the smooth brush size is relative to the main brush size
                float brushSize = brushSettings.brushSize * paintBrushSize / 100f;

                BrushTransform brushXform      = TerrainPaintUtility.CalculateBrushTransform(terrain, editContext.raycastHit.textureCoord, brushSize, brushSettings.brushRotationDegrees);
                PaintContext   ctx             = TerrainPaintUtility.BeginPaintHeightmap(terrain, brushXform.GetBrushXYBounds(), 1);
                Material       brushPreviewMat = BrushUtilities.GetDefaultBrushPreviewMaterial();
                brushPreviewMat.color = paintBrushColor;
                BrushUtilities.DrawBrushPreview(ctx, BrushUtilities.BrushPreview.SourceRenderTexture, editContext.brushTexture, brushXform, brushPreviewMat, 0);
                TerrainPaintUtility.ReleaseContextResources(ctx);
            }
        }