码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:style   blog   http   color   width   2014   

第八章 第三题

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

标签:style   blog   http   color   width   2014   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!