Interface: dxshadermanager
The dxshadermanager Core Interface exposes the DirectX Shader Manager to MAXScript.
Interface: dxshadermanager
Methods:
<maxObject>dxshadermanager.getViewportManager <material>material
Returns the viewport manager’s ViewportManagerCustAttrib object for the specified material.
<boolean>dxshadermanager.IsVisible()
Returns true if the manager is visible.
<float>dxshadermanager.SetVisible <boolean>show
This method can be used to turn the manager on and off. It will not have an effect
if the user is running in DirectX mode.
<maxObject>dxshadermanager.addViewportManager <material>material
Adds a new viewport manager to the specified material and returns the ViewportManagerCustAttrib
object providing an interface to access its effects.
EXAMPLE:
|
-- Create a new standard material
newmat = StandardMaterial()
-- Get the viewport manager from the material
manager = DXShaderManager.getViewportManager newmat
-- If there is no manager, assign a new one
if (manager==null) then manager = DXShaderManager.addViewportManager newmat
-- Get the active viewport effect
effect = manager.getactiveviewporteffect()
-- If there is no active effect, create a new one.
if (effect == null) then
effect = manager.setviewporteffect 1
-- 1 in our case is the lightmap, 0 sets it to "none" -- Set the LightMap file names
effect.lightmap_filename = GetDir(#image) + "\\testlightmap.bmp"
effect.diffuse_filename = GetDir(#image) + "\\testdiffuse.bmp"
-- set the mapping channel to use
effect.lightmap_mapping = 1
effect.diffuse_mapping = 1
-- Search for the effect based on name -- Get the total number of effects:
num = manager.getNumViewportEffects()
-- Step through all effects and check for name. If found, -- then activate it.
for i = 1 to num do
(
if (manager.getViewportEffectName(i) == "LightMap") then effect = manager.setviewporteffect i
)
|