Panda3D
|
00001 // Filename: lwoSurfaceBlockOpacity.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 "lwoSurfaceBlockOpacity.h" 00016 #include "lwoInputFile.h" 00017 00018 #include "dcast.h" 00019 #include "indent.h" 00020 00021 TypeHandle LwoSurfaceBlockOpacity::_type_handle; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: LwoSurfaceBlockOpacity::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 LwoSurfaceBlockOpacity:: 00034 read_iff(IffInputFile *in, size_t stop_at) { 00035 LwoInputFile *lin = DCAST(LwoInputFile, in); 00036 00037 _type = (Type)lin->get_be_uint16(); 00038 _opacity = lin->get_be_float32(); 00039 _envelope = lin->get_vx(); 00040 00041 return true; 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: LwoSurfaceBlockOpacity::write 00046 // Access: Public, Virtual 00047 // Description: 00048 //////////////////////////////////////////////////////////////////// 00049 void LwoSurfaceBlockOpacity:: 00050 write(ostream &out, int indent_level) const { 00051 indent(out, indent_level) 00052 << get_id() << " { type = " << (int)_type 00053 << ", opacity = " << _opacity * 100.0 << "%, envelope = " << _envelope 00054 << " }\n"; 00055 }