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