当前位置: 首页>>代码示例>>C++>>正文


C++ SetShaderValue函数代码示例

本文整理汇总了C++中SetShaderValue函数的典型用法代码示例。如果您正苦于以下问题:C++ SetShaderValue函数的具体用法?C++ SetShaderValue怎么用?C++ SetShaderValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetShaderValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetParameters

	/** Sets shader parameter values */
	void SetParameters(
		FRHICommandList& RHICmdList, FSamplerStateRHIParamRef SamplerStateRHI, FTextureRHIParamRef FilterTextureRHI, FTextureRHIParamRef AdditiveTextureRHI, 
		const FLinearColor* SampleWeightValues, const FVector2D* SampleOffsetValues, uint32 NumSamples )
	{
		check(CompileTimeNumSamples == 0 && NumSamples > 0 && NumSamples <= MAX_FILTER_SAMPLES || CompileTimeNumSamples == NumSamples);
		const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();

		SetTextureParameter(RHICmdList, ShaderRHI, FilterTexture, FilterTextureSampler, SamplerStateRHI, FilterTextureRHI);
		SetTextureParameter(RHICmdList, ShaderRHI, AdditiveTexture, AdditiveTextureSampler, SamplerStateRHI, AdditiveTextureRHI);
		SetShaderValueArray(RHICmdList, ShaderRHI, SampleWeights, SampleWeightValues, NumSamples);

		if (CompileTimeNumSamples == 0)
		{
			// we needs additional setups for the dynamic loop
			FVector4 PackedSampleOffsetsValues[MAX_PACKED_SAMPLES_OFFSET];

			for(uint32 SampleIndex = 0;SampleIndex < NumSamples;SampleIndex += 2)
			{
				PackedSampleOffsetsValues[SampleIndex / 2].X = SampleOffsetValues[SampleIndex + 0].X;
				PackedSampleOffsetsValues[SampleIndex / 2].Y = SampleOffsetValues[SampleIndex + 0].Y;
				if(SampleIndex + 1 < NumSamples)
				{
					PackedSampleOffsetsValues[SampleIndex / 2].W = SampleOffsetValues[SampleIndex + 1].X;
					PackedSampleOffsetsValues[SampleIndex / 2].Z = SampleOffsetValues[SampleIndex + 1].Y;
				}
			}

			SetShaderValueArray(RHICmdList, ShaderRHI, SampleOffsets, PackedSampleOffsetsValues, MAX_PACKED_SAMPLES_OFFSET);
			SetShaderValue(RHICmdList, ShaderRHI, SampleCount, NumSamples);
		}
	}
开发者ID:dineshone,项目名称:UnrealGameEngine,代码行数:32,代码来源:PostProcessWeightedSampleSum.cpp

示例2: SetParameters

	void SetParameters(FRHICommandList& RHICmdList, const FSceneView& View, const FMatrix& InFrustumComponentToClip)
	{
		const FVertexShaderRHIParamRef ShaderRHI = GetVertexShader();

		FGlobalShader::SetParameters(RHICmdList, ShaderRHI, View);
		SetShaderValue(RHICmdList, ShaderRHI, FrustumComponentToClip, InFrustumComponentToClip);
	}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:7,代码来源:DecalRenderingShared.cpp

示例3: SetParameters

	void SetParameters(const FRenderingCompositePassContext& Context, IPooledRenderTarget& DistortionRT)
	{
		FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(Context.RHICmdList);
		const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();

		FTextureRHIParamRef DistortionTextureValue = DistortionRT.GetRenderTargetItem().ShaderResourceTexture;
		FTextureRHIParamRef SceneColorTextureValue = SceneContext.GetSceneColor()->GetRenderTargetItem().ShaderResourceTexture;

		// Here we use SF_Point as in fullscreen the pixels are 1:1 mapped.
		SetTextureParameter(
			Context.RHICmdList,
			ShaderRHI,
			DistortionTexture,
			DistortionTextureSampler,
			TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
			DistortionTextureValue
			);

		SetTextureParameter(
			Context.RHICmdList,
			ShaderRHI,
			SceneColorTexture,
			SceneColorTextureSampler,
			TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
			SceneColorTextureValue
			);

		FIntPoint SceneBufferSize = SceneContext.GetBufferSizeXY();
		FIntRect ViewportRect = Context.GetViewport();
		FVector4 SceneColorRectValue = FVector4((float)ViewportRect.Min.X/SceneBufferSize.X,
												(float)ViewportRect.Min.Y/SceneBufferSize.Y,
												(float)ViewportRect.Max.X/SceneBufferSize.X,
												(float)ViewportRect.Max.Y/SceneBufferSize.Y);
		SetShaderValue(Context.RHICmdList, ShaderRHI, SceneColorRect, SceneColorRectValue);
	}
开发者ID:colwalder,项目名称:unrealengine,代码行数:35,代码来源:DistortionRendering.cpp

示例4: GetComputeShader

void FClearTexture2DReplacementCS::SetParameters( FRHICommandList& RHICmdList, FUnorderedAccessViewRHIParamRef TextureRW, FLinearColor Value )
{
	FComputeShaderRHIParamRef ComputeShaderRHI = GetComputeShader();
	SetShaderValue(RHICmdList, ComputeShaderRHI, ClearColor, Value);

	RHICmdList.TransitionResource(EResourceTransitionAccess::ERWBarrier, EResourceTransitionPipeline::EGfxToCompute, TextureRW);
	RHICmdList.SetUAVParameter(ComputeShaderRHI, ClearTextureRW.GetBaseIndex(), TextureRW);
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:8,代码来源:ClearReplacementShaders.cpp

示例5: SetParameters

	void SetParameters(FRHICommandList& RHICmdList, const FSceneView& View)
	{
		const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();

		FGlobalShader::SetParameters(RHICmdList, ShaderRHI, View);
		DeferredParameters.Set(RHICmdList, ShaderRHI, View);
		SetShaderValue(RHICmdList, ShaderRHI, MaskComparison, View.Family->EngineShowFlags.ShaderComplexity ? -1.0f : 0.5f);
	}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:8,代码来源:PostProcessDeferredDecals.cpp

示例6: SetParameters

	/** Sets shader parameter values */
	void SetParameters(FRHICommandList& RHICmdList, const FLightSceneInfo* LightSceneInfo, const FViewInfo& View, int32 PassIndex, TRefCountPtr<IPooledRenderTarget>& PassSource)
	{
		FGlobalShader::SetParameters(RHICmdList, GetPixelShader(), View);
		LightShaftParameters.SetParameters(RHICmdList, GetPixelShader(), LightSceneInfo, View, PassSource);

		const FVector4 Parameters(GLightShaftBlurNumSamples, GLightShaftFirstPassDistance, PassIndex);
		SetShaderValue(RHICmdList, GetPixelShader(), RadialBlurParameters, Parameters);
	}
开发者ID:colwalder,项目名称:unrealengine,代码行数:9,代码来源:LightShaftRendering.cpp

示例7: SetShaderValue

/**
* Sets all the constant parameters for this shader
*
* @param Texture - 2d tile texture
* @param Gamma - if gamma != 1.0 then a pow(color,Gamma) is applied
* @param ClipRef - reference value to compare with alpha for killing pixels
* @param SmoothWidth - The width to smooth the edge the texture
* @param EnableShadow - Toggles drop shadow rendering
* @param ShadowDirection - 2D vector specifying the direction of shadow
* @param ShadowColor - Color of the shadowed pixels
* @param ShadowSmoothWidth - The width to smooth the edge the shadow of the texture
* @param BlendMode - current batched element blend mode being rendered
*/
void FSimpleElementDistanceFieldGammaPS::SetParameters(
	const FTexture* Texture,
	float Gamma,
	float ClipRef,
	float SmoothWidthValue,
	bool EnableShadowValue,
	const FVector2D& ShadowDirectionValue,
	const FLinearColor& ShadowColorValue,
	float ShadowSmoothWidthValue,
	const FDepthFieldGlowInfo& GlowInfo,
	ESimpleElementBlendMode BlendMode
	)
{
	FSimpleElementMaskedGammaPS::SetParameters(Texture,Gamma,ClipRef,BlendMode);
	SetShaderValue(GetPixelShader(),SmoothWidth,SmoothWidthValue);		
	SetPixelShaderBool(GetPixelShader(),EnableShadow,EnableShadowValue);
	if (EnableShadowValue)
	{
		SetShaderValue(GetPixelShader(),ShadowDirection,ShadowDirectionValue);
		SetShaderValue(GetPixelShader(),ShadowColor,ShadowColorValue);
		SetShaderValue(GetPixelShader(),ShadowSmoothWidth,ShadowSmoothWidthValue);
	}
	SetPixelShaderBool(GetPixelShader(),EnableGlow,GlowInfo.bEnableGlow);
	if (GlowInfo.bEnableGlow)
	{
		SetShaderValue(GetPixelShader(),GlowColor,GlowInfo.GlowColor);
		SetShaderValue(GetPixelShader(),GlowOuterRadius,GlowInfo.GlowOuterRadius);
		SetShaderValue(GetPixelShader(),GlowInnerRadius,GlowInfo.GlowInnerRadius);
	}

	// This shader does not use editor compositing
	SetEditorCompositingParameters( NULL, FTexture2DRHIRef() );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:46,代码来源:SimpleElementShaders.cpp

示例8: SetParameters

	/** to have a similar interface as all other shaders */
	void SetParameters(const FRenderingCompositePassContext& Context, FIntPoint TileCountValue)
	{
		const FVertexShaderRHIParamRef ShaderRHI = GetVertexShader();

		FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);
		PostprocessParameter.SetVS(ShaderRHI, Context, TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());

		SetShaderValue(Context.RHICmdList, ShaderRHI, TileCount, TileCountValue);
	}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:10,代码来源:PostProcessMotionBlur.cpp

示例9: SetMesh

	virtual void SetMesh(FRHICommandList& RHICmdList, FShader* Shader,const FVertexFactory* VertexFactory,const FSceneView& View,const FMeshBatchElement& BatchElement,uint32 DataFlags) const override
	{
		FParticleSpriteVertexFactory* SpriteVF = (FParticleSpriteVertexFactory*)VertexFactory;
		FVertexShaderRHIParamRef VertexShaderRHI = Shader->GetVertexShader();
		SetUniformBufferParameter(RHICmdList, VertexShaderRHI, Shader->GetUniformBufferParameter<FParticleSpriteUniformParameters>(), SpriteVF->GetSpriteUniformBuffer() );

		SetShaderValue(RHICmdList, VertexShaderRHI, NumCutoutVerticesPerFrame, SpriteVF->GetNumCutoutVerticesPerFrame());
		FShaderResourceViewRHIParamRef NullSRV = GFNullSubUVCutoutVertexBuffer.VertexBufferSRV;
		SetSRVParameter(RHICmdList, VertexShaderRHI, CutoutGeometry, SpriteVF->GetCutoutGeometrySRV() ? SpriteVF->GetCutoutGeometrySRV() : NullSRV);
	}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:10,代码来源:ParticleVertexFactory.cpp

示例10: SetCS

	void SetCS( FRHICommandList& RHICmdList, const FRenderingCompositePassContext& Context, const FSceneView& View )
	{
		const FComputeShaderRHIParamRef ShaderRHI = GetComputeShader();

		FGlobalShader::SetParameters(RHICmdList, ShaderRHI, Context.View);
		PostprocessParameter.SetCS(ShaderRHI, Context, TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
		CameraMotionParams.Set(RHICmdList, Context.View, ShaderRHI);

		SetShaderValue(RHICmdList, ShaderRHI, ViewDimensions, View.ViewRect);
	}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:10,代码来源:PostProcessMotionBlur.cpp

示例11: SetParameters

	void SetParameters(const FRenderingCompositePassContext& Context, FVector2D TexScaleValue)
	{
		const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();

		FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);

		PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI());

		SetShaderValue(Context.RHICmdList, ShaderRHI, TexScale, TexScaleValue);
	}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:10,代码来源:PostProcessLensFlares.cpp

示例12: float

void FShaderComplexityAccumulatePS::SetParameters(
	FRHICommandList& RHICmdList, 
	uint32 NumVertexInstructions, 
	uint32 NumPixelInstructions,
	ERHIFeatureLevel::Type InFeatureLevel)
{
	//normalize the complexity so we can fit it in a low precision scene color which is necessary on some platforms
	const float NormalizedComplexityValue = float(NumPixelInstructions) / GetMaxShaderComplexityCount(InFeatureLevel);

	SetShaderValue(RHICmdList, GetPixelShader(), NormalizedComplexity, NormalizedComplexityValue);
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:11,代码来源:ShaderComplexityRendering.cpp

示例13: SetParameters

	void SetParameters(const FSceneView& View)
	{
		FGlobalShader::SetParameters(GetPixelShader(), View);

		// Used to remap view space Z (which is stored in scene color alpha) into post projection z and w so we can write z/w into the downsized depth buffer
		const FVector2D ProjectionScaleBiasValue(View.ViewMatrices.ProjMatrix.M[2][2], View.ViewMatrices.ProjMatrix.M[3][2]);
		SetShaderValue(GetPixelShader(), ProjectionScaleBias, ProjectionScaleBiasValue);

		FIntPoint BufferSize = GSceneRenderTargets.GetBufferSizeXY();

		const uint32 DownsampledBufferSizeX = BufferSize.X / GSceneRenderTargets.GetSmallColorDepthDownsampleFactor();
		const uint32 DownsampledBufferSizeY = BufferSize.Y / GSceneRenderTargets.GetSmallColorDepthDownsampleFactor();

		// Offsets of the four full resolution pixels corresponding with a low resolution pixel
		const FVector4 Offsets01(0.0f, 0.0f, 1.0f / DownsampledBufferSizeX, 0.0f);
		SetShaderValue(GetPixelShader(), SourceTexelOffsets01, Offsets01);
		const FVector4 Offsets23(0.0f, 1.0f / DownsampledBufferSizeY, 1.0f / DownsampledBufferSizeX, 1.0f / DownsampledBufferSizeY);
		SetShaderValue(GetPixelShader(), SourceTexelOffsets23, Offsets23);
		SceneTextureParameters.Set(GetPixelShader());
	}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:20,代码来源:DeferredShadingRenderer.cpp

示例14: SetParameters

	void SetParameters(FRHICommandList& RHICmdList, int32 CubeFaceValue, int32 NumMips, int32 SourceMipIndexValue, int32 CoefficientIndex, FTextureRHIRef& SourceTextureValue)
	{
		SetShaderValue(RHICmdList, GetPixelShader(), CubeFace, CubeFaceValue);
		SetShaderValue(RHICmdList, GetPixelShader(), SourceMipIndex, SourceMipIndexValue);

		SetTextureParameter(
			RHICmdList, 
			GetPixelShader(), 
			SourceTexture, 
			SourceTextureSampler, 
			TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI(), 
			SourceTextureValue);

		const int32 MipSize = 1 << (NumMips - SourceMipIndexValue - 1);
		const float HalfSourceTexelSize = .5f / MipSize;
		const FVector4 Sample01Value(-HalfSourceTexelSize, -HalfSourceTexelSize, HalfSourceTexelSize, -HalfSourceTexelSize);
		const FVector4 Sample23Value(-HalfSourceTexelSize, HalfSourceTexelSize, HalfSourceTexelSize, HalfSourceTexelSize);
		SetShaderValue(RHICmdList, GetPixelShader(), Sample01, Sample01Value);
		SetShaderValue(RHICmdList, GetPixelShader(), Sample23, Sample23Value);
	}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:20,代码来源:ReflectionEnvironmentDiffuseIrradiance.cpp

示例15: SetCS

    void SetCS(const FRenderingCompositePassContext& Context, FIntPoint ThreadGroupCountValue, FIntPoint LeftTopOffsetValue, FIntPoint GatherExtent)
    {
        const FComputeShaderRHIParamRef ShaderRHI = GetComputeShader();

        FGlobalShader::SetParameters(ShaderRHI, Context.View);

        PostprocessParameter.SetCS(ShaderRHI, Context, TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());

        SetShaderValue(ShaderRHI, ThreadGroupCount, ThreadGroupCountValue);
        SetShaderValue(ShaderRHI, LeftTopOffset, LeftTopOffsetValue);

        FVector4 HistogramParametersValue(GatherExtent.X, GatherExtent.Y, 0, 0);
        SetShaderValue(ShaderRHI, HistogramParameters, HistogramParametersValue);

        {
            FVector4 Temp[3];

            FRCPassPostProcessEyeAdaptation::ComputeEyeAdaptationParamsValue(Context.View, Temp);
            SetShaderValueArray(ShaderRHI, EyeAdaptationParams, Temp, 3);
        }
    }
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:21,代码来源:PostProcessHistogram.cpp


注:本文中的SetShaderValue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。