resurrect x converter

This commit is contained in:
David Rose 2004-10-02 15:38:25 +00:00
parent 0466905408
commit 8ecf040e27
6 changed files with 72 additions and 42 deletions

View File

@ -2,7 +2,8 @@
#define TARGET ptloader
#define BUILDING_DLL BUILDING_PTLOADER
#define LOCAL_LIBS \
fltegg flt lwoegg lwo dxfegg dxf vrmlegg pvrml converter pandatoolbase
fltegg flt lwoegg lwo dxfegg dxf vrmlegg pvrml xfile \
converter pandatoolbase
#define OTHER_LIBS \
egg2pg:c builder:c egg:c pandaegg:m \
mathutil:c linmath:c putil:c \
@ -17,6 +18,9 @@
#define UNIX_SYS_LIBS \
m
#define WIN_SYS_LIBS \
d3dxof.lib dxguid.lib d3d8.lib d3dx8.lib dxerr8.lib
#define SOURCES \
config_ptloader.cxx config_ptloader.h \
loaderFileTypePandatool.cxx loaderFileTypePandatool.h

View File

@ -26,12 +26,10 @@
#include "dxfToEggConverter.h"
#include "vrmlToEggConverter.h"
/*
#ifdef HAVE_DX
#include "config_xfile.h"
#include "xFileToEggConverter.h"
#endif
*/
#include "dconfig.h"
#include "loaderFileTypeRegistry.h"
@ -89,13 +87,11 @@ init_libptloader() {
VRMLToEggConverter *vrml = new VRMLToEggConverter;
reg->register_type(new LoaderFileTypePandatool(vrml));
/*
#ifdef HAVE_DX
init_libxfile();
XFileToEggConverter *xfile = new XFileToEggConverter;
reg->register_type(new LoaderFileTypePandatool(xfile));
#endif
*/
#ifdef HAVE_MAYA
// Register the Maya converter as a deferred type. We don't compile

View File

@ -1,7 +1,8 @@
// This package is temporarily disabled.
#define BUILD_DIRECTORY
//#define BUILD_DIRECTORY $[HAVE_DX]
// The .x converter takes advantage of the DirectX API's; therefore,
// it can only be built if we have DX available (and therefore it only
// builds on Windows--sorry).
#define BUILD_DIRECTORY $[HAVE_DX]
#define USE_PACKAGES dx
#begin ss_lib_target
@ -14,7 +15,7 @@
dtoolconfig dtool pystub \
#define WIN_SYS_LIBS \
d3dxof.lib dxguid.lib
d3dxof.lib dxguid.lib d3d8.lib d3dx8.lib dxerr8.lib
#define COMBINED_SOURCES $[TARGET]_composite1.cxx

View File

@ -231,9 +231,11 @@ convert_object(LPDIRECTXFILEOBJECT obj, EggGroupNode *egg_parent) {
}
// It isn't.
xfile_cat.error()
<< "Ignoring object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring object of unknown type: "
<< get_object_name(obj) << "\n";
}
return true;
}
@ -276,9 +278,11 @@ convert_data_object(LPDIRECTXFILEDATA obj, EggGroupNode *egg_parent) {
}
} else {
xfile_cat.error()
<< "Ignoring data object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring data object of unknown type: "
<< get_object_name(obj) << "\n";
}
}
return true;
@ -416,9 +420,11 @@ convert_mesh_object(LPDIRECTXFILEOBJECT obj, XFileMesh &mesh) {
}
// It isn't.
xfile_cat.error()
<< "Ignoring object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring mesh object of unknown type: "
<< get_object_name(obj) << "\n";
}
return true;
}
@ -462,9 +468,11 @@ convert_mesh_data_object(LPDIRECTXFILEDATA obj, XFileMesh &mesh) {
}
} else {
xfile_cat.error()
<< "Ignoring data object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring mesh data object of unknown type: "
<< get_object_name(obj) << "\n";
}
}
return true;
@ -581,6 +589,7 @@ bool XFileToEggConverter::
convert_material_list_object(LPDIRECTXFILEOBJECT obj, XFileMesh &mesh) {
HRESULT hr;
LPDIRECTXFILEDATA data_obj;
LPDIRECTXFILEDATAREFERENCE ref_obj;
// See if the object is a data object.
hr = obj->QueryInterface(IID_IDirectXFileData, (void **)&data_obj);
@ -589,10 +598,21 @@ convert_material_list_object(LPDIRECTXFILEOBJECT obj, XFileMesh &mesh) {
return convert_material_list_data_object(data_obj, mesh);
}
// Or maybe it's a reference to a previous object.
hr = obj->QueryInterface(IID_IDirectXFileDataReference, (void **)&ref_obj);
if (hr == DD_OK) {
// It is.
if (ref_obj->Resolve(&data_obj) == DXFILE_OK) {
return convert_material_list_data_object(data_obj, mesh);
}
}
// It isn't.
xfile_cat.error()
<< "Ignoring object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring material list object of unknown type: "
<< get_object_name(obj) << "\n";
}
return true;
}
@ -620,9 +640,11 @@ convert_material_list_data_object(LPDIRECTXFILEDATA obj, XFileMesh &mesh) {
return false;
}
} else {
xfile_cat.error()
<< "Ignoring data object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring material list data object of unknown type: "
<< get_object_name(obj) << "\n";
}
}
return true;
@ -692,9 +714,11 @@ convert_material_object(LPDIRECTXFILEOBJECT obj, XFileMaterial &material) {
}
// It isn't.
xfile_cat.error()
<< "Ignoring object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring material object of unknown type: "
<< get_object_name(obj) << "\n";
}
return true;
}
@ -722,9 +746,11 @@ convert_material_data_object(LPDIRECTXFILEDATA obj, XFileMaterial &material) {
return false;
}
} else {
xfile_cat.error()
<< "Ignoring data object of unknown type: " << get_object_name(obj)
<< "\n";
if (xfile_cat.is_debug()) {
xfile_cat.debug()
<< "Ignoring material data object of unknown type: "
<< get_object_name(obj) << "\n";
}
}
return true;

View File

@ -1,7 +1,8 @@
// This package is temporarily disabled.
#define BUILD_DIRECTORY
//#define BUILD_DIRECTORY $[HAVE_DX]
// The .x converter takes advantage of the DirectX API's; therefore,
// it can only be built if we have DX available (and therefore it only
// builds on Windows--sorry).
#define BUILD_DIRECTORY $[HAVE_DX]
#define USE_PACKAGES dx
#begin bin_target
@ -14,7 +15,7 @@
dtoolconfig dtool pystub \
#define WIN_SYS_LIBS \
d3dxof.lib dxguid.lib
d3dxof.lib dxguid.lib d3d8.lib d3dx8.lib dxerr8.lib
#define SOURCES \
eggToX.cxx eggToX.h
@ -31,7 +32,7 @@
dtoolconfig dtool pystub \
#define WIN_SYS_LIBS \
d3dxof.lib
d3dxof.lib dxguid.lib d3d8.lib d3dx8.lib dxerr8.lib
#define SOURCES \
xFileToEgg.cxx xFileToEgg.h

View File

@ -29,11 +29,11 @@ XFileToEgg::
XFileToEgg() :
SomethingToEgg("DirectX", ".x")
{
add_path_replace_options();
add_path_store_options();
add_units_options();
add_normals_options();
add_transform_options();
add_texture_path_options();
add_rel_dir_options();
add_search_path_options(true);
set_program_description
("This program converts DirectX retained-mode (.x) files to egg. This "
@ -59,7 +59,9 @@ run() {
XFileToEggConverter converter;
converter.set_egg_data(&_data, false);
converter.set_texture_path_convert(_texture_path_convert, _make_rel_dir);
// Copy in the path and animation parameters.
apply_parameters(converter);
if (!converter.convert_file(_input_filename)) {
nout << "Unable to read " << _input_filename << "\n";