D3D9学习笔记(八) .x file

8.1 load

  1. Use the DirectXFileCreate function to create
    an IDirectXFile object.
  2. If templates are present in the DirectX file that you will load, use the
    IDirectXFile::RegisterTemplates method to register those templates.
  3. Use the IDirectXFile::CreateEnumObject method
    to create an IDirectXFileEnumObject enumerator object.
  4. Loop through the objects in the file. For each object, perform the following steps.
    1. Use the IDirectXFileEnumObject::GetNextDataObject
      method to retrieve each IDirectXFileData object.
    2. Use the IDirectXFileData::GetType method to
      retrieve the data's type.
    3. Load the data using the
      IDirectXFileData::GetData method.
    4. If the object has optional members, retrieve the optional members by calling the
      IDirectXFileData::GetNextObject method.
    5. Release the IDirectXFileData object.
  5. Release the IDirectXFileEnumObject object.
  6. Release the IDirectXFile object.

8.2 save

  1. Use the DirectXFileCreate function to create
    an IDirectXFile object.
  2. Use the IDirectXFile::RegisterTemplates method
    to inform the DirectX file system about any templates that you will use.
  3. Use the IDirectXFile::CreateSaveObject method
    to create an IDirectXFileSaveObject object.
  4. Use the IDirectXFileSaveObject::SaveTemplates
    method to save templates, if desired.
  5. Loop through the objects to save. For each top-level object, perform the following steps.

o    Use the
IDirectXFileSaveObject::CreateDataObject method to create an
IDirectXFileData object as a top-level object in the file. If the top-level data object has optional
child objects, add them to the object by using the appropriate method from the next step.

o    Each
IDirectXFileData object can have optional child objects if its template allows it. The child objects can
be any of the three types of objects: IDirectXFileData,
IDirectXFileDataReference, or
IDirectXFileBinary. Loop through the objects you need to save, adding each optional child member
to the object list in the manner appropriate to its type, as illustrated in the following steps. Then, if the object type is Data, call the
IDirectXFileSaveObject::CreateDataObject method to create an
IDirectXFileData object, and then call the IDirectXFileData::AddDataObject method
to add it as a child of the object. If the object type is Data Reference, call the
IDirectXFileData::AddDataReference method to create and add the data reference object as a child
of the object. Or, if the object type is Binary, call the IDirectXFileData::AddBinaryObject method
to create and add the binary object as a child of the object.

o    Call the
IDirectXFileSaveObject::SaveData method to save the data object and its children.

o    Release the
IDirectXFileData object.

  1. Release the IDirectXFileSaveObject object.
  2. Release the IDirectXFile object.
时间: 2024-08-24 07:34:56

D3D9学习笔记(八) .x file的相关文章

kvm虚拟化学习笔记(八)之kvm虚拟机vnc配置

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://koumm.blog.51cto.com/703525/1291803 KVM虚拟化学习笔记系列文章列表 ---------------------------------------- kvm虚拟化学习笔记(一)之kvm虚拟化环境安装http://koumm.blog.51cto.com/703525/1288795 kvm虚拟化学习笔记(二)之linux kvm虚拟机安装 h

JSP学习笔记(八)-----include的运用

include|js|笔记 1. 向JSP页面中插入指定的页面方法有两种:JSP命令<%@ include%>JSP动作<jsp:include />2. a.jsp代码如下:<html>huanghui<%@ include file="b.jsp"%><jsp:include page="b.jsp" flush="true"/></html>3. b.jsp代码如下:&

D3D9学习笔记(三) Device

2.1架构 2.2类型 基本的device类型:hal:硬件渲染(发布).这也不是直接访问硬件驱动,而是访问在上一层的hal.(在顶点处理过程中,如果硬件处理失败,可尝试混合处理及纯软处理,设定标志D3DCREATE_MIXED_VERTEXPROCESSING)                                        soft软件渲染(但是这种软渲染并不一定拥有同当前硬件相同的渲染能力,所以要经常检查)                                   

D3D9学习笔记(九) effect (hlsl)

effect其实整合了shader和render state的控制两大部分内容 9.1 effect文件基本框架 part1 :shader state包括全局变量 shader数据结构定义,shader的实现 part2 :texture and sampler state,这个通常是全局变量,用于shader中,通常要定义在shader的实现之前 part3 其他的render state设置,写在technique的pass里,这才是effect文件的主入口 effet中任何一个变量后面都

D3D9学习笔记(五) Resource

Usage 这是强制的属性,使用时要明确确定,下面是每种reource的用途列表 Format <d3d9types.h> 存储访问顺序 D3DFORMAT_ARGB:内存中存储顺序是B到A                             D3DFMT_A8L8代表16位整数,高8位是A 存在未定义通道的格式都被默认为1 数据的底层格式是不同硬件不同的,但是被D3D运行时认可后就都变成这里面D3DFORMAT枚举类里面的某种格式   支持的格式及常见写法 1. (A\R\G\B)bit

D3D9学习笔记(六) 坐标系统及坐标变换 几何体

6.1坐标系统 D3D9采用左手系,即Z轴朝里 平面法向也是用右手 6.2生成和设置坐标转换矩阵 world trans D3DXMatrixRotationX D3DXMatrixTranslation.. view trans D3DXMatrixLookAtLH   优化 频繁的set 变换矩阵的开销很大,因此可以本地记录world  view矩阵,然后只set 一个整体的world_view矩阵,而让view矩阵永远为单位帧   IDirect3DDevice9::SetTransfor

设计模式学习笔记(八)—Template Method模式

<设计模式>一书对Template Method模式是这样描述的: 定义一个操作中算法的骨架,而将一些步骤延迟到子类中.不改变算法的结构而重新定义它的步骤. 我的理解:定义一个抽象类或者说接口,在它的内部定义一些抽象的方法(供TemplateMethod调用的步骤)和一个TemplateMethod方法(非抽象方法),封装了这些抽象方法的接口或抽象类就是骨架.而将它的实现延迟到子类中,也就是用子类实现它.不改变算法的结构而重新定义它的步骤,也就是改写或者实现父类的这些非TemplateMeth

Unmi的Struts2学习笔记(八)

吾同人数进寺庙,却从未点过一柱香.概因精神世界里终无所寄托.既不为生 儿还是女而筹算,也无须因落下亏心事要请得神灵庇佑.想来,真要的东西,阿 弥陀佛也给不了.在物价飞涨之际,谁能给你加薪,何来民主,看看这辈子能不 能有机会参与选一回国家领导人,少说几句了,就这点言论自由了. 1. Struts 2 标签库以 OGNL 表达式为基础,对集合.对象的访问功能更强了 .Struts 2 的标签用统一的前缀,一般为 "s",不再像 Struts1 那样分 <html:.../>.&

hibernate3学习笔记(八) DetachedCriteria

依然接着前面的例子:http://www.bianceng.cn/Programming/Java/201101/23637.htm 示例代码如下: 1.package com.hb3.pack_01;2.3.import java.util.Iterator;4.import java.util.List;5. 6.import org.hibernate.Criteria;7.import org.hibernate.Session;8.import org.hibernate.Sessio