# MultitexReducer

from pandac.PandaModules import MultitexReducer

Class : MultitexReducer
Description : This object presents an interface for generating new texture images that represent the combined images from one or more individual textures, reproducing certain kinds of multitexture effects without depending on multitexture support in the hardware.
This also flattens out texture matrices and removes extra texture coordinates from the Geoms. It is thus not a complete substitute for true multitexturing, because it does not lend itself well to dynamic animation of the textures once they have been flattened. It is, however, useful for "baking in" a particular multitexture effect.

## Inheritance:

MultitexReducer:

## Methods of MultitexReducer:

clear
flatten
scan
setAllowTexMat
setTarget
setUseGeom

clear void MultitexReducer::clear(void); Description: Removes the record of nodes that were previously discovered by scan().

flatten void MultitexReducer::flatten(GraphicsOutput *window); Description: Actually performs the reducing operations on the nodes that were previously scanned. A window that can be used to create texture buffers suitable for rendering this geometry must be supplied. This specifies the particular GSG that will be used to composite the textures.

scan void MultitexReducer::scan(NodePath const &node); Filename: multitexReducer.I Created by: drose (30Nov04) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Starts scanning the hierarchy beginning at the indicated node. Any GeomNodes discovered in the hierarchy with multitexture will be added to internal structures in the MultitexReducer so that a future call to flatten() will operate on all of these at once. This version of this method does not accumulate state from the parents of the indicated node; thus, only multitexture effects that have been applied at node and below will be considered. The second parameter represents the NodePath from which to accumulate the state that is considered for the multitexture. Pass an empty NodePath to accumulate all the state from the root of the graph, or you may specify some other node here in order to not consider nodes above that as contributing to the state to be flattened. This is particularly useful if you have some texture stage which is applied globally to a scene (for instance, a caustics effect), which you don't want to be considered for flattening by the MultitexReducer. The indicated transform and state are the state inherited from the node's ancestors; any multitexture operations will be accumulated from the indicated starting state.

setAllowTexMat void MultitexReducer::set_allow_tex_mat(bool allow_tex_mat); Description: Indicates whether the resulting texture should be expected to be animated beyond its current range via a texture matrix (true), or whether the current range of texture coordinates will be sufficient forever (false). If this is set to true, then the entire texture image must be generated, in the assumption that the user may animate the texture around on the surface after it has been composed. If this is set to false (the default), then only the portion of the texture image which is actually in use must be generated, which may be a significant savings in texture memory.

setTarget void MultitexReducer::set_target(TextureStage *stage); Description: Specifies the target TextureStage (and InternalName) that will be left on each multitexture node after the flatten operation has completed.

setUseGeom void MultitexReducer::set_use_geom(bool use_geom); Description: Indicates whether the actual geometry will be used to generate the textures. If this is set to true, the geometry discovered by scan() will be used to generate the textures, which allows for the vertex and polygon colors to be made part of the texture itself (and makes the M_decal multitexture mode more reliable). However, this only works if the geometry does not contain multiple different polygons that map to the same UV range. If this is set to false (the default), a plain flat card will be used to generate the textures, which is more robust in general, but the resulting texture will not include vertex colors and M_decal won't work properly. Note that in case multiple sets of texture coordinates are in effect, then the additional sets will always use the geometry anyway regardless of the setting of this flag (but this will not affect vertex color).