**********************
***                ***
***                ***
*** Direct3D Notes ***
***                ***
***                ***
**********************

Last updated  Apr 30, 1996


PLEASE NOTE:

- IMPORTANT!!!
  Any DirectDraw surface that is to be used as a Direct3DDevice, must be
  created with the new DDSCAPS_3DDEVICE cap.  This is new behaviour and is
  strictly enforced.

- dwSize fields are validated!
  We must enforce size fields so that if we choose to grow the structure 
  in the future, we can still allow old applications to run.
  

Reality Lab name change
=======================

The Reality Lab retained mode portion of the Direct3D API has been renamed
to Direct3DRM.

The name changes affect both the COM interfaces and objects, and the types.
The use of the interfaces in the examples have also been modified to be in
the same style as all of DirectX.
For example, where you would have used IRealityLabDevice*, you would now
use LPDIRECT3DRMDEVICE.  The following list details all of the changes:

Old interface name       New name                 Usage
------------------       --------                 -----
IRealityLab              IDirect3DRM              DIRECT3DRM
IRealityLabDevice        IDirect3DRMDevice        DIRECT3DDEVICE
IRealityLabObject        IDirect3DRMObject        DIRECT3DRMOBJECT
IRealityLabViewport      IDirect3DRMViewport      DIRECT3DRMVIEWPORT
IRealityLabFrame         IDirect3DRMFrame         DIRECT3DRMFRAME
IRealityLabVisual        IDirect3DRMVisual        DIRECT3DRMVISUAL
IRealityLabMesh          IDirect3DRMMesh          DIRECT3DRMMESH
IRealityLabMeshBuilder   IDirect3DRMMeshBuilder   DIRECT3DRMMESHBUILDER
IRealityLabFace          IDirect3DRMFace          DIRECT3DRMFACE
IRealityLabLight         IDirect3DRMLight         DIRECT3DRMLIGHT
IRealityLabTexture       IDirect3DRMTexture       DIRECT3DRMTEXTURE
IRealityLabWrap          IDirect3DRMWrap          DIRECT3DRMWRAP
IRealityLabMaterial      IDirect3DRMMaterial      DIRECT3DRMMATERIAL
IRealityLabAnimation     IDirect3DRMAnimation     DIRECT3DRMANIMATION
IRealityLabAnimationSet  IDirect3DRMAnimationSet  DIRECT3DRMANIMATIONSET
IRealityLabUserVisual    IDirect3DRMUserVisual    DIRECT3DRMUSERVISUAL
IRealityLabShadow        IDirect3DRMShadow        DIRECT3DRMSHADOW
IRealityLabArray         IDirect3DRMArray         DIRECT3DRMOBJECTARRAY
IRealityLabDeviceArray   IDirect3DRMDeviceArray   DIRECT3DRMDEVICEARRAY
IRealityLabFaceArray     IDirect3DRMFaceArray     DIRECT3DRMFACEARRAY
IRealityLabViewportArray IDirect3DRMViewportArray DIRECT3DRMVIEWPORTARRAY
IRealityLabFrameArray    IDirect3DRMFrameArray    DIRECT3DRMFRAMEARRAY
IRealityLabVisualArray   IDirect3DRMVisualArray   DIRECT3DRMVISUALARRAY
IRealityLabPickedArray   IDirect3DRMPickedArray   DIRECT3DRMPICKEDARRAY
IRealityLabLightArray    IDirect3DRMLightArray    DIRECT3DRMLIGHTARRAY
IWinRealityLabDevice     IDirect3DRMWinDevice     DIRECT3DWINDEVICE

All structure names have been trivially renamed replacing RL with D3DRM.

The header files have also changed name:

irlwin.h becomes d3drmwin.h
irlobj.h becomes d3drmobj.h
irlapi.h becomes d3drm.h
rltypes.h becomes d3drmdef.h


Other notes
===========

There is now a new object type: the user visual (IDirect3DRMUserVisual).
This allows the user to specify their own method for rendering a user
defined visual.  For example you can use Direct3D's immediate mode to
specify geometry and then render it yourself at the appropriate time.
You provide Direct3DRM with a CanSee (is it visible?) and rendering methods.
See the "uvis" sample for an example on how to use this new feature.

You can now control whether to Z buffer or not using the
IDirect3DRMFrame::SetZbufferMode() API to control the use of Z buffering
for a frame hierarchy.

You can now constrain the way lights affect a scene by constraining a lights
effect to a particular frame hierarchy using the
IDirect3DRMLight::SetEnableFrame() API.


Direct3D
========

Direct3D's immediate mode types have been converted to hungarian notation.

The IDirect3DTexture interface has a new member: PaletteChanged.  This
informs Direct3D that the application has modified the DirectDraw palette
associated with the texture.


Notes on the software emulation drivers
=======================================

Wireframe and point fill methods have now been enabled in both the RAMP and
RGB software drivers.  For both drivers points and lines can be rendered
in all the modes that the filled polygons support.

Z Test primitives have been enabled. This is the ability to test a given
list of primitives against the Z buffer.  This allows for fast bounding box
rejection of occluded geometry.  This feature is used by the retained mode
API for all meshes which contain more than a few hundred triangles.


RAMP driver support
===================
Optional Z buffering.
Color key and stippled transparency.
Mono interpolated rasterization only.
Point sampled perspective correct textures.
Flat and Gouraud shade modes.

Performance notes for the RAMP driver
=====================================
Texture mapping performance is heavily gated by the speed of memory.
There are a number of ways of maximizing the cache performance of your
textures.  The smaller the textures are, the better chance they have of being
maintained in the secondary cache.  This is crucial for keeping performance
high.  Also, changing the texture per primitive will thrash the cache.  Try
and keep polygons grouped in order of the textures they use.

When using Z buffering and texturing, rendering your scene from front to
back will increase performance.  The textured Z buffered primitives
pre-test the Z buffer on a scanline basis.  If a scanline is hidden by a
previously rendered polygon it is trivially rejected.  If this is the case, Z
buffering performance can exceed non-Z performance.

The retained mode API automatically orders its scenes from front to back
to facilitate this optimization.

In it often a good idea to use the D3DTest program to verify performance
results with different drivers, especially where hardware is involved.


RGB driver
==========
The RGB driver now supports bilinear filtering for texturing.




Capabilities
============

The D3DDEVICEDESC structure now includes two new members:

1. dwDeviceRenderBitDepth describes the bit depths supported as a rendering
   target.
   
2. dwDeviceZBufferBitDepth describes the supported Z-buffer bit depths.


Known Issues
============
When using RGB software rasterisation, D3DRMMATERIALMODE_FROMFRAME
does not work correctly if the object is unlit.

It is not currently possible to load data from resources if the code
resides in a dll.

Background depth images do not double buffer correctly in the retained
mode api (page flipping scenario).  Use IDirect3DRMViewport::ForceUpdate()
to force the dirty region to be updated.

If you try to add a IDirect3DRMMesh to an IDirect3DRMMeshBuilder using
AddMesh or indirectly via AddFrame (where the frame hierarchy contains
mesh visuals), the mesh's texture coordinates (and vertex colors) do
not get copied to the MeshBuilder.

Line rendering in software emulation does not take the
D3DRENDERSTATE_LASTPIXEL render state into account.

IDirect3D::FindDevice() zeros the dwSize field in the return result.

The following issues is not made clear in the documentation:
1) SetOrientation overrides any previous shear or scale applied to a
frame.

2) Texture Transparency.  If the retained mode API has to sample down
the colors used in a texture in order to, for example, palettize it,
the colour you're using as the transparent color may get remapped to
another close color and transparency will no longer work.  In order to
stop this happening, pick a colour to use for transparency that is not
close to any other colour in the texture.

The Matrox Millenium driver does not render correctly fullscreen
unless Clear is called at least once.  Since the Millenium does not
support texture mapping, this will not affect the types of application
which do not use Clear.  A workaround for this issue is to call Clear
in your application once before entering the rendering loop.

IDirect3DRMViewport::Configure is not functional in this release.  A
workaround for this is to destroy the old viewport and create a new
one at the new position and size.
