Panda3D
 All Classes Functions Variables Enumerations
lwoSurfaceBlockWrap.cxx
1 // Filename: lwoSurfaceBlockWrap.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 "lwoSurfaceBlockWrap.h"
16 #include "lwoInputFile.h"
17 
18 #include "dcast.h"
19 #include "indent.h"
20 
21 TypeHandle LwoSurfaceBlockWrap::_type_handle;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: LwoSurfaceBlockWrap::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  _width = (Mode)lin->get_be_uint16();
38  _height = (Mode)lin->get_be_uint16();
39 
40  return true;
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: LwoSurfaceBlockWrap::write
45 // Access: Public, Virtual
46 // Description:
47 ////////////////////////////////////////////////////////////////////
48 void LwoSurfaceBlockWrap::
49 write(ostream &out, int indent_level) const {
50  indent(out, indent_level)
51  << get_id() << " { width = " << (int)_width
52  << ", height = " << (int)_height << " }\n";
53 }
virtual bool read_iff(IffInputFile *in, size_t stop_at)
Reads the data of the chunk in from the given input file, if possible.
PN_uint16 get_be_uint16()
Extracts an unsigned 16-bit big-endian integer.
A wrapper around an istream used for reading an IFF file.
Definition: iffInputFile.h:33
IffId get_id() const
Returns the ID associated with this chunk.
Definition: iffChunk.I:31
A specialization of IffInputFile to handle reading a Lightwave Object file.
Definition: lwoInputFile.h:29
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85