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


C++ PixelShader类代码示例

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


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

示例1: VertexShader

//----------------------------------------------------------------------------
DefaultEffect::DefaultEffect ()
{
    VertexShader* vshader = new0 VertexShader("Wm5.Default",
        1, 1, 1, 0, false);
    vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
        Shader::VS_POSITION);
    vshader->SetOutput(0, "clipPosition",
        Shader::VT_FLOAT, Shader::VS_POSITION);
    vshader->SetConstant(0, "PVWMatrix", 4);
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);

    PixelShader* pshader = new0 PixelShader("Wm5.Default",
        1, 1, 0, 0, false);
    pshader->SetInput(0, "vertexTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetPrograms(msPPrograms);

    VisualPass* pass = new0 VisualPass();
    pass->SetVertexShader(vshader);
    pass->SetPixelShader(pshader);
    pass->SetAlphaState(new0 AlphaState());
    pass->SetCullState(new0 CullState());
    pass->SetDepthState(new0 DepthState());
    pass->SetOffsetState(new0 OffsetState());
    pass->SetStencilState(new0 StencilState());
    pass->SetWireState(new0 WireState());

    VisualTechnique* technique = new0 VisualTechnique();
    technique->InsertPass(pass);
    InsertTechnique(technique);
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:35,代码来源:Wm5DefaultEffect.cpp

示例2: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* Texture2ColorBlendEffect::CreateInstance (
    Texture2D* texture0, Texture2D* texture1) const
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetPixelTexture(0, 0, texture0);
    instance->SetPixelTexture(0, 1, texture1);

    PixelShader* pshader = GetPixelShader();

    Shader::SamplerFilter filter0 = pshader->GetFilter(0);
    if (filter0 != Shader::SF_NEAREST && filter0 != Shader::SF_LINEAR
    &&  !texture0->HasMipmaps())
    {
        texture0->GenerateMipmaps();
    }

    Shader::SamplerFilter filter1 = pshader->GetFilter(1);
    if (filter1 != Shader::SF_NEAREST && filter1 != Shader::SF_LINEAR
    &&  !texture1->HasMipmaps())
    {
        texture1->GenerateMipmaps();
    }

    return instance;
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:27,代码来源:Wm5Texture2ColorBlendEffect.cpp

示例3: GetMeshMaterialGOC

void GameObjectMaterialComponentsWidget::on_m_PSPropsButton_clicked()
{
	if(!m_IsReady)
	{
		return;
	}

	MeshMaterialGOC* meshMat = GetMeshMaterialGOC();

	if(meshMat == nullptr)
	{
		return;
	}

	PixelShader* ps = meshMat->GetPixelShaderResource();
	if(ps == nullptr)
	{
		return;
	}

	ShaderProperties* psProps = meshMat->GetPixelShaderProperties();

	GameObjectShaderPropsDialog shaderPropsDiag(meshMat->GetName(), ps->GetName(), m_GameApp->GetGameAssetManager(), psProps);

	shaderPropsDiag.exec();
}
开发者ID:dtbinh,项目名称:Arenal-Engine,代码行数:26,代码来源:GameObjectMaterialComponentsWidget.cpp

示例4: PixelShader

//----------------------------------------------------------------------------
void Smoke2D::CreateAdjustVelocityEffect (VisualEffect*& effect,
    VisualEffectInstance*& instance)
{
    PixelShader* pshader = new0 PixelShader("Wm5.AdjustVelocity2",
        1, 1, 1, 2, false);
    pshader->SetInput(0, "vertexTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetConstant(0, "SpaceParam", 1);
    pshader->SetSampler(0, "StateSampler", Shader::ST_2D);
    pshader->SetSampler(1, "PoissonSampler", Shader::ST_2D);
    pshader->SetBaseRegisters(msAdjustVelocityPRegisters);
    pshader->SetTextureUnits(msAdjustVelocityPTextureUnits);
    pshader->SetPrograms(msAdjustVelocityPPrograms);

    mIP->CreateEffect(pshader, effect, instance);

    ShaderFloat* spaceParamConstant = new0 ShaderFloat(1);
    float* spaceParam = spaceParamConstant->GetData();
    spaceParam[0] = mDx;
    spaceParam[1] = mDy;
    spaceParam[2] = mHalfDivDx;
    spaceParam[3] = mHalfDivDy;
    instance->SetPixelConstant(0, "SpaceParam", spaceParamConstant);

    instance->SetPixelTexture(0, "StateSampler",
        mIP->GetTarget(1)->GetColorTexture(0));
    instance->SetPixelTexture(0, "PoissonSampler",
        mIP->GetTarget(0)->GetColorTexture(0));
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例5: PostLink

//----------------------------------------------------------------------------
void LightAmbEffect::PostLink ()
{
	VisualEffect::PostLink();

	VisualPass* pass = mTechniques[0]->GetPass(0);
	VertexShader* vshader = pass->GetVertexShader();
	PixelShader* pshader = pass->GetPixelShader();
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);
	pshader->SetPrograms(msPPrograms);
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:12,代码来源:Wm5LightAmbEffect.cpp

示例6: VertexShader

//----------------------------------------------------------------------------
JunglerMaterial::JunglerMaterial ()
{
	VertexShader* vshader = new0 VertexShader("PX2.JunglerMaterial",
		3, 3, 8, 0, false);
	vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
		Shader::VS_POSITION);
	vshader->SetInput(1, "modelNormal", Shader::VT_FLOAT3,
		Shader::VS_NORMAL);
	vshader->SetInput(2, "modelTCoord0", Shader::VT_FLOAT2,
		Shader::VS_TEXCOORD0);

	vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
		Shader::VS_POSITION);
	vshader->SetOutput(1, "vertexTCoord0", Shader::VT_FLOAT2,
		Shader::VS_TEXCOORD0);
	vshader->SetOutput(2, "vertexTCoord1", Shader::VT_FLOAT4,
		Shader::VS_TEXCOORD1);

	vshader->SetConstant(0, "gPVWMatrix", 4);
	vshader->SetConstant(1, "gShineEmissive", 1);
	vshader->SetConstant(2, "gShineAmbient", 1);
	vshader->SetConstant(3, "gShineDiffuse", 1);
	vshader->SetConstant(4, "gLightColour", 1);
	vshader->SetConstant(5, "gLightAttenuation", 1);
	vshader->SetConstant(6, "gLightModelDirection", 1);
	vshader->SetConstant(7, "gUser", 1);
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);

	PixelShader* pshader = new0 PixelShader("PX2.JunglerMaterial",
		2, 1, 0, 1, false);
	pshader->SetInput(0, "vertexTCoord0", Shader::VT_FLOAT2,
		Shader::VS_TEXCOORD0);
	pshader->SetInput(1, "vertexTCoord1", Shader::VT_FLOAT4,
		Shader::VS_TEXCOORD1);
	pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
		Shader::VS_COLOR0);

	pshader->SetSampler(0, "gDiffuseSampler", Shader::ST_2D);
	pshader->SetFilter(0, Shader::SF_LINEAR);
	pshader->SetCoordinate(0, 0, Shader::SC_REPEAT);
	pshader->SetCoordinate(0, 1, Shader::SC_REPEAT);
	pshader->SetTextureUnits(msPTextureUnits);
	pshader->SetPrograms(msPPrograms);

	MaterialPass* pass = new0 MaterialPass();
	pass->SetVertexShader(vshader);
	pass->SetPixelShader(pshader);
	pass->SetAlphaProperty(new0 AlphaProperty());
	pass->SetCullProperty(new0 CullProperty());
	pass->SetDepthProperty(new0 DepthProperty());
	pass->SetOffsetProperty(new0 OffsetProperty());
	pass->SetStencilProperty(new0 StencilProperty());
	pass->SetWireProperty(new0 WireProperty());

	MaterialTechnique* technique = new0 MaterialTechnique();
	technique->InsertPass(pass);
	InsertTechnique(technique);
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:60,代码来源:PX2JunglerMaterial.cpp

示例7:

//----------------------------------------------------------------------------
void Texture2ColorBlendEffect::PostLink ()
{
    VisualEffect::PostLink();

    VisualPass* pass = mTechniques[0]->GetPass(0);
    VertexShader* vshader = pass->GetVertexShader();
    PixelShader* pshader = pass->GetPixelShader();
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);
    pshader->SetTextureUnits(msPTextureUnits);
    pshader->SetPrograms(msPPrograms);
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:13,代码来源:Wm5Texture2ColorBlendEffect.cpp

示例8: Texture2DEffect

//----------------------------------------------------------------------------
VisualEffectInstance* Texture2DEffect::CreateUniqueInstance (
    Texture2D* texture, Shader::SamplerFilter filter,
    Shader::SamplerCoordinate coordinate0,
    Shader::SamplerCoordinate coordinate1)
{
    Texture2DEffect* effect = new0 Texture2DEffect();
    PixelShader* pshader = effect->GetPixelShader();
    pshader->SetFilter(0, filter);
    pshader->SetCoordinate(0, 0, coordinate0);
    pshader->SetCoordinate(0, 1, coordinate1);
    return effect->CreateInstance(texture);
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:13,代码来源:Wm5Texture2DEffect.cpp

示例9: PostLink

//----------------------------------------------------------------------------
void JunglerMaterial::PostLink ()
{
	Material::PostLink();

	MaterialPass* pass = mTechniques[0]->GetPass(0);
	VertexShader* vshader = pass->GetVertexShader();
	PixelShader* pshader = pass->GetPixelShader();
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);
	pshader->SetTextureUnits(msPTextureUnits);
	pshader->SetPrograms(msPPrograms);
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:13,代码来源:PX2JunglerMaterial.cpp

示例10: VisualEffect

//----------------------------------------------------------------------------
DLitMatTexEffect::DLitMatTexEffect (const std::string& effectFile)
    :
    VisualEffect(effectFile)
{
    // TODO:  Once WmfxCompiler parses the Cg FX files, we will not need to
    // set the sampler state.
    PixelShader* pshader = GetPixelShader(0, 0);

    // DiffuseSampler
    pshader->SetFilter(0, Shader::SF_LINEAR_LINEAR);
    pshader->SetCoordinate(0, 0, Shader::SC_REPEAT);
    pshader->SetCoordinate(0, 1, Shader::SC_REPEAT);
}
开发者ID:rasslingcats,项目名称:calico,代码行数:14,代码来源:DLitMatTexEffect.cpp

示例11: VisualEffect

//----------------------------------------------------------------------------
SMBlurEffect::SMBlurEffect (const std::string& effectFile)
    :
    VisualEffect(effectFile)
{
    // TODO:  Once WmfxCompiler parses the Cg FX files, we will not need to
    // set the sampler state.
    PixelShader* pshader = GetPixelShader(0, 0);

    // BaseSampler
    pshader->SetFilter(0, Shader::SF_LINEAR);
    pshader->SetCoordinate(0, 0, Shader::SC_CLAMP_EDGE);
    pshader->SetCoordinate(0, 1, Shader::SC_CLAMP_EDGE);
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例12: FindPixelShaderRaii

//==============================================================================
PixelShader * CGraphicsMgr::LoadPixelShader (
    const std::wstring & name,
    const std::wstring & filepath,
    const std::string &  entryFunction
) {

    PixelShader * shader = FindPixelShaderRaii(name);
    
    if (!shader->Compile(name, filepath, entryFunction))
        return NULL;

    return shader;

}
开发者ID:Akaito,项目名称:codesaru-environ_src_csaru-dx11_graphics-cpp,代码行数:15,代码来源:GraphicsMgr.cpp

示例13: main

int
main (int argc, char **argv)
{
	cairo_t *cr;
	cairo_surface_t *dst, *src;
	CustomEffect *effect;
	PixelShader *shader;
	int stride = width * 4;
        Rect bounds = Rect (0, 0, width, height);
	gpointer data;
	bool status;

	if (argc < 2) {
		printf ("usage: %s SHADERFILE\n", argv[0]);
		return 1;
	}

	gtk_init (&argc, &argv);

	runtime_init_desktop ();

	data = g_malloc0 (height * stride);
        dst = cairo_image_surface_create_for_data ((unsigned char *) data,
                                                   CAIRO_FORMAT_ARGB32,
                                                   width, height, stride);
	src = cairo_surface_create_similar (dst,
					    CAIRO_CONTENT_COLOR_ALPHA,
					    width, height);
        cr = cairo_create (dst);

	effect = new CustomEffect ();
	shader = new PixelShader ();

	shader->SetTokensFromPath (argv[1]);
	effect->SetPixelShader (shader);

	status = effect->Render (cr, src, NULL, 0, 0, width, height);

	effect->unref ();
	shader->unref ();

        cairo_destroy (cr);
	cairo_surface_destroy (src);
	cairo_surface_destroy (dst);
	g_free (data);

	runtime_shutdown ();

	return status != true;
}
开发者ID:lewing,项目名称:moon,代码行数:50,代码来源:effect-test.cpp

示例14: setPixelShader

void PipelineStateCache::setPixelShader(const PixelShader& pixelShader)
{
  // FIXME: cache this
  ID3D11Buffer* const* constantBuffers;
  uint32 numConstantBuffers = pixelShader.queryBuffersArray(constantBuffers);
  m_deviceContext->PSSetConstantBuffers(0, numConstantBuffers, constantBuffers);

  ID3D11PixelShader* shaderResourcePtr = pixelShader.getResourcePtr();
  if (shaderResourcePtr != m_currentPixelShader)
  {
    m_currentPixelShader = shaderResourcePtr;
    m_deviceContext->PSSetShader(shaderResourcePtr, NULL, 0);
  }
}
开发者ID:D13David,项目名称:Framework,代码行数:14,代码来源:RenderSystem.cpp

示例15: VertexShader

//----------------------------------------------------------------------------
LightPntPerVerEffect::LightPntPerVerEffect ()
{
    VertexShader* vshader = new0 VertexShader("Wm5.LightPntPerVer",
        2, 2, 12, 0, false);
    vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
        Shader::VS_POSITION);
    vshader->SetInput(1, "modelNormal", Shader::VT_FLOAT3,
        Shader::VS_NORMAL);
    vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
        Shader::VS_POSITION);
    vshader->SetOutput(1, "vertexColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    vshader->SetConstant(0, "PVWMatrix", 4);
    vshader->SetConstant(1, "WMatrix", 4);
    vshader->SetConstant(2, "CameraModelPosition", 1);
    vshader->SetConstant(3, "MaterialEmissive", 1);
    vshader->SetConstant(4, "MaterialAmbient", 1);
    vshader->SetConstant(5, "MaterialDiffuse", 1);
    vshader->SetConstant(6, "MaterialSpecular", 1);
    vshader->SetConstant(7, "LightModelPosition", 1);
    vshader->SetConstant(8, "LightAmbient", 1);
    vshader->SetConstant(9, "LightDiffuse", 1);
    vshader->SetConstant(10, "LightSpecular", 1);
    vshader->SetConstant(11, "LightAttenuation", 1);
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);

    PixelShader* pshader = new0 PixelShader("Wm5.LightPntPerVer",
        1, 1, 0, 0, false);
    pshader->SetInput(0, "vertexColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetPrograms(msPPrograms);

    VisualPass* pass = new0 VisualPass();
    pass->SetVertexShader(vshader);
    pass->SetPixelShader(pshader);
    pass->SetAlphaState(new0 AlphaState());
    pass->SetCullState(new0 CullState());
    pass->SetDepthState(new0 DepthState());
    pass->SetOffsetState(new0 OffsetState());
    pass->SetStencilState(new0 StencilState());
    pass->SetWireState(new0 WireState());

    VisualTechnique* technique = new0 VisualTechnique();
    technique->InsertPass(pass);
    InsertTechnique(technique);
}
开发者ID:rasslingcats,项目名称:calico,代码行数:50,代码来源:Wm5LightPntPerVerEffect.cpp


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