Panda3D

lwoClip.cxx

00001 // Filename: lwoClip.cxx
00002 // Created by:  drose (24Apr01)
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 "lwoClip.h"
00016 #include "iffInputFile.h"
00017 #include "lwoStillImage.h"
00018 
00019 #include "indent.h"
00020 
00021 TypeHandle LwoClip::_type_handle;
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //     Function: LwoClip::read_iff
00025 //       Access: Public, Virtual
00026 //  Description: Reads the data of the chunk in from the given input
00027 //               file, if possible.  The ID and length of the chunk
00028 //               have already been read.  stop_at is the byte position
00029 //               of the file to stop at (based on the current position
00030 //               at in->get_bytes_read()).  Returns true on success,
00031 //               false otherwise.
00032 ////////////////////////////////////////////////////////////////////
00033 bool LwoClip::
00034 read_iff(IffInputFile *in, size_t stop_at) {
00035   _index = in->get_be_int32();
00036   read_subchunks_iff(in, stop_at);
00037   return true;
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: LwoClip::write
00042 //       Access: Public, Virtual
00043 //  Description:
00044 ////////////////////////////////////////////////////////////////////
00045 void LwoClip::
00046 write(ostream &out, int indent_level) const {
00047   indent(out, indent_level)
00048     << get_id() << " {\n";
00049   indent(out, indent_level + 2)
00050     << "index = " << _index << "\n";
00051   write_chunks(out, indent_level + 2);
00052   indent(out, indent_level)
00053     << "}\n";
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: LwoClip::make_new_chunk
00058 //       Access: Protected, Virtual
00059 //  Description: Allocates and returns a new chunk of the appropriate
00060 //               type based on the given ID, according to the context
00061 //               given by this chunk itself.
00062 ////////////////////////////////////////////////////////////////////
00063 IffChunk *LwoClip::
00064 make_new_chunk(IffInputFile *in, IffId id) {
00065   if (id == IffId("STIL")) {
00066     return new LwoStillImage;
00067 
00068   } else {
00069     return IffChunk::make_new_chunk(in, id);
00070   }
00071 }
00072 
 All Classes Functions Variables Enumerations