MaxSDK::Graphics Namespace Reference

This reference page is linked to from the following overview topics: Porting Object Plug-ins to Nitrous.


Classes

class   BaseMaterialHandle
class   IDisplayManager
  A core interface for accessing properties of the graphics library introduced in 3ds Max 2012. More...
class   IObjectDisplay
  This is the base interface for all objects that want to be displayed in viewport. More...
class   IParameterTranslator
  Facilitates translation of material and texture map parameter values to their shaders representation. More...
class   IShaderManager
  Represents the programmable shader associated with a material or texture map plug-in. More...
class   IShaderManagerCreator
  Factory class for IShaderManager objects. More...
class   ISimpleMaterial
  ISimpleMaterial provides any material or texture plugin the ability to display itself in the new Viewport Display system in 3ds Max 2012. More...
class   DisplayTextureHelper
  Used for creating texture handles (TexHandle) and updating texture data managed by the viewport display system. More...
class   ITextureDisplay
  This interface enables material and texture map plugins to display textures in the new viewport display system in 3ds Max 2012. More...
struct   MaterialRequiredStreamElement
  This struct describes a single stream element that will be used by the hardware shader of a material. More...
class   MaterialRequiredStreams
  This class is used for describing the mesh stream requirements of a material. More...
class   RenderItemHandle
  This is the base wrapper class for all viewport render items. More...
class   SmartHandle
  This is the base wrapper class for all graphics primitive classes in max viewport: worlds, nodes, render items, materials, etc. More...

Typedefs

typedef MaxSDK::Array
< RenderItemHandle
RenderItemHandleArray
  This is a utility class.
typedef unsigned __int64  Identifier
  This is the unique id type of our internal graphics objects.

Enumerations

enum   VertexFieldType {
  VertexFieldTypeUnknown, VertexFieldFloat1, VertexFieldFloat2, VertexFieldFloat3,
  VertexFieldFloat4, VertexFieldColor, VertexFieldTypeCount
}
 

types available for vertex fields, e.g.

More...
enum   VertexFieldUsage {
  VertexFieldUsageUnknown, VertexFieldUsagePosition, VertexFieldUsageNormal, VertexFieldUsageDiffuse,
  VertexFieldUsageSpecular, VertexFieldUsageTexcoord, VertexFieldUsageTangent, VertexFieldUsageBitangent,
  VertexFieldUsageCount
}
 

Indicates the usage of a vertex field of a vertex buffer.

More...
enum   MeshChannelCategory {
  MeshChannelUnknown, MeshChannelPosition, MeshChannelVertexNormal, MeshChannelTexcoord,
  MeshChannelVertexColor, MeshChannelTangent, MeshChannelBitangent, MeshChannelFaceMap,
  MeshChannelCategoryCount
}
 

Indicates the data source of a vertex field of a mesh vertex buffer.

More...
enum   IndexType { IndexTypeUnknown, IndexTypeShort, IndexTypeInt, IndexTypeCount }
 

Buffers are composed of arrays of elements all of the same type.

More...
enum   MaterialRequirementFlags { MaterialRequirementSplitByMaterialID = 0x00000001 }
 

This enum defines requirement flags of material additional to mesh stream requirements of MaterialRequiredStreams.

More...
enum   RenderItemCategory {
  RenderItemCategorySolidMesh = 0x00000001, RenderItemCategoryDiagonalMesh = 0x00000002, RenderItemCategoryEdgeMesh = 0x00000004, RenderItemCategorySubObjectVertexTicks = 0x00000008,
  RenderItemCategorySubObjectEdgeMesh = 0x00000010, RenderItemCategoryOtherSubObjects = 0x00000020, RenderItemCategoryGizmo = 0x00000040
}
 

A renderable plugin object could be consist of several render items.

More...

Functions

DataBridgeAPI size_t  GetVertexStride (const VertexFieldType type)
  Get the vertex stride by a given vertex type, in bytes.
DataBridgeAPI size_t  GetIndexStride (const IndexType type)
  Get the index stride by a given index type, in bytes.
IDisplayManager GetIDisplayManager ()
  Helper function to access the IDisplayManager core interface.
bool  IsRetainedModeEnabled ()
  Helper function to test whether the new viewport graphics system is running.
GraphicsDriverAPI void  GenerateRenderItems (RenderItemHandleArray &renderItems, Mesh *pMaxMesh, unsigned long renderItemCategoryFlags, const MaterialRequiredStreams &requiredStreams)
  Generate a set of render items from an input mesh and viewport requirements.
GraphicsDriverAPI void  GenerateRenderItems (RenderItemHandleArray &renderItems, MNMesh *pMaxMesh, unsigned long renderItemCategoryFlags, const MaterialRequiredStreams &requiredStreams)
  Generate a set of render items from an input MNMesh and viewport requirements.

Variables

const Identifier  NIL_ID = (Identifier)-1
  Invalid id value.

Typedef Documentation

This is a utility class.

It is used for storing a set of render items.

typedef unsigned __int64 Identifier

This is the unique id type of our internal graphics objects.


Enumeration Type Documentation

types available for vertex fields, e.g.

Float4

Enumerator:
VertexFieldTypeUnknown 

unknown field

VertexFieldFloat1 

single float field

VertexFieldFloat2 

double float field.

x,y

VertexFieldFloat3 

triple float field

VertexFieldFloat4 

quad float field

VertexFieldColor 

color field

VertexFieldTypeCount 

Indicates the usage of a vertex field of a vertex buffer.

This enum is used to make hardware shaders understand the usage of vertex buffer.

Enumerator:
VertexFieldUsageUnknown 

Unknown usage.

VertexFieldUsagePosition 

Position.

VertexFieldUsageNormal 

Normal.

VertexFieldUsageDiffuse 

Vertex diffuse color.

VertexFieldUsageSpecular 

Vertex specular color.

VertexFieldUsageTexcoord 

Texture coordinate.

VertexFieldUsageTangent 

tangent

VertexFieldUsageBitangent 

bitangent

VertexFieldUsageCount 

Indicates the data source of a vertex field of a mesh vertex buffer.

e.g. Position, Normal, Texture, etc.

Enumerator:
MeshChannelUnknown 

Unknown data source.

MeshChannelPosition 

position

MeshChannelVertexNormal 

vertex normal components

MeshChannelTexcoord 

texture coordinate components

MeshChannelVertexColor 

vertex color components

MeshChannelTangent 

tangent components

MeshChannelBitangent 

bitangent components

MeshChannelFaceMap 

face map components

MeshChannelCategoryCount 

Buffers are composed of arrays of elements all of the same type.

This enum describes the size and interpretation of the elements in the buffer. Index buffers can have ushort or uint elements.

Enumerator:
IndexTypeUnknown 

not defined

IndexTypeShort 

unsigned 16 bit short integer, used for index buffers.

IndexTypeInt 

unsigned 32 bit integer, used for index buffers.

IndexTypeCount 

This enum defines requirement flags of material additional to mesh stream requirements of MaterialRequiredStreams.

Enumerator:
MaterialRequirementSplitByMaterialID 

Plug-in needs to split mesh to sub meshes according to face material id.

This flag is on when the material is multi/sub material.

A renderable plugin object could be consist of several render items.

Each render item belongs to a category. Render items that belongs to different category will be visible when the node and viewport has specific settings.

Enumerator:
RenderItemCategorySolidMesh 

Solid Mesh, it could be: vertex color mesh or general mesh.

This will be displayed in any viewport that requires smooth mesh.

RenderItemCategoryDiagonalMesh 

Diagonal Mesh.

This is the dotted edge lines when user enabled "show edges" of a node and enable the wireframe mode of viewport.

RenderItemCategoryEdgeMesh 

Edge mesh, this layer includes the edges.

This will be displayed in viewport that has "wireframe" or "hidden line" on.

RenderItemCategorySubObjectVertexTicks 

Vertex ticks mesh.

This will be displayed when the node has "Vertex Ticks" display option on or the vertex tick sub-object be selected.

RenderItemCategorySubObjectEdgeMesh 

Sub object edge mesh.

The difference between this kind of render item and the edge mesh render item is that this kind of render item highlight selected edges, and only be displayed when the node is selected.

RenderItemCategoryOtherSubObjects 

Other sub objects.

This will be treated as gizmos and will only be displayed when the node is selected.

RenderItemCategoryGizmo 

Gizmos part.

This layer includes all other renderable items, like slice plane, mouse helper, etc. This kind of render items will be displayed in all viewports.


Function Documentation

DataBridgeAPI size_t MaxSDK::Graphics::GetVertexStride ( const VertexFieldType  type )

Get the vertex stride by a given vertex type, in bytes.

Parameters:
type the vertex type.
Returns:
the vertex stride, in bytes.
DataBridgeAPI size_t MaxSDK::Graphics::GetIndexStride ( const IndexType  type )

Get the index stride by a given index type, in bytes.

Parameters:
type the index type.
Returns:
the index stride, in bytes.
IDisplayManager* MaxSDK::Graphics::GetIDisplayManager ( ) [inline]

Helper function to access the IDisplayManager core interface.

Returns:
A pointer to IDisplayManager
{
    return dynamic_cast<IDisplayManager*>(GetCOREInterface(INITROUS_DISPLAY_MANAGER_INTERFACE_ID));
};
bool MaxSDK::Graphics::IsRetainedModeEnabled ( ) [inline]

Helper function to test whether the new viewport graphics system is running.

Returns:
TRUE if new viewport graphics is active
{
    IDisplayManager* pGraphicsManager = GetIDisplayManager();
    return NULL != pGraphicsManager && pGraphicsManager->IsRetainedModeEnabled();
}
GraphicsDriverAPI void MaxSDK::Graphics::GenerateRenderItems ( RenderItemHandleArray &  renderItems,
Mesh pMaxMesh,
unsigned long  renderItemCategoryFlags,
const MaterialRequiredStreams &  requiredStreams 
)

Generate a set of render items from an input mesh and viewport requirements.

Remarks:
Usually plugins use this function in their UpdateDisplay(). If plugins maintain instances of Mesh, then they should use this function to convert those mesh instances to render items (RenderItemHandle).
Parameters:
renderItems the container that accept newly generated render items.
pMaxMesh the input mesh to be converted to render items.
renderItemCategoryFlags defines the visible render item categories. It is a combination of RenderItemCategory
requiredStreams defines the required mesh channel. This parameter defines which channel (for example: normal channel, texture coordinate channel, etc.) will be added to the final render item.
GraphicsDriverAPI void MaxSDK::Graphics::GenerateRenderItems ( RenderItemHandleArray &  renderItems,
MNMesh pMaxMesh,
unsigned long  renderItemCategoryFlags,
const MaterialRequiredStreams &  requiredStreams 
)

Generate a set of render items from an input MNMesh and viewport requirements.

Remarks:
Usually plugins use this function in their UpdateDisplay(). If plugins maintain instances of MNMesh, then they should use this function to convert those MNMesh instances to render items (RenderItemHandle). Converting MNMesh to Mesh via MNMesh::OutToTri() and then use the Mesh version of GenerateRenderItems is possible but not recommended because it causes unnecessary conversions and is very slow.
Parameters:
renderItems the container that accept newly generated render items.
pMaxMesh the input MNMesh to be converted to render items.
renderItemCategoryFlags defines the visible render item categories. It is a combination of RenderItemCategory
requiredStreams defines the required mesh channel. This parameter defines which channel (for example: normal channel, texture coordinate channel, etc.) will be added to the final render item.

Variable Documentation