Low-level Device API

The following interfaces can be used in the CustomRenderItemHandle:

The plug-ins can provide complex display in Nitrous using these interfaces.

Built-in Stock Material

Nitrous provides the following material classes that can be used by both the object and material plug-ins:

To use these materials to shade vertex buffers, the plug-ins need to initialize the handle in proper time. The plug-ins must make sure that the MeshRequiredStreams of the material handle and the vertex buffer format is consistent, and use the BaseMaterialHandle functions to draw. Following is an example:

// Use a material handle to draw something
void XXXPlugin_CustomItem::Display(DrawContext& dc)
{
    // Assuming that the material handle is properly initialized
    BaseMaterialHandle hMaterial;

    hMaterial.Activate(dc);
    int numPass = hMaterial.GetPassCount(dc);
    for (int i = 0; i < numPass; ++i)
    {
        // Assuming that the vertex buffer has a consistent format
        hMaterial.ActivatePass(dc, i);
        // Use IVirtualDevice to draw the vertex buffer
    }
    hMaterial.PassFinished(dc);
    hMaterial.Terminate();
}

Customize Material Shaders

Nitrous also provides a HLSLMaterialHandle class that allows plug-ins to use the DirectX effect. Plug-ins can directly use the DirectX effect string or file ( \.fx* ) to initialize the material handle and use it as other material handles.

When Nitrous is in DirectX 9 (DX9) mode, this class only supports DX9 effects, and when Nitrous is in DirectX 11 (DX11) mode, this class only supports DX11 effects. Plug-ins can get the device capability through IVirtualDevice::FeatureLevel().