File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -373,7 +373,7 @@ namespace vsg
373373 vsg::deallocate (_data);
374374 }
375375
376- removeMipmapLayout ();
376+ Data::_delete ();
377377 }
378378
379379 private:
Original file line number Diff line number Diff line change @@ -369,7 +369,7 @@ namespace vsg
369369 vsg::deallocate (_data);
370370 }
371371
372- removeMipmapLayout ();
372+ Data::_delete ();
373373 }
374374
375375 private:
Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ namespace vsg
385385 vsg::deallocate (_data);
386386 }
387387
388- removeMipmapLayout ();
388+ Data::_delete ();
389389 }
390390
391391 private:
Original file line number Diff line number Diff line change @@ -39,6 +39,12 @@ namespace vsg
3939
4040 virtual int compare (const Auxiliary& rhs) const ;
4141
42+ using ObjectMap = std::map<std::string, vsg::ref_ptr<Object>>;
43+
44+ // / container for all user objects
45+ ObjectMap userObjects;
46+
47+
4248 void setObject (const std::string& key, ref_ptr<Object> object)
4349 {
4450 userObjects[key] = object;
@@ -76,10 +82,11 @@ namespace vsg
7682 return {};
7783 }
7884
79- using ObjectMap = std::map<std::string, vsg::ref_ptr<Object>>;
85+ void clear ()
86+ {
87+ userObjects.clear ();
88+ }
8089
81- // / container for all user objects
82- ObjectMap userObjects;
8390
8491 protected:
8592 explicit Auxiliary (Object* object);
Original file line number Diff line number Diff line change @@ -217,16 +217,17 @@ namespace vsg
217217 // / return true if Data's ModifiedCount is different from the specified ModifiedCount
218218 bool differentModifiedCount (const ModifiedCount& mc) const { return _modifiedCount != mc; }
219219
220+ // / set the MipmapLayout, only required when the data contains mipmaps that use block compressed formats and the pixels size doesn't fit exactly to the block size.
220221 void setMipmapLayout (MipmapLayout* mipmapData);
221222
223+ // / get the MipmapLayout if assigned.
222224 const MipmapLayout* getMipmapLayout () const ;
223225
224- void removeMipmapLayout ();
225-
226226 protected:
227227 virtual ~Data () {}
228228
229229 void _copy (const Data& rhs);
230+ void _delete ();
230231
231232 ModifiedCount _modifiedCount;
232233
Original file line number Diff line number Diff line change @@ -128,24 +128,23 @@ void Data::_copy(const Data& rhs)
128128 }
129129}
130130
131+ void Data::_delete ()
132+ {
133+ if (getAuxiliary ()) getAuxiliary ()->clear ();
134+ }
135+
131136void Data::setMipmapLayout (MipmapLayout* mipmapLayout)
132137{
133138 if (mipmapLayout)
134139 setObject (" mipmapLayout" , ref_ptr<MipmapLayout>(mipmapLayout));
135- else
136- removeMipmapLayout ();
140+ else if (getAuxiliary ()) removeObject (" mipmapLayout" );
137141}
138142
139143const MipmapLayout* Data::getMipmapLayout () const
140144{
141145 return getObject<MipmapLayout>(" mipmapLayout" );
142146}
143147
144- void Data::removeMipmapLayout ()
145- {
146- if (getAuxiliary ()) removeObject (" mipmapLayout" );
147- }
148-
149148std::size_t Data::computeValueCountIncludingMipmaps () const
150149{
151150 std::size_t count = 0 ;
You can’t perform that action at this time.
0 commit comments