Commit 0871a6a9 authored by Brandon Jones's avatar Brandon Jones Committed by Commit Bot

Removed previous version of light estimation API

Will shortly be replaced by a more up-to-date variant of the API, but
due to some conflicting interface names it's going to be cleaner to
remove the current blink code (minus a couple of stubs that I know the
upcoming code will need). XRCubeMap specifically will be sticking around
as an internal utility, but won't be web exposed with the new API shape.

Bug: 1070819
Change-Id: I40f752c8caebf6de49d1abc1d8385857389a5eee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2152954Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759903}
parent 5af70ef0
...@@ -941,7 +941,6 @@ static_idl_files_in_modules = get_path_info( ...@@ -941,7 +941,6 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/xr/xr_anchor.idl", "//third_party/blink/renderer/modules/xr/xr_anchor.idl",
"//third_party/blink/renderer/modules/xr/xr_anchor_set.idl", "//third_party/blink/renderer/modules/xr/xr_anchor_set.idl",
"//third_party/blink/renderer/modules/xr/xr_bounded_reference_space.idl", "//third_party/blink/renderer/modules/xr/xr_bounded_reference_space.idl",
"//third_party/blink/renderer/modules/xr/xr_cube_map.idl",
"//third_party/blink/renderer/modules/xr/xr_dom_overlay_init.idl", "//third_party/blink/renderer/modules/xr/xr_dom_overlay_init.idl",
"//third_party/blink/renderer/modules/xr/xr_dom_overlay_state.idl", "//third_party/blink/renderer/modules/xr/xr_dom_overlay_state.idl",
"//third_party/blink/renderer/modules/xr/xr_frame.idl", "//third_party/blink/renderer/modules/xr/xr_frame.idl",
...@@ -955,10 +954,6 @@ static_idl_files_in_modules = get_path_info( ...@@ -955,10 +954,6 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/xr/xr_input_source_event_init.idl", "//third_party/blink/renderer/modules/xr/xr_input_source_event_init.idl",
"//third_party/blink/renderer/modules/xr/xr_input_sources_change_event.idl", "//third_party/blink/renderer/modules/xr/xr_input_sources_change_event.idl",
"//third_party/blink/renderer/modules/xr/xr_input_sources_change_event_init.idl", "//third_party/blink/renderer/modules/xr/xr_input_sources_change_event_init.idl",
"//third_party/blink/renderer/modules/xr/xr_light_estimation.idl",
"//third_party/blink/renderer/modules/xr/xr_light_estimation_state.idl",
"//third_party/blink/renderer/modules/xr/xr_light_estimation_state_init.idl",
"//third_party/blink/renderer/modules/xr/xr_light_probe.idl",
"//third_party/blink/renderer/modules/xr/xr_plane.idl", "//third_party/blink/renderer/modules/xr/xr_plane.idl",
"//third_party/blink/renderer/modules/xr/xr_plane_detection_state.idl", "//third_party/blink/renderer/modules/xr/xr_plane_detection_state.idl",
"//third_party/blink/renderer/modules/xr/xr_plane_detection_state_init.idl", "//third_party/blink/renderer/modules/xr/xr_plane_detection_state_init.idl",
...@@ -968,7 +963,6 @@ static_idl_files_in_modules = get_path_info( ...@@ -968,7 +963,6 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/xr/xr_reference_space.idl", "//third_party/blink/renderer/modules/xr/xr_reference_space.idl",
"//third_party/blink/renderer/modules/xr/xr_reference_space_event.idl", "//third_party/blink/renderer/modules/xr/xr_reference_space_event.idl",
"//third_party/blink/renderer/modules/xr/xr_reference_space_event_init.idl", "//third_party/blink/renderer/modules/xr/xr_reference_space_event_init.idl",
"//third_party/blink/renderer/modules/xr/xr_reflection_probe.idl",
"//third_party/blink/renderer/modules/xr/xr_render_state.idl", "//third_party/blink/renderer/modules/xr/xr_render_state.idl",
"//third_party/blink/renderer/modules/xr/xr_render_state_init.idl", "//third_party/blink/renderer/modules/xr/xr_render_state_init.idl",
"//third_party/blink/renderer/modules/xr/xr_rigid_transform.idl", "//third_party/blink/renderer/modules/xr/xr_rigid_transform.idl",
...@@ -977,7 +971,6 @@ static_idl_files_in_modules = get_path_info( ...@@ -977,7 +971,6 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/xr/xr_session_event_init.idl", "//third_party/blink/renderer/modules/xr/xr_session_event_init.idl",
"//third_party/blink/renderer/modules/xr/xr_session_init.idl", "//third_party/blink/renderer/modules/xr/xr_session_init.idl",
"//third_party/blink/renderer/modules/xr/xr_space.idl", "//third_party/blink/renderer/modules/xr/xr_space.idl",
"//third_party/blink/renderer/modules/xr/xr_spherical_harmonics.idl",
"//third_party/blink/renderer/modules/xr/xr_system.idl", "//third_party/blink/renderer/modules/xr/xr_system.idl",
"//third_party/blink/renderer/modules/xr/xr_transient_input_hit_test_options_init.idl", "//third_party/blink/renderer/modules/xr/xr_transient_input_hit_test_options_init.idl",
"//third_party/blink/renderer/modules/xr/xr_transient_input_hit_test_result.idl", "//third_party/blink/renderer/modules/xr/xr_transient_input_hit_test_result.idl",
......
...@@ -43,12 +43,6 @@ blink_modules_sources("xr") { ...@@ -43,12 +43,6 @@ blink_modules_sources("xr") {
"xr_input_source_event.h", "xr_input_source_event.h",
"xr_input_sources_change_event.cc", "xr_input_sources_change_event.cc",
"xr_input_sources_change_event.h", "xr_input_sources_change_event.h",
"xr_light_estimation.cc",
"xr_light_estimation.h",
"xr_light_estimation_state.cc",
"xr_light_estimation_state.h",
"xr_light_probe.cc",
"xr_light_probe.h",
"xr_native_origin_information.cc", "xr_native_origin_information.cc",
"xr_native_origin_information.h", "xr_native_origin_information.h",
"xr_object_space.h", "xr_object_space.h",
...@@ -66,8 +60,6 @@ blink_modules_sources("xr") { ...@@ -66,8 +60,6 @@ blink_modules_sources("xr") {
"xr_reference_space.h", "xr_reference_space.h",
"xr_reference_space_event.cc", "xr_reference_space_event.cc",
"xr_reference_space_event.h", "xr_reference_space_event.h",
"xr_reflection_probe.cc",
"xr_reflection_probe.h",
"xr_render_state.cc", "xr_render_state.cc",
"xr_render_state.h", "xr_render_state.h",
"xr_rigid_transform.cc", "xr_rigid_transform.cc",
...@@ -79,8 +71,6 @@ blink_modules_sources("xr") { ...@@ -79,8 +71,6 @@ blink_modules_sources("xr") {
"xr_setlike.h", "xr_setlike.h",
"xr_space.cc", "xr_space.cc",
"xr_space.h", "xr_space.h",
"xr_spherical_harmonics.cc",
"xr_spherical_harmonics.h",
"xr_system.cc", "xr_system.cc",
"xr_system.h", "xr_system.h",
"xr_target_ray_space.cc", "xr_target_ray_space.cc",
......
...@@ -7,15 +7,11 @@ modules_idl_files = [ ...@@ -7,15 +7,11 @@ modules_idl_files = [
"xr_anchor_set.idl", "xr_anchor_set.idl",
"xr_bounded_reference_space.idl", "xr_bounded_reference_space.idl",
"xr_dom_overlay_state.idl", "xr_dom_overlay_state.idl",
"xr_cube_map.idl",
"xr_frame.idl", "xr_frame.idl",
"xr_input_source.idl", "xr_input_source.idl",
"xr_input_source_array.idl", "xr_input_source_array.idl",
"xr_input_source_event.idl", "xr_input_source_event.idl",
"xr_input_sources_change_event.idl", "xr_input_sources_change_event.idl",
"xr_light_estimation.idl",
"xr_light_estimation_state.idl",
"xr_light_probe.idl",
"xr_plane.idl", "xr_plane.idl",
"xr_plane_detection_state.idl", "xr_plane_detection_state.idl",
"xr_plane_set.idl", "xr_plane_set.idl",
...@@ -23,7 +19,6 @@ modules_idl_files = [ ...@@ -23,7 +19,6 @@ modules_idl_files = [
"xr_ray.idl", "xr_ray.idl",
"xr_reference_space.idl", "xr_reference_space.idl",
"xr_reference_space_event.idl", "xr_reference_space_event.idl",
"xr_reflection_probe.idl",
"xr_render_state.idl", "xr_render_state.idl",
"xr_rigid_transform.idl", "xr_rigid_transform.idl",
"xr_hit_test_result.idl", "xr_hit_test_result.idl",
...@@ -31,7 +26,6 @@ modules_idl_files = [ ...@@ -31,7 +26,6 @@ modules_idl_files = [
"xr_session.idl", "xr_session.idl",
"xr_session_event.idl", "xr_session_event.idl",
"xr_space.idl", "xr_space.idl",
"xr_spherical_harmonics.idl",
"xr_system.idl", "xr_system.idl",
"xr_transient_input_hit_test_result.idl", "xr_transient_input_hit_test_result.idl",
"xr_transient_input_hit_test_source.idl", "xr_transient_input_hit_test_source.idl",
...@@ -50,7 +44,6 @@ modules_dictionary_idl_files = [ ...@@ -50,7 +44,6 @@ modules_dictionary_idl_files = [
"xr_hit_test_options_init.idl", "xr_hit_test_options_init.idl",
"xr_input_source_event_init.idl", "xr_input_source_event_init.idl",
"xr_input_sources_change_event_init.idl", "xr_input_sources_change_event_init.idl",
"xr_light_estimation_state_init.idl",
"xr_plane_detection_state_init.idl", "xr_plane_detection_state_init.idl",
"xr_reference_space_event_init.idl", "xr_reference_space_event_init.idl",
"xr_render_state_init.idl", "xr_render_state_init.idl",
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/util/type_safety/pass_key.h" #include "base/util/type_safety/pass_key.h"
#include "device/vr/public/mojom/vr_service.mojom-blink-forward.h" #include "device/vr/public/mojom/vr_service.mojom-blink-forward.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink { namespace blink {
...@@ -16,9 +15,7 @@ class WebGL2RenderingContextBase; ...@@ -16,9 +15,7 @@ class WebGL2RenderingContextBase;
class WebGLTexture; class WebGLTexture;
class ExceptionState; class ExceptionState;
class XRCubeMap : public ScriptWrappable { class XRCubeMap {
DEFINE_WRAPPERTYPEINFO();
public: public:
explicit XRCubeMap(const device::mojom::blink::XRCubeMap& cube_map); explicit XRCubeMap(const device::mojom::blink::XRCubeMap& cube_map);
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRIncubations
]
interface XRCubeMap {
[RaisesException]
WebGLTexture updateWebGLEnvironmentCube(WebGL2RenderingContext context, WebGLTexture? texture);
};
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h" #include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h"
#include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/modules/xr/xr_light_estimation_state.h"
#include "third_party/blink/renderer/modules/xr/xr_plane_detection_state.h" #include "third_party/blink/renderer/modules/xr/xr_plane_detection_state.h"
#include "third_party/blink/renderer/modules/xr/xr_session.h" #include "third_party/blink/renderer/modules/xr/xr_session.h"
#include "third_party/blink/renderer/modules/xr/xr_system.h" #include "third_party/blink/renderer/modules/xr/xr_system.h"
...@@ -163,7 +162,7 @@ void XRFrameProvider::RequestFrame(XRSession* session) { ...@@ -163,7 +162,7 @@ void XRFrameProvider::RequestFrame(XRSession* session) {
auto options = device::mojom::blink::XRFrameDataRequestOptions::New( auto options = device::mojom::blink::XRFrameDataRequestOptions::New(
session->worldTrackingState()->planeDetectionState()->enabled(), session->worldTrackingState()->planeDetectionState()->enabled(),
session->worldTrackingState()->lightEstimationState()->enabled()); session->LightEstimationEnabled());
// Immersive frame logic. // Immersive frame logic.
if (session->immersive()) { if (session->immersive()) {
...@@ -356,7 +355,7 @@ void XRFrameProvider::RequestNonImmersiveFrameData(XRSession* session) { ...@@ -356,7 +355,7 @@ void XRFrameProvider::RequestNonImmersiveFrameData(XRSession* session) {
auto& data_provider = provider->value; auto& data_provider = provider->value;
auto options = device::mojom::blink::XRFrameDataRequestOptions::New( auto options = device::mojom::blink::XRFrameDataRequestOptions::New(
session->worldTrackingState()->planeDetectionState()->enabled(), session->worldTrackingState()->planeDetectionState()->enabled(),
session->worldTrackingState()->lightEstimationState()->enabled()); session->LightEstimationEnabled());
data_provider->GetFrameData( data_provider->GetFrameData(
std::move(options), std::move(options),
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/xr/xr_light_estimation.h"
#include "device/vr/public/mojom/vr_service.mojom-blink.h"
#include "third_party/blink/renderer/modules/xr/xr_light_probe.h"
#include "third_party/blink/renderer/modules/xr/xr_reflection_probe.h"
namespace blink {
XRLightEstimation::XRLightEstimation(
const device::mojom::blink::XRLightEstimationData& data) {
if (data.light_probe) {
light_probe_ = MakeGarbageCollected<XRLightProbe>(*data.light_probe);
}
if (data.reflection_probe) {
reflection_probe_ =
MakeGarbageCollected<XRReflectionProbe>(*data.reflection_probe);
}
}
XRLightProbe* XRLightEstimation::lightProbe() const {
return light_probe_.Get();
}
XRReflectionProbe* XRLightEstimation::reflectionProbe() const {
return reflection_probe_.Get();
}
void XRLightEstimation::Trace(Visitor* visitor) {
visitor->Trace(light_probe_);
visitor->Trace(reflection_probe_);
ScriptWrappable::Trace(visitor);
}
} // namespace blink
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_ESTIMATION_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_ESTIMATION_H_
#include "device/vr/public/mojom/vr_service.mojom-blink-forward.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink {
class XRLightProbe;
class XRReflectionProbe;
class XRLightEstimation : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
explicit XRLightEstimation(
const device::mojom::blink::XRLightEstimationData& data);
XRLightProbe* lightProbe() const;
XRReflectionProbe* reflectionProbe() const;
void Trace(Visitor* visitor) override;
private:
Member<XRLightProbe> light_probe_;
Member<XRReflectionProbe> reflection_probe_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_ESTIMATION_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRIncubations
]
interface XRLightEstimation {
readonly attribute XRLightProbe? lightProbe;
readonly attribute XRReflectionProbe? reflectionProbe;
};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/xr/xr_light_estimation_state.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_xr_light_estimation_state_init.h"
namespace blink {
XRLightEstimationState::XRLightEstimationState(
XRLightEstimationStateInit* light_estimation_state_init) {
if (light_estimation_state_init) {
if (light_estimation_state_init->hasEnabled()) {
enabled_ = light_estimation_state_init->enabled();
}
}
}
} // namespace blink
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_ESTIMATION_STATE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_ESTIMATION_STATE_H_
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink {
class XRLightEstimationStateInit;
class XRLightEstimationState : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
explicit XRLightEstimationState(
XRLightEstimationStateInit* light_estimation_state_init);
bool enabled() const { return enabled_; }
private:
bool enabled_ = false;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_ESTIMATION_STATE_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRIncubations
]
interface XRLightEstimationState {
readonly attribute boolean enabled;
};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
dictionary XRLightEstimationStateInit {
boolean enabled;
};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/xr/xr_light_probe.h"
#include "device/vr/public/mojom/vr_service.mojom-blink.h"
#include "third_party/blink/renderer/core/geometry/dom_point_read_only.h"
#include "third_party/blink/renderer/modules/xr/xr_spherical_harmonics.h"
namespace blink {
XRLightProbe::XRLightProbe(
const device::mojom::blink::XRLightProbe& light_probe) {
spherical_harmonics_ = MakeGarbageCollected<XRSphericalHarmonics>(
*light_probe.spherical_harmonics);
main_light_direction_ =
DOMPointReadOnly::Create(light_probe.main_light_direction.x(),
light_probe.main_light_direction.y(),
light_probe.main_light_direction.z(), 0);
main_light_intensity_ =
DOMPointReadOnly::Create(light_probe.main_light_intensity.red(),
light_probe.main_light_intensity.green(),
light_probe.main_light_intensity.blue(), 1);
}
XRSphericalHarmonics* XRLightProbe::sphericalHarmonics() const {
return spherical_harmonics_.Get();
}
DOMPointReadOnly* XRLightProbe::mainLightDirection() const {
return main_light_direction_.Get();
}
DOMPointReadOnly* XRLightProbe::mainLightIntensity() const {
return main_light_intensity_.Get();
}
void XRLightProbe::Trace(Visitor* visitor) {
visitor->Trace(spherical_harmonics_);
visitor->Trace(main_light_direction_);
visitor->Trace(main_light_intensity_);
ScriptWrappable::Trace(visitor);
}
} // namespace blink
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_PROBE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_PROBE_H_
#include "device/vr/public/mojom/vr_service.mojom-blink-forward.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink {
class XRSphericalHarmonics;
class DOMPointReadOnly;
class XRLightProbe : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
explicit XRLightProbe(const device::mojom::blink::XRLightProbe& light_probe);
XRSphericalHarmonics* sphericalHarmonics() const;
DOMPointReadOnly* mainLightDirection() const;
DOMPointReadOnly* mainLightIntensity() const;
void Trace(Visitor* visitor) override;
private:
Member<XRSphericalHarmonics> spherical_harmonics_;
Member<DOMPointReadOnly> main_light_direction_;
Member<DOMPointReadOnly> main_light_intensity_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_LIGHT_PROBE_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRIncubations
]
interface XRLightProbe {
readonly attribute XRSphericalHarmonics sphericalHarmonics;
readonly attribute DOMPointReadOnly mainLightDirection;
readonly attribute DOMPointReadOnly mainLightIntensity;
};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/xr/xr_reflection_probe.h"
#include "device/vr/public/mojom/vr_service.mojom-blink.h"
#include "third_party/blink/renderer/modules/xr/xr_cube_map.h"
namespace blink {
XRReflectionProbe::XRReflectionProbe(
const device::mojom::blink::XRReflectionProbe& reflection_probe) {
cube_map_ = MakeGarbageCollected<XRCubeMap>(*reflection_probe.cube_map);
}
XRCubeMap* XRReflectionProbe::cubeMap() const {
return cube_map_.Get();
}
void XRReflectionProbe::Trace(Visitor* visitor) {
visitor->Trace(cube_map_);
ScriptWrappable::Trace(visitor);
}
} // namespace blink
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_REFLECTION_PROBE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_REFLECTION_PROBE_H_
#include "base/util/type_safety/pass_key.h"
#include "device/vr/public/mojom/vr_service.mojom-blink-forward.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink {
class XRCubeMap;
class XRReflectionProbe : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
explicit XRReflectionProbe(
const device::mojom::blink::XRReflectionProbe& reflection_probe);
XRCubeMap* cubeMap() const;
void Trace(Visitor* visitor) override;
private:
Member<XRCubeMap> cube_map_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_REFLECTION_PROBE_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRIncubations
]
interface XRReflectionProbe {
readonly attribute XRCubeMap cubeMap;
};
...@@ -1454,13 +1454,10 @@ void XRSession::UpdateWorldUnderstandingStateForFrame( ...@@ -1454,13 +1454,10 @@ void XRSession::UpdateWorldUnderstandingStateForFrame(
frame_data->detected_planes_data.get(), timestamp); frame_data->detected_planes_data.get(), timestamp);
ProcessAnchorsData(frame_data->anchors_data.get(), timestamp); ProcessAnchorsData(frame_data->anchors_data.get(), timestamp);
ProcessHitTestData(frame_data->hit_test_subscription_results.get()); ProcessHitTestData(frame_data->hit_test_subscription_results.get());
world_information_->ProcessLightEstimationData(
frame_data->light_estimation_data.get(), timestamp);
} else { } else {
world_information_->ProcessPlaneInformation(nullptr, timestamp); world_information_->ProcessPlaneInformation(nullptr, timestamp);
ProcessAnchorsData(nullptr, timestamp); ProcessAnchorsData(nullptr, timestamp);
ProcessHitTestData(nullptr); ProcessHitTestData(nullptr);
world_information_->ProcessLightEstimationData(nullptr, timestamp);
} }
} }
......
...@@ -274,6 +274,7 @@ class XRSession final ...@@ -274,6 +274,7 @@ class XRSession final
void SetXRDisplayInfo(device::mojom::blink::VRDisplayInfoPtr display_info); void SetXRDisplayInfo(device::mojom::blink::VRDisplayInfoPtr display_info);
bool UsesInputEventing() { return uses_input_eventing_; } bool UsesInputEventing() { return uses_input_eventing_; }
bool LightEstimationEnabled() { return false; }
void Trace(Visitor* visitor) override; void Trace(Visitor* visitor) override;
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/xr/xr_spherical_harmonics.h"
#include "device/vr/public/mojom/vr_service.mojom-blink.h"
#include "third_party/blink/renderer/core/geometry/dom_point_read_only.h"
namespace blink {
XRSphericalHarmonics::XRSphericalHarmonics(
const device::mojom::blink::XRSphericalHarmonics& spherical_harmonics) {
DCHECK_EQ(spherical_harmonics.coefficients.size(), 9u);
coefficients_ = DOMFloat32Array::Create(
spherical_harmonics.coefficients.data()->components,
spherical_harmonics.coefficients.size() *
device::RgbTupleF32::kNumComponents);
orientation_ = DOMPointReadOnly::Create(0, 0, 0, 1);
}
DOMPointReadOnly* XRSphericalHarmonics::orientation() const {
return orientation_.Get();
}
DOMFloat32Array* XRSphericalHarmonics::coefficients() const {
return coefficients_.Get();
}
void XRSphericalHarmonics::Trace(Visitor* visitor) {
visitor->Trace(coefficients_);
visitor->Trace(orientation_);
ScriptWrappable::Trace(visitor);
}
} // namespace blink
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_SPHERICAL_HARMONICS_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_SPHERICAL_HARMONICS_H_
#include "device/vr/public/mojom/vr_service.mojom-blink-forward.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink {
class DOMPointReadOnly;
class XRSphericalHarmonics : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
XRSphericalHarmonics(
const device::mojom::blink::XRSphericalHarmonics& spherical_harmonics);
DOMPointReadOnly* orientation() const;
DOMFloat32Array* coefficients() const;
void Trace(Visitor* visitor) override;
private:
Member<DOMFloat32Array> coefficients_;
Member<DOMPointReadOnly> orientation_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_SPHERICAL_HARMONICS_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXRIncubations
]
interface XRSphericalHarmonics {
readonly attribute DOMPointReadOnly orientation;
readonly attribute Float32Array coefficients;
};
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "third_party/blink/renderer/modules/xr/xr_world_information.h" #include "third_party/blink/renderer/modules/xr/xr_world_information.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "third_party/blink/renderer/modules/xr/xr_light_estimation.h"
#include "third_party/blink/renderer/modules/xr/xr_session.h" #include "third_party/blink/renderer/modules/xr/xr_session.h"
namespace blink { namespace blink {
...@@ -15,7 +14,6 @@ XRWorldInformation::XRWorldInformation(XRSession* session) ...@@ -15,7 +14,6 @@ XRWorldInformation::XRWorldInformation(XRSession* session)
void XRWorldInformation::Trace(Visitor* visitor) { void XRWorldInformation::Trace(Visitor* visitor) {
visitor->Trace(plane_ids_to_planes_); visitor->Trace(plane_ids_to_planes_);
visitor->Trace(light_estimation_);
visitor->Trace(session_); visitor->Trace(session_);
ScriptWrappable::Trace(visitor); ScriptWrappable::Trace(visitor);
} }
...@@ -35,10 +33,6 @@ XRPlaneSet* XRWorldInformation::detectedPlanes() const { ...@@ -35,10 +33,6 @@ XRPlaneSet* XRWorldInformation::detectedPlanes() const {
return MakeGarbageCollected<XRPlaneSet>(result); return MakeGarbageCollected<XRPlaneSet>(result);
} }
XRLightEstimation* XRWorldInformation::lightEstimation() const {
return light_estimation_.Get();
}
void XRWorldInformation::ProcessPlaneInformation( void XRWorldInformation::ProcessPlaneInformation(
const device::mojom::blink::XRPlaneDetectionData* detected_planes_data, const device::mojom::blink::XRPlaneDetectionData* detected_planes_data,
double timestamp) { double timestamp) {
...@@ -99,16 +93,4 @@ void XRWorldInformation::ProcessPlaneInformation( ...@@ -99,16 +93,4 @@ void XRWorldInformation::ProcessPlaneInformation(
plane_ids_to_planes_.swap(updated_planes); plane_ids_to_planes_.swap(updated_planes);
} }
void XRWorldInformation::ProcessLightEstimationData(
const device::mojom::blink::XRLightEstimationData* data,
double timestamp) {
TRACE_EVENT0("xr", __FUNCTION__);
if (data) {
light_estimation_ = MakeGarbageCollected<XRLightEstimation>(*data);
} else {
light_estimation_ = nullptr;
}
}
} // namespace blink } // namespace blink
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace blink { namespace blink {
class XRLightEstimation;
class XRSession; class XRSession;
class XRWorldInformation : public ScriptWrappable { class XRWorldInformation : public ScriptWrappable {
...@@ -24,8 +23,6 @@ class XRWorldInformation : public ScriptWrappable { ...@@ -24,8 +23,6 @@ class XRWorldInformation : public ScriptWrappable {
// disabled. // disabled.
XRPlaneSet* detectedPlanes() const; XRPlaneSet* detectedPlanes() const;
XRLightEstimation* lightEstimation() const;
void Trace(Visitor* visitor) override; void Trace(Visitor* visitor) override;
// Applies changes to the stored plane information based on the contents of // Applies changes to the stored plane information based on the contents of
...@@ -35,10 +32,6 @@ class XRWorldInformation : public ScriptWrappable { ...@@ -35,10 +32,6 @@ class XRWorldInformation : public ScriptWrappable {
const device::mojom::blink::XRPlaneDetectionData* detected_planes_data, const device::mojom::blink::XRPlaneDetectionData* detected_planes_data,
double timestamp); double timestamp);
void ProcessLightEstimationData(
const device::mojom::blink::XRLightEstimationData* data,
double timestamp);
private: private:
// Signifies if we should return null from `detectedPlanes()`. // Signifies if we should return null from `detectedPlanes()`.
// This is the case if we have a freshly constructed instance, or if our // This is the case if we have a freshly constructed instance, or if our
...@@ -46,8 +39,6 @@ class XRWorldInformation : public ScriptWrappable { ...@@ -46,8 +39,6 @@ class XRWorldInformation : public ScriptWrappable {
bool is_detected_planes_null_ = true; bool is_detected_planes_null_ = true;
HeapHashMap<uint64_t, Member<XRPlane>> plane_ids_to_planes_; HeapHashMap<uint64_t, Member<XRPlane>> plane_ids_to_planes_;
Member<XRLightEstimation> light_estimation_;
Member<XRSession> session_; Member<XRSession> session_;
}; };
......
...@@ -11,6 +11,5 @@ ...@@ -11,6 +11,5 @@
] ]
interface XRWorldInformation { interface XRWorldInformation {
readonly attribute XRPlaneSet? detectedPlanes; readonly attribute XRPlaneSet? detectedPlanes;
readonly attribute XRLightEstimation? lightEstimation;
}; };
...@@ -4,10 +4,8 @@ ...@@ -4,10 +4,8 @@
#include "third_party/blink/renderer/modules/xr/xr_world_tracking_state.h" #include "third_party/blink/renderer/modules/xr/xr_world_tracking_state.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_xr_light_estimation_state_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_xr_plane_detection_state_init.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_xr_plane_detection_state_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_xr_world_tracking_state_init.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_xr_world_tracking_state_init.h"
#include "third_party/blink/renderer/modules/xr/xr_light_estimation_state.h"
#include "third_party/blink/renderer/modules/xr/xr_plane_detection_state.h" #include "third_party/blink/renderer/modules/xr/xr_plane_detection_state.h"
namespace blink { namespace blink {
...@@ -22,20 +20,10 @@ XRWorldTrackingState::XRWorldTrackingState( ...@@ -22,20 +20,10 @@ XRWorldTrackingState::XRWorldTrackingState(
plane_detection_state_ = plane_detection_state_ =
MakeGarbageCollected<XRPlaneDetectionState>(nullptr); MakeGarbageCollected<XRPlaneDetectionState>(nullptr);
} }
if (world_tracking_state_init &&
world_tracking_state_init->hasLightEstimationState()) {
light_estimation_state_ = MakeGarbageCollected<XRLightEstimationState>(
world_tracking_state_init->lightEstimationState());
} else {
light_estimation_state_ =
MakeGarbageCollected<XRLightEstimationState>(nullptr);
}
} }
void XRWorldTrackingState::Trace(Visitor* visitor) { void XRWorldTrackingState::Trace(Visitor* visitor) {
visitor->Trace(plane_detection_state_); visitor->Trace(plane_detection_state_);
visitor->Trace(light_estimation_state_);
ScriptWrappable::Trace(visitor); ScriptWrappable::Trace(visitor);
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
namespace blink { namespace blink {
class XRPlaneDetectionState; class XRPlaneDetectionState;
class XRLightEstimationState;
class XRWorldTrackingStateInit; class XRWorldTrackingStateInit;
class XRWorldTrackingState : public ScriptWrappable { class XRWorldTrackingState : public ScriptWrappable {
...@@ -26,15 +25,10 @@ class XRWorldTrackingState : public ScriptWrappable { ...@@ -26,15 +25,10 @@ class XRWorldTrackingState : public ScriptWrappable {
return plane_detection_state_; return plane_detection_state_;
} }
XRLightEstimationState* lightEstimationState() const {
return light_estimation_state_;
}
void Trace(Visitor* visitor) override; void Trace(Visitor* visitor) override;
private: private:
Member<XRPlaneDetectionState> plane_detection_state_; Member<XRPlaneDetectionState> plane_detection_state_;
Member<XRLightEstimationState> light_estimation_state_;
}; };
} // namespace blink } // namespace blink
......
...@@ -11,6 +11,5 @@ ...@@ -11,6 +11,5 @@
] ]
interface XRWorldTrackingState { interface XRWorldTrackingState {
readonly attribute XRPlaneDetectionState planeDetectionState; readonly attribute XRPlaneDetectionState planeDetectionState;
readonly attribute XRLightEstimationState lightEstimationState;
}; };
...@@ -6,6 +6,5 @@ ...@@ -6,6 +6,5 @@
// https://github.com/immersive-web/real-world-geometry/blob/master/plane-detection-explainer.md // https://github.com/immersive-web/real-world-geometry/blob/master/plane-detection-explainer.md
dictionary XRWorldTrackingStateInit { dictionary XRWorldTrackingStateInit {
XRPlaneDetectionStateInit planeDetectionState; XRPlaneDetectionStateInit planeDetectionState;
XRLightEstimationStateInit lightEstimationState;
}; };
...@@ -11275,10 +11275,6 @@ interface XRBoundedReferenceSpace : XRReferenceSpace ...@@ -11275,10 +11275,6 @@ interface XRBoundedReferenceSpace : XRReferenceSpace
attribute @@toStringTag attribute @@toStringTag
getter boundsGeometry getter boundsGeometry
method constructor method constructor
interface XRCubeMap
attribute @@toStringTag
method constructor
method updateWebGLEnvironmentCube
interface XRDOMOverlayState interface XRDOMOverlayState
attribute @@toStringTag attribute @@toStringTag
getter type getter type
...@@ -11332,21 +11328,6 @@ interface XRInputSourcesChangeEvent : Event ...@@ -11332,21 +11328,6 @@ interface XRInputSourcesChangeEvent : Event
getter removed getter removed
getter session getter session
method constructor method constructor
interface XRLightEstimation
attribute @@toStringTag
getter lightProbe
getter reflectionProbe
method constructor
interface XRLightEstimationState
attribute @@toStringTag
getter enabled
method constructor
interface XRLightProbe
attribute @@toStringTag
getter mainLightDirection
getter mainLightIntensity
getter sphericalHarmonics
method constructor
interface XRPlane interface XRPlane
attribute @@toStringTag attribute @@toStringTag
getter lastChangedTime getter lastChangedTime
...@@ -11391,10 +11372,6 @@ interface XRReferenceSpaceEvent : Event ...@@ -11391,10 +11372,6 @@ interface XRReferenceSpaceEvent : Event
getter referenceSpace getter referenceSpace
getter transform getter transform
method constructor method constructor
interface XRReflectionProbe
attribute @@toStringTag
getter cubeMap
method constructor
interface XRRenderState interface XRRenderState
attribute @@toStringTag attribute @@toStringTag
getter baseLayer getter baseLayer
...@@ -11452,11 +11429,6 @@ interface XRSessionEvent : Event ...@@ -11452,11 +11429,6 @@ interface XRSessionEvent : Event
interface XRSpace : EventTarget interface XRSpace : EventTarget
attribute @@toStringTag attribute @@toStringTag
method constructor method constructor
interface XRSphericalHarmonics
attribute @@toStringTag
getter coefficients
getter orientation
method constructor
interface XRSystem : EventTarget interface XRSystem : EventTarget
attribute @@toStringTag attribute @@toStringTag
getter ondevicechange getter ondevicechange
...@@ -11504,11 +11476,9 @@ interface XRWebGLLayer ...@@ -11504,11 +11476,9 @@ interface XRWebGLLayer
interface XRWorldInformation interface XRWorldInformation
attribute @@toStringTag attribute @@toStringTag
getter detectedPlanes getter detectedPlanes
getter lightEstimation
method constructor method constructor
interface XRWorldTrackingState interface XRWorldTrackingState
attribute @@toStringTag attribute @@toStringTag
getter lightEstimationState
getter planeDetectionState getter planeDetectionState
method constructor method constructor
interface XSLTProcessor interface XSLTProcessor
......
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>let additionalChromiumResources = ["../resources/xr-internal-device-mocking.js"];</script>
<script src="/webxr/resources/webxr_util.js"></script>
<script src="/webxr/resources/webxr_test_constants.js"></script>
<script src="/webxr/resources/webxr_test_asserts.js"></script>
<canvas />
<script>
// Because AR is not yet in the core webxr spec, this is an internal-chrome only test.
let fakeDeviceInitParams = { supportedModes: ["immersive-ar"],
views: VALID_VIEWS,
supportedFeatures: ALL_FEATURES };
function assert_defined(v, description) {
assert_not_equals(v, undefined, description);
}
// Verifies the structure of |XRCubeMap|
// Defined in 'third_party/blink/renderer/modules/xr/xr_cube_map.idl'
function verifyXRCubeMap(cubeMap) {
assert_defined(cubeMap.updateWebGLEnvironmentCube);
}
// Verifies the structure of |XRReflectionProbe|
// Defined in 'third_party/blink/renderer/modules/xr/xr_reflection_probe.idl'
function verifyXRReflectionProbe(reflectionProbe) {
assert_defined(reflectionProbe.cubeMap);
verifyXRCubeMap(reflectionProbe.cubeMap);
}
// Verifies the structure of |XRSphericalHarmonics|
// Defined in 'third_party/blink/renderer/modules/xr/xr_spherical_harmonics.idl'
function verifyXRSphericalHarmonics(sphericalHarmonics) {
assert_equals(sphericalHarmonics.orientation.x, 0);
assert_equals(sphericalHarmonics.orientation.y, 0);
assert_equals(sphericalHarmonics.orientation.z, 0);
assert_equals(sphericalHarmonics.orientation.w, 1);
assert_array_equals(Array.from(sphericalHarmonics.coefficients), new Array(9).fill().map((x, i) => [i, i, i]).flat());
}
// Verifies the structure of |XRLightProbe|
// Defined in 'third_party/blink/renderer/modules/xr/xr_light_probe.idl'
function verifyXRLightProbe(lightProbe) {
assert_defined(lightProbe.sphericalHarmonics);
verifyXRSphericalHarmonics(lightProbe.sphericalHarmonics);
assert_equals(lightProbe.mainLightDirection.x, 0);
assert_equals(lightProbe.mainLightDirection.y, 1);
assert_equals(lightProbe.mainLightDirection.z, 0);
assert_equals(lightProbe.mainLightDirection.w, 0);
assert_equals(lightProbe.mainLightIntensity.x, 1);
assert_equals(lightProbe.mainLightIntensity.y, 1);
assert_equals(lightProbe.mainLightIntensity.z, 1);
assert_equals(lightProbe.mainLightIntensity.w, 1);
}
// Verifies the structure of |XRLightEstimationData|
// Defined in 'third_party/blink/renderer/modules/xr/xr_light_estimation.idl'
function verifyXRLightEstimationData(lightEstimation) {
assert_defined(lightEstimation.lightProbe);
if (lightEstimation.lightProbe !== null) {
verifyXRLightProbe(lightEstimation.lightProbe);
}
assert_defined(lightEstimation.reflectionProbe);
if (lightEstimation.reflectionProbe !== null) {
verifyXRReflectionProbe(lightEstimation.reflectionProbe);
}
}
// Verifies the structure of |XRFrame| (as it relates to light estimation)
// for a session that's expected to suppot light estimation.
// Defined in 'third_party/blink/renderer/modules/xr/xr_frame.idl'
function verifyLightEstimationExists(t, resolve, count, session, frame) {
t.step(() => {
assert_not_equals(count, 0, "Did not get lighting information with a reasonable number of frames");
assert_defined(frame.worldInformation);
assert_defined(frame.worldInformation.lightEstimation);
if (frame.worldInformation.lightEstimation === null) {
// Check if we get lighting information next frame
session.requestAnimationFrame((time, frame) => {
verifyLightEstimationExists(t, resolve, count - 1, session, frame);
});
} else {
verifyXRLightEstimationData(frame.worldInformation.lightEstimation);
resolve();
}
});
}
let lightingInformationExistsName = "Ensures lighting estimation feature works when enabled";
function lightingInformationExists(session, fakeDeviceController, t) {
session.updateWorldTrackingState({ lightEstimationState: { enabled: true }});
return new Promise((resolve, reject) => {
session.requestAnimationFrame((time, frame) => {
verifyLightEstimationExists(t, resolve, 10, session, frame);
});
});
}
function verifyLightEstimationDoesNotExist(t, resolve, count, session, frame) {
t.step(() => {
if (count === 0) {
resolve();
return;
}
// Lighting estimation should exist, but be null
assert_defined(frame.worldInformation);
assert_equals(frame.worldInformation.lightEstimation, null);
// Run another frame
session.requestAnimationFrame((time, frame) => {
verifyLightEstimationDoesNotExist(t, resolve, count - 1, session, frame);
});
});
}
let lightingInformationDoesNotExistName = "Ensure lighting estimation feature does not work when not explicitly enabled";
function lightingInformationDoesNotExist(session, fakeDeviceController, t) {
return new Promise((resolve, reject) => {
session.requestAnimationFrame((time, frame) => {
verifyLightEstimationDoesNotExist(t, resolve, 10, session, frame);
});
});
}
xr_session_promise_test(
lightingInformationExistsName,
lightingInformationExists,
fakeDeviceInitParams,
'immersive-ar',
{}
);
xr_session_promise_test(
lightingInformationDoesNotExistName,
lightingInformationDoesNotExist,
fakeDeviceInitParams,
'immersive-ar',
{}
);
</script>
...@@ -51,6 +51,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -51,6 +51,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<details open> <details open>
<summary>Lighting Estimation</summary> <summary>Lighting Estimation</summary>
<p> <p>
<b style='color: darkred'>The Light Estimation API is undergoing
a redesign. This page will not be functional in newer versions of
Chrome until that work is complete.</b>
This sample demonstrates use of a non-exclusive XRSession to present This sample demonstrates use of a non-exclusive XRSession to present
Augmented Reality content. Augmented Reality content.
<a class="back" href="./index.html">Back</a> <a class="back" href="./index.html">Back</a>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment