diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 06:06:34 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 06:06:34 +0000 |
commit | 9108d4c2b521e8e58bbc125787550772f585ef6c (patch) | |
tree | 2d7959d73c9545dfa19537abf04fc1e053e7c9cc /o3d/serializer | |
parent | ac49d93303918e3eb99c030673432c7be876c87b (diff) | |
download | chromium_src-9108d4c2b521e8e58bbc125787550772f585ef6c.zip chromium_src-9108d4c2b521e8e58bbc125787550772f585ef6c.tar.gz chromium_src-9108d4c2b521e8e58bbc125787550772f585ef6c.tar.bz2 |
Prep for moving Camera Info out of Params into JSON
I thought it was best to give you what I have so far
for your input and code review instead of giving you
everything all at once.
This CL implements JSONObject which has a mechanism
for adding stuff to be serialized as JSON to the
serialization code. Since JSONObject is a serialization
only object it seemed okay to put Serialize code
inside.
I opted to pre-declare JSONFloat and JSONOptionalFloat
because I felt it made the code more error free.
I had made it were you could just have JSONFloat and
then with RegisterJSONValue you'd pass in optional
or not but this way, declaring the field in a class
makes it more explicit.
CameraInfo is the first class that uses it. I'm not
set on exactly how it is serialized. Whether it's
as "object: { ... }" inside the "properties" section
or whether it should have its own section. I think
I won't know what until I actually write the
deserialization code. That's not imporant for this CL
This code, even if checked it, is not used yet
as the import code, collada.cc, is not yet creating
any of these objects. That's in another CL if you want
to take a look
http://codereview.chromium.org/160007
That CL will have to have lots of o3djs changes,
corresponding sample changes and corresponding
selenium test changes.
Review URL: http://codereview.chromium.org/160008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/serializer')
-rw-r--r-- | o3d/serializer/cross/serializer.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/o3d/serializer/cross/serializer.cc b/o3d/serializer/cross/serializer.cc index 96dd01b..5e70c67 100644 --- a/o3d/serializer/cross/serializer.cc +++ b/o3d/serializer/cross/serializer.cc @@ -49,6 +49,7 @@ #include "core/cross/transform.h" #include "import/cross/destination_buffer.h" #include "import/cross/iarchive_generator.h" +#include "import/cross/json_object.h" #include "import/cross/memory_buffer.h" #include "import/cross/memory_stream.h" #include "serializer/cross/version.h" @@ -221,6 +222,7 @@ class PropertiesVisitor : public VisitorBase<PropertiesVisitor> { Enable<Curve>(&PropertiesVisitor::Visit); Enable<Element>(&PropertiesVisitor::Visit); Enable<NamedObject>(&PropertiesVisitor::Visit); + Enable<JSONObject>(&PropertiesVisitor::Visit); Enable<Pack>(&PropertiesVisitor::Visit); Enable<Primitive>(&PropertiesVisitor::Visit); Enable<Shape>(&PropertiesVisitor::Visit); @@ -252,6 +254,11 @@ class PropertiesVisitor : public VisitorBase<PropertiesVisitor> { Serialize(writer_, element->owner()); } + void Visit(JSONObject* object) { + Visit(static_cast<ParamObject*>(object)); + object->Serialize(writer_); + } + void Visit(NamedObject* object) { Visit(static_cast<ObjectBase*>(object)); @@ -624,8 +631,6 @@ class BinaryVisitor : public VisitorBase<BinaryVisitor> { void Visit(ObjectBase* object) { } - // TODO: Replace this when we have code to serialize to the - // final binary format. This is just placeholder. void Visit(Curve* curve) { Visit(static_cast<NamedObject*>(curve)); |