3dsloader

所属分类:3D图形编程
开发工具:Visual C++
文件大小:669KB
下载次数:7
上传日期:2009-11-29 22:29:25
上 传 者lanazw
说明:  3ds文件录入并显示程序,可进行各种视角变化
(3ds loader)

文件列表:
3dsloader\3dsload.dsw (539, 2007-06-22)
3dsloader\3dsload.ncb (107520, 2009-11-23)
3dsloader\3dsload.plg (35750, 2009-11-23)
3dsloader\CAMERA.C (2732, 2007-06-22)
3dsloader\CAMERA.H (597, 2007-06-22)
3dsloader\IMAGE.C (5147, 2007-06-22)
3dsloader\IMAGE.H (280, 2007-06-22)
3dsloader\MATRIX.C (2538, 2007-06-22)
3dsloader\MATRIX.H (451, 2007-06-22)
3dsloader\MMF.H (840, 2007-06-22)
3dsloader\Main.c (7919, 2007-06-22)
3dsloader\SCEN08.3DS (78446, 2007-06-22)
3dsloader\SCEN12.3DS (962690, 2007-06-22)
3dsloader\SCUDH.3DS (862398, 2007-06-22)
3dsloader\Scen08.bmf (8155, 2007-06-22)
3dsloader\Scen08.gl (69632, 2007-06-22)
3dsloader\View3DS.exe (258123, 2007-06-22)
3dsloader\_desktop.ini (8, 2007-06-22)
3dsloader\3dsload.dsp (4197, 2009-11-23)
3dsloader\3DSLOAD.H (3299, 2009-11-23)
3dsloader\Scen08.h (10088, 2009-11-23)
3dsloader\3DSLOAD.C (20501, 2009-11-23)
3dsloader\OUTGL.H (2393, 2009-11-23)
3dsloader\OUTGL.C (49887, 2009-11-23)
3dsloader\glut32.lib (71040, 1997-12-11)
3dsloader\glut32.dll (154624, 1997-12-11)
3dsloader\glut.h (17057, 1997-12-11)
3dsloader\BMF.H (2572, 2009-11-23)
3dsloader\3dsload.opt (56832, 2009-11-23)
3dsloader\1.3ds (218212, 2009-11-24)
3dsloader (0, 2007-07-18)

The Basic Model Format (BMF) David Farrell The BMF file is a binary file that I created out of a need to work with .3DS files. However, I needed an easier way to get data into my graphics code than parsing the 3DS file every time I loaded the program. I modified View3DS so that it will load in a .3DS file, manipulate it, and then export it into the easier-to-use BMF format. In the bmf/ directory you will find a sample program that will read in a .BMF file and then render it with OpenGL. To use it, type bmf , where filename is the .BMF file you want to see. If you want to use BMF files in your own code, examine MAIN.C to see how it calls LoadBMF() to load a BMF object and then uses DrawBMFObject() to render the object. I think it is pretty simple code; you should be able to easily modify it to read the BMF objects into your own data structures and call your own rendering routines. BMF files are around twice as large as .3DS files because it contains the same information as .3DS files plus the per-vertex normals. The BMF format looks roughly like this: Header Information Material #1 Texture Properties Color Properties Vertex Information Triangle Information Material #2 Texture Properties Color Properties Vertex Information Triangle Information Material #3 Texture Properties Color Properties Vertex Information Triangle Information . . . As you can see, a BMF file consists of a series of materials. Each of these materials has unique color and texture properties. For a given material, there is a set of vertex coordinates, as well as a list of indexes into these coordinates for each triangle. All of the triangles listed in a material use that material's properties. Note that there is not a single vertex pool for the whole model; instead, each material has its own set of vertices independent of the other materials. This means there are some duplicated vertices across the materials, but in general, not that many vertices are wasted. The idea behind splitting up the vertices is that I can transform a set of vertices, then feed them to my hardware accelerator. While it is drawing, I can then go transform the next set of vertices for the next material. I then send these to the accelerator and go on to the next set of vertices. This overlap means that the CPU and the accelerator work in parallel instead of sequentially so that overall performance is increased. The texture coordinates are from 0 to 1. The texture filename is stored in the BMF file, but the texture itself is stored separately. You will have to read the texture in yourself and store it in whatever format you desire. Please look at LOADBMF.C, BMF.H, and TYPES.H for more information. The BMF file format starts with the following: (unsigned short int) # of materials (ushort int) mesh type If mesh type == 0, then it's a sparse (non-stripified) mesh. If it's a one, then it's a stripified mesh. Following the above two entries are each material. These materials are either a sparse mesh or triangle strips. A BMF file never contains both; it is strictly one or the other. A sparse material looks like this: (ushort int) Texture Name Length (Always at least one; the terminating zero is counted) (char) Texture Name (Terminated by a zero) (3 floats)RGB ambient (3 floats)RGB diffuse (3 floats)RGB specular (ushort int)Number of Vertices (for this material only) (BMF_UNVERTEX) vertex[NumberOfVertices] (ushort int)Number of Triangles (BMF_SURFACE) triangle[NumberOfTriangles] If it's a stripified mesh, then it looks like: (ushort int) Texture Name Length (Always at least one; the terminating zero is counted) (char) Texture Name (Terminated by a zero) (3 floats)RGB ambient (3 floats)RGB diffuse (3 floats)RGB specular (ushort int)Number of Vertices (for this material only) (BMF_UNVERTEX) vertex[NumberOfVertices] (ushort int) NumberOfStrips (ushort int) LengthOfEachStrip[NumberOfStrips] (ushort int) NumberOfStripPoints (ushort int) NumberOfStripIndices[NumberOfStripPoints] In the BMF definition, these are also defined: // This is a GL_T2F_N3F_V3F struct // BMF_UNVERTEX means a BMF untransformed vertex with normals struct { GLfloat u,v; GLfloat i,j,k; GLfloat x,y,z; } BMF_UNVERTEX; // A surface (or triangle). These points are indices into the vertex list. struct { unsigned short int point0, point1, point2; } BMF_SURFACE;

近期下载者

相关文件


收藏者