• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VisualPass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mEffect

//----------------------------------------------------------------------------
VisualEffectInstance::VisualEffectInstance (const VisualEffect* effect,
    int techniqueIndex)
    :
    mEffect((VisualEffect*)effect),  // conceptual constness
    mTechniqueIndex(techniqueIndex)
{
    assertion(effect != 0, "Effect must be specified.\n");
    assertion(
        0 <= techniqueIndex && techniqueIndex < effect->GetNumTechniques(),
        "Invalid technique index.\n");

    VisualTechnique* technique = mEffect->GetTechnique(mTechniqueIndex);
    mNumPasses = technique->GetNumPasses();
    mVertexParameters = new1<ShaderParametersPtr>(mNumPasses);
    mPixelParameters = new1<ShaderParametersPtr>(mNumPasses);
    int p;
    for (p = 0; p < mNumPasses; ++p)
    {
        VisualPass* pass = technique->GetPass(p);
        mVertexParameters[p] =
            new0 ShaderParameters(pass->GetVertexShader());
        mPixelParameters[p] =
            new0 ShaderParameters(pass->GetPixelShader());
    }
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:26,代码来源:Wm5VisualEffectInstance.cpp


示例2: 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


示例3: 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


示例4:

//----------------------------------------------------------------------------
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


示例5: VertexShader

//----------------------------------------------------------------------------
LightSptPerPixEffect::LightSptPerPixEffect ()
{
    VertexShader* vshader = new0 VertexShader("Wm5.LightSptPerPix",
        2, 3, 1, 0, false);
    vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
        Shader::VS_POSITION);
    vshader->SetInput(1, "modelNormal", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD1);
    vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
        Shader::VS_POSITION);
    vshader->SetOutput(1, "vertexPosition", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD0);
    vshader->SetOutput(2, "vertexNormal", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD1);
    vshader->SetConstant(0, "PVWMatrix", 4);
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);

    PixelShader* pshader = new0 PixelShader("Wm5.LightSptPerPix",
        2, 1, 13, 0, false);
    pshader->SetInput(0, "vertexPosition", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD0);
    pshader->SetInput(1, "vertexNormal", Shader::VT_FLOAT3,
        Shader::VS_TEXCOORD1);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetConstant(0, "WMatrix", 4);
    pshader->SetConstant(1, "CameraModelPosition", 1);
    pshader->SetConstant(2, "MaterialEmissive", 1);
    pshader->SetConstant(3, "MaterialAmbient", 1);
    pshader->SetConstant(4, "MaterialDiffuse", 1);
    pshader->SetConstant(5, "MaterialSpecular", 1);
    pshader->SetConstant(6, "LightModelPosition", 1);
    pshader->SetConstant(7, "LightModelDirection", 1);
    pshader->SetConstant(8, "LightAmbient", 1);
    pshader->SetConstant(9, "LightDiffuse", 1);
    pshader->SetConstant(10, "LightSpecular", 1);
    pshader->SetConstant(11, "LightSpotCutoff", 1);
    pshader->SetConstant(12, "LightAttenuation", 1);
    pshader->SetBaseRegisters(msPRegisters);
    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,代码行数:57,代码来源:Wm5LightSptPerPixEffect.cpp


示例6: VertexShader

//----------------------------------------------------------------------------
VertexColor4TextureEffect::VertexColor4TextureEffect (
    Shader::SamplerFilter filter, Shader::SamplerCoordinate coordinate0,
    Shader::SamplerCoordinate coordinate1)
{
    VertexShader* vshader = new0 VertexShader("Wm5.VertexColorTexture",
        3, 3, 1, 0, false);
    vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
        Shader::VS_POSITION);
    vshader->SetInput(1, "modelTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    vshader->SetInput(2, "modelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
        Shader::VS_POSITION);
    vshader->SetOutput(1, "vertexTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    vshader->SetOutput(2, "vertexColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    vshader->SetConstant(0, "PVWMatrix", 4);
    vshader->SetBaseRegisters(msVRegisters);
    vshader->SetPrograms(msVPrograms);

    PixelShader* pshader = new0 PixelShader("Wm5.VertexColorTexture",
        2, 1, 0, 1, false);
    pshader->SetInput(0, "vertexColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetInput(1, "vertexTCoord", Shader::VT_FLOAT2,
        Shader::VS_TEXCOORD0);
    pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
        Shader::VS_COLOR0);
    pshader->SetSampler(0, "BaseSampler", Shader::ST_2D);
    pshader->SetFilter(0, filter);
    pshader->SetCoordinate(0, 0, coordinate0);
    pshader->SetCoordinate(0, 1, coordinate1);
    pshader->SetTextureUnits(msPTextureUnits);
    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:Kiichi77,项目名称:WildMagic,代码行数:52,代码来源:Wm5VertexColor4TextureEffect.cpp


示例7: VisualPass

//----------------------------------------------------------------------------
bool FxCompiler::CreateEffect (const Program& vProgram,
    const Program& pProgram)
{
    InputArray vInputs, pInputs;
    OutputArray vOutputs, pOutputs;
    ConstantArray vConstants, pConstants;
    SamplerArray vSamplers, pSamplers;

    if (!Process(vProgram, vInputs, vOutputs, vConstants, vSamplers))
    {
        return false;
    }

    if (!Process(pProgram, pInputs, pOutputs, pConstants, pSamplers))
    {
        return false;
    }

    mVShader = (VertexShader*)CreateShader(true, vProgram, vInputs, vOutputs,
        vConstants, vSamplers);

    mPShader = (PixelShader*)CreateShader(false, pProgram, pInputs, pOutputs,
        pConstants, pSamplers);

    VisualPass* pass = new0 VisualPass();
    pass->SetVertexShader(mVShader);
    pass->SetPixelShader(mPShader);

    // TODO.  Once Cg FX files are parsed, the global state from each pass
    // should be set here.  For now, the application is responsible for
    // setting the global state after the *.wmfx file is loaded.
    pass->SetAlphaState(new0 AlphaState());
    pass->SetCullState(new0 CullState());
    pass->SetDepthState(new0 DepthState());
    pass->SetOffsetState(new0 OffsetState());
    pass->SetStencilState(new0 StencilState());
    pass->SetWireState(new0 WireState());

    // TODO.  Once Cg FX files are parsed, we might have multiple techniques
    // or multiple passes per technique.
    VisualTechnique* technique = new0 VisualTechnique();
    technique->InsertPass(pass);

    mEffect = new0 VisualEffect();
    mEffect->InsertTechnique(technique);
    return true;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:48,代码来源:FxCompiler.cpp


示例8: VertexShader

//----------------------------------------------------------------------------
LightAmbEffect::LightAmbEffect ()
{
	VertexShader* vshader = new0 VertexShader("Wm5.LightAmb",
	                        1, 2, 5, 0, false);
	vshader->SetInput(0, "modelPosition", Shader::VT_FLOAT3,
	                  Shader::VS_POSITION);
	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, "MaterialEmissive", 1);
	vshader->SetConstant(2, "MaterialAmbient", 1);
	vshader->SetConstant(3, "LightAmbient", 1);
	vshader->SetConstant(4, "LightAttenuation", 1);
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);

	PixelShader* pshader = new0 PixelShader("Wm5.LightAmb",
	                                        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:bazhenovc,项目名称:WildMagic,代码行数:41,代码来源:Wm5LightAmbEffect.cpp


示例9: VertexShader

//----------------------------------------------------------------------------
VisualEffectInstance* GeodesicHeightField::CreateEffectInstance ()
{
	// Create the vertex shader.
	VertexShader* vshader = new0 VertexShader("Wm5.DLight2MatTex",
	                        3, 3, 16, 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, "modelTCoord", Shader::VT_FLOAT2,
	                  Shader::VS_TEXCOORD0);
	vshader->SetOutput(0, "clipPosition", Shader::VT_FLOAT4,
	                   Shader::VS_POSITION);
	vshader->SetOutput(1, "vertexColor", Shader::VT_FLOAT4,
	                   Shader::VS_COLOR0);
	vshader->SetOutput(2, "vertexTCoord", Shader::VT_FLOAT2,
	                   Shader::VS_TEXCOORD0);
	vshader->SetConstant( 0, "PVWMatrix", 4);
	vshader->SetConstant( 1, "CameraModelPosition", 1);
	vshader->SetConstant( 2, "MaterialEmissive", 1);
	vshader->SetConstant( 3, "MaterialAmbient", 1);
	vshader->SetConstant( 4, "MaterialDiffuse", 1);
	vshader->SetConstant( 5, "MaterialSpecular", 1);
	vshader->SetConstant( 6, "Light0ModelDirection", 1);
	vshader->SetConstant( 7, "Light0Ambient", 1);
	vshader->SetConstant( 8, "Light0Diffuse", 1);
	vshader->SetConstant( 9, "Light0Specular", 1);
	vshader->SetConstant(10, "Light0Attenuation", 1);
	vshader->SetConstant(11, "Light1ModelDirection", 1);
	vshader->SetConstant(12, "Light1Ambient", 1);
	vshader->SetConstant(13, "Light1Diffuse", 1);
	vshader->SetConstant(14, "Light1Specular", 1);
	vshader->SetConstant(15, "Light1Attenuation", 1);
	vshader->SetBaseRegisters(msVRegisters);
	vshader->SetPrograms(msVPrograms);

	// Create the pixel shader.
	PixelShader* pshader = new0 PixelShader("Wm5.DLight2MatTex",
	                                        2, 1, 0, 1, false);
	pshader->SetInput(0, "vertexColor", Shader::VT_FLOAT4,
	                  Shader::VS_COLOR0);
	pshader->SetInput(1, "vertexTCoord", Shader::VT_FLOAT2,
	                  Shader::VS_TEXCOORD0);
	pshader->SetOutput(0, "pixelColor", Shader::VT_FLOAT4,
	                   Shader::VS_COLOR0);
	pshader->SetSampler(0, "BaseSampler", Shader::ST_2D);
	pshader->SetFilter(0, Shader::SF_LINEAR /*_LINEAR */);
	pshader->SetCoordinate(0, 0, Shader::SC_CLAMP_EDGE);
	pshader->SetCoordinate(0, 1, Shader::SC_CLAMP_EDGE);
	pshader->SetTextureUnits(msPTextureUnits);
	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());

	// Create the effect.
	VisualTechnique* technique = new0 VisualTechnique();
	technique->InsertPass(pass);
	VisualEffect* effect = new0 VisualEffect();
	effect->InsertTechnique(technique);

	// Create the material for the effect.
	Float4 black(0.0f, 0.0f, 0.0f, 1.0f);
	Float4 white(1.0f, 1.0f, 1.0f, 1.0f);
	Material* material = new0 Material();
	material->Emissive = black;
	material->Ambient = Float4(0.24725f, 0.2245f, 0.0645f, 1.0f);
	material->Diffuse = Float4(0.34615f, 0.3143f, 0.0903f, 1.0f);
	material->Specular = Float4(0.797357f, 0.723991f, 0.208006f, 83.2f);

	// Create the lights for the effect.
	Light* light0 = new0 Light(Light::LT_DIRECTIONAL);
	light0->SetDirection(AVector(0.0f, 0.0f, -1.0f));
	light0->Ambient = white;
	light0->Diffuse = white;
	light0->Specular = black;

	Light* light1 = new0 Light(Light::LT_DIRECTIONAL);
	light1->SetDirection(AVector(0.0f, 0.0f, 1.0f));
	light1->Ambient = white;
	light1->Diffuse = white;
	light1->Specular = black;

	// Create a texture for the effect.
	mTexture = new0 Texture2D(Texture::TF_A8R8G8B8, 512, 512, 0);
	unsigned char* data = (unsigned char*)mTexture->GetData(0);
	memset(data, 0xFF, mTexture->GetNumLevelBytes(0));

	// Create an instance of the effect.
	VisualEffectInstance* instance = new0 VisualEffectInstance(effect, 0);
	instance->SetVertexConstant(0, 0,
	                            new0 PVWMatrixConstant());
//.........这里部分代码省略.........
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:101,代码来源:GeodesicHeightField.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VisualServer类代码示例发布时间:2022-05-31
下一篇:
C++ VisualNode类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap