MCPcopy Create free account
hub / github.com/microsoft/SandDance / _CubeLayer

Function _CubeLayer

docs/app/js/sanddance-app.js:7694–7766  ·  view source on GitHub ↗
(props1)

Source from the content-addressed store, hash-verified

7692 }
7693};
7694function _CubeLayer(props1) {
7695 //dynamic superclass, since we don't know have deck.Layer in the declaration phase
7696 class __CubeLayer extends (0, _base.base).deck.Layer {
7697 getShaders() {
7698 return {
7699 vs: (0, _cubeLayerVertexGlslDefault.default),
7700 fs: (0, _cubeLayerFragmentGlslDefault.default),
7701 modules: [
7702 (0, _base.base).deck.project32,
7703 (0, _base.base).deck.gouraudLighting,
7704 (0, _base.base).deck.picking
7705 ]
7706 };
7707 }
7708 initializeState() {
7709 const attributeManager = this.getAttributeManager();
7710 attributeManager.addInstanced({
7711 instancePositions: {
7712 size: 3,
7713 type: DOUBLE,
7714 transition: true,
7715 accessor: "getPosition"
7716 },
7717 instanceSizes: {
7718 size: 3,
7719 transition: true,
7720 accessor: "getSize"
7721 },
7722 instanceColors: {
7723 size: 4,
7724 type: UNSIGNED_BYTE,
7725 transition: true,
7726 accessor: "getColor",
7727 defaultValue: DEFAULT_COLOR
7728 }
7729 });
7730 }
7731 updateState({ props , oldProps , changeFlags }) {
7732 super.updateState({
7733 props,
7734 oldProps,
7735 changeFlags
7736 }); //TODO add parameter type to deck.gl-typings
7737 // Re-generate model if geometry changed
7738 //if (props.fp64 !== oldProps.fp64) {
7739 const { gl } = this.context;
7740 if (this.state.model) this.state.model.delete();
7741 this.setState({
7742 model: this._getModel(gl)
7743 });
7744 this.getAttributeManager().invalidateAll();
7745 //}
7746 }
7747 _getModel(gl) {
7748 return new (0, _base.base).luma.Model(gl, Object.assign({}, this.getShaders(), {
7749 id: this.props.id,
7750 geometry: new (0, _base.base).luma.CubeGeometry(),
7751 isInstanced: true

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected