*** empty log message ***

This commit is contained in:
David Rose 2001-06-22 03:47:32 +00:00
parent fd61ad814a
commit 5eb03014e6
13 changed files with 108 additions and 47 deletions

View File

@ -1,7 +1,7 @@
#begin lib_target
#define TARGET ptloader
#define BUILDING_DLL BUILDING_PTLOADER
#define LOCAL_LIBS fltegg flt lwoegg lwo converter pandatoolbase
#define LOCAL_LIBS xfile fltegg flt lwoegg lwo converter pandatoolbase
#define OTHER_LIBS \
egg2sg:c builder:c egg:c pandaegg:m \
mathutil:c linmath:c putil:c panda:m \
@ -10,6 +10,12 @@
#define UNIX_SYS_LIBS \
m
#if $[HAVE_DX]
// To link in xfile, we need to also link in the DX libraries.
#define WIN_SYS_LIBS d3dxof.lib
#define USE_DX yes
#endif
#define SOURCES \
config_ptloader.cxx config_ptloader.h \
loaderFileTypePandatool.cxx loaderFileTypePandatool.h

View File

@ -19,14 +19,18 @@
#include "config_ptloader.h"
#include "loaderFileTypePandatool.h"
#include <config_lwo.h>
#include <fltToEggConverter.h>
#include <config_flt.h>
#include <lwoToEggConverter.h>
#include "config_lwo.h"
#include "fltToEggConverter.h"
#include "config_flt.h"
#include "lwoToEggConverter.h"
#include <dconfig.h>
#include <loaderFileTypeRegistry.h>
#include <eggData.h>
#ifdef HAVE_DX
#include "xFileToEggConverter.h"
#endif
#include "dconfig.h"
#include "loaderFileTypeRegistry.h"
#include "eggData.h"
ConfigureDef(config_ptloader);
@ -61,4 +65,9 @@ init_libptloader() {
init_libflt();
LwoToEggConverter *lwo = new LwoToEggConverter;
reg->register_type(new LoaderFileTypePandatool(lwo));
#ifdef HAVE_DX
XFileToEggConverter *xfile = new XFileToEggConverter;
reg->register_type(new LoaderFileTypePandatool(xfile));
#endif
}

View File

@ -1,8 +1,8 @@
#define DIRECTORY_IF_DX yes
#define USE_DX yes
#begin bin_target
#define TARGET egg2x
#begin ss_lib_target
#define TARGET xfile
#define LOCAL_LIBS eggbase progbase pandatoolbase
#define OTHER_LIBS \
egg:c pandaegg:m \
@ -23,36 +23,4 @@
xFileToEggConverter.cxx xFileToEggConverter.h \
xFileVertex.cxx xFileVertex.h
#define SOURCES \
$[SOURCES] \
eggToX.cxx eggToX.h
#end bin_target
#begin bin_target
#define TARGET x2egg
#define LOCAL_LIBS converter eggbase progbase pandatoolbase
#define OTHER_LIBS \
egg:c pandaegg:m \
mathutil:c linmath:c putil:c panda:m \
express:c pandaexpress:m \
dtoolconfig dtool pystub \
#define WIN_SYS_LIBS \
d3dxof.lib
#define SOURCES \
xFileFace.cxx xFileFace.h \
xFileMaker.cxx xFileMaker.h \
xFileMaterial.cxx xFileMaterial.h \
xFileMesh.cxx xFileMesh.h \
xFileNormal.cxx xFileNormal.h \
xFileTemplates.cxx xFileTemplates.h \
xFileToEggConverter.cxx xFileToEggConverter.h \
xFileVertex.cxx xFileVertex.h
#define SOURCES \
$[SOURCES] \
xFileToEgg.cxx xFileToEgg.h
#end bin_target
#end ss_lib_target

View File

@ -92,6 +92,7 @@ open(const Filename &filename) {
// Save the templates we will use.
static const GUID *temps[] = {
&mydef_TID_D3DRMHeader,
&TID_D3DRMCoords2d,
&TID_D3DRMVector,
&TID_D3DRMColorRGBA,

View File

@ -211,13 +211,27 @@ void XFileMaterial::
make_texture_data(Datagram &raw_data) {
raw_data.clear();
// Convert the filename to an appropriate form for the X file.
string os_filename = _texture.to_os_specific();
// Now we have to double up the backslashes.
string filename;
for (string::const_iterator pi = os_filename.begin();
pi != os_filename.end();
++pi) {
if ((*pi) == '\\') {
filename += '\\';
filename += '\\';
} else {
filename += (*pi);
}
}
// Get a char * pointer to the texture filename, to pass into the
// Microsoft DX file interface. Unfortunately, we can't delete this
// again, since it needs to live longer than the life of the
// XFileMaterial object itself, so this becomes a memory leak
// (unless the DX file interface frees it, but the documentation is
// far from clear). Too bad.
string filename = _texture.to_os_specific();
char *filename_str = strdup(filename.c_str());
// The Microsoft convention is to stuff a pointer into a four-byte
@ -269,7 +283,7 @@ read_texture_data(const Datagram &raw_data) {
// The Microsoft convention is to stuff a pointer into a four-byte
// field. Not terribly portable, but that's the interface.
const char *ptr = (const char *)di.get_int32();
_texture = ptr;
_texture = Filename::from_os_specific(ptr);
_has_texture = true;
if (di.get_remaining_size() != 0) {

View File

@ -24,4 +24,11 @@
const int d3drm_xtemplates_length = D3DRM_XTEMPLATE_BYTES;
// I don't know what the official Windows way to declare this thing
// is. This is my way. What a strange coding environment this is.
#define DECLARE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DECLARE_GUID(mydef_TID_D3DRMHeader,
0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);

View File

@ -19,6 +19,15 @@
#ifndef XFILETEMPLATES_H
#define XFILETEMPLATES_H
#include "pandatoolbase.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <d3d.h>
#include <dxfile.h>
#include <rmxfguid.h>
#undef WIN32_LEAN_AND_MEAN
////////////////////////////////////////////////////////////////////
//
// This file exists to get an external handle to the table defined in
@ -36,5 +45,10 @@
extern unsigned char D3DRM_XTEMPLATES[];
extern const int d3drm_xtemplates_length;
// For some reason, this definition does not appear in rmxfguid.h.
/* {3D82AB43-62DA-11cf-AB39-0020AF71E433} */
DEFINE_GUID(mydef_TID_D3DRMHeader,
0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33);
#endif

View File

@ -27,7 +27,6 @@
#include "eggMaterialCollection.h"
#include "eggTextureCollection.h"
////////////////////////////////////////////////////////////////////
// Function: XFileToEggConverter::Constructor
// Access: Public
@ -133,6 +132,10 @@ convert_file(const Filename &filename) {
return false;
}
if (_egg_data->get_coordinate_system() == CS_default) {
_egg_data->set_coordinate_system(CS_yup_left);
}
return get_toplevel();
}
@ -249,7 +252,10 @@ convert_data_object(LPDIRECTXFILEDATA obj, EggGroupNode *egg_parent) {
return false;
}
if (*type == TID_D3DRMFrame) {
if (*type == mydef_TID_D3DRMHeader) {
// Quietly ignore headers.
} else if (*type == TID_D3DRMFrame) {
if (!convert_frame(obj, egg_parent)) {
return false;
}

View File

@ -0,0 +1,36 @@
#define DIRECTORY_IF_DX yes
#define USE_DX yes
#begin bin_target
#define TARGET egg2x
#define LOCAL_LIBS xfile eggbase progbase pandatoolbase
#define OTHER_LIBS \
egg:c pandaegg:m \
mathutil:c linmath:c putil:c panda:m \
express:c pandaexpress:m \
dtoolconfig dtool pystub \
#define WIN_SYS_LIBS \
d3dxof.lib
#define SOURCES \
eggToX.cxx eggToX.h
#end bin_target
#begin bin_target
#define TARGET x2egg
#define LOCAL_LIBS xfile converter eggbase progbase pandatoolbase
#define OTHER_LIBS \
egg:c pandaegg:m \
mathutil:c linmath:c putil:c panda:m \
express:c pandaexpress:m \
dtoolconfig dtool pystub \
#define WIN_SYS_LIBS \
d3dxof.lib
#define SOURCES \
xFileToEgg.cxx xFileToEgg.h
#end bin_target