Преглед на файлове

*** empty log message ***

David Rose преди 25 години
родител
ревизия
bc82855d21

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

@@ -26,8 +26,16 @@
     lwoStillImage.h lwoStillImage.cxx \
     lwoSurface.h lwoSurface.cxx \
     lwoSurfaceBlock.h lwoSurfaceBlock.cxx \
+    lwoSurfaceBlockAxis.h lwoSurfaceBlockAxis.cxx \
+    lwoSurfaceBlockChannel.h lwoSurfaceBlockChannel.cxx \
+    lwoSurfaceBlockEnabled.h lwoSurfaceBlockEnabled.cxx \
+    lwoSurfaceBlockImage.h lwoSurfaceBlockImage.cxx \
+    lwoSurfaceBlockOpacity.h lwoSurfaceBlockOpacity.cxx \
+    lwoSurfaceBlockProjection.h lwoSurfaceBlockProjection.cxx \
     lwoSurfaceBlockHeader.h lwoSurfaceBlockHeader.cxx \
+    lwoSurfaceBlockRepeat.h lwoSurfaceBlockRepeat.cxx \
     lwoSurfaceBlockTMap.h lwoSurfaceBlockTMap.cxx \
+    lwoSurfaceBlockWrap.h lwoSurfaceBlockWrap.cxx \
     lwoSurfaceColor.h lwoSurfaceColor.cxx \
     lwoSurfaceParameter.h lwoSurfaceParameter.cxx \
     lwoSurfaceSidedness.h lwoSurfaceSidedness.cxx \
@@ -52,8 +60,16 @@
     lwoStillImage.h \
     lwoSurface.h \
     lwoSurfaceBlock.h \
+    lwoSurfaceBlockAxis.h \
+    lwoSurfaceBlockChannel.h \
+    lwoSurfaceBlockEnabled.h \
+    lwoSurfaceBlockImage.h \
+    lwoSurfaceBlockOpacity.h \
+    lwoSurfaceBlockProjection.h \
     lwoSurfaceBlockHeader.h \
+    lwoSurfaceBlockRepeat.h \
     lwoSurfaceBlockTMap.h \
+    lwoSurfaceBlockWrap.h \
     lwoSurfaceColor.h \
     lwoSurfaceParameter.h \
     lwoSurfaceSidedness.h \

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

@@ -21,8 +21,16 @@
 #include "lwoStillImage.h"
 #include "lwoSurface.h"
 #include "lwoSurfaceBlock.h"
+#include "lwoSurfaceBlockAxis.h"
+#include "lwoSurfaceBlockChannel.h"
+#include "lwoSurfaceBlockEnabled.h"
+#include "lwoSurfaceBlockImage.h"
+#include "lwoSurfaceBlockOpacity.h"
+#include "lwoSurfaceBlockProjection.h"
 #include "lwoSurfaceBlockHeader.h"
+#include "lwoSurfaceBlockRepeat.h"
 #include "lwoSurfaceBlockTMap.h"
+#include "lwoSurfaceBlockWrap.h"
 #include "lwoSurfaceColor.h"
 #include "lwoSurfaceParameter.h"
 #include "lwoSurfaceSidedness.h"
@@ -53,8 +61,16 @@ ConfigureFn(config_lwo) {
   LwoStillImage::init_type();
   LwoSurface::init_type();
   LwoSurfaceBlock::init_type();
+  LwoSurfaceBlockAxis::init_type();
+  LwoSurfaceBlockChannel::init_type();
+  LwoSurfaceBlockEnabled::init_type();
+  LwoSurfaceBlockImage::init_type();
+  LwoSurfaceBlockOpacity::init_type();
+  LwoSurfaceBlockProjection::init_type();
   LwoSurfaceBlockHeader::init_type();
+  LwoSurfaceBlockRepeat::init_type();
   LwoSurfaceBlockTMap::init_type();
+  LwoSurfaceBlockWrap::init_type();
   LwoSurfaceColor::init_type();
   LwoSurfaceParameter::init_type();
   LwoSurfaceSidedness::init_type();

+ 1 - 1
pandatool/src/lwo/lwoSurface.h

@@ -14,7 +14,7 @@
 // 	 Class : LwoSurface
 // Description : Describes the shading attributes of a surface.  This
 //               is similar to the concept usually called a "material"
-//               in other file formats.
+//               or "shader" in other file formats.
 ////////////////////////////////////////////////////////////////////
 class LwoSurface : public LwoGroupChunk {
 public:

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

@@ -5,8 +5,13 @@
 
 #include "lwoSurfaceBlock.h"
 #include "iffInputFile.h"
+#include "lwoSurfaceBlockAxis.h"
+#include "lwoSurfaceBlockImage.h"
 #include "lwoSurfaceBlockHeader.h"
+#include "lwoSurfaceBlockProjection.h"
+#include "lwoSurfaceBlockRepeat.h"
 #include "lwoSurfaceBlockTMap.h"
+#include "lwoSurfaceBlockWrap.h"
 
 #include <indent.h>
 
@@ -60,6 +65,22 @@ make_new_chunk(IffInputFile *in, IffId id) {
   } else if (id == IffId("TMAP")) {
     return new LwoSurfaceBlockTMap;
 
+  } else if (id == IffId("PROJ")) {
+    return new LwoSurfaceBlockProjection;
+
+  } else if (id == IffId("AXIS")) {
+    return new LwoSurfaceBlockAxis;
+
+  } else if (id == IffId("IMAG")) {
+    return new LwoSurfaceBlockImage;
+
+  } else if (id == IffId("WRAP")) {
+    return new LwoSurfaceBlockWrap;
+
+  } else if (id == IffId("WRPH") ||
+	     id == IffId("WRPW")) {
+    return new LwoSurfaceBlockRepeat;
+
   } else  {
     return IffChunk::make_new_chunk(in, id);
   }

+ 41 - 0
pandatool/src/lwo/lwoSurfaceBlockAxis.cxx

@@ -0,0 +1,41 @@
+// Filename: lwoSurfaceBlockAxis.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockAxis.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockAxis::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockAxis::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 LwoSurfaceBlockAxis::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _axis = (Axis)lin->get_be_uint16();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockAxis::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockAxis::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { axis = " << (int)_axis << " }\n";
+}

+ 53 - 0
pandatool/src/lwo/lwoSurfaceBlockAxis.h

@@ -0,0 +1,53 @@
+// Filename: lwoSurfaceBlockAxis.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKAXIS_H
+#define LWOSURFACEBLOCKAXIS_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockAxis
+// Description : Indicates the axis for this particular shader's
+//               projection.  This works in conjunction with
+//               LwoSurfaceBlockProjection.  This is a subchunk of
+//               LwoSurfaceBlock.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockAxis : public LwoChunk {
+public:
+  enum Axis {
+    M_x        = 0,
+    M_y        = 1,
+    M_z        = 2
+  };
+  Axis _axis;
+
+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, "LwoSurfaceBlockAxis",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  

+ 41 - 0
pandatool/src/lwo/lwoSurfaceBlockChannel.cxx

@@ -0,0 +1,41 @@
+// Filename: lwoSurfaceBlockChannel.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockChannel.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockChannel::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockChannel::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 LwoSurfaceBlockChannel::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _channel_id = lin->get_id();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockChannel::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockChannel::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { channel_id = " << _channel_id << " }\n";
+}

+ 47 - 0
pandatool/src/lwo/lwoSurfaceBlockChannel.h

@@ -0,0 +1,47 @@
+// Filename: lwoSurfaceBlockChannel.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKCHANNEL_H
+#define LWOSURFACEBLOCKCHANNEL_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockChannel
+// Description : Indicates which channel the texture in this
+//               LwoSurfaceBlock is applied to.  This is a subchunk of
+//               LwoSurfaceBlockHeader.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockChannel : public LwoChunk {
+public:
+  IffId _channel_id;
+
+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, "LwoSurfaceBlockChannel",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  

+ 41 - 0
pandatool/src/lwo/lwoSurfaceBlockEnabled.cxx

@@ -0,0 +1,41 @@
+// Filename: lwoSurfaceBlockEnabled.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockEnabled.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockEnabled::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockEnabled::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 LwoSurfaceBlockEnabled::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _enabled = (lin->get_be_uint16() != 0);
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockEnabled::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockEnabled::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { enabled = " << _enabled << " }\n";
+}

+ 47 - 0
pandatool/src/lwo/lwoSurfaceBlockEnabled.h

@@ -0,0 +1,47 @@
+// Filename: lwoSurfaceBlockEnabled.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKENABLED_H
+#define LWOSURFACEBLOCKENABLED_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockEnabled
+// Description : Indicates whether this particular layer or shader
+//               should be rendered or not.  This is a subchunk of
+//               LwoSurfaceBlockHeader.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockEnabled : public LwoChunk {
+public:
+  bool _enabled;
+
+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, "LwoSurfaceBlockEnabled",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  

+ 10 - 21
pandatool/src/lwo/lwoSurfaceBlockHeader.cxx

@@ -5,6 +5,9 @@
 
 #include "lwoSurfaceBlockHeader.h"
 #include "lwoInputFile.h"
+#include "lwoSurfaceBlockChannel.h"
+#include "lwoSurfaceBlockEnabled.h"
+#include "lwoSurfaceBlockOpacity.h"
 
 #include <indent.h>
 
@@ -63,30 +66,16 @@ write(ostream &out, int indent_level) const {
 ////////////////////////////////////////////////////////////////////
 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;
+  if (id == IffId("CHAN")) {
+    return new LwoSurfaceBlockChannel;
 
-  } else if (id == IffId("SIDE")) {
-    return new LwoSurfaceSidedness;
+  } else if (id == IffId("ENAB")) {
+    return new LwoSurfaceBlockEnabled;
 
-  } else if (id == IffId("SMAN")) {
-    return new LwoSurfaceSmoothingAngle;
+  } else if (id == IffId("OPAC")) {
+    return new LwoSurfaceBlockOpacity;
   
-    } else */ {
+  } else {
     return IffChunk::make_new_chunk(in, id);
   }
 }

+ 41 - 0
pandatool/src/lwo/lwoSurfaceBlockImage.cxx

@@ -0,0 +1,41 @@
+// Filename: lwoSurfaceBlockImage.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockImage.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockImage::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockImage::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 LwoSurfaceBlockImage::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _index = lin->get_vx();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockImage::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockImage::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { index = " << _index << " }\n";
+}

+ 47 - 0
pandatool/src/lwo/lwoSurfaceBlockImage.h

@@ -0,0 +1,47 @@
+// Filename: lwoSurfaceBlockImage.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKIMAGE_H
+#define LWOSURFACEBLOCKIMAGE_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockImage
+// Description : Specifies the particular image that is being applied
+//               as a texture.  This references a recently-defined
+//               CLIP image by index number.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockImage : public LwoChunk {
+public:
+  int _index;
+
+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, "LwoSurfaceBlockImage",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  

+ 45 - 0
pandatool/src/lwo/lwoSurfaceBlockOpacity.cxx

@@ -0,0 +1,45 @@
+// Filename: lwoSurfaceBlockOpacity.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockOpacity.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockOpacity::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockOpacity::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 LwoSurfaceBlockOpacity::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _type = (Type)lin->get_be_uint16();
+  _opacity = lin->get_be_float32();
+  _envelope = lin->get_vx();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockOpacity::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockOpacity::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { type = " << (int)_type 
+    << ", opacity = " << _opacity * 100.0 << "%, envelope = " << _envelope
+    << " }\n";
+}

+ 59 - 0
pandatool/src/lwo/lwoSurfaceBlockOpacity.h

@@ -0,0 +1,59 @@
+// Filename: lwoSurfaceBlockOpacity.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKOPACITY_H
+#define LWOSURFACEBLOCKOPACITY_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockOpacity
+// Description : Indicates how transparent or opaque this particular
+//               layer is in relation to the layers beneath it.  This
+//               is a subchunk of LwoSurfaceBlockHeader.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockOpacity : public LwoChunk {
+public:
+  enum Type {
+    T_additive             = 0,
+    T_subtractive          = 1,
+    T_difference           = 2,
+    T_multiply             = 3,
+    T_divide               = 4,
+    T_alpha                = 5,
+    T_texture_displacement = 6
+  };
+
+  Type _type;
+  float _opacity;
+  int _envelope;
+
+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, "LwoSurfaceBlockOpacity",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  

+ 41 - 0
pandatool/src/lwo/lwoSurfaceBlockProjection.cxx

@@ -0,0 +1,41 @@
+// Filename: lwoSurfaceBlockProjection.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockProjection.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockProjection::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockProjection::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 LwoSurfaceBlockProjection::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _mode = (Mode)lin->get_be_uint16();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockProjection::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockProjection::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { mode = " << (int)_mode << " }\n";
+}

+ 56 - 0
pandatool/src/lwo/lwoSurfaceBlockProjection.h

@@ -0,0 +1,56 @@
+// Filename: lwoSurfaceBlockProjection.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKPROJECTION_H
+#define LWOSURFACEBLOCKPROJECTION_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockProjection
+// Description : Indicates the projection mode for this particular
+//               shader.  This determines how UV coordinates should be
+//               computed based on the vertex positions.  This is a
+//               subchunk of LwoSurfaceBlock.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockProjection : public LwoChunk {
+public:
+  enum Mode {
+    M_planar        = 0,
+    M_cylindrical   = 1,
+    M_spherical     = 2,
+    M_cubic         = 3,
+    M_front         = 4,
+    M_uv            = 5
+  };
+  Mode _mode;
+
+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, "LwoSurfaceBlockProjection",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  

+ 43 - 0
pandatool/src/lwo/lwoSurfaceBlockRepeat.cxx

@@ -0,0 +1,43 @@
+// Filename: lwoSurfaceBlockRepeat.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockRepeat.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockRepeat::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockRepeat::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 LwoSurfaceBlockRepeat::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _cycles = lin->get_be_float32();
+  _envelope = lin->get_vx();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockRepeat::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockRepeat::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { cycles = " << _cycles
+    << ", envelope = " << _envelope << " }\n";
+}

+ 50 - 0
pandatool/src/lwo/lwoSurfaceBlockRepeat.h

@@ -0,0 +1,50 @@
+// Filename: lwoSurfaceBlockRepeat.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKREPEAT_H
+#define LWOSURFACEBLOCKREPEAT_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockRepeat
+// Description : For cylindrical and spherical projections, this
+//               parameter controls how many times the image repeats
+//               over each full interval, in either dimension.  The
+//               dimension is specified by the id of the chunk, either
+//               WRPW or WRPH.  This is a subchunk of LwoSurfaceBlock.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockRepeat : public LwoChunk {
+public:
+  float _cycles;
+  int _envelope;
+
+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, "LwoSurfaceBlockRepeat",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+  

+ 41 - 0
pandatool/src/lwo/lwoSurfaceBlockWrap.cxx

@@ -0,0 +1,41 @@
+// Filename: lwoSurfaceBlockWrap.cxx
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "lwoSurfaceBlockWrap.h"
+#include "lwoInputFile.h"
+
+#include <indent.h>
+
+TypeHandle LwoSurfaceBlockWrap::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockWrap::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 LwoSurfaceBlockWrap::
+read_iff(IffInputFile *in, size_t stop_at) {
+  LwoInputFile *lin = DCAST(LwoInputFile, in);
+
+  _mode = (Mode)lin->get_be_uint16();
+
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LwoSurfaceBlockWrap::write
+//       Access: Public, Virtual
+//  Description: 
+////////////////////////////////////////////////////////////////////
+void LwoSurfaceBlockWrap::
+write(ostream &out, int indent_level) const {
+  indent(out, indent_level)
+    << get_id() << " { mode = " << (int)_mode << " }\n";
+}

+ 52 - 0
pandatool/src/lwo/lwoSurfaceBlockWrap.h

@@ -0,0 +1,52 @@
+// Filename: lwoSurfaceBlockWrap.h
+// Created by:  drose (24Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef LWOSURFACEBLOCKWRAP_H
+#define LWOSURFACEBLOCKWRAP_H
+
+#include <pandatoolbase.h>
+
+#include "lwoChunk.h"
+
+////////////////////////////////////////////////////////////////////
+// 	 Class : LwoSurfaceBlockWrap
+// Description : Specifies how the texture image appears for areas
+//               outside the image.
+////////////////////////////////////////////////////////////////////
+class LwoSurfaceBlockWrap : public LwoChunk {
+public:
+  enum Mode {
+    M_reset    = 0,    // black outside
+    M_repeat   = 1,    // standard repeat
+    M_mirror   = 2,    // repeat with reflection
+    M_edge     = 3     // GL-style clamping
+  };
+  Mode _mode;
+
+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, "LwoSurfaceBlockWrap",
+		  LwoChunk::get_class_type());
+  }
+
+private:
+  static TypeHandle _type_handle;
+};
+
+#endif
+
+