Panda3D
 All Classes Functions Variables Enumerations
loaderFileTypeSrt.cxx
00001 // Filename: loaderFileTypeSrt.cxx
00002 // Created by:  drose (06Oct10)
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 "loaderFileTypeSrt.h"
00016 #include "speedTreeNode.h"
00017 #include "stTree.h"
00018 
00019 TypeHandle LoaderFileTypeSrt::_type_handle;
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: LoaderFileTypeSrt::Constructor
00023 //       Access: Public
00024 //  Description:
00025 ////////////////////////////////////////////////////////////////////
00026 LoaderFileTypeSrt::
00027 LoaderFileTypeSrt() {
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: LoaderFileTypeSrt::get_name
00032 //       Access: Public, Virtual
00033 //  Description:
00034 ////////////////////////////////////////////////////////////////////
00035 string LoaderFileTypeSrt::
00036 get_name() const {
00037   return "SpeedTree compiled tree";
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: LoaderFileTypeSrt::get_extension
00042 //       Access: Public, Virtual
00043 //  Description:
00044 ////////////////////////////////////////////////////////////////////
00045 string LoaderFileTypeSrt::
00046 get_extension() const {
00047   return "srt";
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: LoaderFileTypeSrt::supports_compressed
00052 //       Access: Published, Virtual
00053 //  Description: Returns true if this file type can transparently load
00054 //               compressed files (with a .pz extension), false
00055 //               otherwise.
00056 ////////////////////////////////////////////////////////////////////
00057 bool LoaderFileTypeSrt::
00058 supports_compressed() const {
00059   return false;
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: LoaderFileTypeSrt::load_file
00064 //       Access: Public, Virtual
00065 //  Description:
00066 ////////////////////////////////////////////////////////////////////
00067 PT(PandaNode) LoaderFileTypeSrt::
00068 load_file(const Filename &path, const LoaderOptions &, 
00069           BamCacheRecord *record) const {
00070   if (!path.is_regular_file()) {
00071     // Quietly fail if the file doesn't exist.  The Loader expects
00072     // this.
00073     return NULL;
00074   }
00075 
00076   PT(STTree) tree = new STTree(path);
00077   if (!tree->is_valid()) {
00078     return NULL;
00079   }
00080 
00081   PT(SpeedTreeNode) st = new SpeedTreeNode(path.get_basename());
00082   st->add_instance(tree, STTransform());
00083 
00084   return st.p();
00085 }
 All Classes Functions Variables Enumerations