Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/lwo/lwoSurfaceBlockTMap.cxx

Go to the documentation of this file.
00001 // Filename: lwoSurfaceBlockTMap.cxx
00002 // Created by:  drose (24Apr01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "lwoSurfaceBlockTMap.h"
00020 #include "lwoInputFile.h"
00021 #include "lwoSurfaceBlockCoordSys.h"
00022 #include "lwoSurfaceBlockTransform.h"
00023 #include "lwoSurfaceBlockRefObj.h"
00024 
00025 #include "dcast.h"
00026 #include "indent.h"
00027 
00028 TypeHandle LwoSurfaceBlockTMap::_type_handle;
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: LwoSurfaceBlockTMap::read_iff
00032 //       Access: Public, Virtual
00033 //  Description: Reads the data of the chunk in from the given input
00034 //               file, if possible.  The ID and length of the chunk
00035 //               have already been read.  stop_at is the byte position
00036 //               of the file to stop at (based on the current position
00037 //               at in->get_bytes_read()).  Returns true on success,
00038 //               false otherwise.
00039 ////////////////////////////////////////////////////////////////////
00040 bool LwoSurfaceBlockTMap::
00041 read_iff(IffInputFile *in, size_t stop_at) {
00042   LwoInputFile *lin = DCAST(LwoInputFile, in);
00043 
00044   read_subchunks_iff(lin, stop_at);
00045 
00046   return true;
00047 }
00048 
00049 ////////////////////////////////////////////////////////////////////
00050 //     Function: LwoSurfaceBlockTMap::write
00051 //       Access: Public, Virtual
00052 //  Description:
00053 ////////////////////////////////////////////////////////////////////
00054 void LwoSurfaceBlockTMap::
00055 write(ostream &out, int indent_level) const {
00056   indent(out, indent_level)
00057     << get_id() << " {\n";
00058   write_chunks(out, indent_level + 2);
00059   indent(out, indent_level)
00060     << "}\n";
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: LwoSurfaceBlockTMap::make_new_chunk
00065 //       Access: Protected, Virtual
00066 //  Description: Allocates and returns a new chunk of the appropriate
00067 //               type based on the given ID, according to the context
00068 //               given by this chunk itself.
00069 ////////////////////////////////////////////////////////////////////
00070 IffChunk *LwoSurfaceBlockTMap::
00071 make_new_chunk(IffInputFile *in, IffId id) {
00072   if (id == IffId("CNTR") ||
00073       id == IffId("SIZE") ||
00074       id == IffId("ROTA")) {
00075     return new LwoSurfaceBlockTransform;
00076 
00077   } else if (id == IffId("OREF")) {
00078     return new LwoSurfaceBlockRefObj;
00079 
00080   } else if (id == IffId("CSYS")) {
00081     return new LwoSurfaceBlockCoordSys;
00082 
00083   } else {
00084     return IffChunk::make_new_chunk(in, id);
00085   }
00086 }
00087 

Generated on Fri May 2 03:20:56 2003 for Panda-Tool by doxygen1.3