Bladeren bron

geo params cleanup

Alexander Rose 6 jaren geleden
bovenliggende
commit
fea490eaae

+ 3 - 4
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(

+ 5 - 6
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
 }
 

+ 3 - 4
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),

+ 3 - 4
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

+ 3 - 4
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