Class IHardwareRenderer
Description:
This class is only available in release 5 or later.
This interface provides access to the DirectX interfaces on the drawing thread of max. This allows creation and loading of various DirectX objects such as Textures. This class has many interfaces not currently implemented, although they will compile and link correctly. This is due to support for DirectX 9, meaning that when a compatible driver is released these methods will be implemented. The documentation for this class only deals with methods that developers can and would normally use.
The basic idea of this class is to provide the developer with access to the DirectX device without actually giving the developer total control, and thus possibility to de-stable the 3ds max Viewports.
A pointer to this class can be obtained with the following code snippet: -
ViewExp *pview = GetCOREInterface()->GetActiveViewport();
GraphicsWindow *gw = pview->getGW();
IHardwareRenderer * phr = (IHardwareRenderer *)gw->GetInterface(HARDWARE_RENDERER_INTERFACE_ID);
For an example usage of this class see MAXSDK\SAMPLES\HardwareShaders\LightMap\Lightmap.cpp
Methods:
Prototype:
Virtual DWORD_PTR BuildTexture(BITMAPINFO *bmi, UINT miplevels, DWORD usage, DWORD format)
Remarks:
This will create a DX texture stored in local storage. The pointer returned can be used in IHardwareMaterial::SetTexture method. An example of using this method can be seen in the Lightmap sample.
Parameters:
BITMAPINFO *bmi
A pointer to the bitmap from which the texture will be created
UINT miplevels
The number of miplevels to create
DWORD usage
The usage falg is the same as for D3DXCreateTexture – see the DirectX documentation for more information
DWORD format
The pixel format for the texture
Prototype:
Virtual DWORD_PTR LoadTexture(LPCSTR filename)
Remarks:
This simple loads a texture from the supplied filename using the default options for D3DXCreateTextureFromFile. Please refer to the DirectX documentation for further information.