Skip to content

Commit

Permalink
fix light settings coordinate system (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Mar 11, 2019
1 parent 8dc659b commit d51096e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions modules/core/src/components/log-viewer/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import {CubeGeometry} from 'luma.gl';
import {COORDINATE_SYSTEM} from 'deck.gl';

export const DEFAULT_CAR = {
mesh: new CubeGeometry(),
Expand All @@ -31,6 +32,8 @@ export const DEFAULT_ORIGIN = [0, 0, 0];
export const CAR_DATA = [[0, 0, 0]];

export const LIGHT_SETTINGS = {
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,
coordinateOrigin: DEFAULT_ORIGIN,
lightsPosition: [0, 0, 5000, -1000, 400, 1000],
ambientRatio: 0.5,
diffuseRatio: 0.2,
Expand Down
15 changes: 12 additions & 3 deletions modules/core/src/components/log-viewer/core-3d-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ export default class Core3DViewer extends PureComponent {
});
}
if (this.props.frame !== nextProps.frame) {
const {frame} = this.props;
const lightSettings = {
...LIGHT_SETTINGS,
coordinateOrigin: (frame && frame.origin) || DEFAULT_ORIGIN
};
this.setState({lightSettings});
stats.bump('frame-update');
}
}
Expand Down Expand Up @@ -178,6 +184,7 @@ export default class Core3DViewer extends PureComponent {

_getCarLayer() {
const {frame, car} = this.props;
const {lightSettings} = this.state;
const {
origin = DEFAULT_ORIGIN,
mesh,
Expand All @@ -202,7 +209,7 @@ export default class Core3DViewer extends PureComponent {
getSize: Number.isFinite(scale) ? [scale, scale, scale] : scale,
texture,
wireframe,
lightSettings: LIGHT_SETTINGS
lightSettings
});
}

Expand All @@ -220,7 +227,7 @@ export default class Core3DViewer extends PureComponent {
}

const {streams, lookAheads = {}} = frame;
const {styleParser} = this.state;
const {styleParser, lightSettings} = this.state;

const streamFilter = normalizeStreamFilter(this.props.streamFilter);
const featuresAndFutures = new Set(
Expand Down Expand Up @@ -253,7 +260,7 @@ export default class Core3DViewer extends PureComponent {
...coordinateProps,

pickable: showTooltip || primitives[0].id,
lightSettings: LIGHT_SETTINGS,
lightSettings,

data: primitives,
style: stylesheet,
Expand All @@ -273,6 +280,8 @@ export default class Core3DViewer extends PureComponent {
...coordinateProps,

pickable: showTooltip,
lightSettings,

data: stream.pointCloud,
style: stylesheet,
vehicleRelativeTransform: frame.vehicleRelativeTransform,
Expand Down

0 comments on commit d51096e

Please sign in to comment.