Text archives Help
- From: sparker@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1388 - in branches/persistent: . Core Core/Color Core/Geometry Core/Reflection Engine/Factory Interface Model/AmbientLights Model/Backgrounds Model/Groups Model/Materials Model/Primitives StandAlone scenes
- Date: Mon, 14 May 2007 12:13:27 -0600 (MDT)
Author: sparker
Date: Mon May 14 12:13:11 2007
New Revision: 1388
Added:
branches/persistent/Core/Color/RGBTraits.cc
Modified:
branches/persistent/Core/CMakeLists.txt
branches/persistent/Core/Color/ColorSpace.h
branches/persistent/Core/Color/RGBTraits.h
branches/persistent/Core/Geometry/Vector.cc
branches/persistent/Core/Geometry/Vector.h
branches/persistent/Core/Reflection/Archive.h
branches/persistent/Core/Reflection/ClassInfo.h
branches/persistent/Core/Reflection/XMLArchive.cc
branches/persistent/Core/Reflection/XMLArchive.h
branches/persistent/Core/Reflection/stdClassInfo.h
branches/persistent/Engine/Factory/Factory.cc
branches/persistent/Interface/InterfaceClassInfo.cc
branches/persistent/Interface/InterfaceClassInfo.h
branches/persistent/Model/AmbientLights/ArcAmbient.cc
branches/persistent/Model/AmbientLights/ArcAmbient.h
branches/persistent/Model/Backgrounds/LinearBackground.cc
branches/persistent/Model/Backgrounds/LinearBackground.h
branches/persistent/Model/Groups/CMakeLists.txt
branches/persistent/Model/Groups/Group.cc
branches/persistent/Model/Materials/CMakeLists.txt
branches/persistent/Model/Primitives/CMakeLists.txt
branches/persistent/StandAlone/savescene.cc
branches/persistent/TODO
branches/persistent/scenes/0.cc
Log:
Writing starting to work
Modified: branches/persistent/Core/CMakeLists.txt
==============================================================================
--- branches/persistent/Core/CMakeLists.txt (original)
+++ branches/persistent/Core/CMakeLists.txt Mon May 14 12:13:11 2007
@@ -6,6 +6,8 @@
Color/ColorSpace.h
Color/RGBColor.h
Color/RGBColor.cc
+ Color/RGBTraits.h
+ Color/RGBTraits.cc
Color/GrayColor.h
Color/GrayColor.cc
Color/RegularColorMap.h
Modified: branches/persistent/Core/Color/ColorSpace.h
==============================================================================
--- branches/persistent/Core/Color/ColorSpace.h (original)
+++ branches/persistent/Core/Color/ColorSpace.h Mon May 14 12:13:11 2007
@@ -7,6 +7,7 @@
#include <Core/Color/RGBColor.h>
#include <Core/Color/RGBTraits.h>
#include <Core/Math/Expon.h>
+#include <Core/Reflection/ClassInfo.h>
#include <sgi_stl_warnings_off.h>
#include <string>
@@ -247,12 +248,15 @@
ComponentType data[NumComponents];
#endif
+ void readwrite(Archive*);
+
protected:
// DO NOT MAKE THIS PUBLIC!
ColorSpace(ComponentType fillValue) {
for(int i=0;i<NumComponents;i++)
data[i] = fillValue;
}
+ friend class ClassInfo<ColorSpace<Traits> >;
};
template<typename Traits, typename Scalar>
@@ -263,6 +267,19 @@
returnValue[i] = scale * s[i];
return returnValue;
}
+
+ template<typename Traits>
+ class ClassInfo<ColorSpace<Traits> > {
+ public:
+ static std::string getPublicClassname() {
+ return "Color";
+ }
+ static void readwrite(Archive* archive, ColorSpace<Traits>& data) {
+ Traits::readwrite(archive, data.data);
+ }
+ static bool force_initialize;
+ };
+
}
#endif
Added: branches/persistent/Core/Color/RGBTraits.cc
==============================================================================
--- (empty file)
+++ branches/persistent/Core/Color/RGBTraits.cc Mon May 14 12:13:11 2007
@@ -0,0 +1,11 @@
+
+#include <Core/Color/RGBTraits.h>
+#include <Core/Util/NotFinished.h>
+
+using namespace Manta;
+
+void RGBTraits::readwrite(Archive* archive, ComponentType data[3])
+{
+ NOT_FINISHED("RGBTraits::readwrite");
+}
+
Modified: branches/persistent/Core/Color/RGBTraits.h
==============================================================================
--- branches/persistent/Core/Color/RGBTraits.h (original)
+++ branches/persistent/Core/Color/RGBTraits.h Mon May 14 12:13:11 2007
@@ -6,6 +6,7 @@
#include <Core/Color/Conversion.h>
namespace Manta {
+ class Archive;
class RGBTraits {
public:
typedef float ComponentType;
@@ -39,6 +40,8 @@
static ComponentType luminance(const ComponentType data[3]) {
return data[0] * ComponentType(0.3) + data[1] * ComponentType(0.59) +
data[2] * ComponentType(0.11);
}
+
+ static void readwrite(Archive* archive, ComponentType data[3]);
};
}
Modified: branches/persistent/Core/Geometry/Vector.cc
==============================================================================
--- branches/persistent/Core/Geometry/Vector.cc (original)
+++ branches/persistent/Core/Geometry/Vector.cc Mon May 14 12:13:11 2007
@@ -34,6 +34,8 @@
#include <iostream>
#include <sgi_stl_warnings_on.h>
+using namespace Manta;
+
namespace Manta {
std::ostream& operator<< (std::ostream& os, const Vector& v) {
os << v[0] << " ";
@@ -48,9 +50,12 @@
is >> v[2];
return is;
}
+}
- void Vector::readwrite(Archive* archive)
- {
- archive->readwrite("data", data, 3);
- }
+REGISTER_CLASS(Vector);
+
+void Vector::readwrite(Archive* archive)
+{
+ archive->readwrite("data", data, 3);
}
+
Modified: branches/persistent/Core/Geometry/Vector.h
==============================================================================
--- branches/persistent/Core/Geometry/Vector.h (original)
+++ branches/persistent/Core/Geometry/Vector.h Mon May 14 12:13:11 2007
@@ -556,12 +556,10 @@
return result;
}
- template<>
- class ClassInfo<Vector> : public ClassInfo_BaseClass<Vector>, public
ClassInfo_readwriteMethod<Vector> {
- };
-
std::ostream& operator<< (std::ostream& os, const Vector& v);
std::istream& operator>> (std::istream& is, Vector& v);
+
+ DECLARE_CLASSINFO_BASECLASS(Vector, ConcreteClass, readwriteMethod);
}
namespace SCIRun {
Modified: branches/persistent/Core/Reflection/Archive.h
==============================================================================
--- branches/persistent/Core/Reflection/Archive.h (original)
+++ branches/persistent/Core/Reflection/Archive.h Mon May 14 12:13:11
2007
@@ -19,8 +19,6 @@
void readwrite(const char* fieldname, T*& data);
template<class T>
void readwrite(const char* fieldname, const T*& data);
- template<class T>
- void readwriteObject(T*& data);
virtual void readwrite(const char* fieldname, int& data) = 0;
virtual void readwrite(const char* fieldname, float& data) = 0;
@@ -38,7 +36,9 @@
virtual std::string getClassname() const = 0;
virtual Archive* findField(const std::string& fieldname) const = 0;
- virtual Archive* createField(const std::string& fieldname, const
std::string& classname) = 0;
+ virtual Archive* createClass(const std::string& classname) = 0;
+ virtual Archive* createField(const std::string& fieldname) = 0;
+ virtual Archive* createFieldForClass(const std::string& fieldname, const
std::string& classname) = 0;
//virtual Archive* addSequence(const std::string& sequencename);
virtual bool isNullPointer() const = 0;
virtual void writeNullPointer() = 0;
@@ -64,8 +64,7 @@
if(!subArchive)
throw SerializationError("Cannot find field: " +
std::string(fieldname));
} else {
- std::string classname = ClassInfo<T>::getPublicClassname();
- subArchive = createField(fieldname, classname);
+ subArchive = createField(fieldname);
}
ClassInfo<T>::readwrite(subArchive, data);
delete subArchive;
@@ -74,61 +73,59 @@
template<class T>
void Archive::readwrite(const char* fieldname, T*& data) {
- Archive* subArchive;
if(reading()){
- subArchive = findField(fieldname);
+ Archive* subArchive = fieldname?findField(fieldname):this;
if(!subArchive)
- throw SerializationError("Cannot find field: " +
std::string(fieldname));
- } else {
- std::string classname = ClassInfo<T>::getPublicClassname();
- subArchive = createField(fieldname, classname);
- }
- subArchive->readwriteObject(data);
- delete subArchive;
- }
-
- template<class T>
- void Archive::readwrite(const char* fieldname, const T*& data) {
- if(reading()){
- T* tmpdata;
- readwrite(fieldname, tmpdata);
- data = tmpdata;
- } else {
- T* tmpdata = const_cast<T*>(data);
- readwrite(fieldname, tmpdata);
- }
- }
-
- template<class T>
- void Archive::readwriteObject(T*& data) {
- if(reading()){
- if(isNullPointer()){
+ throw SerializationError("Cannot find field: " +
std::string(fieldname) + " while reading class: " + typeid(T).name());
+ if(subArchive->isNullPointer()){
data = 0;
- return;
} else {
- std::string classname = getClassname();
+ std::string classname = subArchive->getClassname();
typename ClassDatabase<T>::Entry* dbentry =
ClassDatabase<T>::getEntry(classname);
if(!dbentry)
throw SerializationError("Cannot create class: " + classname + "
due to missing ClassInfo");
data = dbentry->createInstance();
- dbentry->readwrite(this, data);
+ dbentry->readwrite(subArchive, data);
}
+ if(fieldname)
+ delete subArchive;
} else {
// Writing
if(!data){
- writeNullPointer();
+ Archive* subArchive = fieldname?createField(fieldname):this;
+ subArchive->writeNullPointer();
+ if(fieldname)
+ delete subArchive;
return;
}
if(typeid(T) == typeid(*data)){
- ClassInfo<T>::readwrite(this, *data);
+ std::string classname = ClassInfo<T>::getPublicClassname();
+ Archive* subArchive = fieldname?createFieldForClass(fieldname,
classname):createClass(classname);
+ ClassInfo<T>::readwrite(subArchive, *data);
+ delete subArchive;
} else {
typename ClassDatabase<T>::Entry* dbentry =
ClassDatabase<T>::getEntry(typeid(*data));;
if(!dbentry){
std::string classname = typeid(*data).name();
throw SerializationError("Cannot locate serializer for class: " +
classname + " due to missing ClassInfo");
}
- dbentry->readwrite(this, data);
+ std::string classname = dbentry->getPublicClassname();
+ Archive* subArchive = fieldname?createFieldForClass(fieldname,
classname):createClass(classname);
+ dbentry->readwrite(subArchive, data);
+ delete subArchive;
}
+ }
+ }
+
+ template<class T>
+ void Archive::readwrite(const char* fieldname, const T*& data) {
+ if(reading()){
+ T* tmpdata;
+ readwrite(fieldname, tmpdata);
+ data = tmpdata;
+ } else {
+ T* tmpdata = const_cast<T*>(data);
+ readwrite(fieldname, tmpdata);
}
}
Modified: branches/persistent/Core/Reflection/ClassInfo.h
==============================================================================
--- branches/persistent/Core/Reflection/ClassInfo.h (original)
+++ branches/persistent/Core/Reflection/ClassInfo.h Mon May 14 12:13:11
2007
@@ -33,6 +33,7 @@
public:
virtual ~Entry() {}
virtual T* createInstance() const = 0;
+ virtual std::string getPublicClassname() const = 0;
virtual void readwrite(Archive* archive, T* ptr) const = 0;
virtual const std::type_info& get_typeinfo() const = 0;
};
@@ -45,6 +46,9 @@
virtual Class* createInstance() const {
return ClassInfo<Class>::createInstance();
}
+ virtual std::string getPublicClassname() const {
+ return ClassInfo<Class>::getPublicClassname();
+ }
virtual void readwrite(Archive* archive, T* ptr) const {
Class* derivedptr = dynamic_cast<Class*>(ptr);
if(!derivedptr){
@@ -176,7 +180,6 @@
public:
static std::string getPublicClassname() {
if(!classname){
- std::cerr << "T: " << typeid(T).name() << '\n';
throw SCIRun::InternalError(std::string("Class: ") +
typeid(T).name() + " is not registered", __FILE__, __LINE__);
}
return *classname;
@@ -196,7 +199,6 @@
template<class T>
bool ClassInfo_BaseClass<T>::registerClass(const std::string& _classname)
{
- std::cerr << "Registering class: " << _classname << '\n';
if(!classname)
classname = new std::string(_classname);
registerClassAndParents<T>(_classname);
@@ -228,12 +230,34 @@
template<class T, class Parent>
bool ClassInfo_DerivedClass<T, Parent>::registerClass(const std::string&
_classname)
{
- std::cerr << "Registering class: " << _classname << '\n';
if(!classname)
classname = new std::string(_classname);
registerClassAndParents<T>(_classname);
return true;
}
}
+
+// Convenience macros
+#define DECLARE_CLASSINFO_DERIVEDCLASS(declclass, baseclass, classtype,
rwtype) \
+template<>\
+class ClassInfo<declclass> : public ClassInfo_DerivedClass<declclass,
baseclass>, \
+ public ClassInfo_##classtype<declclass>, \
+ public ClassInfo_##rwtype<declclass> \
+{ \
+ static bool force_initialize; \
+}
+
+#define DECLARE_CLASSINFO_BASECLASS(declclass, classtype, rwtype) \
+template<>\
+class ClassInfo<declclass> : public ClassInfo_BaseClass<declclass>, \
+ public ClassInfo_##classtype<declclass>, \
+ public ClassInfo_##rwtype<declclass> \
+{ \
+ static bool force_initialize; \
+}
+
+
+#define REGISTER_CLASS(classname) \
+bool ClassInfo<classname>::force_initialize =
ClassInfo<classname>::registerClass(#classname)
#endif
Modified: branches/persistent/Core/Reflection/XMLArchive.cc
==============================================================================
--- branches/persistent/Core/Reflection/XMLArchive.cc (original)
+++ branches/persistent/Core/Reflection/XMLArchive.cc Mon May 14 12:13:11
2007
@@ -46,9 +46,7 @@
LIBXML_TEST_VERSION;
xmlDocPtr doc = xmlNewDoc(to_xml_ch_ptr("1.0"));
- xmlNodePtr node = xmlNewNode(0, to_xml_ch_ptr("Instance"));
- xmlDocSetRootElement(doc, node);
- return new XMLArchive(doc, node, strdup(filename.c_str()));
+ return new XMLArchive(doc, 0, strdup(filename.c_str()));
} else {
return 0;
}
@@ -140,12 +138,29 @@
return 0;
}
-Archive* XMLArchive::createField(const std::string& fieldname, const
std::string& classname)
+Archive* XMLArchive::createClass(const std::string& classname)
{
- xmlNodePtr child = xmlNewNode(0, to_xml_ch_ptr("Instance"));
- xmlSetProp(child, to_xml_ch_ptr("field"),
to_xml_ch_ptr(fieldname.c_str()));
- xmlSetProp(child, to_xml_ch_ptr("class"),
to_xml_ch_ptr(classname.c_str()));
- xmlAddChild(node, child);
+ xmlNodePtr child = xmlNewNode(0, to_xml_ch_ptr(classname.c_str()));
+ if(node)
+ xmlAddChild(node, child);
+ else
+ xmlDocSetRootElement(doc, child);
+ return new XMLArchive(this, child);
+}
+
+Archive* XMLArchive::createField(const std::string& fieldname)
+{
+ xmlNodePtr field = xmlNewNode(0, to_xml_ch_ptr(fieldname.c_str()));
+ xmlAddChild(node, field);
+ return new XMLArchive(this, field);
+}
+
+Archive* XMLArchive::createFieldForClass(const std::string& fieldname, const
std::string& classname)
+{
+ xmlNodePtr field = xmlNewNode(0, to_xml_ch_ptr(fieldname.c_str()));
+ xmlAddChild(node, field);
+ xmlNodePtr child = xmlNewNode(0, to_xml_ch_ptr(classname.c_str()));
+ xmlAddChild(field, child);
return new XMLArchive(this, child);
}
Modified: branches/persistent/Core/Reflection/XMLArchive.h
==============================================================================
--- branches/persistent/Core/Reflection/XMLArchive.h (original)
+++ branches/persistent/Core/Reflection/XMLArchive.h Mon May 14 12:13:11
2007
@@ -21,7 +21,9 @@
virtual std::string getClassname() const;
virtual Archive* findField(const std::string& fieldname) const;
- virtual Archive* createField(const std::string& fieldname, const
std::string& classname);
+ virtual Archive* createClass(const std::string& fieldname);
+ virtual Archive* createField(const std::string& fieldname);
+ virtual Archive* createFieldForClass(const std::string& fieldname, const
std::string& classname);
virtual bool isNullPointer() const;
virtual void writeNullPointer();
private:
Modified: branches/persistent/Core/Reflection/stdClassInfo.h
==============================================================================
--- branches/persistent/Core/Reflection/stdClassInfo.h (original)
+++ branches/persistent/Core/Reflection/stdClassInfo.h Mon May 14 12:13:11
2007
@@ -29,7 +29,6 @@
public:
Initializer() {
std::string name = "std::vector<" +
ClassInfo<T>::getPublicClassname() + ">";
- std::cerr << "Registering vector: " << name << '\n';
classname = new std::string(name);
ClassDatabase<std::vector<T> >::template
registerClass<std::vector<T> >(name);
}
@@ -74,9 +73,7 @@
template<class T>
ClassInfo<std::vector<T*> >::Initializer::Initializer()
{
- std::cerr << "Initializing vector<" << typeid(T).name() << "*>\n";
std::string name = "std::vector<" + ClassInfo<T>::getPublicClassname() +
"*>";
- std::cerr << "Registering vector: " << name << '\n';
classname = new std::string(name);
ClassDatabase<std::vector<T*> >::template registerClass<std::vector<T*>
>
(name);
}
Modified: branches/persistent/Engine/Factory/Factory.cc
==============================================================================
--- branches/persistent/Engine/Factory/Factory.cc (original)
+++ branches/persistent/Engine/Factory/Factory.cc Mon May 14 12:13:11
2007
@@ -461,7 +461,7 @@
string root = archive->getClassname();
if(root == "Scene"){
Scene* scene = 0;
- archive->readwriteObject(scene);
+ archive->readwrite(0, scene);
if(!scene)
throw InternalError("Error reading file: " + fullname, __FILE__,
__LINE__);
return scene;
Modified: branches/persistent/Interface/InterfaceClassInfo.cc
==============================================================================
--- branches/persistent/Interface/InterfaceClassInfo.cc (original)
+++ branches/persistent/Interface/InterfaceClassInfo.cc Mon May 14 12:13:11
2007
@@ -1,14 +1,29 @@
#include <Interface/InterfaceClassInfo.h>
+#include <Interface/AmbientLight.h>
#include <Interface/Background.h>
+#include <Interface/Clonable.h>
#include <Interface/Interpolable.h>
#include <Interface/Light.h>
+#include <Interface/LightSet.h>
+#include <Interface/Material.h>
#include <Interface/Object.h>
+#include <Interface/Primitive.h>
+#include <Interface/RenderParameters.h>
+#include <Interface/Scene.h>
using namespace std;
using namespace Manta;
-bool ClassInfo<Background>::force_initialize =
ClassInfo<Background>::registerClass("Background");
-bool ClassInfo<Interpolable>::force_initialize =
ClassInfo<Interpolable>::registerClass("Interpolable");
-bool ClassInfo<Light>::force_initialize =
ClassInfo<Light>::registerClass("Light");
-bool ClassInfo<Object>::force_initialize =
ClassInfo<Object>::registerClass("Object");
+REGISTER_CLASS(AmbientLight);
+REGISTER_CLASS(Light);
+REGISTER_CLASS(Material);
+REGISTER_CLASS(TexCoordMapper);
+REGISTER_CLASS(Scene);
+REGISTER_CLASS(Background);
+REGISTER_CLASS(Object);
+REGISTER_CLASS(Primitive);
+REGISTER_CLASS(LightSet);
+REGISTER_CLASS(RenderParameters);
+REGISTER_CLASS(Interpolable);
+REGISTER_CLASS(Clonable);
Modified: branches/persistent/Interface/InterfaceClassInfo.h
==============================================================================
--- branches/persistent/Interface/InterfaceClassInfo.h (original)
+++ branches/persistent/Interface/InterfaceClassInfo.h Mon May 14 12:13:11
2007
@@ -18,66 +18,18 @@
class TexCoordMapper;
class Scene;
- template<>
- class ClassInfo<AmbientLight> : public ClassInfo_BaseClass<AmbientLight>,
public ClassInfo_AbstractClass<AmbientLight>, public
ClassInfo_readwriteNone<AmbientLight> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Light> : public ClassInfo_BaseClass<Light>, public
ClassInfo_AbstractClass<Light>, public ClassInfo_readwriteNone<Light> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Material> : public ClassInfo_DerivedClass<Material,
Interpolable>, public ClassInfo_AbstractClass<Material>, public
ClassInfo_readwriteNone<Material> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<TexCoordMapper> : public
ClassInfo_DerivedClass<TexCoordMapper, Interpolable>, public
ClassInfo_AbstractClass<TexCoordMapper>, public
ClassInfo_readwriteNone<TexCoordMapper> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Scene> : public ClassInfo_BaseClass<Scene>, public
ClassInfo_ConcreteClass<Scene>, public ClassInfo_readwriteMethod<Scene> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Background> : public ClassInfo_BaseClass<Background>,
public ClassInfo_AbstractClass<Background>, public
ClassInfo_readwriteNone<Background> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Object> : public ClassInfo_DerivedClass<Object,
Interpolable>, public ClassInfo_AbstractClass<Object>, public
ClassInfo_readwriteNone<Object> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Primitive> : public ClassInfo_DerivedClass<Primitive,
Object>, public ClassInfo_AbstractClass<Primitive>, public
ClassInfo_readwriteNone<Primitive> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<LightSet> : public ClassInfo_BaseClass<LightSet>, public
ClassInfo_ConcreteClass<LightSet>, public ClassInfo_readwriteMethod<LightSet>
{
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<RenderParameters> : public
ClassInfo_BaseClass<RenderParameters>, public
ClassInfo_readwriteMethod<RenderParameters> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Interpolable> : public
ClassInfo_DerivedClass<Interpolable, Clonable>, public
ClassInfo_AbstractClass<Interpolable>, public
ClassInfo_readwriteNone<Clonable> {
- static bool force_initialize;
- };
-
- template<>
- class ClassInfo<Clonable> : public ClassInfo_BaseClass<Clonable>, public
ClassInfo_AbstractClass<Clonable>, public ClassInfo_readwriteNone<Clonable> {
- static bool force_initialize;
- };
-
+ DECLARE_CLASSINFO_BASECLASS(AmbientLight, AbstractClass, readwriteNone);
+ DECLARE_CLASSINFO_BASECLASS(Light, AbstractClass,readwriteNone);
+ DECLARE_CLASSINFO_DERIVEDCLASS(Material, Interpolable, AbstractClass,
readwriteNone);
+ DECLARE_CLASSINFO_DERIVEDCLASS(TexCoordMapper, Interpolable,
AbstractClass, readwriteNone);
+ DECLARE_CLASSINFO_BASECLASS(Scene, ConcreteClass, readwriteMethod);
+ DECLARE_CLASSINFO_BASECLASS(Background, AbstractClass, readwriteNone);
+ DECLARE_CLASSINFO_DERIVEDCLASS(Object, Interpolable, AbstractClass,
readwriteNone);
+ DECLARE_CLASSINFO_DERIVEDCLASS(Primitive, Object, AbstractClass,
readwriteNone);
+ DECLARE_CLASSINFO_BASECLASS(LightSet, ConcreteClass, readwriteMethod);
+ DECLARE_CLASSINFO_BASECLASS(RenderParameters, ConcreteClass,
readwriteMethod);
+ DECLARE_CLASSINFO_DERIVEDCLASS(Interpolable, Clonable, AbstractClass,
readwriteNone);
+ DECLARE_CLASSINFO_BASECLASS(Clonable, AbstractClass, readwriteNone);
}
#endif
Modified: branches/persistent/Model/AmbientLights/ArcAmbient.cc
==============================================================================
--- branches/persistent/Model/AmbientLights/ArcAmbient.cc (original)
+++ branches/persistent/Model/AmbientLights/ArcAmbient.cc Mon May 14
12:13:11 2007
@@ -1,6 +1,8 @@
#include <Model/AmbientLights/ArcAmbient.h>
#include <Interface/RayPacket.h>
+#include <Interface/InterfaceClassInfo.h>
+#include <Core/Reflection/Archive.h>
#include <sgi_stl_warnings_off.h>
#include <sstream>
@@ -12,6 +14,10 @@
using namespace std;
using namespace SCIRun;
+ArcAmbient::ArcAmbient()
+{
+}
+
ArcAmbient::ArcAmbient(const Color& cup, const Color& cdown,
const Vector& up)
: cup(cup), cdown(cdown), up(up)
@@ -65,4 +71,17 @@
out << "("<<cd.r()<<", "<<cd.g()<<", "<<cd.b()<<")\n";
out << "up = "<<up<<"\n";
return out.str();
+}
+
+namespace Manta {
+DECLARE_CLASSINFO_DERIVEDCLASS(ArcAmbient, AmbientLight, ConcreteClass,
readwriteMethod);
+REGISTER_CLASS(ArcAmbient);
+}
+
+void ArcAmbient::readwrite(Archive* archive)
+{
+ ClassInfo<AmbientLight>::readwrite(archive, *this);
+ archive->readwrite("cup", cup);
+ archive->readwrite("cdown", cdown);
+ archive->readwrite("up", up);
}
Modified: branches/persistent/Model/AmbientLights/ArcAmbient.h
==============================================================================
--- branches/persistent/Model/AmbientLights/ArcAmbient.h (original)
+++ branches/persistent/Model/AmbientLights/ArcAmbient.h Mon May 14
12:13:11 2007
@@ -14,6 +14,7 @@
class ArcAmbient : public AmbientLight {
public:
+ ArcAmbient();
ArcAmbient(const Color& cup, const Color& cdown,
const Vector& up);
virtual ~ArcAmbient();
@@ -22,6 +23,7 @@
virtual void computeAmbient(const RenderContext& context, RayPacket&
rays, ColorArray ambient) const;
virtual std::string toString() const;
+ virtual void readwrite(Archive*);
private:
Color cup;
Color cdown;
Modified: branches/persistent/Model/Backgrounds/LinearBackground.cc
==============================================================================
--- branches/persistent/Model/Backgrounds/LinearBackground.cc (original)
+++ branches/persistent/Model/Backgrounds/LinearBackground.cc Mon May 14
12:13:11 2007
@@ -1,10 +1,16 @@
#include <Model/Backgrounds/LinearBackground.h>
+#include <Core/Reflection/Archive.h>
+#include <Interface/InterfaceClassInfo.h>
#include <Interface/RayPacket.h>
#include <MantaTypes.h>
using namespace Manta;
+LinearBackground::LinearBackground()
+{
+}
+
LinearBackground::LinearBackground(const Color& cup, const Color& cdown,
const Vector& in_up)
: cup(cup), cdown(cdown), up(in_up)
@@ -31,4 +37,17 @@
ColorComponent t = (Real)0.5 * (1 + Dot(rays.getDirection(i), up));
rays.setColor(i, cup*t+cdown*(1-t));
}
+}
+
+namespace Manta {
+DECLARE_CLASSINFO_DERIVEDCLASS(LinearBackground, Background, ConcreteClass,
readwriteMethod);
+REGISTER_CLASS(LinearBackground);
+}
+
+void LinearBackground::readwrite(Archive* archive)
+{
+ ClassInfo<Background>::readwrite(archive, *this);
+ archive->readwrite("cup", cup);
+ archive->readwrite("cdown", cdown);
+ archive->readwrite("up", up);
}
Modified: branches/persistent/Model/Backgrounds/LinearBackground.h
==============================================================================
--- branches/persistent/Model/Backgrounds/LinearBackground.h (original)
+++ branches/persistent/Model/Backgrounds/LinearBackground.h Mon May 14
12:13:11 2007
@@ -5,16 +5,20 @@
#include <Interface/Background.h>
#include <Core/Color/Color.h>
#include <Core/Geometry/Vector.h>
+#include <Core/Reflection/ClassInfo.h>
namespace Manta {
class LinearBackground : public Background {
public:
+ LinearBackground();
LinearBackground(const Color& cup, const Color& cdown, const Vector& up);
virtual ~LinearBackground();
virtual void preprocess(const PreprocessContext& context);
virtual void shade(const RenderContext& context, RayPacket& rays) const;
+
+ void readwrite(Archive* archive);
private:
Color cup;
Color cdown;
Modified: branches/persistent/Model/Groups/CMakeLists.txt
==============================================================================
--- branches/persistent/Model/Groups/CMakeLists.txt (original)
+++ branches/persistent/Model/Groups/CMakeLists.txt Mon May 14 12:13:11
2007
@@ -69,7 +69,7 @@
# Include private code if available
IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Groups/private )
# SUBDIRS (Groups/private)
- INCLUDE (Groups/private/CMakeLists.txt)
+# INCLUDE (Groups/private/CMakeLists.txt)
ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Groups/private)
SET(USE_PRIVATE_CODE_DEF "0" CACHE INTERNAL "Disable use of private code")
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Groups/private)
Modified: branches/persistent/Model/Groups/Group.cc
==============================================================================
--- branches/persistent/Model/Groups/Group.cc (original)
+++ branches/persistent/Model/Groups/Group.cc Mon May 14 12:13:11 2007
@@ -156,13 +156,9 @@
}
namespace Manta {
-template<>
-class ClassInfo<Group> : public ClassInfo_DerivedClass<Group, Object>,
public ClassInfo_ConcreteClass<Group>, public ClassInfo_readwriteMethod<Group>
-{
- static bool force_initialize;
-};
+DECLARE_CLASSINFO_DERIVEDCLASS(Group, Object, ConcreteClass,
readwriteMethod);
+REGISTER_CLASS(Group);
}
-bool ClassInfo<Group>::force_initialize =
ClassInfo<Group>::registerClass("Group");
void Group::readwrite(Archive* archive)
{
Modified: branches/persistent/Model/Materials/CMakeLists.txt
==============================================================================
--- branches/persistent/Model/Materials/CMakeLists.txt (original)
+++ branches/persistent/Model/Materials/CMakeLists.txt Mon May 14 12:13:11
2007
@@ -1,5 +1,10 @@
-SET (Manta_Materials_SRCS
+SET (RTSL_Materials_SRCS
+ Materials/lambertian.h
+ Materials/lambertian.cc
+ )
+
+SET (Manta_Materials_SRCS ${RTSL_Materials_SRCS}
Materials/AmbientOcclusion.h
Materials/AmbientOcclusion.cc
Materials/Checker.h
Modified: branches/persistent/Model/Primitives/CMakeLists.txt
==============================================================================
--- branches/persistent/Model/Primitives/CMakeLists.txt (original)
+++ branches/persistent/Model/Primitives/CMakeLists.txt Mon May 14 12:13:11
2007
@@ -1,5 +1,13 @@
-
-SET (Manta_Primitives_SRCS
+SET (RTSL_Primitives_SRCS
+ Primitives/sphere.cc
+ Primitives/bilinear2.cc
+ Primitives/box2.cc
+ Primitives/triangle2.cc
+ Primitives/triangle5.cc
+ Primitives/cylinder.cc
+ Primitives/cylinder2.cc
+ )
+SET (Manta_Primitives_SRCS ${RTSL_Primitives_SRCS}
Primitives/BvhTriangleMesh.cc
Primitives/BvhTriangleMesh.h
Primitives/Cone.cc
Modified: branches/persistent/StandAlone/savescene.cc
==============================================================================
--- branches/persistent/StandAlone/savescene.cc (original)
+++ branches/persistent/StandAlone/savescene.cc Mon May 14 12:13:11 2007
@@ -90,7 +90,7 @@
if(!archive)
throw OutputError("Could not open Archive for writing: " + outfile);
Scene* scene = rtrt->getScene();
- archive->readwriteObject(scene);
+ archive->readwrite(0, scene);
delete archive;
delete rtrt;
Modified: branches/persistent/TODO
==============================================================================
--- branches/persistent/TODO (original)
+++ branches/persistent/TODO Mon May 14 12:13:11 2007
@@ -1,10 +1,9 @@
-make registration less error prone?
+Separate read for color (can read anything)
+Writer for color
+vector readwrite
+array readwrite
specialize classinfo for pointers? Then remove specialization from vector
-specialization for vector<T*>
-figure out initialization order issues
-SError checking in xmlarchive
-Set class for top level object
-why is maxdepth attached to top object
+Error checking in xmlarchive
Need to mark objects already emitted
reference by id
can backward references work?
@@ -12,8 +11,7 @@
- read
- write
- register
-fix xml format
-more convenience classinfo classes for common cases?
+style-sheet like facility for defaults and other things
Cmake:
- Class rtrt fix
Modified: branches/persistent/scenes/0.cc
==============================================================================
--- branches/persistent/scenes/0.cc (original)
+++ branches/persistent/scenes/0.cc Mon May 14 12:13:11 2007
@@ -14,7 +14,12 @@
#include <Model/Materials/Lambertian.h>
#include <Model/Materials/MetalMaterial.h>
#include <Model/Primitives/Parallelogram.h>
+#if 1
+#include <Model/Primitives/sphere.h>
+#define Sphere sphere
+#else
#include <Model/Primitives/Sphere.h>
+#endif
#include <Model/Textures/CheckerTexture.h>
#include <Core/Geometry/AffineTransform.h>
#include <Core/Util/NotFinished.h>
- [MANTA] r1388 - in branches/persistent: . Core Core/Color Core/Geometry Core/Reflection Engine/Factory Interface Model/AmbientLights Model/Backgrounds Model/Groups Model/Materials Model/Primitives StandAlone scenes, sparker, 05/14/2007
Archive powered by MHonArc 2.6.16.