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

Side by Side Diff: chrome/browser/resources/vr_shell/vr_shell_ui_scene.js

Issue 2749703007: Add menu mode plumbing for WebVR mode. (Closed)
Patch Set: Rename JS WebVR rendering functions for clarity. Created 3 years, 9 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
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui_api.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var scene = {}; 5 var scene = {};
6 6
7 /** 7 /**
8 * The scene class assists in managing element and animations in the UI. It 8 * The scene class assists in managing element and animations in the UI. It
9 * allows UI update API commands to be queued in batches, and manages allocation 9 * allows UI update API commands to be queued in batches, and manages allocation
10 * of element and animation IDs. 10 * of element and animation IDs.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 removeAnimation(id) { 123 removeAnimation(id) {
124 // To-do: Make sure ID exists. 124 // To-do: Make sure ID exists.
125 this.commands.push({ 125 this.commands.push({
126 'type': api.Command.REMOVE_ANIMATION, 126 'type': api.Command.REMOVE_ANIMATION,
127 'data': {'id': id, 'meshId': this.animations[id]} 127 'data': {'id': id, 'meshId': this.animations[id]}
128 }); 128 });
129 delete this.animations[id]; 129 delete this.animations[id];
130 } 130 }
131 131
132 /** 132 /**
133 * Set the background color of the scene. 133 * Configure scene parameters.
134 * @param {{r: number, b: number, g: number, a: number}} color 134 * @param {api.SceneConfiguration} configuration
135 */ 135 */
136 setBackgroundColor(color) { 136 configureScene(configuration) {
137 this.commands.push(
138 {'type': api.Command.UPDATE_BACKGROUND, 'data': {'color': color}});
139 }
140
141 /**
142 * Set the radius of background-bounding sphere.
143 * @param {number} distance
144 */
145 setBackgroundDistance(distance) {
146 this.commands.push({ 137 this.commands.push({
147 'type': api.Command.UPDATE_BACKGROUND, 138 'type': api.Command.CONFIGURE_SCENE,
148 'data': {'distance': distance} 139 'data': configuration.getCommandPayload(),
149 }); 140 });
150 } 141 }
151 142
152 /** 143 /**
144 * @param {{r: number, b: number, g: number, a: number}} color
145 */
146 setBackgroundColor(color) {
147 let configuration = new api.SceneConfiguration();
148 configuration.setBackgroundColor(color);
149 this.configureScene(configuration);
150 }
151
152 /**
153 * @param {number} distance
154 */
155 setBackgroundDistance(distance) {
156 let configuration = new api.SceneConfiguration();
157 configuration.setBackgroundDistance(distance);
158 this.configureScene(configuration);
159 }
160
161 /**
162 * @param {boolean} enabled
163 */
164 setWebVrRenderingModeEnabled(enabled) {
165 let configuration = new api.SceneConfiguration();
166 configuration.setWebVrRenderingModeEnabled(enabled);
167 this.configureScene(configuration);
168 }
169
170 /**
153 * Purge all elements in the scene. 171 * Purge all elements in the scene.
154 */ 172 */
155 purge() { 173 purge() {
156 var ids = Object.keys(this.animations); 174 var ids = Object.keys(this.animations);
157 for (let id_key of ids) { 175 for (let id_key of ids) {
158 var id = parseInt(id_key, 10); 176 var id = parseInt(id_key, 10);
159 this.removeAnimation(id); 177 this.removeAnimation(id);
160 } 178 }
161 var ids = this.elements.values(); 179 var ids = this.elements.values();
162 for (let id of ids) { 180 for (let id of ids) {
163 this.removeElement(id); 181 this.removeElement(id);
164 } 182 }
165 this.flush(); 183 this.flush();
166 } 184 }
167 }; 185 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui_api.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698