Panda3D
lwoSurfaceColor.cxx
1 // Filename: lwoSurfaceColor.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 "lwoSurfaceColor.h"
16 #include "lwoInputFile.h"
17 
18 #include "dcast.h"
19 #include "indent.h"
20 
21 TypeHandle LwoSurfaceColor::_type_handle;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: LwoSurfaceColor::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  _color = lin->get_vec3();
38  _envelope = lin->get_vx();
39 
40  return true;
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: LwoSurfaceColor::write
45 // Access: Public, Virtual
46 // Description:
47 ////////////////////////////////////////////////////////////////////
48 void LwoSurfaceColor::
49 write(ostream &out, int indent_level) const {
50  indent(out, indent_level)
51  << get_id() << " { color = " << _color
52  << ", envelope = " << _envelope << " }\n";
53 }
int get_vx()
Reads a Lightwave variable-length index.
LVecBase3 get_vec3()
Reads a three-component vector of floats.
virtual bool read_iff(IffInputFile *in, size_t stop_at)
Reads the data of the chunk in from the given input file, if possible.
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
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