首页 > 其他 > 详细

3D Game Programming with directx 11 习题答案 8.3

时间:2014-07-13 08:02:49      阅读:424      评论:0      收藏:0      [点我收藏+]

第八章 第三题

1、将flare.dds和flarealpha.dds拷贝到工程目录

2、创建shader resource view

HR(D3DX11CreateShaderResourceViewFromFile(md3dDevice,
    L"Textures/flare.dds", 0, 0, &mFlareSRV, 0));
 
HR(D3DX11CreateShaderResourceViewFromFile(md3dDevice,
    L"Textures/flarealpha.dds", 0, 0, &mFlareAlphaSRV, 0));

3、在Basic.fx中添加纹理

Texture2D gFlare;
Texture2D gFlareAlpha;

4、设置纹理

Flare              = mFX->GetVariableByName("gFlare")->AsShaderResource();
FlareAlpha          = mFX->GetVariableByName("gFlareAlpha")->AsShaderResource();

5、在Basic.fx中将两个texel的值相乘(component-wise multiply)

float4 flareTex = gFlare.Sample(samAnisotropic, pin.Tex);
float4 flareAlphaTex = gFlareAlpha.Sample(samAnisotropic, pin.Tex);
texColor = flareTex * flareAlphaTex;

6、搞定

bubuko.com,布布扣

3D Game Programming with directx 11 习题答案 8.3,布布扣,bubuko.com

3D Game Programming with directx 11 习题答案 8.3

原文:http://www.cnblogs.com/KEGame/p/3838073.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!