From Sebastien Grignard, added support for reading and writing callbacks

This commit is contained in:
Robert Osfield 2005-03-07 14:14:35 +00:00
parent 5684a130b7
commit 238341b0da

View File

@ -35,11 +35,29 @@ bool Drawable_readLocalData(Object& obj, Input& fr)
iteratorAdvanced = true;
}
Shape* shape = static_cast<Shape *>(fr.readObjectOfType(type_wrapper<Shape>()));
if (shape) {
drawable.setShape(shape);
iteratorAdvanced = true;
}
Shape* shape = static_cast<Shape *>(fr.readObjectOfType(type_wrapper<Shape>()));
if (shape) {
drawable.setShape(shape);
iteratorAdvanced = true;
}
Drawable::UpdateCallback* uc = dynamic_cast<Drawable::UpdateCallback *>(fr.readObjectOfType(type_wrapper<Drawable::UpdateCallback>()));
if (uc) {
drawable.setUpdateCallback(uc);
iteratorAdvanced = true;
}
Drawable::CullCallback* cc = dynamic_cast<Drawable::CullCallback *>(fr.readObjectOfType(type_wrapper<Drawable::CullCallback>()));
if (cc) {
drawable.setCullCallback(cc);
iteratorAdvanced = true;
}
Drawable::DrawCallback* dc = dynamic_cast<Drawable::DrawCallback *>(fr.readObjectOfType(type_wrapper<Drawable::DrawCallback>()));
if (dc) {
drawable.setDrawCallback(dc);
iteratorAdvanced = true;
}
if (fr[0].matchWord("supportsDisplayList"))
{
@ -107,6 +125,22 @@ bool Drawable_writeLocalData(const Object& obj, Output& fw)
fw.writeObject(*drawable.getShape());
}
if (drawable.getUpdateCallback())
{
fw.writeObject(*drawable.getUpdateCallback());
}
if (drawable.getCullCallback())
{
fw.writeObject(*drawable.getCullCallback());
}
if (drawable.getDrawCallback())
{
fw.writeObject(*drawable.getDrawCallback());
}
if (!drawable.getSupportsDisplayList())
{
fw.indent()<<"supportsDisplayList ";