当前位置: 首页 > news >正文

wordpress网站搬迁触屏版网站开发样式

wordpress网站搬迁,触屏版网站开发样式,东莞赶集网最新招聘信息,如何建设学校的微网站首页【转】Direct3D顶点结构使用总结 D3D里面最基本的就是顶点了#xff0c;虽说一直在用#xff0c;可是却也是自己比较模糊的一个点#xff0c;知道其中的意思#xff0c;却不是很清楚#xff0c;今天就总结一下#xff0c;扫一下这个盲区#xff1a; D3D中的顶点缓冲区的… 【转】Direct3D顶点结构使用总结 D3D里面最基本的就是顶点了虽说一直在用可是却也是自己比较模糊的一个点知道其中的意思却不是很清楚今天就总结一下扫一下这个盲区 D3D中的顶点缓冲区的声明 LPDIRECT3DVERTEXBUFFER9 g_pVB        NULL;    //顶点缓冲区对象 通常都是用LPDIRECT3DVERTEXBUFFER9 来声明顶点缓冲区它其实就是IDirect3DVertexBuffer9的指针类型这两个起到的效果是一样的。用LPDIRECT3DVERTEXBUFFER9 声明之后只是镇定了一个缓冲区的指针下面还需要开辟一个缓冲区给这个指针。 在开辟真正的内存之前我们先看一下顶点格式的定义D3D里面是采用的灵活顶点格式这点大家应该都是知道的下面就来总结一下这些灵活顶点格式都具体有哪些有什么用处。 一般定义顶点结构的时候都是用一个结构体当然用类去定义也可以但是一般没有那个必要。 struct CUSTOMVERTEX {     FLOAT x, y, z, rhw;     DWORD color; }; 在还需要定义一个宏来向D3D说明一下自己定义的顶点的格式到底有哪些。 #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)  //顶点格式 上面这一句话的意思就是定义的顶点结构包含位置变换信息D3DFVF_XYZRHW和漫反射颜色信息D3DFVF_DIFFUSE 那么一共都有哪些类型可以定义呢都有什么样的用呢。   ---------------------------------------------------------------------------------------------------------------------------------------   Vertex Data Flags #defineDescriptionData order and typeD3DFVF_DIFFUSEVertex format includes a diffuse color component.DWORD in ARGB order. See D3DCOLOR_ARGB.D3DFVF_NORMALVertex format includes a vertex normal vector. This flag cannot be used with the D3DFVF_XYZRHW flag.float, float, floatD3DFVF_PSIZEVertex format specified in point size. This size is expressed in camera space units for vertices that are not transformed and lit, and in device-space units for transformed and lit vertices.floatD3DFVF_SPECULARVertex format includes a specular color component.DWORD in ARGB order. See D3DCOLOR_ARGB.D3DFVF_XYZVertex format includes the position of an untransformed vertex. This flag cannot be used with the D3DFVF_XYZRHW flag.float, float, float.D3DFVF_XYZRHWVertex format includes the position of a transformed vertex. This flag cannot be used with the D3DFVF_XYZ or D3DFVF_NORMAL flags.float, float, float, float.D3DFVF_XYZB1 through D3DFVF_XYZB5Vertex format contains position data, and a corresponding number of weighting (beta) values to use for multimatrix vertex blending operations. Currently, Direct3D can blend with up to three weighting values and four blending matrices. For more information about using blending matrices, see Indexed Vertex Blending (Direct3D 9). 1, 2, or 3 floats. When D3DFVF_LASTBETA_UBYTE4 is used, the last blending weight is treated as a DWORD.D3DFVF_XYZWVertex format contains transformed and clipped (x, y, z, w) data. ProcessVertices does not invoke the clipper, instead outputting data in clip coordinates. This constant is designed for, and can only be used with, the programmable vertex pipeline.float, float, float, float  Texture Flags   #defineDescriptionD3DFVF_TEX0 - D3DFVF_TEX8Number of texture coordinate sets for this vertex. The actual values for these flags are not sequential.D3DFVF_TEXCOORDSIZEN(coordIndex)Define a texture coordinate data set. n indicates the dimension of the texture coordinates. coordIndex indicates texture coordinate index number. See D3DFVF_TEXCOORDSIZEN and Texture coordinates and Texture Stages.  Mask Flags   #defineDescriptionD3DFVF_POSITION_MASKMask for position bits.D3DFVF_RESERVED0, D3DFVF_RESERVED2Mask values for reserved bits in the FVF. Do not use.D3DFVF_TEXCOUNT_MASKMask value for texture flag bits.  Miscellaneous Flags   #defineDescriptionD3DFVF_LASTBETA_D3DCOLORThe last beta field in the vertex position data will be of type D3DCOLOR. The data in the beta fields are used with matrix palette skinning to specify matrix indices.D3DFVF_LASTBETA_UBYTE4The last beta field in the vertex position data will be of type UBYTE4. The data in the beta fields are used with matrix palette skinning to specify matrix indices. // Given the following vertex data definition: struct VERTEXPOSITION {float pos[3];union {float beta[5];struct{float weights[4];DWORD MatrixIndices; // Used as UBYTEs}} };Given the FVF is declared as: D3DFVF_XYZB5 | D3DFVF_LASTBETA_UBYTE4. Weight and MatrixIndices are included in beta[5], where D3DFVF_LASTBETA_UBYTE4 says to interpret the last DWORD in beta[5] as type UBYTE4. D3DFVF_TEXCOUNT_SHIFTThe number of bits by which to shift an integer value that identifies the number of texture coordinates for a vertex. This value might be used as shown below. DWORD dwNumTextures 1; // Vertex has only one set of coordinates.// Shift the value for use when creating a // flexible vertex format (FVF) combination. dwFVF dwNumTextures D3DFVF_TEXCOUNT_SHIFT;// Now, create an FVF combination using the shifted value.   Examples The following examples show other common flag combinations. // Untransformed vertex for lit, untextured, Gouraud-shaded content. dwFVF ( D3DFVF_XYZ | D3DFVF_DIFFUSE );// Untransformed vertex for unlit, untextured, Gouraud-shaded // content with diffuse material color specified per vertex. dwFVF ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE );// Untransformed vertex for light-map-based lighting. dwFVF ( D3DFVF_XYZ | D3DFVF_TEX2 );// Transformed vertex for light-map-based lighting with shared rhw. dwFVF ( D3DFVF_XYZRHW | D3DFVF_TEX2 );// Heavyweight vertex for unlit, colored content with two // sets of texture coordinates. dwFVF ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2 );------------------------------------------------------------------------------------------------------------------     在顶点结构体中没有RHW时Direct3D将执行视、投影、世界等变换以及进行光线计算之后你才能在窗口中得到你所绘制的物体。当顶点结构体中有RHW时就像上面那段英文所述告知Direct3D使用的顶点已经在屏幕坐标系中了不再执行视图、投影、世界等变换和光线计算因为D3DFVF_XYZRHW标志告诉它顶点已经经过了这些处理并直接将顶点进行光栅操作任何用SetTransform进行的转换都对其无效。不过这时的原点就在客户区的左上角了其中x向右为正y向下为正而z的意义已经变为z-buffer的象素深度。     值得注意的是D3DFVF_XYZRHW和D3DFVF_XYZ、D3DFVF_NORMAL不能共存因为后两个标志与前一个矛盾。在使用这种顶点时系统需要顶点的位置已经经过变换了也就是说x、y必须在屏幕坐标系中z必须是z-buffer中的象素深度取值范围0.01.0离观察者最近的地方为0.0观察范围内最远可见的地方为1.0。(不过我测试的时候似乎z值不起作用。)引自http://www.cppblog.com/lovedday/archive/2009/03/22/48507.html 在定义完顶点格式以后就要开辟一块顶点缓冲区 g_pd3dDevice-CreateVertexBuffer( 3*sizeof(CUSTOMVERTEX),                                                   0, D3DFVF_CUSTOMVERTEX,                                                   D3DPOOL_DEFAULT, g_pVB, NULL ) 开辟缓冲区后就需要对这个缓冲区进行填写那么填写的数据呢也需要先指定出来 CUSTOMVERTEX vertices[]     { { 100.0f, 400.0f, 0.5f, 1.0f, 0xffff0000, },         { 300.0f,  50.0f, 0.5f, 1.0f, 0xff00ff00, },         { 500.0f, 400.0f, 0.5f, 1.0f, 0xff0000ff, },     }; 然后将数据写入缓冲区 VOID* pVertices;     if( FAILED( g_pVB-Lock( 0, sizeof(vertices), (void**)pVertices, 0 ) ) )         return E_FAIL;     memcpy( pVertices, vertices, sizeof(vertices) );     g_pVB-Unlock();   posted on 2012-10-29 17:37 Lilac_F 阅读(...) 评论(...) 编辑 收藏 转载于:https://www.cnblogs.com/Lilac-F/archive/2012/10/29/2745128.html
http://www.zqtcl.cn/news/272827/

相关文章:

  • 电商网站有哪些淘宝运营培训班哪里有
  • 网站开发网站制作太原优化排名推广
  • 佛山市网站开发桥西区建设局网站
  • 怎么制作网站应用云主机上传wordpress
  • flash网站代做马鞍山网站建设制作公司
  • 温州网站的优化wordpress 注册邮箱验证失败
  • php网站开发实例视频教程宁波seo运营推广平台排名
  • 网络营销网站开发设计公司网站推广营销
  • 2015年做那个网站致富wordpress最新模板
  • 做网站开发平台北京广告公司有哪些
  • 郑州企业建站系统模板兰州需要做网站的公司有哪些
  • 怎样做网站卖东西 自己有货句容网络公司
  • 网站建设协议书 保密条款免费发布推广的网站
  • 网站首页外链上海网站建设联系方式
  • 陕西网站建设优化技术2023年1月热点新闻事件
  • 广东省建设银行招聘网站免费搭建个人网站
  • 知名商城网站建设公司wordpress主题 汉化
  • 网站上线做什么pc网站如何做移动适配
  • wap网站搭建北京北京网站建设
  • 放心的网站设计制作免费做logo设计的网站
  • 温州专业手机网站制作多少钱移动商城 网站建设方法方式
  • 周口网站开发wordpress
  • 如何查网站的备案号玉环在哪里做网站
  • 网站开发什么叫前端后端seo研究中心晴天
  • 邢台建筑类的建设网站代刷网站只做软件下载
  • 关于旅游的网站建设目的食品网站建设的目的
  • 开发php网站开发太湖网站建设推荐秒搜科技
  • 90设计网站怎么绑定手机号淘宝搜索排名
  • 无锡自助做网站哪些编程语言适合网站开发
  • 蒲城网站建设wzjseo北京专业推广公司