Public Member Functions

IDX8VertexShader Class Reference

Search for all occurrences

Detailed Description

See also:
Class IVertexShader, Class IDX8PixelShader

Description:
This class is available in release 4.0 and later only.

The abstract interface to the Direct-3D Vertex Shader architecture.

The drawing functions are necessary as something other than a simple default body if:
  • The VertexShader needs to add additional per vertex data unknown to the Mesh to the VertexBuffer.
  • The VertexShader needs to have per vertex data ordered differently than the standard position, normal, {color, tex coords ordering}.
  • The VertexShader is being used to create cached VertexBuffers or using higher order surfaces.

In the cases of DrawMeshStrips() and DrawWireMesh(), the VertexShader has the option of not only locking and filling the VertexBuffer with data, but also of making the actual DrawPrimitive call. In the case of StartLines(), the VertexShader must make the DrawPrimitive call. The VertexShader indicates that it has done the drawing by returning 'true' in the Draw functions provided.

In the case where the VertexShader does not want to do the drawing but does want to fill in a VertexBuffer with data, the VertexShader can request the GFX to create a VertexBuffer (and possibly an IndexBuffer) of appropriate size. The GetVertexBuffer and GetIndexBuffer calls on the ID3DGraphicsWindow object will do this and return the allocated buffers in subsequent calls or reallocate them if necessary.

Please note that if a PixelShader or PixelShaders are in use, these Draw functions may need to set them for the appropriate passes of a multipass rendering if the drawing is done in these Draw() functions. If the GFX is doing the drawing, then these Draw() functions are only being used to fill in the VertexBuffer with data; the GFX will be doing the drawing and will be setting the PixelShaders as appropriate.

#include <idx8vertexshader.h>

Inheritance diagram for IDX8VertexShader:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual Interface_ID  GetID ()
virtual HRESULT  ConfirmDevice (ID3DGraphicsWindow *gw)=0
virtual HRESULT  ConfirmPixelShader (IDX8PixelShader *pps)=0
virtual bool  CanTryStrips ()=0
virtual int  GetNumMultiPass ()=0
virtual DWORD  GetVertexShaderHandle (int numPass)=0
virtual HRESULT  SetVertexShader (ID3DGraphicsWindow *gw, int numPass)=0
virtual bool  DrawMeshStrips (ID3DGraphicsWindow *gw, MeshData *data)=0
virtual bool  DrawWireMesh (ID3DGraphicsWindow *gw, WireMeshData *data)=0
virtual void  StartLines (ID3DGraphicsWindow *gw, WireMeshData *data)=0
virtual void  AddLine (ID3DGraphicsWindow *gw, DWORD *vert, int vis)=0
virtual bool  DrawLines (ID3DGraphicsWindow *gw)=0
virtual void  EndLines (ID3DGraphicsWindow *gw, GFX_ESCAPE_FN fn)=0
virtual void  StartTriangles (ID3DGraphicsWindow *gw, MeshFaceData *data)=0
virtual void  AddTriangle (ID3DGraphicsWindow *gw, DWORD index, int *edgeVis)=0
virtual bool  DrawTriangles (ID3DGraphicsWindow *gw)=0
virtual void  EndTriangles (ID3DGraphicsWindow *gw, GFX_ESCAPE_FN fn)=0

Member Function Documentation

virtual Interface_ID GetID ( ) [inline, virtual]
Remarks:
This method returns the interface ID of the class.
Default Implementation:
{ return DX8_VERTEX_SHADER_INTERFACE_ID; }

Reimplemented from BaseInterface.

{ return DX8_VERTEX_SHADER_INTERFACE_ID; }
virtual HRESULT ConfirmDevice ( ID3DGraphicsWindow gw ) [pure virtual]
Remarks:
This method will confirm that the Direct3D Device can handle this VertexShader.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.
virtual HRESULT ConfirmPixelShader ( IDX8PixelShader pps ) [pure virtual]
Remarks:
This method will confirm that an associated PixelShader will work with this VertexShader.
Parameters:
IDX8PixelShader *pps

A pointer to the pixel shader to confirm for.
virtual bool CanTryStrips ( ) [pure virtual]
Remarks:
This method will indicate if it can try tristrips for drawing or must geometry using this VertexShader be drawn as triangles? This should return TRUE unless additional per vertex data is generated by this VertexShader and this data does not map to the Mesh vertices in the same way as existing data the Mesh knows about such as texture coordinates.
virtual int GetNumMultiPass ( ) [pure virtual]
Remarks:
This method returns the number of passes for the effect this VertexShader creates. Note that this value will depend on the hardware currently in use.
virtual DWORD GetVertexShaderHandle ( int  numPass ) [pure virtual]
Remarks:
This method returns the VertexShader handle for the specified pass for use in GFX.
virtual HRESULT SetVertexShader ( ID3DGraphicsWindow gw,
int  numPass 
) [pure virtual]
Remarks:
This method allows you to set the VertexShader for the specified pass. This call will be made at least once per object to set the per object data for the VertexShader such as the VertexShader constants.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

int numPass

The pass for which to set the vertex shader.
virtual bool DrawMeshStrips ( ID3DGraphicsWindow gw,
MeshData data 
) [pure virtual]
Remarks:
This method will draw the 3D Mesh as TriStrips. Fill in the VertexBuffer with data in the order desired by the VertexShader.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

MeshData *data

A pointer to the mesh data.
Returns:
TRUE if the Mesh has actually been drawn in this call, FALSE if the GFX is required to make the DrawPrimitive call.
virtual bool DrawWireMesh ( ID3DGraphicsWindow gw,
WireMeshData data 
) [pure virtual]
Remarks:
This method will draw the 3D Mesh as wireframe. Fill in the VertexBuffer with data in the order desired by the VertexShader.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

WireMeshData *data

A pointer to the wire mesh data.
Returns:
TRUE if the Mesh has actually been drawn in this call, FALSE if the GFX is required to make the DrawPrimitive call.
virtual void StartLines ( ID3DGraphicsWindow gw,
WireMeshData data 
) [pure virtual]
Remarks:
This method will draw 3D lines. A Mesh is being drawn by having line segments handed

down one at a time. Pass in the Mesh data in preparation for drawing 3D lines.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

WireMeshData *data

A pointer to the wire mesh data.
virtual void AddLine ( ID3DGraphicsWindow gw,
DWORD *  vert,
int  vis 
) [pure virtual]
Remarks:
This method will draw 3D lines. A Mesh is being drawn by having line segments handed

down one at a time. Add the connectivity information for one two point line segment.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

DWORD *vert

The array of vertices.

int vis

The visibility flag.
virtual bool DrawLines ( ID3DGraphicsWindow gw ) [pure virtual]
Remarks:
This method will draw the line segments accumulated. This should restart the filling of a VertexBuffer with the next AddLine call if additional data needs to be drawn before EndLines is called.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.
Returns:
TRUE if the Mesh line segments have actually been drawn in this call, FALSE if the GFX is required to make the DrawPrimitive call.
virtual void EndLines ( ID3DGraphicsWindow gw,
GFX_ESCAPE_FN  fn 
) [pure virtual]
Remarks:
This method will let the Mesh know that all drawing and data access is finished.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

GFX_ESCAPE_FN fn

The graphics escape function.
virtual void StartTriangles ( ID3DGraphicsWindow gw,
MeshFaceData data 
) [pure virtual]
Remarks:
This method will Draw 3D triangles. A Mesh is being drawn by having triangles handed down one at a time. Pass in the Mesh data in preparation for drawing 3D triangles.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

MeshFaceData *data

A pointer to the mesh face data.
virtual void AddTriangle ( ID3DGraphicsWindow gw,
DWORD  index,
int *  edgeVis 
) [pure virtual]
Remarks:
This method will Draw 3D triangles. A Mesh is being drawn by having triangles handed down one at a time. Add the connectivity information for one triangle.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

DWORD index

The triangle index.

int *edgeVis

The array of edge visibility information/
virtual bool DrawTriangles ( ID3DGraphicsWindow gw ) [pure virtual]
Remarks:
This method will draw the triangles accumulated. This should restart the filling of a VertexBuffer with the next AddTriangle call if additional data needs to be drawn before EndTriangles is called. Return 'true' if the Mesh triangles have actually been drawn in this call, 'false' if the GFX is required to make the DrawPrimitive call.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.
virtual void EndTriangles ( ID3DGraphicsWindow gw,
GFX_ESCAPE_FN  fn 
) [pure virtual]
Remarks:
This method will let the Mesh know that all drawing and data access is finished.
Parameters:
ID3DGraphicsWindow *gw

A pointer to the Direct-3D Graphics Window.

GFX_ESCAPE_FN fn

The graphics escape function.

IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader
IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader IDX8VertexShader