reuter-group / peprmint-web

Web-tool for calculating and visualizing hydrophobic protrusions
https://reuter-group.github.io/peprmint
10 stars 3 forks source link

Let's have Flat Lighting Back ! #6

Open tubiana opened 2 years ago

tubiana commented 2 years ago

This would be great to have a button to have the old flat lighting back :-) A issue was opened on molstar here, and a piece of code was suggested https://github.com/molstar/molstar/issues/359#issuecomment-1047905764

I don't know it will help, but here's my change to have lighting settings in Flat dirrectly when I open a protein (on my custom version with molstar 2.3.5)

molstar.ts, line ~140

init(targetId: string, options?: {
        customColorList?: number[]
    }) {
        this.plugin = createPlugin(document.getElementById(targetId)!, this.defaultSpec);

        this.plugin.behaviors.canvas3d.initialized.subscribe(v => {
            if (v) {
                PluginCommands.Canvas3D.SetSettings(this.plugin, {                   
                    settings: {
                        renderer: {
                            ...this.plugin.canvas3d!.props.renderer,
                            style: { name: 'flat', params: {} }
                        },
                        camera: {
                            ...this.plugin.canvas3d!.props.camera,
                            mode: 'orthographic',
                            helper: { axes: { name: 'off', params: {} } }
                        },
                        postprocessing: {
                            ...this.plugin.canvas3d!.props.postprocessing,
                            outline: {
                                name: 'on', params: {
                                    scale: 3.0,
                                    threshold: 1
                                }
                            }
                        }

                    }
                });
            }
        });
    }