You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* GetStreamOutElements is a callback function on the shadertype, just like ModifyCompilationEnvironment * If GetStreamOutElements is specified, the FShaderResource includes that shader type in its ID as it can't be shared with any other shader type. * FShader is no longer a FRenderResource which solves some multiple initialization issues #codereview Marcus.Wassmer [CL 2430024 by Daniel Wright in Main branch]
75 lines
2.4 KiB
Plaintext
75 lines
2.4 KiB
Plaintext
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
ConvertToUniformMesh.usf
|
|
=============================================================================*/
|
|
|
|
#include "Common.usf"
|
|
#include "Material.usf"
|
|
#include "VertexFactory.usf"
|
|
|
|
struct FConvertToUniformMeshVSToGS
|
|
{
|
|
FVertexFactoryInterpolantsVSToPS FactoryInterpolants;
|
|
float3 PixelPosition : TEXCOORD6;
|
|
};
|
|
|
|
void ConvertToUniformMeshVS(
|
|
FVertexFactoryInput Input,
|
|
out FConvertToUniformMeshVSToGS Output
|
|
)
|
|
{
|
|
FVertexFactoryIntermediates VFIntermediates = GetVertexFactoryIntermediates(Input);
|
|
float3 WorldPosition = VertexFactoryGetWorldPosition(Input, VFIntermediates).xyz - View.PreViewTranslation.xyz;
|
|
float3x3 TangentToLocal = VertexFactoryGetTangentToLocal(Input, VFIntermediates);
|
|
|
|
FMaterialVertexParameters VertexParameters = GetMaterialVertexParameters(Input, VFIntermediates, WorldPosition, TangentToLocal);
|
|
|
|
Output.FactoryInterpolants = VertexFactoryGetInterpolantsVSToPS(Input, VFIntermediates, VertexParameters);
|
|
Output.PixelPosition = WorldPosition;
|
|
}
|
|
|
|
// Must match GetUniformMeshStreamOutLayout and TRIANGLE_VERTEX_DATA_STRIDE
|
|
struct FConvertToUniformMeshVertex
|
|
{
|
|
float4 Position : SV_Position;
|
|
float3 Tangent0 : Tangent0;
|
|
float3 Tangent1 : Tangent1;
|
|
float3 Tangent2 : Tangent2;
|
|
float2 UV0 : UV0;
|
|
float2 UV1 : UV1;
|
|
float4 VertexColor : VertexColor;
|
|
};
|
|
|
|
[maxvertexcount(3)]
|
|
void ConvertToUniformMeshGS(triangle FConvertToUniformMeshVSToGS Inputs[3], inout TriangleStream<FConvertToUniformMeshVertex> OutStream)
|
|
{
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
FConvertToUniformMeshVSToGS Input = Inputs[i];
|
|
FMaterialPixelParameters MaterialParameters = GetMaterialPixelParameters(Input.FactoryInterpolants, float4(Input.PixelPosition, 1));
|
|
|
|
FConvertToUniformMeshVertex Vertex = (FConvertToUniformMeshVertex)0;
|
|
Vertex.Position = float4(Input.PixelPosition, 40);
|
|
|
|
Vertex.Tangent0 = MaterialParameters.TangentToWorld[0];
|
|
Vertex.Tangent1 = MaterialParameters.TangentToWorld[1];
|
|
Vertex.Tangent2 = MaterialParameters.TangentToWorld[2];
|
|
|
|
Vertex.UV0 = Vertex.UV1 = 0;
|
|
|
|
#if NUM_MATERIAL_TEXCOORDS > 0
|
|
Vertex.UV0 = MaterialParameters.TexCoords[0];
|
|
#endif
|
|
|
|
#if NUM_MATERIAL_TEXCOORDS > 1
|
|
Vertex.UV1 = MaterialParameters.TexCoords[1];
|
|
#endif
|
|
|
|
Vertex.VertexColor = MaterialParameters.VertexColor;
|
|
|
|
OutStream.Append(Vertex);
|
|
}
|
|
}
|
|
|