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 @@
// float depth = gl_FragCoord.z / gl_FragCoord.w;
float fogFactor = smoothstep(uFogNear, uFogFar, depth);
gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor, fogFactor);
float alpha = (1.0 - fogFactor) * gl_FragColor.a;
if (alpha < 0.01)
float fogAlpha = (1.0 - fogFactor) * gl_FragColor.a;
if (fogAlpha < 0.01)
discard;
gl_FragColor = vec4( gl_FragColor.rgb, alpha );
gl_FragColor = vec4( gl_FragColor.rgb, fogAlpha );
#endif
\ No newline at end of file
......@@ -13,6 +13,7 @@ import { MolecularVolumeRepresentationProvider } from './representation/molecula
import { CarbohydrateRepresentationProvider } from './representation/carbohydrate';
import { SpacefillRepresentationProvider } from './representation/spacefill';
import { DistanceRestraintRepresentationProvider } from './representation/distance-restraint';
import { PointRepresentationProvider } from './representation/point';
export class StructureRepresentationRegistry extends RepresentationRegistry<Structure> {
constructor() {
......@@ -31,6 +32,7 @@ export const BuiltInStructureRepresentations = {
'distance-restraint': DistanceRestraintRepresentationProvider,
'molecular-surface': MolecularSurfaceRepresentationProvider,
'molecular-volume': MolecularVolumeRepresentationProvider,
'point': PointRepresentationProvider,
'spacefill': SpacefillRepresentationProvider,
}
export type BuiltInStructureRepresentationsName = keyof typeof BuiltInStructureRepresentations
......
// /**
// * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
// *
// * @author Alexander Rose <alexander.rose@weirdbyte.de>
// */
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
// import { ElementPointVisual, ElementPointParams } from '../visual/element-point';
// import { UnitsRepresentation } from '../units-representation';
// import { ParamDefinition as PD } from 'mol-util/param-definition';
// import { StructureRepresentation } from '../representation';
// import { Representation } from 'mol-repr/representation';
// import { ThemeRegistryContext } from 'mol-theme/theme';
// import { Structure } from 'mol-model/structure';
import { ElementPointVisual, ElementPointParams } from '../visual/element-point';
import { UnitsRepresentation } from '../units-representation';
import { ParamDefinition as PD } from 'mol-util/param-definition';
import { StructureRepresentation, StructureRepresentationProvider } from '../representation';
import { Representation, RepresentationParamsGetter, RepresentationContext } from 'mol-repr/representation';
import { ThemeRegistryContext } from 'mol-theme/theme';
import { Structure } from 'mol-model/structure';
import { UnitKind, UnitKindOptions } from '../visual/util/common';
// export const PointParams = {
// ...ElementPointParams,
// }
// export function getPointParams(ctx: ThemeRegistryContext, structure: Structure) {
// return PointParams // TODO return copy
// }
// export type PointProps = PD.DefaultValues<typeof PointParams>
const PointVisuals = {
'element-point': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, ElementPointParams>) => UnitsRepresentation('Points', ctx, getParams, ElementPointVisual),
}
// 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 {
// return Representation.createMulti('Point', defaultProps, [
// UnitsRepresentation('Point', defaultProps, ElementPointVisual)
// ])
// }
\ No newline at end of file
export type PointRepresentation = StructureRepresentation<PointParams>
export function PointRepresentation(ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, PointParams>): PointRepresentation {
return Representation.createMulti('Point', ctx, getParams, PointVisuals as unknown as Representation.Def<Structure, PointParams>)
}
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';
export const ElementPointParams = {
...UnitsPointsParams,
// sizeFactor: PD.Numeric(1.0, { min: 0, max: 10, step: 0.01 }),
pointSizeAttenuation: PD.Boolean(false),
}
export type ElementPointParams = typeof ElementPointParams
......@@ -25,6 +26,8 @@ export type ElementPointParams = typeof ElementPointParams
// TODO size
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 n = elements.length
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