Browse Source

cleanup, array util refactoring

Alexander Rose 6 years ago
parent
commit
3024c1718c

+ 1 - 1
src/mol-data/util/interval-iterator.ts

@@ -4,7 +4,7 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
- import Iterator from '../iterator'
+import Iterator from '../iterator'
 import { OrderedSet, Interval, Segmentation } from '../int';
 
 /** Emits a segment of length one for each element in the interval that is also in the set */

+ 1 - 1
src/mol-geo/representation/structure/visual/element-point.ts

@@ -9,7 +9,6 @@ import { ValueCell } from 'mol-util/value-cell'
 import { createPointRenderObject, PointRenderObject } from 'mol-gl/render-object'
 import { Unit } from 'mol-model/structure';
 import { RuntimeContext } from 'mol-task'
-import { fillSerial } from 'mol-gl/renderable/util';
 
 import { UnitsVisual, DefaultStructureProps } from '..';
 import VertexMap from '../../../shape/vertex-map';
@@ -23,6 +22,7 @@ import { PickingId } from '../../../util/picking';
 import { Loci } from 'mol-model/loci';
 import { MarkerAction, createMarkers } from '../../../util/marker-data';
 import { Vec3 } from 'mol-math/linear-algebra';
+import { fillSerial } from 'mol-util/array';
 
 export const DefaultPointProps = {
     ...DefaultStructureProps,

+ 1 - 1
src/mol-geo/representation/util.ts

@@ -7,9 +7,9 @@
 import { ValueCell } from 'mol-util/value-cell'
 import { BaseValues } from 'mol-gl/renderable/schema';
 import { MeshValues, RenderableState } from 'mol-gl/renderable';
-import { fillSerial } from 'mol-gl/renderable/util';
 import { defaults } from 'mol-util';
 import { Structure } from 'mol-model/structure';
+import { fillSerial } from 'mol-util/array';
 
 export const DefaultBaseProps = {
     alpha: 1,

+ 1 - 1
src/mol-geo/representation/volume/surface.ts

@@ -11,7 +11,6 @@ import { computeMarchingCubes } from '../../util/marching-cubes/algorithm';
 import { Mesh } from '../../shape/mesh';
 import { VolumeVisual } from '.';
 import { createMeshRenderObject, MeshRenderObject } from 'mol-gl/render-object';
-import { fillSerial } from 'mol-gl/renderable/util';
 import { ValueCell, defaults } from 'mol-util';
 import { Mat4 } from 'mol-math/linear-algebra';
 import { createUniformColor } from '../../util/color-data';
@@ -20,6 +19,7 @@ import { RenderableState, MeshValues } from 'mol-gl/renderable';
 import { PickingId } from '../../util/picking';
 import { createEmptyMarkers, MarkerAction } from '../../util/marker-data';
 import { Loci, EmptyLoci } from 'mol-model/loci';
+import { fillSerial } from 'mol-util/array';
 
 export function computeVolumeSurface(volume: VolumeData, isoValue: VolumeIsoValue) {
     return Task.create<Mesh>('Volume Surface', async ctx => {

+ 1 - 1
src/mol-gl/_spec/renderer.spec.ts

@@ -11,7 +11,6 @@ import { Vec3, Mat4 } from 'mol-math/linear-algebra';
 import { ValueCell } from 'mol-util';
 
 import Renderer from '../renderer';
-import { fillSerial } from '../renderable/util';
 import { createUniformColor } from 'mol-geo/util/color-data';
 import { createUniformSize } from 'mol-geo/util/size-data';
 import { createContext } from '../webgl/context';
@@ -20,6 +19,7 @@ import { createPointRenderObject } from '../render-object';
 import { PointValues } from '../renderable/point';
 import Scene from '../scene';
 import { createEmptyMarkers } from 'mol-geo/util/marker-data';
+import { fillSerial } from 'mol-util/array';
 
 // function writeImage(gl: WebGLRenderingContext, width: number, height: number) {
 //     const pixels = new Uint8Array(width * height * 4)

+ 0 - 6
src/mol-gl/renderable/util.ts

@@ -27,12 +27,6 @@ export function createTextureImage (n: number, itemSize: number): TextureImage {
     return { array: new Uint8Array(length), width, height }
 }
 
-export function fillSerial<T extends Helpers.NumberArray> (array: T) {
-    const n = array.length
-    for (let i = 0; i < n; ++i) array[ i ] = i
-    return array
-}
-
 export interface PositionValues {
     aPosition: ValueCell<Float32Array>
     drawCount: ValueCell<number>,

+ 6 - 0
src/mol-util/array.ts

@@ -41,4 +41,10 @@ export function arrayRms(array: Helpers.NumberArray) {
         sumSq += di * di
     }
     return Math.sqrt(sumSq / n)
+}
+
+export function fillSerial<T extends Helpers.NumberArray> (array: T) {
+    const n = array.length
+    for (let i = 0; i < n; ++i) array[ i ] = i
+    return array
 }