2019-12-27 09:26:59 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
2020-04-18 18:42:59 -04:00
|
|
|
#include "Materials/Material.h"
|
|
|
|
|
#include "Materials/MaterialInstanceDynamic.h"
|
2019-10-01 20:41:42 -04:00
|
|
|
|
2020-12-14 19:16:22 -04:00
|
|
|
class UCurveFloat;
|
2020-03-13 13:40:51 -04:00
|
|
|
class UTexture;
|
2019-10-01 20:41:42 -04:00
|
|
|
class UInteractiveToolManager;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Utility functions for Tool implementations to use when doing configuration/setup
|
|
|
|
|
*/
|
|
|
|
|
namespace ToolSetupUtil
|
|
|
|
|
{
|
2020-06-23 18:40:00 -04:00
|
|
|
/**
|
|
|
|
|
* Get the default material for surfaces
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetDefaultMaterial();
|
|
|
|
|
|
|
|
|
|
|
2019-10-01 20:41:42 -04:00
|
|
|
/**
|
|
|
|
|
* Get the default material to use for objects in an InteractiveTool. Optionally use SourceMaterial if it is valid.
|
|
|
|
|
* @param SourceMaterial optional material to use if available
|
|
|
|
|
* @return default material to use for objects in a tool.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetDefaultMaterial(UInteractiveToolManager* ToolManager, UMaterialInterface* SourceMaterial = nullptr);
|
|
|
|
|
|
2020-04-18 18:42:59 -04:00
|
|
|
/**
|
|
|
|
|
* @return configurable vertex color material
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetVertexColorMaterial(UInteractiveToolManager* ToolManager);
|
|
|
|
|
|
|
|
|
|
|
2019-10-01 20:41:42 -04:00
|
|
|
/**
|
|
|
|
|
* @return default material to use for "Working"/In-Progress animations
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetDefaultWorkingMaterial(UInteractiveToolManager* ToolManager);
|
|
|
|
|
|
2020-08-11 01:36:57 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a black-and-white NxN checkerboard material
|
|
|
|
|
* @param CheckerDensity Number of checks along row/column
|
|
|
|
|
* @return default material to use for uv checkerboard visualizations
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetUVCheckerboardMaterial(double CheckerDensity = 20.0);
|
|
|
|
|
|
|
|
|
|
|
2019-10-01 20:41:42 -04:00
|
|
|
/**
|
2020-09-14 15:58:34 -04:00
|
|
|
* @return default material to use for brush volume indicators (for instance, a spherical sculpt brush).
|
2019-10-01 20:41:42 -04:00
|
|
|
*/
|
2020-03-20 12:44:53 -04:00
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetDefaultBrushVolumeMaterial(UInteractiveToolManager* ToolManager);
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Sculpt Material 1
|
|
|
|
|
*/
|
2020-03-13 13:40:51 -04:00
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetDefaultSculptMaterial(UInteractiveToolManager* ToolManager);
|
|
|
|
|
|
2021-04-01 17:33:33 -04:00
|
|
|
/**
|
|
|
|
|
* @param bTwoSided A two sided material has some rendering artifacts in a transparent material because of indeterminate
|
|
|
|
|
* ordering of triangles within the mesh. Still, it is sometimes useful despite these flaws.
|
|
|
|
|
* @return Transparent two-sided material suitable for sculpting (has some shine and a Fresnel effect)
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetTransparentSculptMaterial(UInteractiveToolManager* ToolManager,
|
|
|
|
|
const FLinearColor& Color, double Opacity, bool bTwoSided);
|
2020-03-13 13:40:51 -04:00
|
|
|
|
|
|
|
|
/** Types of image-based material that we can create */
|
|
|
|
|
enum class ImageMaterialType
|
|
|
|
|
{
|
|
|
|
|
DefaultBasic,
|
|
|
|
|
DefaultSoft,
|
|
|
|
|
TangentNormalFromView
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Image-based sculpt material instance, based ImageMaterialType
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetImageBasedSculptMaterial(UInteractiveToolManager* ToolManager, ImageMaterialType Type);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Image-based sculpt material that supports changing the image
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetCustomImageBasedSculptMaterial(UInteractiveToolManager* ToolManager, UTexture* SetImage);
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Selection Material 1
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetSelectionMaterial(UInteractiveToolManager* ToolManager);
|
|
|
|
|
|
2019-12-19 18:07:47 -05:00
|
|
|
/**
|
2020-06-23 18:40:00 -04:00
|
|
|
* @return Selection Material 1 with custom color and optional depth offset (depth offset moves vertices towards the camera)
|
2019-12-19 18:07:47 -05:00
|
|
|
*/
|
2020-08-11 01:36:57 -04:00
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetSelectionMaterial(const FLinearColor& UseColor, UInteractiveToolManager* ToolManager, float PercentDepthOffset = 0.0f);
|
2019-12-19 18:07:47 -05:00
|
|
|
|
2020-05-04 12:45:17 -04:00
|
|
|
/**
|
2021-04-30 09:22:12 -04:00
|
|
|
* @return Simple material with configurable color and opacity. Note that the material
|
|
|
|
|
* will have translucent blend mode, which can interact poorly with overlapping translucent
|
|
|
|
|
* objects, so use the other overload if you do not need opacity control.
|
2020-05-04 12:45:17 -04:00
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetSimpleCustomMaterial(UInteractiveToolManager* ToolManager, const FLinearColor& Color, float Opacity);
|
2019-10-07 12:26:07 -04:00
|
|
|
|
2021-01-28 13:06:33 -04:00
|
|
|
/**
|
2021-04-30 09:22:12 -04:00
|
|
|
* @return Simple material with configurable color. The material will have opaque blend mode.
|
2021-01-28 13:06:33 -04:00
|
|
|
*/
|
2021-04-30 09:22:12 -04:00
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetSimpleCustomMaterial(UInteractiveToolManager* ToolManager, const FLinearColor& Color);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Simple material with configurable depth offset, color, and opacity. Note that the material
|
|
|
|
|
* will have translucent blend mode, which can interact poorly with overlapping translucent
|
|
|
|
|
* objects, so use the other overload if you do not need opacity control.
|
|
|
|
|
*/
|
2021-04-21 14:36:05 -04:00
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetCustomDepthOffsetMaterial(UInteractiveToolManager* ToolManager, const FLinearColor& Color, float PercentDepthOffset, float Opacity);
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-30 09:22:12 -04:00
|
|
|
* @return Simple material with configurable depth offset and color. The material will have opaque blend mode.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetCustomDepthOffsetMaterial(UInteractiveToolManager* ToolManager, const FLinearColor& Color, float PercentDepthOffset);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Simple two-sided material with configurable depth offset, color, and opacity. Note that
|
|
|
|
|
* the material will have translucent blend mode, which can interact poorly with overlapping translucent
|
|
|
|
|
* objects, so use the other overload if you do not need opacity control.
|
2021-04-21 14:36:05 -04:00
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetCustomTwoSidedDepthOffsetMaterial(UInteractiveToolManager* ToolManager, const FLinearColor& Color, float PercentDepthOffset, float Opacity);
|
2021-01-28 13:06:33 -04:00
|
|
|
|
2021-04-30 09:22:12 -04:00
|
|
|
/**
|
|
|
|
|
* @return Simple two-sided material with configurable depth offset and color. The material will have opaque blend mode.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInstanceDynamic* GetCustomTwoSidedDepthOffsetMaterial(UInteractiveToolManager* ToolManager, const FLinearColor& Color, float PercentDepthOffset);
|
|
|
|
|
|
2020-09-14 15:58:34 -04:00
|
|
|
/**
|
|
|
|
|
* @return Material used when editing AVolume objects using our tools.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetDefaultEditVolumeMaterial();
|
|
|
|
|
|
2019-10-07 12:26:07 -04:00
|
|
|
/**
|
2021-04-30 09:22:12 -04:00
|
|
|
* Gets a custom material suitable for use with UPointSetComponent for square points.
|
|
|
|
|
*
|
|
|
|
|
* @param bDepthTested If true, the material will be depth tested as normal. If false, occluded points will still be
|
|
|
|
|
* displayed but dimmed.
|
|
|
|
|
* Note that the current implementations of the depth-tested and non-depth-tested modes use opaque and translucent
|
|
|
|
|
* blend modes, respectively, and so inherit their limitations. Specifically, opaque does not support opacity,
|
|
|
|
|
* and translucent does not always follow correct draw order relative to other translucent objects, which means
|
|
|
|
|
* that depth offset cannot reliably order lines within a non-depth-tested line set component.
|
2019-10-07 12:26:07 -04:00
|
|
|
*/
|
2021-04-30 09:22:12 -04:00
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetDefaultPointComponentMaterial(UInteractiveToolManager* ToolManager, bool bDepthTested = true);
|
2019-10-07 12:26:07 -04:00
|
|
|
|
2020-04-18 18:42:59 -04:00
|
|
|
/**
|
2021-04-30 09:22:12 -04:00
|
|
|
* Gets a custom material suitable for use with UPointSetComponent for round points.
|
|
|
|
|
* Note that this material uses translucent blend mode, and therefore can't always follow the correct draw order
|
|
|
|
|
* relative to other translucent objects (and within the point set). If this is not acceptible, you will need to use
|
|
|
|
|
* the depth tested square point material (GetDefaultPointComponentMaterial with bDepthTested = true).
|
|
|
|
|
*
|
|
|
|
|
* @param bDepthTested If true, the material will be depth tested as normal. If false, occluded portions of lines
|
|
|
|
|
* will still be displayed, but dashed and dimmed.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetRoundPointComponentMaterial(UInteractiveToolManager* ToolManager, bool bDepthTested = true);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets a custom material suitable for use with ULineSetComponent.
|
|
|
|
|
*
|
|
|
|
|
* @param bDepthTested If true, the material will be depth tested as normal. If false, occluded portions of lines
|
|
|
|
|
* will still be displayed, but dashed and dimmed.
|
|
|
|
|
* Note that the current implementations of the depth-tested and non-depth-tested modes use opaque and translucent
|
|
|
|
|
* blend modes, respectively, and so inherit their limitations. Specifically, opaque does not support opacity,
|
|
|
|
|
* and translucent does not always follow correct draw order relative to other translucent objects, which means
|
|
|
|
|
* that depth offset cannot reliably order lines within a non-depth-tested line set component.
|
2020-04-18 18:42:59 -04:00
|
|
|
*/
|
2020-10-29 13:38:15 -04:00
|
|
|
MODELINGCOMPONENTS_API UMaterialInterface* GetDefaultLineComponentMaterial(UInteractiveToolManager* ToolManager, bool bDepthTested = true);
|
2020-12-14 19:16:22 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return a curve asset used for contrast adjustments when using a texture map for displacements.
|
|
|
|
|
*/
|
|
|
|
|
MODELINGCOMPONENTS_API UCurveFloat* GetContrastAdjustmentCurve(UInteractiveToolManager* ToolManager);
|
2019-10-01 20:41:42 -04:00
|
|
|
}
|