home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / directx2 / sdk / samples / d3dsamp.txt < prev    next >
Encoding:
Text File  |  1996-05-28  |  9.8 KB  |  377 lines

  1. Direct3D Samples Readme
  2. Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved.
  3.  
  4. 1.  Immediate Mode Samples
  5.  
  6. The samples are divided into three parts: a shared foundation which
  7. creates and manages all DirectDraw and Direct3D objects needed to
  8. render (D3DApp), source unique to each sample which creates and
  9. renders the scene and a shared link between the two which creates and
  10. handles a window (D3DMain).
  11.  
  12. For information on creation and rendering of scenes using execute
  13. buffers, consult the individual sample files.  Consult the D3DApp
  14. source for a better understanding of the interaction between
  15. DirectDraw, Direct3D and Windows, creation and management of
  16. DirectDraw and Direct3D objects, and hardware compatibility issues.
  17.  
  18. 1.1 Flipcube
  19.  
  20. A cube is created and spun through mouse and keyboard input.  The
  21. world matrix is changed in response to mouse and keyboard input and
  22. set before rendering each frame.  Keyboard and mouse cues:
  23.  
  24.         F11 - closer
  25.         F12 - further
  26.         left-mouse drag - spin with mouse movement
  27.         right-mouse click - resume spinning
  28.  
  29. Vertices are not shared because the normals are different for each
  30. side.  Each side is covered by a separate material.
  31. DLIGHTSTATE_MATERIAL must be set and D3DPROCESSVERTICES_TRANSFORMLIGHT
  32. must be called for each side of the cube.
  33.  
  34. 1.2 Oct1
  35.  
  36. Simple spinning shape constructed from vertex and triangle data within
  37. the source.  Two materials are used.  The second material is only used
  38. on one vertex.  Spinning is done by updating and setting the matrix
  39. each frame.  The background material contains a texture.
  40.  
  41. 1.3 Oct2
  42.  
  43. Identical to oct1 except that the background does not contain a
  44. texture.
  45.  
  46. 1.4 Sphere
  47.  
  48. A simple spinning sphere with one material.  The spinning is done
  49. through a matrix multiply within the execute buffer.
  50.  
  51. 1.5 Triangle
  52.  
  53. One triangle on a textured background.  The triangle is created by
  54. specifying the screen coordinates for the vertices using TLVERTEXs.
  55.  
  56. The top left vertex, the first vertex in the triangle data, has a
  57. diffuse color of blue.  Switching between flat and gouraud shading
  58. changes the effect this vertex has on the lighting across the
  59. triangle.  When flat shading, the first vertex specifies the lighting
  60. for the entire triangle. When gouraud shading, the lighting is
  61. interpolated across the triangle.  Lighting is different in the two
  62. software renderers.  The RAMP driver does not modulate the texture's
  63. color with the material color.
  64.  
  65. The rhw value of the top right vertex is larger than the other
  66. two; it is closer to the eye.  Turning perspective correction on and
  67. off changes the interpolation of the texture across the triangle.
  68.  
  69. 1.6 Tunnel
  70.  
  71. Camera moves through a tunnel generated around a spline.  Only a small
  72. section of the tunnel is placed in the execute buffer at a time.
  73. After each frame, the buffer is locked and the tunnel vertices updated
  74. to include the next section.
  75.  
  76. Triflags are set so the segments of the tunnel are drawn as quads
  77. rather than triangles when rendered in wireframe.
  78.  
  79. 1.7 Twist
  80.  
  81. Two ends of a flattened sphere are twisted in opposite directions.
  82. All motion and twisting in done in the execute buffer by a series of
  83. matrix multiplies.
  84.  
  85. 1.8 D3DApp
  86.  
  87. D3DApp is the collection of helper functions for Direct3D which is
  88. used by the immediate mode samples and can be a great help when you
  89. write your first applications.  Use D3DApp to create and manage all
  90. the DirectDraw and Direct3D objects needed to begin rendering.  D3DApp
  91. consists of the following files:
  92.  
  93. misc\d3dapp.h
  94.  
  95. Main D3DApp header to be included by application. The best source for
  96. complete information on how D3DApp is used.
  97.  
  98. misc\d3dappi.h
  99.  
  100. Internal header
  101.  
  102. misc\d3dapp.c
  103.  
  104. D3DApp functions seen by application.
  105.  
  106. misc\ddcalls.c
  107.  
  108. All calls to DirectDraw objects except textures.
  109.  
  110. misc\d3dcalls.c
  111.  
  112. All calls to Direct3D objects except textures.
  113.  
  114. misc\texture.c
  115.  
  116. Texture loading and managing texture list.
  117.  
  118. misc\misc.c
  119.  
  120. Miscellaneous functions.
  121.  
  122. 1.9 D3DMain
  123.  
  124. D3DMain is the link between D3DApp and each sample.  It creates a
  125. window, asks D3DApp to set it up for rendering, then asks the sample
  126. to create it's scene and render itself.  All menu and keyboard input
  127. from the user is handled by this code.
  128.  
  129. misc\d3dmain.cpp
  130.  
  131. Main source which includes WinMain and message handler.
  132.  
  133. misc\d3dres.h
  134.  
  135. Header for d3dmain.rc.
  136.  
  137. misc\d3dmain.rc
  138.  
  139. Defines menus and keyboard accelerator.
  140.  
  141. misc\d3ddemo.h.
  142.  
  143. Defines the functions D3DMain uses to communicate with each sample.
  144.  
  145. misc\stats.cpp
  146.  
  147. Calculates and displays frame rate and other information.
  148.  
  149. 1.10 Miscellaneous
  150.  
  151. Many samples use these miscellaneous functions for execute buffer
  152. creation and math.
  153.  
  154. misc\d3dmacs.h
  155.  
  156. Very useful collection of macros which are used in the creation of
  157. execute buffers and matrices.
  158.  
  159. misc\d3dmath.h
  160.  
  161. Header for d3dmath.c.
  162.  
  163. misc\d3dmath.c
  164.  
  165. Collection of vector and matrix mathematical functions and generation
  166. of a spline curve.
  167.  
  168. misc\d3dshpr.h
  169.  
  170. Header for d3dsphr.c.
  171.  
  172. misc\d3dsphr.c
  173.  
  174. Generates verticies and triangle list data for a sphere.
  175.  
  176. misc\lclib.h
  177.  
  178. Header for lclib.c
  179.  
  180. misc\lclib.c
  181.  
  182. Replacements for two string functions.
  183.  
  184. 2 Retained Mode Samples
  185.  
  186. The retained mode samples are divided into two parts: a shared harness
  187. which uses the D3DRM Windows device to setup a window for rendering
  188. (RMMain) and source which is unique to each sample.  (Fly is an
  189. exception, see below).
  190.  
  191. To learn how to use D3DRM to setup a window for rendering, read
  192. through the RMMain source.  For information on building and rendering
  193. scenes, consult the individual sample files.
  194.  
  195. 2.1 Egg
  196.  
  197. Loading a simple XOF of a single mesh object.
  198.  
  199. 2.2 Faces
  200.  
  201. Creation of mesh objects one face at a time.
  202.  
  203. 2.3 Fly
  204.  
  205. Using animations to set the position of a spaceship along a curved
  206. path.
  207.  
  208. 2.4 Globe
  209.  
  210. Loading a simple XOF of a single mesh object with textures.
  211.  
  212. 2.5 Hier1
  213.  
  214. A simple hierarchy of two meshes demonstrating the concept of frames.
  215.  
  216. 2.6 Hier2
  217.  
  218. Another simple hierarchy of four meshes.
  219.  
  220. 2.7 Quat
  221.  
  222. Using quaternions to interpolate between two vectors in space.
  223.  
  224. 2.8 Shadow
  225.  
  226. Creating a shadow of a mesh object.
  227.  
  228. 2.9 Tex1
  229.  
  230. Loading a simple texture mapped mesh object.
  231.  
  232. 2.10 Tex3
  233.  
  234. Using texture wraps for special effects.
  235.  
  236. 2.11 Tex4
  237.  
  238. Another example of using texture wraps for special effects.
  239.  
  240. 2.12 Tex5
  241.  
  242. Using a Wrap for Chrome mapping and a Texture map as decal.
  243.  
  244. 2.13 Trans
  245.  
  246. Using transparent texture maps in various ways.
  247.  
  248. 2.14 Uvis
  249.  
  250. This is an important example demonstrating how D3D can be used with
  251. D3DRM. It demonstrates how a D3D immediate mode execute buffer can be
  252. used as a visual in a D3D retained mode scene.
  253.  
  254. 2.15 Vertcol
  255.  
  256. Setting the colors at each vertex of a triangle. This can be seen only
  257. in RGB mode.
  258.  
  259. 2.16 RMMain
  260.  
  261. Uses D3DRM to setup a window for rendering, ask the sample to build
  262. it's scene and then renders the scene.
  263.  
  264. misc\rmmain.cpp
  265.  
  266. Main source file which includes WinMain and message handler.  Creates
  267. D3DRM, uses it to setup the window for rendering and then asks the
  268. sample to build it's scene.
  269.  
  270. misc\rmmain.h
  271.  
  272. Header for rmmain.cpp.
  273.  
  274. misc\rmmain.rc
  275.  
  276. Resource file for rmmain.cpp.
  277.  
  278. misc\rmerror.cpp
  279.  
  280. D3DRM error code to string and error message box.
  281.  
  282. misc\rmerror.h
  283.  
  284. Header for rmerror.cpp.
  285.  
  286. misc\rmdemo.h
  287.  
  288. Because the samples do not create and manage all DirectDraw and
  289. Direct3D objects themselves, the source is much simpler than the
  290. immediate mode samples, but they can only run in a window.
  291. Optionally, the D3DRM samples can be linked to D3DApp via another
  292. harness.  This will allow them to enter fullscreen modes.  Fly is
  293. linked to these files.
  294.  
  295. misc\rmfull.cpp
  296.  
  297. Main source file which includes WinMain and message handler.  Uses
  298. D3DApp to setup rendering.
  299.  
  300. misc\rmfull.h
  301.  
  302. Header for rmfull.cpp.
  303.  
  304. misc\rmfull.rc
  305.  
  306. Defines menus and keyboard accelerator.
  307.  
  308. misc\rmfullrc.h
  309.  
  310. Header for rmfull.rc.
  311.  
  312. misc\rmstats.cpp
  313.  
  314. Calculates and displays frame rate and other information.
  315.  
  316.  
  317.  
  318. 3.0 Viewer
  319.  
  320. This is a stand alone D3DRM app that allows you to load and view 3d
  321. objects.
  322.  
  323. The initial scene has a light source in the top right. To see this the
  324. view can be moved backwards and forwards using the T and R
  325. keys. Additional objects can be loaded from the file menu, and new
  326. light sources can be added from the lights menu.  Objects can be
  327. rotated with the left mouse button and dragged with the right.
  328.  
  329. The last object that was rotated or dragged remains the current
  330. selection.
  331.  
  332. The device quality can be altered using the Renderer menu. Using this
  333. menu the type of device used can also be switched from ramp to
  334. RGB. When using the RGB device the color of lights in the scene can be
  335. changed in the same way as you change the color of objects. In 256
  336. color mode it is advisable to dither an RGB device for best results.
  337.  
  338. Additional keyboard controls
  339.  
  340. T Forwards
  341. R Back
  342. Z Move current selection forwards
  343. X Move current selection back.
  344. Ctrl+G Gouraud shade
  345. Ctrl+F Flat Shade
  346. Ctrl+D Dither toggle.
  347. Arrow Keys Move left/right/up/down
  348. Delete Delete the current selection.
  349.  
  350.  
  351. 4.0  Rockem3D
  352.  
  353. A robot fighting game written with DirectDraw, Direct3D Retained Mode and
  354. DirectSound.  Move the blue robot around the ring and attempt to knock out
  355. your computer opponent.
  356.  
  357. Up   Forwards
  358. Down Back
  359. Spc  Punch
  360. Ctrl Block
  361.  
  362. Press TAB for an information bar containing the current screen mode and frame
  363. rate.  The letter at the end of the bar indicates whether Rockem3D is running
  364. on a hardware device (H) or in software emulation (S).
  365.  
  366. Additional keys are:
  367.  
  368. F2     Side Camera View
  369. F3     Behind Camera View
  370. F4     Head Camera View
  371. PgUp   Increase Video Mode
  372. PgDn   Decrease Video Mode
  373. Home   Highest Video Mode
  374. End    Lowest Video Mode
  375. Ctrl+M Toggle music on/off
  376. Ctrl+S Toggle sound on/off
  377.