Class RenderTools
Set of utilities for rendering.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Graphics/RenderTools.h
Syntax
public class RenderTools
Constructors
DEPRECATED("Use CalculateTangentFrame with unpacked Float3/Float4.")
Declaration
public DEPRECATED("Use CalculateTangentFrame with unpacked Float3/Float4.") static void CalculateTangentFrame(FloatR10G10B10A2& resultNormal
Parameters
|
"Use CalculateTangentFrame with unpacked Float3/Float4."
RenderTools_DEPRECATED__Use_CalculateTangentFrame_with_unpacked_Float3_Float4___
|
Fields
normal
Declaration
public FloatR10G10B10A2 Float3 normal
Field Value
|
FloatR10G10B10A2 Float3
|
resultTangent
tangent
Declaration
public FloatR10G10B10A2 Float3 Float3 tangent
Field Value
|
FloatR10G10B10A2 Float3 Float3
|
Methods
CalcSubresourceIndex(uint32 mipSlice, int32 arraySlice, int32 mipLevels)
Declaration
public static int32 CalcSubresourceIndex(uint32 mipSlice, int32 arraySlice, int32 mipLevels)
Parameters
|
uint32
mipSlice
|
|
int32
arraySlice
|
|
int32
mipLevels
|
Returns
|
int32
|
CalculateTangentFrame(Float3& resultNormal, Float4& resultTangent, const Float3& normal)
Declaration
public static void CalculateTangentFrame(Float3& resultNormal, Float4& resultTangent, const Float3& normal)
Parameters
|
Float3
resultNormal
|
|
Float4
resultTangent
|
|
Float3
normal
|
CalculateTangentFrame(Float3& resultNormal, Float4& resultTangent, const Float3& normal, const Float3& tangent)
Declaration
public static void CalculateTangentFrame(Float3& resultNormal, Float4& resultTangent, const Float3& normal, const Float3& tangent)
Parameters
|
Float3
resultNormal
|
|
Float4
resultTangent
|
|
Float3
normal
|
|
Float3
tangent
|
CalculateTextureMemoryUsage(PixelFormat format, int32 width, int32 height, int32 depth, int32 mipLevels)
Declaration
public static uint64 CalculateTextureMemoryUsage(PixelFormat format, int32 width, int32 height, int32 depth, int32 mipLevels)
Parameters
|
PixelFormat
format
|
|
int32
width
|
|
int32
height
|
|
int32
depth
|
|
int32
mipLevels
|
Returns
|
uint64
|
CalculateTextureMemoryUsage(PixelFormat format, int32 width, int32 height, int32 mipLevels)
Declaration
public static uint64 CalculateTextureMemoryUsage(PixelFormat format, int32 width, int32 height, int32 mipLevels)
Parameters
|
PixelFormat
format
|
|
int32
width
|
|
int32
height
|
|
int32
mipLevels
|
Returns
|
uint64
|
CanSupportTessellation(ShaderProfile profile)
Check if the given shader profile supports the tessellation. Runtime can reject tessellation support but it defines if given shader profile CAN support tessellation.
Declaration
public static bool CanSupportTessellation(ShaderProfile profile)
Parameters
|
ShaderProfile
profile
The profile. |
Returns
|
bool
True if can support tessellation shaders, otherwise false. |
ComputeBoundsScreenRadiusSquared(const Float3& origin, const float radius, const RenderView& view)
Computes the bounds screen radius squared.
Declaration
public static float ComputeBoundsScreenRadiusSquared(const Float3& origin, const float radius, const RenderView& view)
Parameters
|
Float3
origin
The bounds origin. |
|
float
radius
The bounds radius. |
|
RenderView
view
The render view. |
Returns
|
float
The squared radius. |
ComputeBoundsScreenRadiusSquared(const Float3& origin, float radius, const Float3& viewOrigin, const Matrix& projectionMatrix)
Computes the bounds screen radius squared.
Declaration
public static float ComputeBoundsScreenRadiusSquared(const Float3& origin, float radius, const Float3& viewOrigin, const Matrix& projectionMatrix)
Parameters
|
Float3
origin
The bounds origin. |
|
float
radius
The bounds radius. |
|
Float3
viewOrigin
The render view position. |
|
Matrix
projectionMatrix
The render view projection matrix. |
Returns
|
float
The squared radius. |
ComputeCascadeUpdateFrequency(int32 cascadeIndex, int32 cascadeCount, int32& updateFrequency, int32& updatePhrase, int32 updateMaxCountPerFrame=1)
Declaration
public static void ComputeCascadeUpdateFrequency(int32 cascadeIndex, int32 cascadeCount, int32& updateFrequency, int32& updatePhrase, int32 updateMaxCountPerFrame=1)
Parameters
|
int32
cascadeIndex
|
|
int32
cascadeCount
|
|
int32
updateFrequency
|
|
int32
updatePhrase
|
|
int32
updateMaxCountPerFrame
|
ComputeDistanceSortKey(float distance)
Computes the sorting key for depth value (quantized) Reference: http://aras-p.info/blog/2014/01/16/rough-sorting-by-depth/
Declaration
public static uint32 ComputeDistanceSortKey(float distance)
Parameters
|
float
distance
|
Returns
|
uint32
|
ComputeModelLOD(const Model* model, const Float3& origin, float radius, const RenderContext& renderContext)
Computes the model LOD index to use during rendering.
Declaration
public static int32 ComputeModelLOD(const Model* model, const Float3& origin, float radius, const RenderContext& renderContext)
Parameters
|
Model
model
The model. |
|
Float3
origin
The bounds origin. |
|
float
radius
The bounds radius. |
|
RenderContext
renderContext
The rendering context. |
Returns
|
int32
The zero-based LOD index. Returns -1 if model should not be rendered. |
ComputePitch(PixelFormat format, int32 width, int32 height, uint32& rowPitch, uint32& slicePitch)
Computes the image row pitch in bytes, and the slice pitch (size in bytes of the image) based on format, width, and height.
Declaration
public static void ComputePitch(PixelFormat format, int32 width, int32 height, uint32& rowPitch, uint32& slicePitch)
Parameters
|
PixelFormat
format
The pixel format of the surface. |
|
int32
width
The surface width. |
|
int32
height
The surface height. |
|
uint32
rowPitch
The number of bytes in a scanline of pixels in the image. A standard pitch is 'byte' aligned and therefore it is equal to bytes-per-pixel * width-of-image. For block-compressed (BC) formats, this is the number of bytes in a row of blocks (which covers up to 4 scanlines at once). The rowPitch can be larger than the number of valid pixels in the image due to alignment padding. |
|
uint32
slicePitch
For volume (3D) textures, slicePitch is the number of bytes in each depth slice. For 1D and 2D images, this is simply the total size of the image including any alignment padding. |
ComputeSkinnedModelLOD(const SkinnedModel* model, const Float3& origin, float radius, const RenderContext& renderContext)
Computes the skinned model LOD index to use during rendering.
Declaration
public static int32 ComputeSkinnedModelLOD(const SkinnedModel* model, const Float3& origin, float radius, const RenderContext& renderContext)
Parameters
|
SkinnedModel
model
The skinned model. |
|
Float3
origin
The bounds origin. |
|
float
radius
The bounds radius. |
|
RenderContext
renderContext
The rendering context. |
Returns
|
int32
The zero-based LOD index. Returns -1 if model should not be rendered. |
ComputeSphereModelDrawMatrix(const RenderView& view, const Float3& position, float radius, Matrix& resultWorld, bool& resultIsViewInside)
Declaration
public static void ComputeSphereModelDrawMatrix(const RenderView& view, const Float3& position, float radius, Matrix& resultWorld, bool& resultIsViewInside)
Parameters
|
RenderView
view
|
|
Float3
position
|
|
float
radius
|
|
Matrix
resultWorld
|
|
bool
resultIsViewInside
|
ComputeTemporalTime()
Declaration
public static float ComputeTemporalTime()
Returns
|
float
|
GetFeatureLevel(ShaderProfile profile)
Computes the feature level for the given shader profile.
Declaration
public static FeatureLevel GetFeatureLevel(ShaderProfile profile)
Parameters
|
ShaderProfile
profile
The shader profile. |
Returns
|
FeatureLevel
The feature level matching the given shader profile. |
GetWorldDeterminantSign(const Matrix& worldMatrix)
Declaration
public static float GetWorldDeterminantSign(const Matrix& worldMatrix)
Parameters
|
Matrix
worldMatrix
|
Returns
|
float
|
ShouldUpdateCascade(int32 frameIndex, int32 cascadeIndex, int32 cascadeCount, int32 updateMaxCountPerFrame=1, bool updateForce=false)
Declaration
public static bool ShouldUpdateCascade(int32 frameIndex, int32 cascadeIndex, int32 cascadeCount, int32 updateMaxCountPerFrame=1, bool updateForce=false)
Parameters
|
int32
frameIndex
|
|
int32
cascadeIndex
|
|
int32
cascadeCount
|
|
int32
updateMaxCountPerFrame
|
|
bool
updateForce
|
Returns
|
bool
|
UpdateModelLODTransition(byte& lodTransition)
Declaration
public static void UpdateModelLODTransition(byte& lodTransition)
Parameters
|
byte
lodTransition
|