summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--o3d/core/cross/client.cc15
-rw-r--r--o3d/core/cross/client.h4
-rw-r--r--o3d/core/cross/object_manager.cc11
-rw-r--r--o3d/core/cross/object_manager.h3
-rw-r--r--o3d/core/cross/pack.cc5
5 files changed, 18 insertions, 20 deletions
diff --git a/o3d/core/cross/client.cc b/o3d/core/cross/client.cc
index 341ff915..54aca22 100644
--- a/o3d/core/cross/client.cc
+++ b/o3d/core/cross/client.cc
@@ -116,11 +116,8 @@ Client::~Client() {
// Assigns a Renderer to the Client, and also assigns the Client
// to the Renderer and sets up the default render graph
void Client::Init() {
- if (!renderer_.IsAvailable()) {
- // Don't allow packs to be created.
- object_manager_->DisallowPackCreation();
+ if (!renderer_.IsAvailable())
return;
- }
// Create the root node for the scenegraph. Note that the root lives
// outside of a pack object. The root's lifetime is directly bound to that
@@ -144,6 +141,16 @@ void Client::Cleanup() {
counter_manager_.ClearAllCallbacks();
}
+Pack* Client::CreatePack() {
+ if (!renderer_.IsAvailable()) {
+ O3D_ERROR(service_locator_)
+ << "No Renderer available, Pack creation not allowed.";
+ return NULL;
+ }
+
+ return object_manager_->CreatePack();
+}
+
// Tick Methods ----------------------------------------------------------------
void Client::SetTickCallback(
diff --git a/o3d/core/cross/client.h b/o3d/core/cross/client.h
index 9ee13cb..a41eeaa 100644
--- a/o3d/core/cross/client.h
+++ b/o3d/core/cross/client.h
@@ -118,9 +118,7 @@ class Client {
// The system does not enforce pack name uniqueness.
// Returns:
// A smart-pointer reference to the newly created pack object.
- Pack* CreatePack() {
- return object_manager_->CreatePack();
- }
+ Pack* CreatePack();
// Node methods --------------------------
diff --git a/o3d/core/cross/object_manager.cc b/o3d/core/cross/object_manager.cc
index a83e46e..460e9f9 100644
--- a/o3d/core/cross/object_manager.cc
+++ b/o3d/core/cross/object_manager.cc
@@ -43,8 +43,7 @@ const InterfaceId ObjectManager::kInterfaceId =
ObjectManager::ObjectManager(ServiceLocator* service_locator)
: service_locator_(service_locator),
- service_(service_locator_, this),
- allow_pack_creation_(true) {
+ service_(service_locator_, this) {
}
ObjectManager::~ObjectManager() {
@@ -54,10 +53,6 @@ ObjectManager::~ObjectManager() {
DLOG_ASSERT(object_map_.empty()) << "Client node leak.";
}
-void ObjectManager::DisallowPackCreation() {
- allow_pack_creation_ = false;
-}
-
std::vector<ObjectBase*> ObjectManager::GetObjects(
const String& name,
const String& class_type_name) const {
@@ -134,10 +129,6 @@ bool ObjectManager::DestroyPack(Pack* pack) {
}
Pack* ObjectManager::CreatePack() {
- if (!allow_pack_creation_) {
- O3D_ERROR(service_locator_) << "Pack creation not allowed";
- return NULL;
- }
Pack::Ref pack(new Pack(service_locator_));
if (pack) {
pack_array_.push_back(pack);
diff --git a/o3d/core/cross/object_manager.h b/o3d/core/cross/object_manager.h
index b8fc438..5294ac1 100644
--- a/o3d/core/cross/object_manager.h
+++ b/o3d/core/cross/object_manager.h
@@ -196,9 +196,6 @@ class ObjectManager {
// Map of objects to Ids
ObjectMap object_map_;
- // Allow pack creation.
- bool allow_pack_creation_;
-
// Array required to maintain references to the currently live pack objects.
PackRefArray pack_array_;
diff --git a/o3d/core/cross/pack.cc b/o3d/core/cross/pack.cc
index e38eab2..96b06de 100644
--- a/o3d/core/cross/pack.cc
+++ b/o3d/core/cross/pack.cc
@@ -163,6 +163,11 @@ Texture* Pack::CreateTextureFromFile(const String& uri,
Texture* Pack::CreateTextureFromBitmap(Bitmap *bitmap, const String& uri) {
DCHECK(bitmap);
+ if (!renderer_) {
+ O3D_ERROR(service_locator()) << "No Render Device Available";
+ return NULL;
+ }
+
if (bitmap->width() > Texture::MAX_DIMENSION ||
bitmap->height() > Texture::MAX_DIMENSION) {
O3D_ERROR(service_locator())