游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2681|回复: 2

[??][D3D]HLSL????cpp??uniform?????

[复制链接]

4

主题

14

帖子

14

积分

新手上路

Rank: 1

积分
14
发表于 2011-10-17 18:08:00 | 显示全部楼层 |阅读模式
??????shader???
PS_OUTPUT RenderScenePS( VS_OUTPUT In,
                         uniform bool bTexture )
{
    PS_OUTPUT Output;

    // Lookup mesh texture and modulate it with diffuse
    if( bTexture )
        Output.RGBColor = tex2D(MeshTextureSampler, In.TextureUV) * In.Diffuse;
    else
        Output.RGBColor = In.Diffuse;

    return Output;
}

?????cpp?? bTexture ???

0

主题

27

帖子

69

积分

注册会员

Rank: 2

积分
69
发表于 2011-10-18 17:19:00 | 显示全部楼层

Re:[??][D3D]HLSL????cpp??uniform?????

????????????????
1?????technique????Technique???2?pass???technique????bTexture????????????????????Technique?pass?
pass1
{
    VertexShader = vs();
    PixelShader = ps(true);
}
pass2
{
    VertexShader = vs();
    PixelShader = ps(false);
}
2?????????"g_bTexture"????Shader???????????g_bTexture?????????????
bool g_bTexture;
technique t
{
pass
{
    VertexShader = vs();
    PixelShader = ps(g_bTexture);
}
}

4

主题

14

帖子

14

积分

新手上路

Rank: 1

积分
14
 楼主| 发表于 2011-10-18 18:49:00 | 显示全部楼层

Re:[??][D3D]HLSL????cpp??uniform?????

??Luna~~?????????????????????????????cg??????????cpp???uniform??????????????hlsl????????
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-11-22 13:12

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表