Direct3D Samples 阅读笔记之 BasicHLSL
来源:互联网 发布:中银淘宝信用卡怎么样 编辑:程序博客网 时间:2024/06/05 11:52
BasicHLSL Sample
Overview: This sample simply loads a mesh, creates an effect from a file, and then uses the effect to render the mesh. The effect that is used is a simple vertex shader that animates the vertices based time.
要点:
回调函数OnFrameRender()中。
1. 清除renderTarget和zbuffer.
2. 绘制场景:pd3dDevice->BeginScene();
{
1. 计算MVP矩阵;
2. 绘制指示光线方向的箭头,同时从UI控件中获取参数:光线方向 和 diffuse color;
3. 将 光线方向、diffuse color、MVP、M、Time、Material Diffuse Color传入shader.
4. 根据开启光线的数目选择相应的technique.
5. 应用technique:
{
1. g_pEffect->Begin() 获取pass数目
2. from 0 to passNum
g_pEffect->BeginPass( i );
g_pMesh->DrawSubset(0);
g_pEffect->EndPass();
}
3. g_pEffect->End();
}
3. 结束绘制:pd3dDevice->EndScene()
----------------------------------------------------------------
fx文件:
vertex shader: This shader computes standard transform and lighting.
1. 基于时间和法线方向计算模型空间中顶点偏移后的位置;
2. 变换顶点坐标到齐次投影空间;
3. 变换法向量到世界空间;
4. 计算平行光照;
5. 传uv
pixel shader
1. 纹理查询
2. 计算最终输出颜色
- Direct3D Samples 阅读笔记之 BasicHLSL
- Direct3D Samples 阅读笔记之 SimpleSample
- D3D9 Samples(9)--BasicHLSL
- DirectX9 SDK Samples(8) BasicHLSL Sample(1)
- DirectX9 SDK Samples(8) BasicHLSL Sample(2)
- 【阅读笔记之三】《DIRECTX.9.0.3D游戏开发编程基础》:Direct3D初始化
- 【阅读笔记之五】《DIRECTX.9.0.3D游戏开发编程基础》Direct3D中的绘制
- 【阅读笔记之六】《DIRECTX.9.0.3D游戏开发编程基础》:Direct3D中的颜色
- 【阅读笔记之七】《DIRECTX.9.0.3D游戏开发编程基础》:Direct3D中的光照
- 【阅读笔记之九】《DIRECTX.9.0.3D游戏开发编程基础》:Direct3D中的融合技术
- Java SE Demos and Samples 阅读笔记(1.1 db)
- 【阅读笔记之八】《DIRECTX.9.0.3D游戏开发编程基础》:Direct3D中的纹理与映射
- DirectX 11游戏编程学习笔记之5: 第4章Direct3D Initialization(Direct3D初始化)
- Direct3D 9 SDK阅读理解
- DirectX11笔记(二)--Direct3D初始化1之基本概念
- 【阅读笔记】关于Direct3D初始化的一个完整工程及介绍
- Android Samples 之 basicsyncadapter
- Android Samples之 AlarmManager
- Android 里的Intent是什么意思
- Linux内存映射
- java 树
- 寒假怎么过
- EditPlus快捷键
- Direct3D Samples 阅读笔记之 BasicHLSL
- Oracle常用命令自备
- HTML5 Canvas
- Shape组简介(翻译)
- OpenGLES - glBindTexture 绑定纹理缓存到纹理单元
- 第二篇、java入门之流程控制语句
- XCode学习随笔03--iOS界面-抽屉式交互
- 高并发系统数据库设计
- poj 2752 Seek the Name, Seek the Fame