Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
20b23df117

+ 8 - 0
pandatool/src/lwo/Sources.pp

@@ -25,9 +25,13 @@
     lwoTags.h lwoTags.cxx \
     lwoTags.h lwoTags.cxx \
     lwoStillImage.h lwoStillImage.cxx \
     lwoStillImage.h lwoStillImage.cxx \
     lwoSurface.h lwoSurface.cxx \
     lwoSurface.h lwoSurface.cxx \
+    lwoSurfaceBlock.h lwoSurfaceBlock.cxx \
+    lwoSurfaceBlockHeader.h lwoSurfaceBlockHeader.cxx \
+    lwoSurfaceBlockTMap.h lwoSurfaceBlockTMap.cxx \
     lwoSurfaceColor.h lwoSurfaceColor.cxx \
     lwoSurfaceColor.h lwoSurfaceColor.cxx \
     lwoSurfaceParameter.h lwoSurfaceParameter.cxx \
     lwoSurfaceParameter.h lwoSurfaceParameter.cxx \
     lwoSurfaceSidedness.h lwoSurfaceSidedness.cxx \
     lwoSurfaceSidedness.h lwoSurfaceSidedness.cxx \
+    lwoSurfaceSmoothingAngle.h lwoSurfaceSmoothingAngle.cxx \
     lwoVertexMap.h lwoVertexMap.cxx
     lwoVertexMap.h lwoVertexMap.cxx
 
 
   #define INSTALL_HEADERS \
   #define INSTALL_HEADERS \
@@ -47,9 +51,13 @@
     lwoTags.h \
     lwoTags.h \
     lwoStillImage.h \
     lwoStillImage.h \
     lwoSurface.h \
     lwoSurface.h \
+    lwoSurfaceBlock.h \
+    lwoSurfaceBlockHeader.h \
+    lwoSurfaceBlockTMap.h \
     lwoSurfaceColor.h \
     lwoSurfaceColor.h \
     lwoSurfaceParameter.h \
     lwoSurfaceParameter.h \
     lwoSurfaceSidedness.h \
     lwoSurfaceSidedness.h \
+    lwoSurfaceSmoothingAngle.h \
     lwoVertexMap.h
     lwoVertexMap.h
 
 
 #end ss_lib_target
 #end ss_lib_target

+ 8 - 0
pandatool/src/lwo/config_lwo.cxx

@@ -20,9 +20,13 @@
 #include "lwoPolygonTags.h"
 #include "lwoPolygonTags.h"
 #include "lwoStillImage.h"
 #include "lwoStillImage.h"
 #include "lwoSurface.h"
 #include "lwoSurface.h"
+#include "lwoSurfaceBlock.h"
+#include "lwoSurfaceBlockHeader.h"
+#include "lwoSurfaceBlockTMap.h"
 #include "lwoSurfaceColor.h"
 #include "lwoSurfaceColor.h"
 #include "lwoSurfaceParameter.h"
 #include "lwoSurfaceParameter.h"
 #include "lwoSurfaceSidedness.h"
 #include "lwoSurfaceSidedness.h"
+#include "lwoSurfaceSmoothingAngle.h"
 #include "lwoTags.h"
 #include "lwoTags.h"
 #include "lwoVertexMap.h"
 #include "lwoVertexMap.h"
 
 
@@ -48,9 +52,13 @@ ConfigureFn(config_lwo) {
   LwoTags::init_type();
   LwoTags::init_type();
   LwoStillImage::init_type();
   LwoStillImage::init_type();
   LwoSurface::init_type();
   LwoSurface::init_type();
+  LwoSurfaceBlock::init_type();
+  LwoSurfaceBlockHeader::init_type();
+  LwoSurfaceBlockTMap::init_type();
   LwoSurfaceColor::init_type();
   LwoSurfaceColor::init_type();
   LwoSurfaceParameter::init_type();
   LwoSurfaceParameter::init_type();
   LwoSurfaceSidedness::init_type();
   LwoSurfaceSidedness::init_type();
+  LwoSurfaceSmoothingAngle::init_type();
   LwoVertexMap::init_type();
   LwoVertexMap::init_type();
 }
 }
 
 

+ 18 - 0
pandatool/src/lwo/iffInputFile.cxx

@@ -225,6 +225,10 @@ get_id() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 PT(IffChunk) IffInputFile::
 PT(IffChunk) IffInputFile::
 get_chunk() {
 get_chunk() {
+  if (is_eof()) {
+    return (IffChunk *)NULL;
+  }
+
   IffId id = get_id();
   IffId id = get_id();
   PN_uint32 length = get_be_uint32();
   PN_uint32 length = get_be_uint32();
 
 
@@ -236,6 +240,11 @@ get_chunk() {
     size_t end_point = start_point + length;
     size_t end_point = start_point + length;
 
 
     if (chunk->read_iff(this, end_point)) {
     if (chunk->read_iff(this, end_point)) {
+      if (is_eof()) {
+	nout << "Unexpected EOF on file.\n";
+	return (IffChunk *)NULL;
+      }
+
       size_t num_bytes_read = get_bytes_read() - start_point;
       size_t num_bytes_read = get_bytes_read() - start_point;
       if (num_bytes_read > length) {
       if (num_bytes_read > length) {
 	nout << *chunk << " read " << num_bytes_read
 	nout << *chunk << " read " << num_bytes_read
@@ -267,6 +276,10 @@ get_chunk() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 PT(IffChunk) IffInputFile::
 PT(IffChunk) IffInputFile::
 get_subchunk(IffChunk *context) {
 get_subchunk(IffChunk *context) {
+  if (is_eof()) {
+    return (IffChunk *)NULL;
+  }
+
   IffId id = get_id();
   IffId id = get_id();
   PN_uint16 length = get_be_uint16();
   PN_uint16 length = get_be_uint16();
 
 
@@ -278,6 +291,11 @@ get_subchunk(IffChunk *context) {
     size_t end_point = start_point + length;
     size_t end_point = start_point + length;
 
 
     if (chunk->read_iff(this, end_point)) {
     if (chunk->read_iff(this, end_point)) {
+      if (is_eof()) {
+	nout << "Unexpected EOF on file.\n";
+	return (IffChunk *)NULL;
+      }
+
       size_t num_bytes_read = get_bytes_read() - start_point;
       size_t num_bytes_read = get_bytes_read() - start_point;
       if (num_bytes_read > length) {
       if (num_bytes_read > length) {
 	nout << *chunk << " read " << num_bytes_read
 	nout << *chunk << " read " << num_bytes_read

+ 2 - 1
pandatool/src/lwo/lwoClip.cxx

@@ -24,7 +24,8 @@ TypeHandle LwoClip::_type_handle;
 bool LwoClip::
 bool LwoClip::
 read_iff(IffInputFile *in, size_t stop_at) {
 read_iff(IffInputFile *in, size_t stop_at) {
   _index = in->get_be_int32();
   _index = in->get_be_int32();
-  return read_subchunks_iff(in, stop_at);
+  read_subchunks_iff(in, stop_at);
+  return true;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 2 - 1
pandatool/src/lwo/lwoHeader.cxx

@@ -23,7 +23,8 @@ TypeHandle LwoHeader::_type_handle;
 bool LwoHeader::
 bool LwoHeader::
 read_iff(IffInputFile *in, size_t stop_at) {
 read_iff(IffInputFile *in, size_t stop_at) {
   _lwid = in->get_id();
   _lwid = in->get_id();
-  return read_chunks_iff(in, stop_at);
+  read_chunks_iff(in, stop_at);
+  return true;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 10 - 1
pandatool/src/lwo/lwoSurface.cxx

@@ -5,9 +5,11 @@
 
 
 #include "lwoSurface.h"
 #include "lwoSurface.h"
 #include "iffInputFile.h"
 #include "iffInputFile.h"
+#include "lwoSurfaceBlock.h"
 #include "lwoSurfaceColor.h"
 #include "lwoSurfaceColor.h"
 #include "lwoSurfaceParameter.h"
 #include "lwoSurfaceParameter.h"
 #include "lwoSurfaceSidedness.h"
 #include "lwoSurfaceSidedness.h"
+#include "lwoSurfaceSmoothingAngle.h"
 
 
 #include <indent.h>
 #include <indent.h>
 
 
@@ -27,7 +29,8 @@ bool LwoSurface::
 read_iff(IffInputFile *in, size_t stop_at) {
 read_iff(IffInputFile *in, size_t stop_at) {
   _name = in->get_string();
   _name = in->get_string();
   _source = in->get_string();
   _source = in->get_string();
-  return read_subchunks_iff(in, stop_at);
+  read_subchunks_iff(in, stop_at);
+  return true;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -73,6 +76,12 @@ make_new_chunk(IffInputFile *in, IffId id) {
 
 
   } else if (id == IffId("SIDE")) {
   } else if (id == IffId("SIDE")) {
     return new LwoSurfaceSidedness;
     return new LwoSurfaceSidedness;
+
+  } else if (id == IffId("SMAN")) {
+    return new LwoSurfaceSmoothingAngle;
+
+  } else if (id == IffId("BLOK")) {
+    return new LwoSurfaceBlock;
   
   
   } else {
   } else {
     return IffChunk::make_new_chunk(in, id);
     return IffChunk::make_new_chunk(in, id);

+ 16 - 0
pandatool/src/lwo/lwoSurface.h

@@ -27,6 +27,20 @@ public:
 
 
   virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id);
   virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id);
 
 
+public:
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    LwoGroupChunk::init_type();
+    register_type(_type_handle, "LwoSurface",
+		  LwoGroupChunk::get_class_type());
+  }
+
 private:
 private:
   static TypeHandle _type_handle;
   static TypeHandle _type_handle;
 };
 };
@@ -34,3 +48,5 @@ private:
 #endif
 #endif
 
 
   
   
+
+

+ 67 - 0
pandatool/src/lwo/lwoSurfaceBlock.cxx

@@ -0,0 +1,67 @@
+// Filename: lwoSurfaceBlock.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlock.h"
+#include "iffInputFile.h"
+#include "lwoSurfaceBlockHeader.h"
+#include "lwoSurfaceBlockTMap.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlock::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlock::read_iff
+//       Access: Public, Virtual
+//  Description: Reads the data of the chunk in from the given input
+//               file, if possible.  The ID and length of the chunk
+//               have already been read.  stop_at is the byte position
+//               of the file to stop at (based on the current position
+//               at in->get_bytes_read()).  Returns true on success,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool LwoSurfaceBlock::
+read_iff(IffInputFile *in, size_t stop_at) {
+  read_subchunks_iff(in, stop_at);
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlock::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlock::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " {\n";
+  write_chunks(out, indent_level + 2);
+  indent(out, indent_level)
+    << "}\n";
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlock::make_new_chunk
+//       Access: Protected, Virtual
+//  Description: Allocates and returns a new chunk of the appropriate
+//               type based on the given ID, according to the context
+//               given by this chunk itself.
+////////////////////////////////////////////////////////////////////
+IffChunk *LwoSurfaceBlock::
+make_new_chunk(IffInputFile *in, IffId id) {
+  if (id == IffId("IMAP") ||
+      id == IffId("PROC") ||
+      id == IffId("GRAD") ||
+      id == IffId("SHDR")) {
+    return new LwoSurfaceBlockHeader;
+
+  } else if (id == IffId("TMAP")) {
+    return new LwoSurfaceBlockTMap;
+
+  } else  {
+    return IffChunk::make_new_chunk(in, id);
+  }
+}
+

+ 35 - 0
pandatool/src/lwo/lwoSurfaceBlock.h

@@ -0,0 +1,35 @@
+// Filename: lwoSurfaceBlock.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCK_H
+#define LWOSURFACEBLOCK_H
+
+#include <pandatoolbase.h>
+
+#include "lwoGroupChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlock
+// Description : A texture layer or shader, part of a LwoSurface
+//               chunk.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlock : public LwoGroupChunk {
+public:
+
+public:
+  virtual bool read_iff(IffInputFile *in, size_t stop_at);
+  virtual void write(ostream &out, int indent_level = 0) const;
+
+  virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id);
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  
+
+

+ 93 - 0
pandatool/src/lwo/lwoSurfaceBlockHeader.cxx

@@ -0,0 +1,93 @@
+// Filename: lwoSurfaceBlockHeader.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockHeader.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockHeader::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockHeader::read_iff
+//       Access: Public, Virtual
+//  Description: Reads the data of the chunk in from the given input
+//               file, if possible.  The ID and length of the chunk
+//               have already been read.  stop_at is the byte position
+//               of the file to stop at (based on the current position
+//               at in->get_bytes_read()).  Returns true on success,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool LwoSurfaceBlockHeader::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _ordinal = lin->get_string();
+  read_subchunks_iff(lin, stop_at);
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockHeader::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockHeader::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " {\n";
+  indent(out, indent_level + 2)
+    << "ordinal = 0x" << hex << setfill('0');
+
+  string::const_iterator si;
+  for (si = _ordinal.begin(); si != _ordinal.end(); ++si) {
+    out << setw(2) << (int)(unsigned char)(*si);
+  }
+
+  out << dec << setfill(' ') << "\n";
+  
+  write_chunks(out, indent_level + 2);
+  indent(out, indent_level)
+    << "}\n";
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockHeader::make_new_chunk
+//       Access: Protected, Virtual
+//  Description: Allocates and returns a new chunk of the appropriate
+//               type based on the given ID, according to the context
+//               given by this chunk itself.
+////////////////////////////////////////////////////////////////////
+IffChunk *LwoSurfaceBlockHeader::
+make_new_chunk(IffInputFile *in, IffId id) {
+  /*
+  if (id == IffId("COLR")) {
+    return new LwoSurfaceColor;
+  
+  } else if (id == IffId("DIFF") ||
+	     id == IffId("LUMI") ||
+	     id == IffId("SPEC") ||
+	     id == IffId("REFL") ||
+	     id == IffId("TRAN") ||
+	     id == IffId("TRNL") ||
+	     id == IffId("GLOS") ||
+	     id == IffId("SHRP") ||
+	     id == IffId("BUMP") ||
+	     id == IffId("RSAN") ||
+	     id == IffId("RIND")) {
+    return new LwoSurfaceParameter;
+
+  } else if (id == IffId("SIDE")) {
+    return new LwoSurfaceSidedness;
+
+  } else if (id == IffId("SMAN")) {
+    return new LwoSurfaceSmoothingAngle;
+  
+    } else */ {
+    return IffChunk::make_new_chunk(in, id);
+  }
+}
+

+ 49 - 0
pandatool/src/lwo/lwoSurfaceBlockHeader.h

@@ -0,0 +1,49 @@
+// Filename: lwoSurfaceBlockHeader.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKHEADER_H
+#define LWOSURFACEBLOCKHEADER_H
+
+#include <pandatoolbase.h>
+
+#include "lwoGroupChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockHeader
+// Description : The header chunk within a LwoSurfaceBlock chunk.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockHeader : public LwoGroupChunk {
+public:
+  string _ordinal;
+
+public:
+  virtual bool read_iff(IffInputFile *in, size_t stop_at);
+  virtual void write(ostream &out, int indent_level = 0) const;
+
+  virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id);
+
+public:
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    LwoGroupChunk::init_type();
+    register_type(_type_handle, "LwoSurfaceBlockHeader",
+		  LwoGroupChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  
+
+

+ 82 - 0
pandatool/src/lwo/lwoSurfaceBlockTMap.cxx

@@ -0,0 +1,82 @@
+// Filename: lwoSurfaceBlockTMap.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockTMap.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockTMap::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockTMap::read_iff
+//       Access: Public, Virtual
+//  Description: Reads the data of the chunk in from the given input
+//               file, if possible.  The ID and length of the chunk
+//               have already been read.  stop_at is the byte position
+//               of the file to stop at (based on the current position
+//               at in->get_bytes_read()).  Returns true on success,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool LwoSurfaceBlockTMap::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  read_subchunks_iff(lin, stop_at);
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockTMap::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockTMap::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " {\n";
+  write_chunks(out, indent_level + 2);
+  indent(out, indent_level)
+    << "}\n";
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockTMap::make_new_chunk
+//       Access: Protected, Virtual
+//  Description: Allocates and returns a new chunk of the appropriate
+//               type based on the given ID, according to the context
+//               given by this chunk itself.
+////////////////////////////////////////////////////////////////////
+IffChunk *LwoSurfaceBlockTMap::
+make_new_chunk(IffInputFile *in, IffId id) {
+  /*
+  if (id == IffId("COLR")) {
+    return new LwoSurfaceColor;
+  
+  } else if (id == IffId("DIFF") ||
+	     id == IffId("LUMI") ||
+	     id == IffId("SPEC") ||
+	     id == IffId("REFL") ||
+	     id == IffId("TRAN") ||
+	     id == IffId("TRNL") ||
+	     id == IffId("GLOS") ||
+	     id == IffId("SHRP") ||
+	     id == IffId("BUMP") ||
+	     id == IffId("RSAN") ||
+	     id == IffId("RIND")) {
+    return new LwoSurfaceParameter;
+
+  } else if (id == IffId("SIDE")) {
+    return new LwoSurfaceSidedness;
+
+  } else if (id == IffId("SMAN")) {
+    return new LwoSurfaceSmoothingAngle;
+  
+    } else */ {
+    return IffChunk::make_new_chunk(in, id);
+  }
+}
+

+ 49 - 0
pandatool/src/lwo/lwoSurfaceBlockTMap.h

@@ -0,0 +1,49 @@
+// Filename: lwoSurfaceBlockTMap.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKTMAP_H
+#define LWOSURFACEBLOCKTMAP_H
+
+#include <pandatoolbase.h>
+
+#include "lwoGroupChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockTMap
+// Description : The tMap chunk within a LwoSurfaceBlock chunk.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockTMap : public LwoGroupChunk {
+public:
+  string _ordinal;
+
+public:
+  virtual bool read_iff(IffInputFile *in, size_t stop_at);
+  virtual void write(ostream &out, int indent_level = 0) const;
+
+  virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id);
+
+public:
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    LwoGroupChunk::init_type();
+    register_type(_type_handle, "LwoSurfaceBlockTMap",
+		  LwoGroupChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  
+
+

+ 42 - 0
pandatool/src/lwo/lwoSurfaceSmoothingAngle.cxx

@@ -0,0 +1,42 @@
+// Filename: lwoSurfaceSmoothingAngle.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceSmoothingAngle.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+#include <deg_2_rad.h>
+
+TypeHandle LwoSurfaceSmoothingAngle::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceSmoothingAngle::read_iff
+//       Access: Public, Virtual
+//  Description: Reads the data of the chunk in from the given input
+//               file, if possible.  The ID and length of the chunk
+//               have already been read.  stop_at is the byte position
+//               of the file to stop at (based on the current position
+//               at in->get_bytes_read()).  Returns true on success,
+//               false otherwise.
+////////////////////////////////////////////////////////////////////
+bool LwoSurfaceSmoothingAngle::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _angle = lin->get_be_float32();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceSmoothingAngle::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceSmoothingAngle::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { angle = " << rad_2_deg(_angle) << " degrees }\n";
+}

+ 46 - 0
pandatool/src/lwo/lwoSurfaceSmoothingAngle.h

@@ -0,0 +1,46 @@
+// Filename: lwoSurfaceSmoothingAngle.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACESMOOTHINGANGLE_H
+#define LWOSURFACESMOOTHINGANGLE_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceSmoothingAngle
+// Description : Indicates the maximum angle (in radians) between
+//               adjacent polygons that should be smooth-shaded.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceSmoothingAngle : public LwoChunk {
+public:
+  float _angle;
+
+public:
+  virtual bool read_iff(IffInputFile *in, size_t stop_at);
+  virtual void write(ostream &out, int indent_level = 0) const;
+  
+public:
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    LwoChunk::init_type();
+    register_type(_type_handle, "LwoSurfaceSmoothingAngle",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+