diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 04:24:21 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 04:24:21 +0000 |
commit | 34f464fb752432829a22a30767b66eb5c24a2242 (patch) | |
tree | 93545e6e6f56e7151ae8bc5100accf0998c262ad /o3d/core | |
parent | e8b80d819b7d1888e10f5cfef75bfeff0f5d3b03 (diff) | |
download | chromium_src-34f464fb752432829a22a30767b66eb5c24a2242.zip chromium_src-34f464fb752432829a22a30767b66eb5c24a2242.tar.gz chromium_src-34f464fb752432829a22a30767b66eb5c24a2242.tar.bz2 |
Add o3djs.DestinationBuffer to converter.
I named it o3djs.DestinationBuffer because it has nothing to do
with O3D. It's purely part of our sample serialization example.
Review URL: http://codereview.chromium.org/149236
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r-- | o3d/core/cross/object_base.cc | 10 | ||||
-rw-r--r-- | o3d/core/cross/object_base.h | 28 | ||||
-rw-r--r-- | o3d/core/cross/stream_bank.cc | 3 |
3 files changed, 33 insertions, 8 deletions
diff --git a/o3d/core/cross/object_base.cc b/o3d/core/cross/object_base.cc index 36cc43f..7a91f41 100644 --- a/o3d/core/cross/object_base.cc +++ b/o3d/core/cross/object_base.cc @@ -44,6 +44,16 @@ ObjectBase::Class ObjectBase::class_ = { O3D_STRING_CONSTANT("ObjectBase"), NULL }; +const char* ObjectBase::Class::unqualified_name() const { + if (strncmp( + name_, + O3D_NAMESPACE O3D_NAMESPACE_SEPARATOR, + sizeof(O3D_NAMESPACE) + sizeof(O3D_NAMESPACE_SEPARATOR) - 2) == 0) { + return name_ + sizeof(O3D_NAMESPACE) + sizeof(O3D_NAMESPACE_SEPARATOR) - 2; + } + return name_; +} + ObjectBase::ObjectBase(ServiceLocator *service_locator) : id_(IdManager::CreateId()), service_locator_(service_locator) { diff --git a/o3d/core/cross/object_base.h b/o3d/core/cross/object_base.h index 0fa9edf..9a174c0 100644 --- a/o3d/core/cross/object_base.h +++ b/o3d/core/cross/object_base.h @@ -50,11 +50,12 @@ #define O3D_STRING_CONSTANT(value) \ (O3D_NAMESPACE O3D_NAMESPACE_SEPARATOR value) + // This macro declares the necessary functions for the type mechanism to work. // It needs to be used in each of the definition of any class that derives from // ObjectBase. // CLASS is the class being defined, BASE is its base class. -#define O3D_DECL_CLASS(CLASS, BASE) \ +#define O3D_OBJECT_BASE_DECL_CLASS(CLASS, BASE) \ public: \ static const ObjectBase::Class *GetApparentClass() { return &class_; } \ static const String GetApparentClassName() { \ @@ -72,10 +73,24 @@ // This macro defines the class descriptor for the type mechanism. It needs to // be used once in the definition file of any class that derives from // ObjectBase. +// CLASSNAME is the name to use to identify the class. +// CLASS is the class being defined. +// BASE is its base class. +#define O3D_OBJECT_BASE_DEFN_CLASS(CLASSNAME, CLASS, BASE) \ + ObjectBase::Class CLASS::class_ = { CLASSNAME, BASE::GetApparentClass() }; + +// This macro declares the necessary functions for the type mechanism to work. +// It needs to be used in each of the definition of any class that derives from +// ObjectBase. // CLASS is the class being defined, BASE is its base class. -#define O3D_DEFN_CLASS(CLASS, BASE) \ - ObjectBase::Class CLASS::class_ = \ - { O3D_STRING_CONSTANT(#CLASS), BASE::GetApparentClass() }; +#define O3D_DECL_CLASS(CLASS, BASE) O3D_OBJECT_BASE_DECL_CLASS(CLASS, BASE) + +// This macro defines the class descriptor for the type mechanism. It needs to +// be used once in the definition file of any class that derives from +// ObjectBase. +// CLASS is the class being defined, BASE is its base class. +#define O3D_DEFN_CLASS(CLASS, BASE) \ + O3D_OBJECT_BASE_DEFN_CLASS(O3D_STRING_CONSTANT(#CLASS), CLASS, BASE) namespace o3d { @@ -142,10 +157,7 @@ class ObjectBase : public RefCounted { return name_; } - const char* unqualified_name() const { - return name_ + sizeof(O3D_NAMESPACE) + - sizeof(O3D_NAMESPACE_SEPARATOR) - 2; - } + const char* unqualified_name() const; public: // The name of the class. diff --git a/o3d/core/cross/stream_bank.cc b/o3d/core/cross/stream_bank.cc index 54c5f2d..65f6b73 100644 --- a/o3d/core/cross/stream_bank.cc +++ b/o3d/core/cross/stream_bank.cc @@ -89,6 +89,9 @@ bool StreamBank::SetVertexStream(Stream::Semantic stream_semantic, O3D_ERROR(service_locator()) << "No buffer on field"; return false; } + + // Check that this buffer is renderable. StreamBanks are used to submit + // data to GPU so we can only allow GPU accessible buffers through here. if (!buffer->IsA(VertexBuffer::GetApparentClass())) { O3D_ERROR(service_locator()) << "Buffer is not a VertexBuffer"; return false; |