2 * \file editable_mesh.cpp
4 * \date 2012-08-26 12:11GMT
5 * \author Jan Boon (Kaetemi)
10 * Copyright (C) 2012 by authors
12 * This file is part of RYZOM CORE PIPELINE.
13 * RYZOM CORE PIPELINE is free software: you can redistribute it
14 * and/or modify it under the terms of the GNU Affero General Public
15 * License as published by the Free Software Foundation, either
16 * version 3 of the License, or (at your option) any later version.
18 * RYZOM CORE PIPELINE is distributed in the hope that it will be
19 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Affero General Public License for more details.
23 * You should have received a copy of the GNU Affero General Public
24 * License along with RYZOM CORE PIPELINE. If not, see
25 * <http://www.gnu.org/licenses/>.
28 #include <nel/misc/types_nl.h>
29 #include "editable_mesh.h"
35 // #include <nel/misc/debug.h>
41 // using namespace NLMISC;
47 CEditableMesh::CEditableMesh(CScene
*scene
) : CTriObject(scene
)
52 CEditableMesh::~CEditableMesh()
54 if (!m_ChunksOwnsPointers
)
56 for (TStorageObjectContainer::iterator it
= m_EditableMeshUnknown
.begin(), end
= m_EditableMeshUnknown
.end(); it
!= end
; ++it
)
58 m_EditableMeshUnknown
.clear();
62 const ucstring
CEditableMesh::DisplayName
= ucstring("EditableMesh");
63 const char *CEditableMesh::InternalName
= "EditableMesh";
64 const NLMISC::CClassId
CEditableMesh::ClassId
= NLMISC::CClassId(0xe44f10b3, 0x00000000);
65 const TSClassId
CEditableMesh::SuperClassId
= CTriObject::SuperClassId
;
66 const CEditableMeshClassDesc
EditableMeshClassDesc(&DllPluginDescUpdate1
);
68 void CEditableMesh::parse(uint16 version
, uint filter
)
70 CTriObject::parse(version
);
73 so
= getChunk(0x3001);
76 m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x3001, so
));
79 if (peekChunk() == 0x2845)
81 so
= getChunk(0x2845);
82 m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x2845, so
));
84 else if (peekChunk() == 0x2846)
86 so
= getChunk(0x2846);
87 m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x2846, so
));
89 else if (peekChunk() == 0x2847)
91 so
= getChunk(0x2847);
92 m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x2847, so
));
99 so
= getChunk(0x3003);
100 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x3003, so
));
102 so
= getChunk(0x3004);
103 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x3004, so
));
105 so
= getChunk(0x3002);
106 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x3002, so
));
107 so
= getChunk(0x4020);
108 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x4020, so
));
109 so
= getChunk(0x4024);
110 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x4024, so
));
111 so
= getChunk(0x4025);
112 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x4025, so
));
113 so
= getChunk(0x4026);
114 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x4026, so
));
115 so
= getChunk(0x402c);
116 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x402c, so
));
117 so
= getChunk(0x402d);
118 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x402d, so
));
119 so
= getChunk(0x4030);
120 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x4030, so
));
121 so
= getChunk(0x4034);
122 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x4034, so
));
123 so
= getChunk(0x4038);
124 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x4038, so
));
125 so
= getChunk(0x403b);
126 if (so
) m_EditableMeshUnknown
.push_back(TStorageObjectWithId(0x403b, so
));
128 CTriObject::parse(version
, PMB_TRI_OBJECT_PARSE_FILTER
);
131 void CEditableMesh::clean()
136 void CEditableMesh::build(uint16 version
, uint filter
)
138 CTriObject::build(version
);
140 for (TStorageObjectContainer::iterator it
= m_EditableMeshUnknown
.begin(), end
= m_EditableMeshUnknown
.end(); it
!= end
; ++it
)
141 putChunk(it
->first
, it
->second
);
143 CTriObject::build(version
, PMB_TRI_OBJECT_PARSE_FILTER
);
146 void CEditableMesh::disown()
148 m_EditableMeshUnknown
.clear();
149 CTriObject::disown();
152 void CEditableMesh::init()
157 bool CEditableMesh::inherits(const NLMISC::CClassId classId
) const
159 if (classId
== classDesc()->classId()) return true;
160 return CTriObject::inherits(classId
);
163 const ISceneClassDesc
*CEditableMesh::classDesc() const
165 return &EditableMeshClassDesc
;
168 void CEditableMesh::toStringLocal(std::ostream
&ostream
, const std::string
&pad
, uint filter
) const
170 CTriObject::toStringLocal(ostream
, pad
);
172 std::string padpad
= pad
+ "\t";
174 for (TStorageObjectContainer::const_iterator it
= m_EditableMeshUnknown
.begin(), end
= m_EditableMeshUnknown
.end(); it
!= end
; ++it
)
176 std::stringstream ss
;
177 ss
<< std::hex
<< std::setfill('0');
178 ss
<< std::setw(4) << it
->first
;
179 ostream
<< "\n" << pad
<< "EditableMeshUnkown[" << i
<< "] 0x" << ss
.str() << ": ";
180 it
->second
->toString(ostream
, padpad
);
184 CTriObject::toStringLocal(ostream
, pad
, PMB_TRI_OBJECT_PARSE_FILTER
);
187 IStorageObject
*CEditableMesh::createChunkById(uint16 id
, bool container
)
189 return CTriObject::createChunkById(id
, container
);
192 } /* namespace UPDATE1 */
193 } /* namespace MAX */
194 } /* namespace PIPELINE */