engine
 
载入中...
搜索中...
未找到
Public 成员函数 | Protected 成员函数 | 友元 | 所有成员列表
FMaterial类 参考abstract

FMaterial serves 3 intertwined purposes: Represents a material to the material compilation process, and provides hooks for extensibility (CompileProperty, etc) Represents a material to the renderer, with functions to access material properties Stores a cached shader map, and other transient output from a compile, which is necessary with async shader compiling (when a material finishes async compilation, the shader map and compile errors need to be stored somewhere) 更多...

#include <MaterialShared.h>

+ 类 FMaterial 继承关系图:

Public 成员函数

ENGINE_API bool CacheShaders (const FMaterialShaderMapId &ShaderMapId, EShaderPlatform Platform, const ITargetPlatform *TargetPlatform=nullptr)
 Caches the material shaders for the given static parameter set and platform. 更多...
 
ENGINE_API bool CacheShaders (EShaderPlatform Platform, const ITargetPlatform *TargetPlatform=nullptr)
 Caches the material shaders for this material on the given platform. 更多...
 
void DiscardShaderMap ()
 Discards loaded shader maps if the application can't render
 
 FMaterial ()
 Minimal initialization constructor.
 
virtual bool GetAllowDevelopmentShaderCompile () const
 Returns true if this material is allowed to make development shaders via the global CVar CompileShadersForDevelopment.
 
ENGINE_API bool GetMaterialExpressionSource (FString &OutSource)
 Get user source code for the material, with a list of code snippets to highlight representing the code for each MaterialExpression 更多...
 
virtual EMaterialShaderMapUsage::Type GetMaterialShaderMapUsage () const
 Returns which shadermap this material is bound to.
 
virtual FString GetMaterialUsageDescription () const =0
 Returns a string that describes the material's usage for debugging purposes.
 
ENGINE_API uint8 GetRuntimeVirtualTextureOutputAttibuteMask_RenderThread () const
 Get the runtime virtual texture output attribute mask for the material.
 
template<typename ShaderType >
TShaderRef< ShaderType > GetShader (FVertexFactoryType *VertexFactoryType, const typename ShaderType::FPermutationDomain &PermutationVector, bool bFatalIfMissing=true) const
 Finds the shader matching the template type and the passed in vertex factory, asserts if not found. 更多...
 
ENGINE_API bool HasValidGameThreadShaderMap () const
 Checks if there is a valid GameThreadShaderMap, that is, the material can be rendered as intended. 更多...
 
virtual bool IsPersistent () const =0
 Should shaders compiled for this material be saved to disk?
 
virtual ENGINE_API void LegacySerialize (FArchive &Ar)
 Serializes the material.
 
ENGINE_API bool MaterialMayModifyMeshPosition () const
 Note: This function is only intended for use in deciding whether or not shader permutations are required before material translation occurs.
 
ENGINE_API bool MaterialModifiesMeshPosition_RenderThread () const
 Does the material modify the mesh position.
 
ENGINE_API bool MaterialUsesDistanceCullFade_GameThread () const
 Does the material use a distance cull fade.
 
ENGINE_API bool MaterialUsesPixelDepthOffset () const
 Does the material use a pixel depth offset.
 
ENGINE_API bool MaterialUsesSceneDepthLookup_RenderThread () const
 Does the material use a SceneDepth lookup.
 
void RegisterInlineShaderMap (bool bLoadedByCookedMaterial)
 Serializes the shader map inline in this material, including any shader dependencies.
 
void ReleaseShaderMap ()
 Releases this material's shader map. 更多...
 
void SerializeInlineShaderMap (FArchive &Ar)
 Serializes the shader map inline in this material, including any shader dependencies.
 
ENGINE_API void SetRenderingThreadShaderMap (const TRefCountPtr< FMaterialShaderMap > &InMaterialShaderMap)
 Note: SetGameThreadShaderMap must also be called with the same value, but from the game thread.
 
virtual void SetupExtaCompilationSettings (const EShaderPlatform Platform, FExtraShaderCompilerSettings &Settings) const
 call during shader compilation jobs setup to fill additional settings that may be required by classes who inherit from this
 
virtual ENGINE_API bool ShouldCache (EShaderPlatform Platform, const FShaderType *ShaderType, const FVertexFactoryType *VertexFactoryType) const
 Should the shader for this material with the given platform, shader type and vertex factory type combination be compiled 更多...
 
bool ShouldCastDynamicShadows () const
 Returns whether this material should be considered for casting dynamic shadows.
 
ENGINE_API bool UsesCustomDepthStencil_GameThread () const
 Does the material use CustomDepth or CustomStencil lookup
 
virtual ENGINE_API ~FMaterial ()
 Destructor
 

Protected 成员函数

virtual int32 CompilePropertyAndSetMaterialProperty (EMaterialProperty Property, class FMaterialCompiler *Compiler, EShaderFrequency OverrideShaderFrequency=SF_NumFrequencies, bool bUsePreviousFrameTime=false) const =0
 Entry point for compiling a specific material property. 更多...
 
virtual FString GetBaseMaterialPathName () const
 Useful for debugging.
 
ENGINE_API void GetDependentShaderAndVFTypes (EShaderPlatform Platform, TArray< FShaderType * > &OutShaderTypes, TArray< const FShaderPipelineType * > &OutShaderPipelineTypes, TArray< FVertexFactoryType * > &OutVFTypes) const
 Produces arrays of any shader and vertex factory type that this material is dependent on.
 
virtual FGuid GetMaterialId () const =0
 Gets the Guid that represents this material.
 
virtual EMaterialShaderMapUsage::Type GetShaderMapUsage () const
 Gets the shader map usage of the material, which will be included in the DDC key. 更多...
 

友元

class FMaterialShaderMap
 
class FShaderCompilingManager
 

详细描述

FMaterial serves 3 intertwined purposes: Represents a material to the material compilation process, and provides hooks for extensibility (CompileProperty, etc) Represents a material to the renderer, with functions to access material properties Stores a cached shader map, and other transient output from a compile, which is necessary with async shader compiling (when a material finishes async compilation, the shader map and compile errors need to be stored somewhere)

成员函数说明

◆ CacheShaders() [1/2]

ENGINE_API bool FMaterial::CacheShaders ( const FMaterialShaderMapId &  ShaderMapId,
EShaderPlatform  Platform,
const ITargetPlatform *  TargetPlatform = nullptr 
)

Caches the material shaders for the given static parameter set and platform.

This is used by material resources of UMaterialInstances.

◆ CacheShaders() [2/2]

ENGINE_API bool FMaterial::CacheShaders ( EShaderPlatform  Platform,
const ITargetPlatform *  TargetPlatform = nullptr 
)

Caches the material shaders for this material on the given platform.

This is used by material resources of UMaterials.

◆ CompilePropertyAndSetMaterialProperty()

virtual int32 FMaterial::CompilePropertyAndSetMaterialProperty ( EMaterialProperty  Property,
class FMaterialCompiler *  Compiler,
EShaderFrequency  OverrideShaderFrequency = SF_NumFrequencies,
bool  bUsePreviousFrameTime = false 
) const
protectedpure virtual

Entry point for compiling a specific material property.

This must call SetMaterialProperty.

参数
OverrideShaderFrequencySF_NumFrequencies to not override
返回
cases to the proper type e.g. Compiler->ForceCast(Ret, GetValueType(Property));

在 FMaterialResource 内被实现.

◆ GetMaterialExpressionSource()

ENGINE_API bool FMaterial::GetMaterialExpressionSource ( FString &  OutSource)

Get user source code for the material, with a list of code snippets to highlight representing the code for each MaterialExpression

参数
OutSource- generated source code
OutHighlightMap- source code highlight list
返回
- true on Success

◆ GetShader()

template<typename ShaderType >
TShaderRef< ShaderType > FMaterial::GetShader ( FVertexFactoryType *  VertexFactoryType,
const typename ShaderType::FPermutationDomain &  PermutationVector,
bool  bFatalIfMissing = true 
) const
inline

Finds the shader matching the template type and the passed in vertex factory, asserts if not found.

Note - Only implemented for FMeshMaterialShaderTypes

◆ GetShaderMapUsage()

virtual EMaterialShaderMapUsage::Type FMaterial::GetShaderMapUsage ( ) const
inlineprotectedvirtual

Gets the shader map usage of the material, which will be included in the DDC key.

This mechanism allows derived material classes to create different DDC keys with the same base material. For example lightmass exports diffuse and emissive, each of which requires a material resource with the same base material.

◆ HasValidGameThreadShaderMap()

ENGINE_API bool FMaterial::HasValidGameThreadShaderMap ( ) const

Checks if there is a valid GameThreadShaderMap, that is, the material can be rendered as intended.

返回
returns true if there is a GameThreadShaderMap.

◆ ReleaseShaderMap()

void FMaterial::ReleaseShaderMap ( )

Releases this material's shader map.

Must only be called on materials not exposed to the rendering thread!

◆ ShouldCache()

virtual ENGINE_API bool FMaterial::ShouldCache ( EShaderPlatform  Platform,
const FShaderType *  ShaderType,
const FVertexFactoryType *  VertexFactoryType 
) const
virtual

Should the shader for this material with the given platform, shader type and vertex factory type combination be compiled

参数
PlatformThe platform currently being compiled for
ShaderTypeWhich shader is being compiled
VertexFactoryWhich vertex factory is being compiled (can be NULL)
返回
true if the shader should be compiled

该类的文档由以下文件生成: