Skip to content
Snippets Groups Projects
Commit 1aaa6fcb authored by Alexander Rose's avatar Alexander Rose
Browse files

registered point repr

parent 710c7b8a
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
// float depth = gl_FragCoord.z / gl_FragCoord.w; // float depth = gl_FragCoord.z / gl_FragCoord.w;
float fogFactor = smoothstep(uFogNear, uFogFar, depth); float fogFactor = smoothstep(uFogNear, uFogFar, depth);
gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor, fogFactor); gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor, fogFactor);
float alpha = (1.0 - fogFactor) * gl_FragColor.a; float fogAlpha = (1.0 - fogFactor) * gl_FragColor.a;
if (alpha < 0.01) if (fogAlpha < 0.01)
discard; discard;
gl_FragColor = vec4( gl_FragColor.rgb, alpha ); gl_FragColor = vec4( gl_FragColor.rgb, fogAlpha );
#endif #endif
\ No newline at end of file
...@@ -13,6 +13,7 @@ import { MolecularVolumeRepresentationProvider } from './representation/molecula ...@@ -13,6 +13,7 @@ import { MolecularVolumeRepresentationProvider } from './representation/molecula
import { CarbohydrateRepresentationProvider } from './representation/carbohydrate'; import { CarbohydrateRepresentationProvider } from './representation/carbohydrate';
import { SpacefillRepresentationProvider } from './representation/spacefill'; import { SpacefillRepresentationProvider } from './representation/spacefill';
import { DistanceRestraintRepresentationProvider } from './representation/distance-restraint'; import { DistanceRestraintRepresentationProvider } from './representation/distance-restraint';
import { PointRepresentationProvider } from './representation/point';
export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> { export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> {
constructor() { constructor() {
...@@ -31,6 +32,7 @@ export const BuiltInStructureRepresentations = { ...@@ -31,6 +32,7 @@ export const BuiltInStructureRepresentations = {
'distance-restraint': DistanceRestraintRepresentationProvider, 'distance-restraint': DistanceRestraintRepresentationProvider,
'molecular-surface': MolecularSurfaceRepresentationProvider, 'molecular-surface': MolecularSurfaceRepresentationProvider,
'molecular-volume': MolecularVolumeRepresentationProvider, 'molecular-volume': MolecularVolumeRepresentationProvider,
'point': PointRepresentationProvider,
'spacefill': SpacefillRepresentationProvider, 'spacefill': SpacefillRepresentationProvider,
} }
export type BuiltInStructureRepresentationsName = keyof typeof BuiltInStructureRepresentations export type BuiltInStructureRepresentationsName = keyof typeof BuiltInStructureRepresentations
......
// /** /**
// * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
// * *
// * @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
// */ */
// import { ElementPointVisual, ElementPointParams } from '../visual/element-point'; import { ElementPointVisual, ElementPointParams } from '../visual/element-point';
// import { UnitsRepresentation } from '../units-representation'; import { UnitsRepresentation } from '../units-representation';
// import { ParamDefinition as PD } from 'mol-util/param-definition'; import { ParamDefinition as PD } from 'mol-util/param-definition';
// import { StructureRepresentation } from '../representation'; import { StructureRepresentation, StructureRepresentationProvider } from '../representation';
// import { Representation } from 'mol-repr/representation'; import { Representation, RepresentationParamsGetter, RepresentationContext } from 'mol-repr/representation';
// import { ThemeRegistryContext } from 'mol-theme/theme'; import { ThemeRegistryContext } from 'mol-theme/theme';
// import { Structure } from 'mol-model/structure'; import { Structure } from 'mol-model/structure';
import { UnitKind, UnitKindOptions } from '../visual/util/common';
// export const PointParams = { const PointVisuals = {
// ...ElementPointParams, 'element-point': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementPointParams>) => UnitsRepresentation('Points', ctx, getParams, ElementPointVisual),
// } }
// export function getPointParams(ctx: ThemeRegistryContext, structure: Structure) {
// return PointParams // TODO return copy
// }
// export type PointProps = PD.DefaultValues<typeof PointParams>
// export type PointRepresentation = StructureRepresentation<PointProps> export const PointParams = {
...ElementPointParams,
unitKinds: PD.MultiSelect<UnitKind>(['atomic', 'spheres'], UnitKindOptions),
}
export type PointParams = typeof PointParams
export function getPointParams(ctx: ThemeRegistryContext, structure: Structure) {
return PD.clone(PointParams)
}
// export function PointRepresentation(defaultProps: PointProps): PointRepresentation { export type PointRepresentation = StructureRepresentation<PointParams>
// return Representation.createMulti('Point', defaultProps, [ export function PointRepresentation(ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, PointParams>): PointRepresentation {
// UnitsRepresentation('Point', defaultProps, ElementPointVisual) return Representation.createMulti('Point', ctx, getParams, PointVisuals as unknown as Representation.Def<Structure, PointParams>)
// ]) }
// }
\ No newline at end of file export const PointRepresentationProvider: StructureRepresentationProvider<PointParams> = {
label: 'Point',
description: 'Displays elements (atoms, coarse spheres) as spheres.',
factory: PointRepresentation,
getParams: getPointParams,
defaultValues: PD.getDefaultValues(PointParams),
defaultColorTheme: 'element-symbol',
defaultSizeTheme: 'physical'
}
\ No newline at end of file
...@@ -18,6 +18,7 @@ import { Theme } from 'mol-theme/theme'; ...@@ -18,6 +18,7 @@ import { Theme } from 'mol-theme/theme';
export const ElementPointParams = { export const ElementPointParams = {
...UnitsPointsParams, ...UnitsPointsParams,
// sizeFactor: PD.Numeric(1.0, { min: 0, max: 10, step: 0.01 }),
pointSizeAttenuation: PD.Boolean(false), pointSizeAttenuation: PD.Boolean(false),
} }
export type ElementPointParams = typeof ElementPointParams export type ElementPointParams = typeof ElementPointParams
...@@ -25,6 +26,8 @@ export type ElementPointParams = typeof ElementPointParams ...@@ -25,6 +26,8 @@ export type ElementPointParams = typeof ElementPointParams
// TODO size // TODO size
export function createElementPoint(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<ElementPointParams>, points: Points) { export function createElementPoint(ctx: VisualContext, unit: Unit, structure: Structure, theme: Theme, props: PD.Values<ElementPointParams>, points: Points) {
// const { sizeFactor } = props
const elements = unit.elements const elements = unit.elements
const n = elements.length const n = elements.length
const builder = PointsBuilder.create(n, n / 10, points) const builder = PointsBuilder.create(n, n / 10, points)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment