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

geo params cleanup

parent a1168aa2
No related branches found
No related tags found
No related merge requests found
...@@ -75,10 +75,9 @@ export namespace DirectVolume { ...@@ -75,10 +75,9 @@ export namespace DirectVolume {
renderMode: PD.Select('Render Mode', '', 'isosurface', RenderModeOptions), 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'), 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 Params = typeof Params
export type Props = typeof DefaultProps
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 { gridTexture, gridTextureDim } = directVolume
const { bboxSize, bboxMin, bboxMax, gridDimension, transform: gridTransform } = directVolume const { bboxSize, bboxMin, bboxMax, gridDimension, transform: gridTransform } = directVolume
...@@ -126,7 +125,7 @@ export namespace 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) const vertices = new Float32Array(values.aPosition.ref.value)
transformPositionArray(values.uTransform.ref.value, vertices, 0, vertices.length / 3) transformPositionArray(values.uTransform.ref.value, vertices, 0, vertices.length / 3)
const boundingSphere = calculateBoundingSphere( const boundingSphere = calculateBoundingSphere(
......
...@@ -72,12 +72,11 @@ export namespace Geometry { ...@@ -72,12 +72,11 @@ export namespace Geometry {
colorTheme: PD.Select<BuiltInColorThemeName>('Color Name', '', 'uniform', BuiltInColorThemeOptions), colorTheme: PD.Select<BuiltInColorThemeName>('Color Name', '', 'uniform', BuiltInColorThemeOptions),
sizeTheme: PD.Select<BuiltInSizeThemeName>('Size Name', '', 'uniform', BuiltInSizeThemeOptions), sizeTheme: PD.Select<BuiltInSizeThemeName>('Size Name', '', 'uniform', BuiltInSizeThemeOptions),
} }
export const DefaultProps = PD.getDefaultValues(Params) export type Params = typeof Params
export type Props = typeof DefaultProps
export type Counts = { drawCount: number, groupCount: number, instanceCount: number } 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 { return {
uAlpha: ValueCell.create(props.alpha), uAlpha: ValueCell.create(props.alpha),
uHighlightColor: ValueCell.create(Color.toArrayNormalized(props.highlightColor, Vec3.zero(), 0)), uHighlightColor: ValueCell.create(Color.toArrayNormalized(props.highlightColor, Vec3.zero(), 0)),
...@@ -88,7 +87,7 @@ export namespace Geometry { ...@@ -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) { if (Color.fromNormalizedArray(values.uHighlightColor.ref.value, 0) !== props.highlightColor) {
ValueCell.update(values.uHighlightColor, Color.toArrayNormalized(props.highlightColor, values.uHighlightColor.ref.value, 0)) ValueCell.update(values.uHighlightColor, Color.toArrayNormalized(props.highlightColor, values.uHighlightColor.ref.value, 0))
} }
...@@ -102,14 +101,14 @@ export namespace Geometry { ...@@ -102,14 +101,14 @@ export namespace Geometry {
// //
export function createRenderableState(props: Geometry.Props): RenderableState { export function createRenderableState(props: PD.Values<Geometry.Params>): RenderableState {
return { return {
visible: true, visible: true,
depthMask: props.depthMask 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 state.depthMask = props.depthMask
} }
......
...@@ -97,10 +97,9 @@ export namespace Lines { ...@@ -97,10 +97,9 @@ export namespace Lines {
...Geometry.Params, ...Geometry.Params,
lineSizeAttenuation: PD.Boolean('Line Size Attenuation', '', false), lineSizeAttenuation: PD.Boolean('Line Size Attenuation', '', false),
} }
export const DefaultProps = PD.getDefaultValues(Params) export type Params = typeof Params
export type Props = typeof DefaultProps
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 { instanceCount, groupCount } = locationIt
const color = await createColors(ctx, locationIt, theme.color) const color = await createColors(ctx, locationIt, theme.color)
const size = await createSizes(ctx, locationIt, theme.size) const size = await createSizes(ctx, locationIt, theme.size)
...@@ -138,7 +137,7 @@ export namespace Lines { ...@@ -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( const boundingSphere = Sphere3D.addSphere(
calculateBoundingSphere( calculateBoundingSphere(
values.aStart.ref.value, Math.floor(values.aStart.ref.value.length / 3), values.aStart.ref.value, Math.floor(values.aStart.ref.value.length / 3),
......
...@@ -345,10 +345,9 @@ export namespace Mesh { ...@@ -345,10 +345,9 @@ export namespace Mesh {
flipSided: PD.Boolean('Flip Sided', '', false), flipSided: PD.Boolean('Flip Sided', '', false),
flatShaded: PD.Boolean('Flat Shaded', '', false), flatShaded: PD.Boolean('Flat Shaded', '', false),
} }
export const DefaultProps = PD.getDefaultValues(Params) export type Params = typeof Params
export type Props = typeof DefaultProps
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 { instanceCount, groupCount } = locationIt
const color = await createColors(ctx, locationIt, theme.color) const color = await createColors(ctx, locationIt, theme.color)
const marker = createMarkers(instanceCount * groupCount) const marker = createMarkers(instanceCount * groupCount)
...@@ -377,7 +376,7 @@ export namespace Mesh { ...@@ -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( const boundingSphere = calculateBoundingSphere(
values.aPosition.ref.value, Math.floor(values.aPosition.ref.value.length / 3), values.aPosition.ref.value, Math.floor(values.aPosition.ref.value.length / 3),
values.aTransform.ref.value, values.instanceCount.ref.value values.aTransform.ref.value, values.instanceCount.ref.value
......
...@@ -61,10 +61,9 @@ export namespace Points { ...@@ -61,10 +61,9 @@ export namespace Points {
pointFilledCircle: PD.Boolean('Point Filled Circle', '', false), pointFilledCircle: PD.Boolean('Point Filled Circle', '', false),
pointEdgeBleach: PD.Numeric('Point Edge Bleach', '', 0.2, 0, 1, 0.05), pointEdgeBleach: PD.Numeric('Point Edge Bleach', '', 0.2, 0, 1, 0.05),
} }
export const DefaultProps = PD.getDefaultValues(Params) export type Params = typeof Params
export type Props = typeof DefaultProps
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 { instanceCount, groupCount } = locationIt
const color = await createColors(ctx, locationIt, theme.color) const color = await createColors(ctx, locationIt, theme.color)
const size = await createSizes(ctx, locationIt, theme.size) const size = await createSizes(ctx, locationIt, theme.size)
...@@ -93,7 +92,7 @@ export namespace Points { ...@@ -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( const boundingSphere = calculateBoundingSphere(
values.aPosition.ref.value, Math.floor(values.aPosition.ref.value.length / 3), values.aPosition.ref.value, Math.floor(values.aPosition.ref.value.length / 3),
values.aTransform.ref.value, values.instanceCount.ref.value values.aTransform.ref.value, values.instanceCount.ref.value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment