00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "lwoSurface.h"
00020 #include "iffInputFile.h"
00021 #include "lwoSurfaceBlock.h"
00022 #include "lwoSurfaceColor.h"
00023 #include "lwoSurfaceParameter.h"
00024 #include "lwoSurfaceSidedness.h"
00025 #include "lwoSurfaceSmoothingAngle.h"
00026
00027 #include <indent.h>
00028
00029 TypeHandle LwoSurface::_type_handle;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 bool LwoSurface::
00042 read_iff(IffInputFile *in, size_t stop_at) {
00043 _name = in->get_string();
00044 _source = in->get_string();
00045 read_subchunks_iff(in, stop_at);
00046 return true;
00047 }
00048
00049
00050
00051
00052
00053
00054 void LwoSurface::
00055 write(ostream &out, int indent_level) const {
00056 indent(out, indent_level)
00057 << get_id() << " {\n";
00058 indent(out, indent_level + 2)
00059 << "name = \"" << _name << "\", source = \"" << _source << "\"\n";
00060 write_chunks(out, indent_level + 2);
00061 indent(out, indent_level)
00062 << "}\n";
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072 IffChunk *LwoSurface::
00073 make_new_chunk(IffInputFile *in, IffId id) {
00074 if (id == IffId("COLR")) {
00075 return new LwoSurfaceColor;
00076
00077 } else if (id == IffId("DIFF") ||
00078 id == IffId("LUMI") ||
00079 id == IffId("SPEC") ||
00080 id == IffId("REFL") ||
00081 id == IffId("TRAN") ||
00082 id == IffId("TRNL") ||
00083 id == IffId("GLOS") ||
00084 id == IffId("SHRP") ||
00085 id == IffId("BUMP") ||
00086 id == IffId("RSAN") ||
00087 id == IffId("RIND")) {
00088 return new LwoSurfaceParameter;
00089
00090 } else if (id == IffId("SIDE")) {
00091 return new LwoSurfaceSidedness;
00092
00093 } else if (id == IffId("SMAN")) {
00094 return new LwoSurfaceSmoothingAngle;
00095
00096 } else if (id == IffId("BLOK")) {
00097 return new LwoSurfaceBlock;
00098
00099 } else {
00100 return IffChunk::make_new_chunk(in, id);
00101 }
00102 }
00103