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

geo & repr data update tweaks

parent 27f94c81
Branches
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ export function createClipping(count: number, clippingData?: ClippingData): Clip ...@@ -34,7 +34,7 @@ export function createClipping(count: number, clippingData?: ClippingData): Clip
if (clippingData) { if (clippingData) {
ValueCell.update(clippingData.tClipping, clipping); ValueCell.update(clippingData.tClipping, clipping);
ValueCell.update(clippingData.uClippingTexDim, Vec2.create(clipping.width, clipping.height)); ValueCell.update(clippingData.uClippingTexDim, Vec2.create(clipping.width, clipping.height));
ValueCell.update(clippingData.dClipping, count > 0); ValueCell.updateIfChanged(clippingData.dClipping, count > 0);
return clippingData; return clippingData;
} else { } else {
return { return {
......
/** /**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2018-2020 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>
*/ */
...@@ -34,9 +34,7 @@ export function createColors(locationIt: LocationIterator, colorTheme: ColorThem ...@@ -34,9 +34,7 @@ export function createColors(locationIt: LocationIterator, colorTheme: ColorThem
export function createValueColor(value: Color, colorData?: ColorData): ColorData { export function createValueColor(value: Color, colorData?: ColorData): ColorData {
if (colorData) { if (colorData) {
ValueCell.update(colorData.uColor, Color.toVec3Normalized(colorData.uColor.ref.value, value)); ValueCell.update(colorData.uColor, Color.toVec3Normalized(colorData.uColor.ref.value, value));
if (colorData.dColorType.ref.value !== 'uniform') { ValueCell.updateIfChanged(colorData.dColorType, 'uniform');
ValueCell.update(colorData.dColorType, 'uniform');
}
return colorData; return colorData;
} else { } else {
return { return {
...@@ -57,9 +55,7 @@ export function createTextureColor(colors: TextureImage<Uint8Array>, type: Color ...@@ -57,9 +55,7 @@ export function createTextureColor(colors: TextureImage<Uint8Array>, type: Color
if (colorData) { if (colorData) {
ValueCell.update(colorData.tColor, colors); ValueCell.update(colorData.tColor, colors);
ValueCell.update(colorData.uColorTexDim, Vec2.create(colors.width, colors.height)); ValueCell.update(colorData.uColorTexDim, Vec2.create(colors.width, colors.height));
if (colorData.dColorType.ref.value !== type) { ValueCell.updateIfChanged(colorData.dColorType, type);
ValueCell.update(colorData.dColorType, type);
}
return colorData; return colorData;
} else { } else {
return { return {
......
/** /**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2019-2020 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>
*/ */
...@@ -33,7 +33,7 @@ export function createOverpaint(count: number, overpaintData?: OverpaintData): O ...@@ -33,7 +33,7 @@ export function createOverpaint(count: number, overpaintData?: OverpaintData): O
if (overpaintData) { if (overpaintData) {
ValueCell.update(overpaintData.tOverpaint, overpaint); ValueCell.update(overpaintData.tOverpaint, overpaint);
ValueCell.update(overpaintData.uOverpaintTexDim, Vec2.create(overpaint.width, overpaint.height)); ValueCell.update(overpaintData.uOverpaintTexDim, Vec2.create(overpaint.width, overpaint.height));
ValueCell.update(overpaintData.dOverpaint, count > 0); ValueCell.updateIfChanged(overpaintData.dOverpaint, count > 0);
return overpaintData; return overpaintData;
} else { } else {
return { return {
......
...@@ -64,9 +64,7 @@ function createEmptySizeTexture() { ...@@ -64,9 +64,7 @@ function createEmptySizeTexture() {
export function createValueSize(value: number, sizeData?: SizeData): SizeData { export function createValueSize(value: number, sizeData?: SizeData): SizeData {
if (sizeData) { if (sizeData) {
ValueCell.update(sizeData.uSize, value); ValueCell.update(sizeData.uSize, value);
if (sizeData.dSizeType.ref.value !== 'uniform') { ValueCell.updateIfChanged(sizeData.dSizeType, 'uniform');
ValueCell.update(sizeData.dSizeType, 'uniform');
}
return sizeData; return sizeData;
} else { } else {
return { return {
...@@ -86,9 +84,7 @@ export function createTextureSize(sizes: TextureImage<Uint8Array>, type: SizeTyp ...@@ -86,9 +84,7 @@ export function createTextureSize(sizes: TextureImage<Uint8Array>, type: SizeTyp
if (sizeData) { if (sizeData) {
ValueCell.update(sizeData.tSize, sizes); ValueCell.update(sizeData.tSize, sizes);
ValueCell.update(sizeData.uSizeTexDim, Vec2.create(sizes.width, sizes.height)); ValueCell.update(sizeData.uSizeTexDim, Vec2.create(sizes.width, sizes.height));
if (sizeData.dSizeType.ref.value !== type) { ValueCell.updateIfChanged(sizeData.dSizeType, type);
ValueCell.update(sizeData.dSizeType, type);
}
return sizeData; return sizeData;
} else { } else {
return { return {
......
/** /**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2019-2020 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>
*/ */
...@@ -31,7 +31,7 @@ export function createTransparency(count: number, transparencyData?: Transparenc ...@@ -31,7 +31,7 @@ export function createTransparency(count: number, transparencyData?: Transparenc
if (transparencyData) { if (transparencyData) {
ValueCell.update(transparencyData.tTransparency, transparency); ValueCell.update(transparencyData.tTransparency, transparency);
ValueCell.update(transparencyData.uTransparencyTexDim, Vec2.create(transparency.width, transparency.height)); ValueCell.update(transparencyData.uTransparencyTexDim, Vec2.create(transparency.width, transparency.height));
ValueCell.update(transparencyData.dTransparency, count > 0); ValueCell.updateIfChanged(transparencyData.dTransparency, count > 0);
return transparencyData; return transparencyData;
} else { } else {
return { return {
......
...@@ -21,13 +21,14 @@ import { Task } from '../../../mol-task'; ...@@ -21,13 +21,14 @@ import { Task } from '../../../mol-task';
import { IndexPairBonds } from '../../../mol-model-formats/structure/property/bonds/index-pair'; import { IndexPairBonds } from '../../../mol-model-formats/structure/property/bonds/index-pair';
import { createModels } from '../../../mol-model-formats/structure/basic/parser'; import { createModels } from '../../../mol-model-formats/structure/basic/parser';
import { MmcifFormat } from '../../../mol-model-formats/structure/mmcif'; import { MmcifFormat } from '../../../mol-model-formats/structure/mmcif';
import { ChainIndex } from './indexing'; import { ChainIndex, ElementIndex } from './indexing';
import { SymmetryOperator } from '../../../mol-math/geometry'; import { SymmetryOperator } from '../../../mol-math/geometry';
import { ModelSymmetry } from '../../../mol-model-formats/structure/property/symmetry'; import { ModelSymmetry } from '../../../mol-model-formats/structure/property/symmetry';
import { Column } from '../../../mol-data/db'; import { Column } from '../../../mol-data/db';
import { CustomModelProperty } from '../../../mol-model-props/common/custom-model-property'; import { CustomModelProperty } from '../../../mol-model-props/common/custom-model-property';
import { Trajectory, ArrayTrajectory } from '../trajectory'; import { Trajectory, ArrayTrajectory } from '../trajectory';
import { Unit } from '../structure'; import { Unit } from '../structure';
import SortedArray from '../../../mol-data/int/sorted-array';
/** /**
* Interface to the "source data" of the molecule. * Interface to the "source data" of the molecule.
...@@ -206,7 +207,7 @@ export namespace Model { ...@@ -206,7 +207,7 @@ export namespace Model {
const CoordinatesHistoryProp = '__CoordinatesHistory__'; const CoordinatesHistoryProp = '__CoordinatesHistory__';
export type CoordinatesHistory = { export type CoordinatesHistory = {
areEqual(unit: Unit, model: Model): boolean areEqual(elements: SortedArray<ElementIndex>, kind: Unit.Kind, model: Model): boolean
} }
export const CoordinatesHistory = { export const CoordinatesHistory = {
get(model: Model): CoordinatesHistory | undefined { get(model: Model): CoordinatesHistory | undefined {
......
...@@ -496,7 +496,7 @@ namespace Unit { ...@@ -496,7 +496,7 @@ namespace Unit {
export function isSameConformation(u: Unit, model: Model) { export function isSameConformation(u: Unit, model: Model) {
const coordsHistory = Model.CoordinatesHistory.get(Model.getRoot(model)); const coordsHistory = Model.CoordinatesHistory.get(Model.getRoot(model));
if (coordsHistory?.areEqual(u, model)) return true; if (coordsHistory) return coordsHistory.areEqual(u.elements, u.kind, model);
const xs = u.elements; const xs = u.elements;
const { x: xa, y: ya, z: za } = u.conformation.coordinates; const { x: xa, y: ya, z: za } = u.conformation.coordinates;
......
...@@ -98,7 +98,7 @@ export function ComplexVisual<G extends Geometry, P extends StructureParams & Ge ...@@ -98,7 +98,7 @@ export function ComplexVisual<G extends Geometry, P extends StructureParams & Ge
setUpdateState(updateState, newProps, currentProps, newTheme, currentTheme, newStructure, currentStructure); setUpdateState(updateState, newProps, currentProps, newTheme, currentTheme, newStructure, currentStructure);
if (Structure.conformationHash(newStructure) !== Structure.conformationHash(currentStructure)) { if (!Structure.areHierarchiesEqual(newStructure, currentStructure)) {
updateState.updateTransform = true; updateState.updateTransform = true;
updateState.createGeometry = true; updateState.createGeometry = true;
} }
...@@ -113,6 +113,7 @@ export function ComplexVisual<G extends Geometry, P extends StructureParams & Ge ...@@ -113,6 +113,7 @@ export function ComplexVisual<G extends Geometry, P extends StructureParams & Ge
if (updateState.createGeometry) { if (updateState.createGeometry) {
updateState.updateColor = true; updateState.updateColor = true;
updateState.updateSize = true;
} }
} }
...@@ -241,7 +242,7 @@ export function ComplexMeshVisual<P extends ComplexMeshParams>(builder: ComplexM ...@@ -241,7 +242,7 @@ export function ComplexMeshVisual<P extends ComplexMeshParams>(builder: ComplexM
...builder, ...builder,
setUpdateState: (state: VisualUpdateState, newProps: PD.Values<P>, currentProps: PD.Values<P>, newTheme: Theme, currentTheme: Theme, newStructure: Structure, currentStructure: Structure) => { setUpdateState: (state: VisualUpdateState, newProps: PD.Values<P>, currentProps: PD.Values<P>, newTheme: Theme, currentTheme: Theme, newStructure: Structure, currentStructure: Structure) => {
builder.setUpdateState(state, newProps, currentProps, newTheme, currentTheme, newStructure, currentStructure); builder.setUpdateState(state, newProps, currentProps, newTheme, currentTheme, newStructure, currentStructure);
if (!SizeTheme.areEqual(newTheme.size, currentTheme.size)) state.updateSize = true; if (!SizeTheme.areEqual(newTheme.size, currentTheme.size)) state.createGeometry = true;
}, },
geometryUtils: Mesh.Utils geometryUtils: Mesh.Utils
}, materialId); }, materialId);
......
...@@ -111,6 +111,7 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom ...@@ -111,6 +111,7 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom
// console.log('new hierarchy'); // console.log('new hierarchy');
updateState.updateTransform = true; updateState.updateTransform = true;
updateState.updateColor = true; updateState.updateColor = true;
updateState.updateSize = true;
} }
if (!ColorTheme.areEqual(newTheme.color, currentTheme.color)) { if (!ColorTheme.areEqual(newTheme.color, currentTheme.color)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment