Public Types | Public Member Functions | Static Public Member Functions

IHLSLCodeGenerator Class Reference

Search for all occurrences

Detailed Description

Shader generators were built on top of Ashli, a shader compiler from AMD ATI.

Deprecated:
Shader generation is now handled by MetaSL and the mental mill compiler

Now all shader generation in 3ds Max is performed by mental mill. To get similar data being generated based on actual supported shader code, the developer is advised to use the IEffectFile interface

#include <DeprecatedRealtimeMaterialTexturemapShaderAPI.h>

Inheritance diagram for IHLSLCodeGenerator:
Inheritance graph
[legend]

List of all members.

Public Types

enum   CodeVersion { PS_1_X, PS_2_0, PS_3_0, PS_2_X }

Public Member Functions

virtual MCHAR *  GenerateFragmentCode (StdMat2 *mtl, Tab< INode * > lights, bool &transp)=0
  Generate HLSL Code based on the material.
virtual MCHAR *  GenerateVertexCode ()=0
  Generates a basic Vertex shader to support the pixel shader.
virtual MCHAR *  GenerateEffectFile (StdMat2 *mtl, Tab< INode * > lights, CodeVersion code, bool &transp, int instSize, bool useLPRT=false)=0
  Generates an Effect File based on the material supplied.
virtual Texmap GetShaderDefinedTexmap (StdMat2 *mat, MCHAR *mapName, bool &bump)=0
  Get the texture map used by the specified mapName.
virtual void  Release ()=0

Static Public Member Functions

static DllExport
IHLSLCodeGenerator
GetHLSLCodeGenerator ()
  Access to the factory class.

Member Enumeration Documentation


Member Function Documentation

static DllExport IHLSLCodeGenerator* GetHLSLCodeGenerator ( ) [static]

Access to the factory class.

virtual MCHAR* GenerateFragmentCode ( StdMat2 mtl,
Tab< INode * >  lights,
bool &  transp 
) [pure virtual]

Generate HLSL Code based on the material.

This will create HLSL code based on the material and lights in the scene. It will generate code for Blinn and ONB style specular component. It will support Ambient,Diffuse, specular, Self Illumination, opacity, bump, reflection maps.

Parameters:
*mtl The material source
lights A table of lights to used in the HLSL generation
&transp True if there is a transparent component
Returns:
A string containing the code.
virtual MCHAR* GenerateVertexCode ( ) [pure virtual]

Generates a basic Vertex shader to support the pixel shader.

virtual MCHAR* GenerateEffectFile ( StdMat2 mtl,
Tab< INode * >  lights,
CodeVersion  code,
bool &  transp,
int  instSize,
bool  useLPRT = false 
) [pure virtual]

Generates an Effect File based on the material supplied.

This is similar to GenerateFragmentCode, but will optimize the HLSL code to assembler, based on a pass compiler. The effect file generated will only represent what is currently seen in the viewport

Parameters:
*mtl The material that will be used to generate the effect
lights An array of lights to be used by the shader
code The Shader Model to compile to
&transp Tells the code if transparency is used. This can be used to setup specific RenderStates
instSize The maximum number of instructions
useLPRT This is not needed by the developer. It is used in conjunction with Ashli
Returns:
A string containing the effect file. This can be loaded in the DirectX 9 Shader material
virtual Texmap* GetShaderDefinedTexmap ( StdMat2 mat,
MCHAR *  mapName,
bool &  bump 
) [pure virtual]

Get the texture map used by the specified mapName.

When the material tree is processed, a texture map can provide its only HLSL code and texture samplers. This function will return the texmap of these maps and the default diffuse, bump etc..

Parameters:
*mat The standard material whose textures are to be queried
*mapName This is the name parsed out in the effect file
&bump Allows special handling of the bump map
Returns:
A pointer to the specified texture map
virtual void Release ( ) [pure virtual]

IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator
IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator IHLSLCodeGenerator