Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: core/cross/client.cc

Issue 151103: Changed way Packs cannot be created if there is no Renderer. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « core/cross/client.h ('k') | core/cross/object_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Unmap the client from the renderer on exit. 110 // Unmap the client from the renderer on exit.
111 if (renderer_.IsAvailable()) { 111 if (renderer_.IsAvailable()) {
112 renderer_->UninitCommon(); 112 renderer_->UninitCommon();
113 } 113 }
114 } 114 }
115 115
116 // Assigns a Renderer to the Client, and also assigns the Client 116 // Assigns a Renderer to the Client, and also assigns the Client
117 // to the Renderer and sets up the default render graph 117 // to the Renderer and sets up the default render graph
118 void Client::Init() { 118 void Client::Init() {
119 if (!renderer_.IsAvailable()) { 119 if (!renderer_.IsAvailable())
120 // Don't allow packs to be created.
121 object_manager_->DisallowPackCreation();
122 return; 120 return;
123 }
124 121
125 // Create the root node for the scenegraph. Note that the root lives 122 // Create the root node for the scenegraph. Note that the root lives
126 // outside of a pack object. The root's lifetime is directly bound to that 123 // outside of a pack object. The root's lifetime is directly bound to that
127 // of the client. 124 // of the client.
128 root_ = Transform::Ref(new Transform(service_locator_)); 125 root_ = Transform::Ref(new Transform(service_locator_));
129 root_->set_name(O3D_STRING_CONSTANT("root")); 126 root_->set_name(O3D_STRING_CONSTANT("root"));
130 127
131 // Creates the root for the render graph. 128 // Creates the root for the render graph.
132 rendergraph_root_ = RenderNode::Ref(new RenderNode(service_locator_)); 129 rendergraph_root_ = RenderNode::Ref(new RenderNode(service_locator_));
133 rendergraph_root_->set_name(O3D_STRING_CONSTANT("root")); 130 rendergraph_root_->set_name(O3D_STRING_CONSTANT("root"));
134 131
135 // Let the renderer Init a few common things. 132 // Let the renderer Init a few common things.
136 renderer_->InitCommon(); 133 renderer_->InitCommon();
137 } 134 }
138 135
139 void Client::Cleanup() { 136 void Client::Cleanup() {
140 ClearRenderCallback(); 137 ClearRenderCallback();
141 ClearPostRenderCallback(); 138 ClearPostRenderCallback();
142 ClearTickCallback(); 139 ClearTickCallback();
143 event_manager_.ClearAll(); 140 event_manager_.ClearAll();
144 counter_manager_.ClearAllCallbacks(); 141 counter_manager_.ClearAllCallbacks();
145 } 142 }
146 143
144 Pack* Client::CreatePack() {
145 if (!renderer_.IsAvailable()) {
146 O3D_ERROR(service_locator_) << "Pack creation not allowed";
gman 2009/06/30 21:32:11 How about changing this message to "No Renderer av
147 return NULL;
148 }
149
150 return object_manager_->CreatePack();
151 }
152
147 // Tick Methods ---------------------------------------------------------------- 153 // Tick Methods ----------------------------------------------------------------
148 154
149 void Client::SetTickCallback( 155 void Client::SetTickCallback(
150 TickCallback* tick_callback) { 156 TickCallback* tick_callback) {
151 tick_callback_manager_.Set(tick_callback); 157 tick_callback_manager_.Set(tick_callback);
152 } 158 }
153 159
154 void Client::ClearTickCallback() { 160 void Client::ClearTickCallback() {
155 tick_callback_manager_.Clear(); 161 tick_callback_manager_.Clear();
156 } 162 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 443 }
438 444
439 String Client::ProfileToString() { 445 String Client::ProfileToString() {
440 StringWriter string_writer(StringWriter::LF); 446 StringWriter string_writer(StringWriter::LF);
441 JsonWriter json_writer(&string_writer, 2); 447 JsonWriter json_writer(&string_writer, 2);
442 profiler_->Write(&json_writer); 448 profiler_->Write(&json_writer);
443 json_writer.Close(); 449 json_writer.Close();
444 return string_writer.ToString(); 450 return string_writer.ToString();
445 } 451 }
446 } // namespace o3d 452 } // namespace o3d
OLDNEW
« no previous file with comments | « core/cross/client.h ('k') | core/cross/object_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698