Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cameraHelper not defined for update #5099

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
148 changes: 95 additions & 53 deletions examples/test/shadows/index.html
Original file line number Diff line number Diff line change
@@ -1,62 +1,104 @@
<!DOCTYPE html>
<html>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<html>
<html>
- @andyli

<head>
<meta charset="utf-8">
<title>Shadows</title>
<meta name="description" content="Shadows - A-Frame">
<script src="../../../dist/aframe-master.js"></script>
</head>
<body>
<a-scene background="color: #111" shadow="type: basic" stats>
<a-assets>
<a-mixin id="wall"
geometry="primitive: box; height: 30; width: 30; depth: 2"
material="color: #333; metalness: 0; roughness: 1"
shadow="cast: false; receive: true"></a-mixin>
</a-assets>

<a-entity position="0 8.4 -8">
<a-entity light="color: #AAA; type: ambient"></a-entity>

<!-- Center point light. -->
<a-entity geometry="primitive: sphere; radius: 0.15"
material="color: #FAFAFA; shader: flat"
light="castShadow: true; color: #FAFAFA; intensity: 0.5; shadowBias: 0.01

<head>
<meta charset="utf-8">
<title>Shadows</title>
<meta name="description"
content="Shadows - A-Frame">
<script src="../../../dist/aframe-master.js"></script>
</head>

<body>
<a-scene background="color: #111"
shadow="type: basic"
stats>
<a-assets>
<a-mixin id="wall"
geometry="primitive: box; height: 30; width: 30; depth: 2"
material="color: #333; metalness: 0; roughness: 1"
shadow="cast: false; receive: true"></a-mixin>
</a-assets>

<a-entity position="0 0.5 0"
light="castShadow: true;
color: #FFFFFF;
intensity: 1.5;
shadowCameraVisible: true;
shadowCameraLeft: -3;
shadowCameraRight: 3;
shadowCameraTop: 5.2;
shadowCameraBottom: 2;
shadowBias: -0.00001;
shadowCameraNear: 0;
type: directional;
shadowMapWidth: 1024;
shadowMapHeight: 1024">
</a-entity>

<a-entity position="0 8.4 -8">
<a-entity light="color: #AAA; type: ambient"></a-entity>

<!-- Center point light. -->
<a-entity geometry="primitive: sphere; radius: 0.15"
material="color: #FAFAFA; shader: flat"
light="castShadow: true; color: #FAFAFA; intensity: 0.5;
shadowBias:-0.0001;
shadowCameraNear: 1; type: point; shadowMapWidth: 1024; shadowMapHeight: 1024"
position="0 -1 1"
animation="property: scale; to: 2 2 2; dur: 3000; dir: alternate; loop: true"
animation="property: intensity; to: 1; dur: 3000; dir: alternate; loop: true"></a-entity>

<!-- Animating point light. -->
<a-entity animation="property: rotation; to: 0 360 360; dur: 5000; easing: linear; loop: true">
<a-entity geometry="primitive: sphere; radius: 0.25"
material="color: #EF2D5E; shader: flat"
light="castShadow: true; color: #EF2D5E; intensity: 1; shadowBias: 0.01
position="0 -1 1"
animation="property: scale; to: 2 2 2; dur: 3000; dir: alternate; loop: true"
animation="property: intensity; to: 1; dur: 3000; dir: alternate; loop: true"></a-entity>

<!-- Animating point light. -->
<a-entity animation="property: rotation; to: 0 360 360; dur: 5000; easing: linear; loop: true">
<a-entity geometry="primitive: sphere; radius: 0.25"
material="color: #EF2D5E; shader: flat"
light="castShadow: true; color: #EF2D5E; intensity: 1;
shadowBias: -0.0001;
shadowCameraNear: 1; type: point; shadowMapWidth: 1024; shadowMapHeight: 1024"
position="0 5 5"></a-entity>
</a-entity>
position="0 5 5"></a-entity>
</a-entity>

<!-- Torus. -->
<a-entity geometry="primitive: torusKnot; radius: 4; radiusTubular: 0.1;
<!-- Torus. -->
<a-entity geometry="primitive: torusKnot; radius: 4; radiusTubular: 0.1;
segmentsRadial: 150; segmentsTubular: 20; p: 17; q: 4;"
material="color: #EF2D5E; metalness: 0.75"
shadow="cast: true; receive: true"
position="0 -1 2"
animation="property: rotation; dur: 36000; to: 0 360 0; loop: true; easing: linear">
</a-entity>

<!-- Walls. -->
<a-entity mixin="wall" position="0 0 -10"></a-entity>
<a-entity mixin="wall" position="-10 0 0" rotation="0 90 0"></a-entity>
<a-entity mixin="wall" position="10 0 0" rotation="0 90 0"></a-entity>
<a-entity mixin="wall" position="0 10 0" rotation="90 0 0"></a-entity>
<a-entity mixin="wall" position="0 -10 0" rotation="90 0 0"></a-entity>
material="color: #EF2D5E; metalness: 0.75"
shadow="cast: true; receive: true"
position="0 -1 2"
animation="property: rotation; dur: 36000; to: 0 360 0; loop: true; easing: linear">
</a-entity>

<!-- Meshes -->
<a-entity geometry="primitive: box" material="color: #EF2D5E; metalness: 0" shadow position="0 0 -4"></a-entity>
<a-entity geometry="primitive: sphere" material="color: #EF2D5E; metalness: 0" shadow position="-2 0 -4"></a-entity>
<a-entity geometry="primitive: cylinder" material="color: #EF2D5E; metalness: 0" shadow position="2 0 -4"></a-entity>
</a-scene>
</body>
<!-- Walls. -->
<a-entity mixin="wall"
position="0 0 -10"></a-entity>
<a-entity mixin="wall"
position="-10 0 0"
rotation="0 90 0"></a-entity>
<a-entity mixin="wall"
position="10 0 0"
rotation="0 90 0"></a-entity>
<a-entity mixin="wall"
position="0 10 0"
rotation="90 0 0"></a-entity>
<a-entity mixin="wall"
position="0 -10 0"
rotation="90 0 0"></a-entity>
</a-entity>

<!-- Meshes -->
<a-entity geometry="primitive: box"
material="color: #EF2D5E; metalness: 0"
shadow
position="0 0 -4"></a-entity>
<a-entity geometry="primitive: sphere"
material="color: #EF2D5E; metalness: 0"
shadow
position="-2 0 -4"></a-entity>
<a-entity geometry="primitive: cylinder"
material="color: #EF2D5E; metalness: 0"
shadow
position="2 0 -4"></a-entity>
</a-scene>
</body>

</html>
1 change: 1 addition & 0 deletions src/components/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ module.exports.Component = registerComponent('light', {
var cameraHelper = el.getObject3D('cameraHelper');
if (data.shadowCameraVisible && !cameraHelper) {
el.setObject3D('cameraHelper', new THREE.CameraHelper(light.shadow.camera));
cameraHelper = el.getObject3D('cameraHelper');
} else if (!data.shadowCameraVisible && cameraHelper) {
el.removeObject3D('cameraHelper');
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ require('./core/a-mixin');
require('./extras/components/');
require('./extras/primitives/');

console.log('A-Frame Version: 1.3.0 (Date 2022-08-17, Commit #0fe1f286)');
console.log('A-Frame Version: 1.3.0 (Date 2022-08-23, Commit #7182e320)');
console.log('THREE Version (https://github.com/supermedium/three.js):',
pkg.dependencies['super-three']);
console.log('WebVR Polyfill Version:', pkg.dependencies['webvr-polyfill']);
Expand Down