Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XFileMaker Class Reference

This class converts a Panda scene graph into a .X file and writes it out. More...

#include <xFileMaker.h>

List of all members.

Public Member Functions

 XFileMaker ()
 ~XFileMaker ()
bool open (const Filename &filename)
 Opens the indicated filename for writing, and writes the .x header information; returns true on success, false otherwise.

void close ()
 Finalizes and closes the file previously opened via open().

bool add_tree (EggData &egg_data)
 Adds the egg tree rooted at the indicated node to the DX structure.


Private Types

typedef pmap< LPDIRECTXFILEDATA,
XFileMesh * > 
Meshes

Private Member Functions

bool add_node (EggNode *egg_node, LPDIRECTXFILEDATA dx_parent)
 Adds the node to the DX structure, in whatever form it is supported.

bool add_group (EggGroup *egg_group, LPDIRECTXFILEDATA dx_parent)
 Adds a frame for the indicated group node.

bool add_bin (EggBin *egg_bin, LPDIRECTXFILEDATA dx_parent)
 Determines what kind of object needs to be added for the indicated bin node.

bool add_polyset (EggBin *egg_bin, LPDIRECTXFILEDATA dx_parent)
 Adds a mesh object corresponding to the collection of polygons within the indicated bin.

bool recurse_nodes (EggGroupNode *egg_node, LPDIRECTXFILEDATA dx_parent)
 Adds each child of the indicated Node as a child of the indicated DX object.

bool create_object (LPDIRECTXFILEDATA &obj, REFGUID template_id, const string &name, const Datagram &dg)
 Creates a DX data object.

bool create_frame (LPDIRECTXFILEDATA &obj, const string &name)
 Creates a "frame" object with the indicated name.

bool add_frame_transform (LPDIRECTXFILEDATA obj, const LMatrix4f &mat)
 Adds a transformation matrix to the indicated frame.

bool attach_and_release (LPDIRECTXFILEDATA obj, LPDIRECTXFILEDATA dx_parent)
 Assigns the indicated X data object to the indicated parent, and releases the pointer.

XFileMeshget_mesh (LPDIRECTXFILEDATA dx_parent)
 Returns a suitable XFileMesh object for creating meshes within the indicated dx_parent object.

bool finalize_mesh (LPDIRECTXFILEDATA dx_parent)
 Creates the actual DX mesh object corresponding to the indicated dx_parent object.


Static Private Member Functions

string make_nice_name (const string &str)
 Transforms the indicated egg name to a name that is acceptable to the DirectX format.


Private Attributes

LPDIRECTXFILE _dx_file
LPDIRECTXFILESAVEOBJECT _dx_file_save
int _mesh_index
Meshes _meshes


Detailed Description

This class converts a Panda scene graph into a .X file and writes it out.

Definition at line 56 of file xFileMaker.h.


Member Typedef Documentation

typedef pmap<LPDIRECTXFILEDATA, XFileMesh *> XFileMaker::Meshes [private]
 

Definition at line 91 of file xFileMaker.h.


Constructor & Destructor Documentation

XFileMaker::XFileMaker  ) 
 

Definition at line 50 of file xFileMaker.cxx.

References close().

XFileMaker::~XFileMaker  ) 
 

Definition at line 64 of file xFileMaker.cxx.

References _dx_file, close(), D3DRM_XTEMPLATES, d3drm_xtemplates_length, and nout.


Member Function Documentation

bool XFileMaker::add_bin EggBin egg_bin,
LPDIRECTXFILEDATA  dx_parent
[private]
 

Determines what kind of object needs to be added for the indicated bin node.

Definition at line 299 of file xFileMaker.cxx.

Referenced by add_tree().

bool XFileMaker::add_frame_transform LPDIRECTXFILEDATA  obj,
const LMatrix4f &  mat
[private]
 

Adds a transformation matrix to the indicated frame.

Definition at line 417 of file xFileMaker.cxx.

bool XFileMaker::add_group EggGroup egg_group,
LPDIRECTXFILEDATA  dx_parent
[private]
 

Adds a frame for the indicated group node.

Definition at line 255 of file xFileMaker.cxx.

Referenced by add_tree().

bool XFileMaker::add_node EggNode egg_node,
LPDIRECTXFILEDATA  dx_parent
[private]
 

Adds the node to the DX structure, in whatever form it is supported.

Definition at line 204 of file xFileMaker.cxx.

bool XFileMaker::add_polyset EggBin egg_bin,
LPDIRECTXFILEDATA  dx_parent
[private]
 

Adds a mesh object corresponding to the collection of polygons within the indicated bin.

Definition at line 321 of file xFileMaker.cxx.

References _dx_file_save, Datagram::get_data(), Datagram::get_length(), make_nice_name(), nout, and NULL.

bool XFileMaker::add_tree EggData egg_data  ) 
 

Adds the egg tree rooted at the indicated node to the DX structure.

This may be somewhat destructive of the egg tree. Returns true on success, false on failure.

Definition at line 172 of file xFileMaker.cxx.

References add_bin(), add_group(), create_frame(), DCAST, EggGroupNode::get_class_type(), EggGroup::get_class_type(), EggBin::get_class_type(), EggGroupNode::get_name(), EggNode::is_of_type(), and recurse_nodes().

bool XFileMaker::attach_and_release LPDIRECTXFILEDATA  obj,
LPDIRECTXFILEDATA  dx_parent
[private]
 

Assigns the indicated X data object to the indicated parent, and releases the pointer.

Definition at line 444 of file xFileMaker.cxx.

void XFileMaker::close  ) 
 

Finalizes and closes the file previously opened via open().

Definition at line 146 of file xFileMaker.cxx.

References _meshes, finalize_mesh(), EggPolysetMaker::make_bins(), nassertr, NULL, and recurse_nodes().

Referenced by XFileMaker(), and ~XFileMaker().

bool XFileMaker::create_frame LPDIRECTXFILEDATA &  obj,
const string &  name
[private]
 

Creates a "frame" object with the indicated name.

Definition at line 404 of file xFileMaker.cxx.

Referenced by add_tree().

bool XFileMaker::create_object LPDIRECTXFILEDATA &  obj,
REFGUID  template_id,
const string &  name,
const Datagram dg
[private]
 

Creates a DX data object.

Definition at line 371 of file xFileMaker.cxx.

Referenced by recurse_nodes().

bool XFileMaker::finalize_mesh LPDIRECTXFILEDATA  dx_parent  )  [private]
 

Creates the actual DX mesh object corresponding to the indicated dx_parent object.

Definition at line 544 of file xFileMaker.cxx.

Referenced by close().

XFileMesh * XFileMaker::get_mesh LPDIRECTXFILEDATA  dx_parent  )  [private]
 

Returns a suitable XFileMesh object for creating meshes within the indicated dx_parent object.

Definition at line 518 of file xFileMaker.cxx.

string XFileMaker::make_nice_name const string &  str  )  [static, private]
 

Transforms the indicated egg name to a name that is acceptable to the DirectX format.

Definition at line 486 of file xFileMaker.cxx.

References _mesh_index, and _meshes.

Referenced by add_polyset().

bool XFileMaker::open const Filename filename  ) 
 

Opens the indicated filename for writing, and writes the .x header information; returns true on success, false otherwise.

Definition at line 81 of file xFileMaker.cxx.

References nout.

bool XFileMaker::recurse_nodes EggGroupNode egg_node,
LPDIRECTXFILEDATA  dx_parent
[private]
 

Adds each child of the indicated Node as a child of the indicated DX object.

Definition at line 350 of file xFileMaker.cxx.

References create_object().

Referenced by add_tree(), and close().


Member Data Documentation

LPDIRECTXFILE XFileMaker::_dx_file [private]
 

Definition at line 86 of file xFileMaker.h.

Referenced by ~XFileMaker().

LPDIRECTXFILESAVEOBJECT XFileMaker::_dx_file_save [private]
 

Definition at line 87 of file xFileMaker.h.

Referenced by add_polyset().

int XFileMaker::_mesh_index [private]
 

Definition at line 89 of file xFileMaker.h.

Referenced by make_nice_name().

Meshes XFileMaker::_meshes [private]
 

Definition at line 92 of file xFileMaker.h.

Referenced by close(), and make_nice_name().


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:28:09 2003 for Panda-Tool by doxygen1.3