From fea490eaaef7d83592eddd65f254d20fc1615c4c Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Wed, 14 Nov 2018 15:06:20 -0800 Subject: [PATCH] geo params cleanup --- src/mol-geo/geometry/direct-volume/direct-volume.ts | 7 +++---- src/mol-geo/geometry/geometry.ts | 11 +++++------ src/mol-geo/geometry/lines/lines.ts | 7 +++---- src/mol-geo/geometry/mesh/mesh.ts | 7 +++---- src/mol-geo/geometry/points/points.ts | 7 +++---- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/mol-geo/geometry/direct-volume/direct-volume.ts b/src/mol-geo/geometry/direct-volume/direct-volume.ts index 50dfc577d..919699272 100644 --- a/src/mol-geo/geometry/direct-volume/direct-volume.ts +++ b/src/mol-geo/geometry/direct-volume/direct-volume.ts @@ -75,10 +75,9 @@ export namespace DirectVolume { renderMode: PD.Select('Render Mode', '', 'isosurface', RenderModeOptions), controlPoints: PD.Text('Control Points', '', '0.19:0.1, 0.2:0.5, 0.21:0.1, 0.4:0.3'), } - export const DefaultProps = PD.getDefaultValues(Params) - export type Props = typeof DefaultProps + export type Params = typeof Params - export async function createValues(ctx: RuntimeContext, directVolume: DirectVolume, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: Props): Promise<DirectVolumeValues> { + export async function createValues(ctx: RuntimeContext, directVolume: DirectVolume, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: PD.Values<Params>): Promise<DirectVolumeValues> { const { gridTexture, gridTextureDim } = directVolume const { bboxSize, bboxMin, bboxMax, gridDimension, transform: gridTransform } = directVolume @@ -126,7 +125,7 @@ export namespace DirectVolume { } } - export function updateValues(values: DirectVolumeValues, props: Props) { + export function updateValues(values: DirectVolumeValues, props: PD.Values<Params>) { const vertices = new Float32Array(values.aPosition.ref.value) transformPositionArray(values.uTransform.ref.value, vertices, 0, vertices.length / 3) const boundingSphere = calculateBoundingSphere( diff --git a/src/mol-geo/geometry/geometry.ts b/src/mol-geo/geometry/geometry.ts index 7e364387c..79d665d11 100644 --- a/src/mol-geo/geometry/geometry.ts +++ b/src/mol-geo/geometry/geometry.ts @@ -72,12 +72,11 @@ export namespace Geometry { colorTheme: PD.Select<BuiltInColorThemeName>('Color Name', '', 'uniform', BuiltInColorThemeOptions), sizeTheme: PD.Select<BuiltInSizeThemeName>('Size Name', '', 'uniform', BuiltInSizeThemeOptions), } - export const DefaultProps = PD.getDefaultValues(Params) - export type Props = typeof DefaultProps + export type Params = typeof Params export type Counts = { drawCount: number, groupCount: number, instanceCount: number } - export function createValues(props: Props, counts: Counts) { + export function createValues(props: PD.Values<Params>, counts: Counts) { return { uAlpha: ValueCell.create(props.alpha), uHighlightColor: ValueCell.create(Color.toArrayNormalized(props.highlightColor, Vec3.zero(), 0)), @@ -88,7 +87,7 @@ export namespace Geometry { } } - export function updateValues(values: BaseValues, props: Props) { + export function updateValues(values: BaseValues, props: PD.Values<Params>) { if (Color.fromNormalizedArray(values.uHighlightColor.ref.value, 0) !== props.highlightColor) { ValueCell.update(values.uHighlightColor, Color.toArrayNormalized(props.highlightColor, values.uHighlightColor.ref.value, 0)) } @@ -102,14 +101,14 @@ export namespace Geometry { // -export function createRenderableState(props: Geometry.Props): RenderableState { +export function createRenderableState(props: PD.Values<Geometry.Params>): RenderableState { return { visible: true, depthMask: props.depthMask } } -export function updateRenderableState(state: RenderableState, props: Geometry.Props) { +export function updateRenderableState(state: RenderableState, props: PD.Values<Geometry.Params>) { state.depthMask = props.depthMask } diff --git a/src/mol-geo/geometry/lines/lines.ts b/src/mol-geo/geometry/lines/lines.ts index 4c5a48a73..0cf5bfef2 100644 --- a/src/mol-geo/geometry/lines/lines.ts +++ b/src/mol-geo/geometry/lines/lines.ts @@ -97,10 +97,9 @@ export namespace Lines { ...Geometry.Params, lineSizeAttenuation: PD.Boolean('Line Size Attenuation', '', false), } - export const DefaultProps = PD.getDefaultValues(Params) - export type Props = typeof DefaultProps + export type Params = typeof Params - export async function createValues(ctx: RuntimeContext, lines: Lines, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: Props): Promise<LinesValues> { + export async function createValues(ctx: RuntimeContext, lines: Lines, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: PD.Values<Params>): Promise<LinesValues> { const { instanceCount, groupCount } = locationIt const color = await createColors(ctx, locationIt, theme.color) const size = await createSizes(ctx, locationIt, theme.size) @@ -138,7 +137,7 @@ export namespace Lines { } } - export function updateValues(values: LinesValues, props: Props) { + export function updateValues(values: LinesValues, props: PD.Values<Params>) { const boundingSphere = Sphere3D.addSphere( calculateBoundingSphere( values.aStart.ref.value, Math.floor(values.aStart.ref.value.length / 3), diff --git a/src/mol-geo/geometry/mesh/mesh.ts b/src/mol-geo/geometry/mesh/mesh.ts index 0c1a8f5cf..0f7910745 100644 --- a/src/mol-geo/geometry/mesh/mesh.ts +++ b/src/mol-geo/geometry/mesh/mesh.ts @@ -345,10 +345,9 @@ export namespace Mesh { flipSided: PD.Boolean('Flip Sided', '', false), flatShaded: PD.Boolean('Flat Shaded', '', false), } - export const DefaultProps = PD.getDefaultValues(Params) - export type Props = typeof DefaultProps + export type Params = typeof Params - export async function createValues(ctx: RuntimeContext, mesh: Mesh, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: Props): Promise<MeshValues> { + export async function createValues(ctx: RuntimeContext, mesh: Mesh, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: PD.Values<Params>): Promise<MeshValues> { const { instanceCount, groupCount } = locationIt const color = await createColors(ctx, locationIt, theme.color) const marker = createMarkers(instanceCount * groupCount) @@ -377,7 +376,7 @@ export namespace Mesh { } } - export function updateValues(values: MeshValues, props: Props) { + export function updateValues(values: MeshValues, props: PD.Values<Params>) { const boundingSphere = calculateBoundingSphere( values.aPosition.ref.value, Math.floor(values.aPosition.ref.value.length / 3), values.aTransform.ref.value, values.instanceCount.ref.value diff --git a/src/mol-geo/geometry/points/points.ts b/src/mol-geo/geometry/points/points.ts index 616e7e057..2b245338d 100644 --- a/src/mol-geo/geometry/points/points.ts +++ b/src/mol-geo/geometry/points/points.ts @@ -61,10 +61,9 @@ export namespace Points { pointFilledCircle: PD.Boolean('Point Filled Circle', '', false), pointEdgeBleach: PD.Numeric('Point Edge Bleach', '', 0.2, 0, 1, 0.05), } - export const DefaultProps = PD.getDefaultValues(Params) - export type Props = typeof DefaultProps + export type Params = typeof Params - export async function createValues(ctx: RuntimeContext, points: Points, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: Props): Promise<PointsValues> { + export async function createValues(ctx: RuntimeContext, points: Points, transform: TransformData, locationIt: LocationIterator, theme: Theme, props: PD.Values<Params>): Promise<PointsValues> { const { instanceCount, groupCount } = locationIt const color = await createColors(ctx, locationIt, theme.color) const size = await createSizes(ctx, locationIt, theme.size) @@ -93,7 +92,7 @@ export namespace Points { } } - export function updateValues(values: PointsValues, props: Props) { + export function updateValues(values: PointsValues, props: PD.Values<Params>) { const boundingSphere = calculateBoundingSphere( values.aPosition.ref.value, Math.floor(values.aPosition.ref.value.length / 3), values.aTransform.ref.value, values.instanceCount.ref.value -- GitLab