Panda3D
lwoSurfaceBlockChannel.cxx
1 // Filename: lwoSurfaceBlockChannel.cxx
2 // Created by: drose (24Apr01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "lwoSurfaceBlockChannel.h"
16 #include "lwoInputFile.h"
17 
18 #include "dcast.h"
19 #include "indent.h"
20 
21 TypeHandle LwoSurfaceBlockChannel::_type_handle;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: LwoSurfaceBlockChannel::read_iff
25 // Access: Public, Virtual
26 // Description: Reads the data of the chunk in from the given input
27 // file, if possible. The ID and length of the chunk
28 // have already been read. stop_at is the byte position
29 // of the file to stop at (based on the current position
30 // at in->get_bytes_read()). Returns true on success,
31 // false otherwise.
32 ////////////////////////////////////////////////////////////////////
34 read_iff(IffInputFile *in, size_t stop_at) {
35  LwoInputFile *lin = DCAST(LwoInputFile, in);
36 
37  _channel_id = lin->get_id();
38 
39  return true;
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: LwoSurfaceBlockChannel::write
44 // Access: Public, Virtual
45 // Description:
46 ////////////////////////////////////////////////////////////////////
47 void LwoSurfaceBlockChannel::
48 write(ostream &out, int indent_level) const {
49  indent(out, indent_level)
50  << get_id() << " { channel_id = " << _channel_id << " }\n";
51 }
A wrapper around an istream used for reading an IFF file.
Definition: iffInputFile.h:33
A specialization of IffInputFile to handle reading a Lightwave Object file.
Definition: lwoInputFile.h:29
virtual bool read_iff(IffInputFile *in, size_t stop_at)
Reads the data of the chunk in from the given input file, if possible.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
IffId get_id() const
Returns the ID associated with this chunk.
Definition: iffChunk.I:31
IffId get_id()
Extracts a 4-character IFF ID.