随笔 - 132  文章 - 51  trackbacks - 0
<2012年1月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(7)

随笔分类

随笔档案

文章分类

文章档案

cocos2d-x

OGRE

OPenGL

搜索

  •  

最新评论

阅读排行榜

评论排行榜

/******************************************************************************
  Pixel shader that does multi texturing.
 *****************************************************************************
*/



struct sPixelInput
{
    float2 
base         : TEXCOORD0;
    float2 spotlight : TEXCOORD1;
    float2 text         : TEXCOORD2;
}
;

struct sPixelOutput
{
    vector diffuse : COLOR0;
}
;


texture Tex0;
texture Tex1;
texture Tex2;

sampler g_base_texture 
=
sampler_state
{
    Texture 
= <Tex0>;
    MipFilter 
= LINEAR;
    MinFilter 
= LINEAR;
    MagFilter 
= LINEAR;
}
;

sampler g_spotlight_texture 
=
sampler_state
{
    Texture 
= <Tex1>;
    MipFilter 
= LINEAR;
    MinFilter 
= LINEAR;
    MagFilter 
= LINEAR;
}
;

sampler g_string_texture 
=
sampler_state
{
    Texture 
= <Tex2>;
    MipFilter 
= LINEAR;
    MinFilter 
= LINEAR;
    MagFilter 
= LINEAR;
}
;

/////////////////////////////////////////////////////////////////////////////////

sPixelOutput main(sPixelInput input)
{
    sPixelOutput output 
= (sPixelOutput) 0;

    
// sample appropriate textures
    vector base_color       = tex2D(g_base_texture,        input.base);
    vector spotlight_color 
= tex2D(g_spotlight_texture, input.spotlight);
    vector text_color       
= tex2D(g_string_texture,    input.text);

    
// combine texel colors
    vector color = base_color * spotlight_color + text_color;

    
// increase the intensity of the pixel slightly
    color += 0.1f;

    
//PSMultiTextureDemo save the resulting pixel color
    output.diffuse = color;

    
return output;
}


下载:PSMultiTextureDemo
posted on 2012-01-07 16:31 风轻云淡 阅读(269) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理