Panda3D
 All Classes Functions Variables Enumerations
loaderFileTypeBam.cxx
00001 // Filename: loaderFileTypeBam.cxx
00002 // Created by:  jason (21Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "loaderFileTypeBam.h"
00016 #include "config_pgraph.h"
00017 #include "bamFile.h"
00018 #include "bamCacheRecord.h"
00019 #include "loaderOptions.h"
00020 
00021 #include "dcast.h"
00022 
00023 TypeHandle LoaderFileTypeBam::_type_handle;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: LoaderFileTypeBam::Constructor
00027 //       Access: Public
00028 //  Description:
00029 ////////////////////////////////////////////////////////////////////
00030 LoaderFileTypeBam::
00031 LoaderFileTypeBam() {
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: LoaderFileTypeBam::get_name
00036 //       Access: Public, Virtual
00037 //  Description:
00038 ////////////////////////////////////////////////////////////////////
00039 string LoaderFileTypeBam::
00040 get_name() const {
00041   return "Bam";
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: LoaderFileTypeBam::get_extension
00046 //       Access: Public, Virtual
00047 //  Description:
00048 ////////////////////////////////////////////////////////////////////
00049 string LoaderFileTypeBam::
00050 get_extension() const {
00051   return "bam";
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: LoaderFileTypeBam::supports_compressed
00056 //       Access: Published, Virtual
00057 //  Description: Returns true if this file type can transparently load
00058 //               compressed files (with a .pz extension), false
00059 //               otherwise.
00060 ////////////////////////////////////////////////////////////////////
00061 bool LoaderFileTypeBam::
00062 supports_compressed() const {
00063   return true;
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function: LoaderFileTypeBam::load_file
00068 //       Access: Public, Virtual
00069 //  Description:
00070 ////////////////////////////////////////////////////////////////////
00071 PT(PandaNode) LoaderFileTypeBam::
00072 load_file(const Filename &path, const LoaderOptions &options,
00073           BamCacheRecord *record) const {
00074   if (record != (BamCacheRecord *)NULL) {
00075     record->add_dependent_file(path);
00076   }
00077 
00078   bool report_errors = (options.get_flags() & LoaderOptions::LF_report_errors) != 0;
00079   BamFile bam_file;
00080   if (!bam_file.open_read(path, report_errors)) {
00081     return NULL;
00082   }
00083   bam_file.get_reader()->set_loader_options(options);
00084   return bam_file.read_node(report_errors);
00085 }
00086 
 All Classes Functions Variables Enumerations