public virtual void OnInspector(TerrainToolEditor editor) { Dig = EditorGUILayout.ToggleLeft("Dig", Dig); Width = EditorGUILayout.Slider("Width:", Width, 1f, 100f); Height = EditorGUILayout.Slider("Height:", Height, 1f, 100f); VoxelTypeIndex = EditorUtils.VoxelTypeField("Voxel type:", VoxelTypeIndex, editor.Terrain.VoxelTypeSet); }
public void OnInspector(TerrainToolEditor editor) { DesiredHeight = EditorGUILayout.FloatField("Height to flatten to:", DesiredHeight); Radius = EditorGUILayout.Slider("Radius:", Radius, 2f, 100f); UpsideDown = EditorGUILayout.Toggle("Upside-down:", UpsideDown); VoxelTypeIndex = EditorUtils.VoxelTypeField("Voxel type:", VoxelTypeIndex, editor.Terrain.VoxelTypeSet); }
public virtual void OnInspector(TerrainToolEditor editor) { FollowGrid = EditorGUILayout.ToggleLeft(new GUIContent("Follow Grid", "Check this to force the brush to be positionned on voxels."), FollowGrid); Dig = EditorGUILayout.ToggleLeft("Dig", Dig); Radius = EditorGUILayout.Slider("Radius:", Radius, 2f, 100f); VoxelTypeIndex = EditorUtils.VoxelTypeField("Voxel type:", VoxelTypeIndex, editor.Terrain.VoxelTypeSet); }
public void OnInspector(TerrainToolEditor editor) { DesiredHeight = EditorGUILayout.FloatField("Height to flatten to:", DesiredHeight); Size = editor.SizeField("Size:", Size, true); UpsideDown = EditorGUILayout.Toggle("Upside-down:", UpsideDown); VoxelTypeIndex = EditorUtils.VoxelTypeField("Voxel type:", VoxelTypeIndex, editor.Terrain.VoxelTypeSet); }
public virtual void OnInspector(TerrainToolEditor editor) { Radius = EditorGUILayout.Slider("Radius:", Radius, 2f, 100f); EditorGUILayout.HelpBox("Sharpen operation can quickly drop performance! Try to keep 'Sampling Accuracy' as " + "low as possible.", MessageType.Warning, true); SamplingAccuracy = EditorGUILayout.Slider("Sampling Accuracy:", SamplingAccuracy, 1f, 8f); }
public void OnScene(TerrainToolEditor editor, SceneView sceneview) { if (Reticle == null) { Reticle = editor.LoadReticle <ReticleLinesForEditor>("ReticleLinesForEditor"); } if (Event.current.control || Event.current.type == EventType.MouseDown && Event.current.button == 1) { startPosition = null; } var hit = editor.GetIntersectionWithTerrain(true); if (hit.HasValue) { var p = hit.Value.point - new Vector3(0, Height * 0.5f, Width * 0.5f); Vector3 vL, vH, vW; if (startPosition.HasValue) { UMath.ComputeEdgeVectors(startPosition.Value, p, Width, Height, out vL, out vH, out vW); Reticle.SetCornerAndEdges(startPosition.Value, vL, vH, vW); } else { UMath.ComputeEdgeVectors(p, p + Vector3.forward, Width, Height, out vL, out vH, out vW); Reticle.SetCornerAndEdges(p, vL, vH, vW); } if (editor.Clicking) { Event.current.Use(); if (!startPosition.HasValue) { startPosition = p; } else { editor.PerformOperation(CreateOperationFromEditor(startPosition.Value, p, editor), sceneview); startPosition = null; } } } }
public void OnScene(TerrainToolEditor editor, SceneView sceneview) { if (Reticle == null) { Reticle = editor.LoadReticle <SphericalReticleForEditor>("SphericalReticleForEditor"); } var hit = editor.GetIntersectionWithTerrain(true); if (hit.HasValue) { Reticle.SetPositionAndSize(hit.Value.point, Radius); } if (editor.Clicking) { Event.current.Use(); editor.PerformOperation(CreateOperationFromEditor(Reticle.transform.position, editor), sceneview); } }
public void OnScene(TerrainToolEditor editor, SceneView sceneview) { if (Reticle == null) { Reticle = editor.LoadReticle <CylinderReticleForEditor>("CylinderReticleForEditor"); } if (Event.current.control || Event.current.type == EventType.MouseDown && Event.current.button == 1) { startPosition = null; } var hit = editor.GetIntersectionWithTerrain(true); if (hit.HasValue) { var p = hit.Value.point; if (startPosition.HasValue) { Reticle.SetPositionsAndRadius(startPosition.Value, hit.Value.point, Radius); } else { Reticle.SetPositionsAndRadius(hit.Value.point, hit.Value.point + Vector3.right, Radius); } if (editor.Clicking) { Event.current.Use(); if (!startPosition.HasValue) { startPosition = p; } else { editor.PerformOperation(CreateOperationFromEditor(startPosition.Value, p, editor), sceneview); startPosition = null; } } } }
protected virtual IOperation CreateOperationFromEditor(Vector3 start, Vector3 end, TerrainToolEditor editor) { var voxelType = EditorUtils.GetVoxelTypeFromIndex(VoxelTypeIndex, editor.Terrain.VoxelTypeSet); return(Cylinder.CreateFromUnityWorld(editor.Terrain, Dig, start, end, Radius, voxelType)); }
public virtual void OnInspector(TerrainToolEditor editor) { Dig = EditorGUILayout.ToggleLeft("Dig", Dig); Radius = EditorGUILayout.Slider("Radius:", Radius, 1f, 100f); VoxelTypeIndex = EditorUtils.VoxelTypeField("Voxel type:", VoxelTypeIndex, editor.Terrain.VoxelTypeSet); }
protected IOperation CreateOperationFromEditor(Vector3 worldPosition, TerrainToolEditor editor) { var voxelType = EditorUtils.GetVoxelTypeFromIndex(VoxelTypeIndex, editor.Terrain.VoxelTypeSet); return(FlattenSphere.CreateFromUnityWorld(editor.Terrain, UpsideDown, worldPosition, Radius, DesiredHeight, voxelType)); }
protected virtual IOperation CreateOperationFromEditor(Vector3 worldPosition, TerrainToolEditor editor) { return(Sharpen.CreateFromUnityWorld(editor.Terrain, worldPosition, Radius, Math.Max(1.0, Radius / SamplingAccuracy))); }
protected virtual IOperation CreateOperationFromEditor(Vector3 worldPosition, TerrainToolEditor editor) { var voxelType = EditorUtils.GetVoxelTypeFromIndex(VoxelTypeIndex, editor.Terrain.VoxelTypeSet); return(Paint.CreateFromUnityWorld(editor.Terrain, worldPosition, Radius, voxelType)); }
protected virtual IOperation CreateOperationFromEditor(Vector3 start, Vector3 end, TerrainToolEditor editor) { var voxelType = EditorUtils.GetVoxelTypeFromIndex(VoxelTypeIndex, editor.Terrain.VoxelTypeSet); Vector3 vL, vH, vW; UMath.ComputeEdgeVectors(start, end, Width, Height, out vL, out vH, out vW); return(Parallelepiped.CreateFromUnityWorld(editor.Terrain, Dig, start, vL, vH, vW, voxelType)); }
protected virtual IOperation CreateOperationFromEditor(Vector3 worldPosition, TerrainToolEditor editor) { var voxelType = EditorUtils.GetVoxelTypeFromIndex(VoxelTypeIndex, editor.Terrain.VoxelTypeSet); return(AxisAlignedCube.CreateFromUnityWorld(editor.Terrain, Dig, worldPosition, Size, voxelType)); }
public virtual void OnInspector(TerrainToolEditor editor) { Dig = EditorGUILayout.ToggleLeft("Dig", Dig); Size = editor.SizeField("Size:", Size, true); VoxelTypeIndex = EditorUtils.VoxelTypeField("Voxel type:", VoxelTypeIndex, editor.Terrain.VoxelTypeSet); }