From 8e1c8a07890b2c122833c402d01e91e54540984c Mon Sep 17 00:00:00 2001 From: "gman@google.com" Date: Mon, 17 Aug 2009 08:01:28 +0000 Subject: Change StreamBank to inherit from VertexSource in preparation for Morph Targets Review URL: http://codereview.chromium.org/164483 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23541 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/core/cross/primitive.cc | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'o3d/core/cross/primitive.cc') diff --git a/o3d/core/cross/primitive.cc b/o3d/core/cross/primitive.cc index 19ccfa1..b47015a 100644 --- a/o3d/core/cross/primitive.cc +++ b/o3d/core/cross/primitive.cc @@ -36,7 +36,7 @@ #include "core/cross/primitive.h" #include "core/cross/renderer.h" #include "core/cross/error.h" -#include "core/cross/vertex_source.h" +#include "core/cross/stream_bank.h" namespace o3d { @@ -94,6 +94,48 @@ Primitive::Primitive(ServiceLocator* service_locator) Primitive::~Primitive() { } +void Primitive::Render(Renderer* renderer, + DrawElement* draw_element, + Material* material, + ParamObject* override, + ParamCache* param_cache) { + DLOG_ASSERT(draw_element); + DLOG_ASSERT(param_cache); + // If there's no material attached to this Shape. + if (!material) { + O3D_ERROR(service_locator()) << "No Material attached to Shape \"" + << draw_element->name() << "\""; + return; + } + + Effect* effect = material->effect(); + if (!effect) { + O3D_ERROR(service_locator()) << "No Effect attached to Material '" + << material->name() << "' in Shape '" + << draw_element->name() << "'"; + return; + } + + StreamBank* bank = stream_bank(); + if (!bank) { + O3D_ERROR(service_locator()) + << "No StreambBank attached to Primitive '" + << material->name() << "' in Shape '" + << draw_element->name() << "'"; + return; + } + + if (!bank->renderable()) { + O3D_ERROR(service_locator()) + << "StreamBank has non-renderable buffers '" + << bank->name() << "'"; + return; + } + + PlatformSpecificRender(renderer, draw_element, material, override, + param_cache); +} + namespace { // A class to make it easy to access floats from a buffer given a stream. -- cgit v1.1