mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
a bit more .pz support
This commit is contained in:
parent
ecf6915a02
commit
6d0b7f4344
@ -93,6 +93,18 @@ get_additional_extensions() const {
|
|||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: SomethingToEggConverter::supports_compressed
|
||||||
|
// Access: Published, Virtual
|
||||||
|
// Description: Returns true if this file type can transparently load
|
||||||
|
// compressed files (with a .pz extension), false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool SomethingToEggConverter::
|
||||||
|
supports_compressed() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: SomethingToEggConverter::get_input_units
|
// Function: SomethingToEggConverter::get_input_units
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -106,6 +106,7 @@ public:
|
|||||||
virtual string get_name() const=0;
|
virtual string get_name() const=0;
|
||||||
virtual string get_extension() const=0;
|
virtual string get_extension() const=0;
|
||||||
virtual string get_additional_extensions() const;
|
virtual string get_additional_extensions() const;
|
||||||
|
virtual bool supports_compressed() const;
|
||||||
|
|
||||||
virtual bool convert_file(const Filename &filename)=0;
|
virtual bool convert_file(const Filename &filename)=0;
|
||||||
virtual DistanceUnit get_input_units();
|
virtual DistanceUnit get_input_units();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "dxfFile.h"
|
#include "dxfFile.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
|
#include "virtualFileSystem.h"
|
||||||
|
|
||||||
DXFFile::Color DXFFile::_colors[DXF_num_colors] = {
|
DXFFile::Color DXFFile::_colors[DXF_num_colors] = {
|
||||||
{ 1, 1, 1 }, // Color 0 is not used.
|
{ 1, 1, 1 }, // Color 0 is not used.
|
||||||
@ -286,6 +287,8 @@ DXFFile::Color DXFFile::_colors[DXF_num_colors] = {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
DXFFile::
|
DXFFile::
|
||||||
DXFFile() {
|
DXFFile() {
|
||||||
|
_in = NULL;
|
||||||
|
_owns_in = false;
|
||||||
_layer = NULL;
|
_layer = NULL;
|
||||||
reset_entity();
|
reset_entity();
|
||||||
_color_index = -1;
|
_color_index = -1;
|
||||||
@ -298,6 +301,10 @@ DXFFile() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
DXFFile::
|
DXFFile::
|
||||||
~DXFFile() {
|
~DXFFile() {
|
||||||
|
if (_owns_in) {
|
||||||
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
|
vfs->close_read_file(_in);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -310,19 +317,32 @@ DXFFile::
|
|||||||
void DXFFile::
|
void DXFFile::
|
||||||
process(Filename filename) {
|
process(Filename filename) {
|
||||||
filename.set_text();
|
filename.set_text();
|
||||||
filename.open_read(_in_file);
|
|
||||||
process(_in_file);
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
|
istream *in = vfs->open_read_file(filename, true);
|
||||||
|
if (in == (istream *)NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
process(in, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXFFile::process
|
// Function: DXFFile::process
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Reads the indicated stream as a DXF file.
|
// Description: Reads the indicated stream as a DXF file. If owns_in
|
||||||
|
// is true, then the istream will be deleted via
|
||||||
|
// vfs->close_read_file() when the DXFFile object
|
||||||
|
// destructs.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DXFFile::
|
void DXFFile::
|
||||||
process(istream &in) {
|
process(istream *in, bool owns_in) {
|
||||||
_in = ∈
|
if (_owns_in) {
|
||||||
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
|
vfs->close_read_file(_in);
|
||||||
|
}
|
||||||
|
_in = in;
|
||||||
|
_owns_in = owns_in;
|
||||||
_state = ST_top;
|
_state = ST_top;
|
||||||
|
|
||||||
begin_file();
|
begin_file();
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
virtual ~DXFFile();
|
virtual ~DXFFile();
|
||||||
|
|
||||||
void process(Filename filename);
|
void process(Filename filename);
|
||||||
void process(istream &in);
|
void process(istream *in, bool owns_in);
|
||||||
|
|
||||||
// These functions are called as the file is processed. These are
|
// These functions are called as the file is processed. These are
|
||||||
// the main hooks for redefining how the class should dispense its
|
// the main hooks for redefining how the class should dispense its
|
||||||
@ -151,7 +151,7 @@ protected:
|
|||||||
LMatrix4d _ocs2wcs;
|
LMatrix4d _ocs2wcs;
|
||||||
|
|
||||||
istream *_in;
|
istream *_in;
|
||||||
ifstream _in_file;
|
bool _owns_in;
|
||||||
|
|
||||||
int _code;
|
int _code;
|
||||||
string _string;
|
string _string;
|
||||||
|
@ -82,6 +82,18 @@ get_extension() const {
|
|||||||
return "dxf";
|
return "dxf";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DXFToEggConverter::supports_compressed
|
||||||
|
// Access: Published, Virtual
|
||||||
|
// Description: Returns true if this file type can transparently load
|
||||||
|
// compressed files (with a .pz extension), false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DXFToEggConverter::
|
||||||
|
supports_compressed() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXFToEggConverter::convert_file
|
// Function: DXFToEggConverter::convert_file
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -144,10 +156,10 @@ done_entity() {
|
|||||||
// same). We'll add the vertices to our list of vertices and then
|
// same). We'll add the vertices to our list of vertices and then
|
||||||
// define the polygon.
|
// define the polygon.
|
||||||
_verts.clear();
|
_verts.clear();
|
||||||
_verts.push_back(DXFVertex(_p));
|
|
||||||
_verts.push_back(DXFVertex(_q));
|
|
||||||
_verts.push_back(DXFVertex(_r));
|
|
||||||
_verts.push_back(DXFVertex(_s));
|
_verts.push_back(DXFVertex(_s));
|
||||||
|
_verts.push_back(DXFVertex(_r));
|
||||||
|
_verts.push_back(DXFVertex(_q));
|
||||||
|
_verts.push_back(DXFVertex(_p));
|
||||||
|
|
||||||
nassertv(_layer!=NULL);
|
nassertv(_layer!=NULL);
|
||||||
((DXFToEggLayer *)_layer)->add_polygon(this);
|
((DXFToEggLayer *)_layer)->add_polygon(this);
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
|
|
||||||
virtual string get_name() const;
|
virtual string get_name() const;
|
||||||
virtual string get_extension() const;
|
virtual string get_extension() const;
|
||||||
|
virtual bool supports_compressed() const;
|
||||||
|
|
||||||
virtual bool convert_file(const Filename &filename);
|
virtual bool convert_file(const Filename &filename);
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ add_polygon(const DXFToEggConverter *entity) {
|
|||||||
const DXFFile::Color &color = entity->get_color();
|
const DXFFile::Color &color = entity->get_color();
|
||||||
poly->set_color(Colorf(color.r, color.g, color.b, 1.0));
|
poly->set_color(Colorf(color.r, color.g, color.b, 1.0));
|
||||||
|
|
||||||
// A polyline's vertices are stored in the attached vector by dxf.C.
|
// A polyline's vertices are stored in the attached vector by
|
||||||
// They were defined in the DXF file using a series of "VERTEX"
|
// dxf.cxx. They were defined in the DXF file using a series of
|
||||||
// entries.
|
// "VERTEX" entries.
|
||||||
|
|
||||||
// For a 3dface, the vertices are defined explicitly as part of the
|
// For a 3dface, the vertices are defined explicitly as part of the
|
||||||
// entity; but in this case, they were added to the vector before
|
// entity; but in this case, they were added to the vector before
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#define USE_PACKAGES zlib
|
||||||
|
|
||||||
#begin ss_lib_target
|
#begin ss_lib_target
|
||||||
#define TARGET flt
|
#define TARGET flt
|
||||||
#define LOCAL_LIBS converter pandatoolbase
|
#define LOCAL_LIBS converter pandatoolbase
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
#include "fltRecordWriter.h"
|
#include "fltRecordWriter.h"
|
||||||
#include "fltUnsupportedRecord.h"
|
#include "fltUnsupportedRecord.h"
|
||||||
#include "config_flt.h"
|
#include "config_flt.h"
|
||||||
|
#include "zStream.h"
|
||||||
#include "nearly_zero.h"
|
#include "nearly_zero.h"
|
||||||
|
#include "virtualFileSystem.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -222,13 +223,15 @@ read_flt(Filename filename) {
|
|||||||
filename.set_binary();
|
filename.set_binary();
|
||||||
_flt_filename = filename;
|
_flt_filename = filename;
|
||||||
|
|
||||||
ifstream in;
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
if (!filename.open_read(in)) {
|
istream *in = vfs->open_read_file(filename, true);
|
||||||
|
if (in == (istream *)NULL) {
|
||||||
assert(!flt_error_abort);
|
assert(!flt_error_abort);
|
||||||
return FE_could_not_open;
|
return FE_could_not_open;
|
||||||
}
|
}
|
||||||
|
FltError result = read_flt(*in);
|
||||||
return read_flt(in);
|
vfs->close_read_file(in);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -280,6 +283,15 @@ write_flt(Filename filename) {
|
|||||||
return FE_could_not_open;
|
return FE_could_not_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
if (filename.get_extension() == "pz") {
|
||||||
|
// The filename ends in .pz, which means to automatically compress
|
||||||
|
// the flt file that we write.
|
||||||
|
OCompressStream compressor(&out, false);
|
||||||
|
return write_flt(compressor);
|
||||||
|
}
|
||||||
|
#endif // HAVE_ZLIB
|
||||||
|
|
||||||
return write_flt(out);
|
return write_flt(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +107,18 @@ get_extension() const {
|
|||||||
return "flt";
|
return "flt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FltToEggConverter::supports_compressed
|
||||||
|
// Access: Published, Virtual
|
||||||
|
// Description: Returns true if this file type can transparently load
|
||||||
|
// compressed files (with a .pz extension), false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool FltToEggConverter::
|
||||||
|
supports_compressed() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: FltToEggConverter::convert_file
|
// Function: FltToEggConverter::convert_file
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
|
|
||||||
virtual string get_name() const;
|
virtual string get_name() const;
|
||||||
virtual string get_extension() const;
|
virtual string get_extension() const;
|
||||||
|
virtual bool supports_compressed() const;
|
||||||
|
|
||||||
virtual bool convert_file(const Filename &filename);
|
virtual bool convert_file(const Filename &filename);
|
||||||
virtual DistanceUnit get_input_units();
|
virtual DistanceUnit get_input_units();
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
#include "iffInputFile.h"
|
#include "iffInputFile.h"
|
||||||
#include "iffGenericChunk.h"
|
#include "iffGenericChunk.h"
|
||||||
|
|
||||||
#include "datagram.h"
|
#include "datagram.h"
|
||||||
#include "datagramIterator.h"
|
#include "datagramIterator.h"
|
||||||
|
#include "virtualFileSystem.h"
|
||||||
|
|
||||||
TypeHandle IffInputFile::_type_handle;
|
TypeHandle IffInputFile::_type_handle;
|
||||||
|
|
||||||
@ -46,7 +46,8 @@ IffInputFile() {
|
|||||||
IffInputFile::
|
IffInputFile::
|
||||||
~IffInputFile() {
|
~IffInputFile() {
|
||||||
if (_owns_istream) {
|
if (_owns_istream) {
|
||||||
delete _input;
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
|
vfs->close_read_file(_input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,13 +60,16 @@ IffInputFile::
|
|||||||
bool IffInputFile::
|
bool IffInputFile::
|
||||||
open_read(Filename filename) {
|
open_read(Filename filename) {
|
||||||
filename.set_binary();
|
filename.set_binary();
|
||||||
ifstream *in = new ifstream;
|
|
||||||
if (filename.open_read(*in)) {
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
set_input(in, true);
|
istream *in = vfs->open_read_file(filename, true);
|
||||||
set_filename(filename);
|
if (in == (istream *)NULL) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_input(in, true);
|
||||||
|
set_filename(filename);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,12 +78,14 @@ open_read(Filename filename) {
|
|||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Sets up the input to use an arbitrary istream. If
|
// Description: Sets up the input to use an arbitrary istream. If
|
||||||
// owns_istream is true, the istream will be deleted
|
// owns_istream is true, the istream will be deleted
|
||||||
// when the IffInputFile destructs.
|
// (via vfs->close_read_file()) when the IffInputFile
|
||||||
|
// destructs.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void IffInputFile::
|
void IffInputFile::
|
||||||
set_input(istream *input, bool owns_istream) {
|
set_input(istream *input, bool owns_istream) {
|
||||||
if (_owns_istream) {
|
if (_owns_istream) {
|
||||||
delete _input;
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
|
vfs->close_read_file(_input);
|
||||||
}
|
}
|
||||||
_input = input;
|
_input = input;
|
||||||
_owns_istream = owns_istream;
|
_owns_istream = owns_istream;
|
||||||
|
@ -101,6 +101,18 @@ get_extension() const {
|
|||||||
return "lwo";
|
return "lwo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LwoToEggConverter::supports_compressed
|
||||||
|
// Access: Published, Virtual
|
||||||
|
// Description: Returns true if this file type can transparently load
|
||||||
|
// compressed files (with a .pz extension), false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool LwoToEggConverter::
|
||||||
|
supports_compressed() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LwoToEggConverter::convert_file
|
// Function: LwoToEggConverter::convert_file
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
|
|
||||||
virtual bool convert_file(const Filename &filename);
|
virtual bool convert_file(const Filename &filename);
|
||||||
bool convert_lwo(const LwoHeader *lwo_header);
|
bool convert_lwo(const LwoHeader *lwo_header);
|
||||||
|
virtual bool supports_compressed() const;
|
||||||
|
|
||||||
CLwoLayer *get_layer(int number) const;
|
CLwoLayer *get_layer(int number) const;
|
||||||
CLwoClip *get_clip(int number) const;
|
CLwoClip *get_clip(int number) const;
|
||||||
|
@ -79,6 +79,18 @@ get_additional_extensions() const {
|
|||||||
return _converter->get_additional_extensions();
|
return _converter->get_additional_extensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LoaderFileTypePandatool::supports_compressed
|
||||||
|
// Access: Published, Virtual
|
||||||
|
// Description: Returns true if this file type can transparently load
|
||||||
|
// compressed files (with a .pz extension), false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool LoaderFileTypePandatool::
|
||||||
|
supports_compressed() const {
|
||||||
|
return _converter->supports_compressed();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LoaderFileTypePandatool::resolve_filename
|
// Function: LoaderFileTypePandatool::resolve_filename
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -40,6 +40,7 @@ public:
|
|||||||
virtual string get_name() const;
|
virtual string get_name() const;
|
||||||
virtual string get_extension() const;
|
virtual string get_extension() const;
|
||||||
virtual string get_additional_extensions() const;
|
virtual string get_additional_extensions() const;
|
||||||
|
virtual bool supports_compressed() const;
|
||||||
|
|
||||||
virtual void resolve_filename(Filename &path) const;
|
virtual void resolve_filename(Filename &path) const;
|
||||||
virtual PT(PandaNode) load_file(const Filename &path, const LoaderOptions &options) const;
|
virtual PT(PandaNode) load_file(const Filename &path, const LoaderOptions &options) const;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "vrmlNode.h"
|
#include "vrmlNode.h"
|
||||||
#include "standard_nodes.h"
|
#include "standard_nodes.h"
|
||||||
#include "zStream.h"
|
#include "zStream.h"
|
||||||
|
#include "virtualFileSystem.h"
|
||||||
|
|
||||||
extern int vrmlyyparse();
|
extern int vrmlyyparse();
|
||||||
extern void vrmlyyResetLineNumber();
|
extern void vrmlyyResetLineNumber();
|
||||||
@ -87,13 +88,15 @@ get_standard_nodes() {
|
|||||||
VrmlScene *
|
VrmlScene *
|
||||||
parse_vrml(Filename filename) {
|
parse_vrml(Filename filename) {
|
||||||
filename.set_text();
|
filename.set_text();
|
||||||
ifstream infile;
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
if (!filename.open_read(infile)) {
|
istream *in = vfs->open_read_file(filename, true);
|
||||||
cerr << "Error, couldn't open " << filename << "\n";
|
if (in == (istream *)NULL) {
|
||||||
|
nout << "Cannot open " << filename << " for reading.\n";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
VrmlScene *result = parse_vrml(*in, filename);
|
||||||
return parse_vrml(infile, filename);
|
vfs->close_read_file(in);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -89,6 +89,18 @@ get_extension() const {
|
|||||||
return "wrl";
|
return "wrl";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: VRMLToEggConverter::supports_compressed
|
||||||
|
// Access: Published, Virtual
|
||||||
|
// Description: Returns true if this file type can transparently load
|
||||||
|
// compressed files (with a .pz extension), false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool VRMLToEggConverter::
|
||||||
|
supports_compressed() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: VRMLToEggConverter::convert_file
|
// Function: VRMLToEggConverter::convert_file
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
|
|
||||||
virtual string get_name() const;
|
virtual string get_name() const;
|
||||||
virtual string get_extension() const;
|
virtual string get_extension() const;
|
||||||
|
virtual bool supports_compressed() const;
|
||||||
|
|
||||||
virtual bool convert_file(const Filename &filename);
|
virtual bool convert_file(const Filename &filename);
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#define YACC_PREFIX xyy
|
#define YACC_PREFIX xyy
|
||||||
#define LFLAGS -i
|
#define LFLAGS -i
|
||||||
|
|
||||||
|
#define USE_PACKAGES zlib
|
||||||
|
|
||||||
#begin ss_lib_target
|
#begin ss_lib_target
|
||||||
#define TARGET xfile
|
#define TARGET xfile
|
||||||
#define LOCAL_LIBS pandatoolbase
|
#define LOCAL_LIBS pandatoolbase
|
||||||
|
@ -161,6 +161,15 @@ write(Filename filename) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
if (filename.get_extension() == "pz") {
|
||||||
|
// The filename ends in .pz, which means to automatically compress
|
||||||
|
// the X file that we write.
|
||||||
|
OCompressStream compressor(&out, false);
|
||||||
|
return write(compressor);
|
||||||
|
}
|
||||||
|
#endif // HAVE_ZLIB
|
||||||
|
|
||||||
return write(out);
|
return write(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,18 @@ get_extension() const {
|
|||||||
return "x";
|
return "x";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: XFileToEggConverter::supports_compressed
|
||||||
|
// Access: Published, Virtual
|
||||||
|
// Description: Returns true if this file type can transparently load
|
||||||
|
// compressed files (with a .pz extension), false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool XFileToEggConverter::
|
||||||
|
supports_compressed() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: XFileToEggConverter::convert_file
|
// Function: XFileToEggConverter::convert_file
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -53,6 +53,7 @@ public:
|
|||||||
|
|
||||||
virtual string get_name() const;
|
virtual string get_name() const;
|
||||||
virtual string get_extension() const;
|
virtual string get_extension() const;
|
||||||
|
virtual bool supports_compressed() const;
|
||||||
|
|
||||||
virtual bool convert_file(const Filename &filename);
|
virtual bool convert_file(const Filename &filename);
|
||||||
void close();
|
void close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user