|
@@ -47,6 +47,7 @@ export interface DirectVolume {
|
|
|
readonly unitToCartn: ValueCell<Mat4>
|
|
|
readonly cartnToUnit: ValueCell<Mat4>
|
|
|
readonly packedGroup: ValueCell<boolean>
|
|
|
+ readonly axisOrder: ValueCell<Vec3>
|
|
|
|
|
|
/** Bounding sphere of the volume */
|
|
|
readonly boundingSphere: Sphere3D
|
|
@@ -55,10 +56,10 @@ export interface DirectVolume {
|
|
|
}
|
|
|
|
|
|
export namespace DirectVolume {
|
|
|
- export function create(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean, directVolume?: DirectVolume): DirectVolume {
|
|
|
+ export function create(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean, axisOrder: Vec3, directVolume?: DirectVolume): DirectVolume {
|
|
|
return directVolume ?
|
|
|
- update(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, directVolume) :
|
|
|
- fromData(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup);
|
|
|
+ update(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder, directVolume) :
|
|
|
+ fromData(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder);
|
|
|
}
|
|
|
|
|
|
function hashCode(directVolume: DirectVolume) {
|
|
@@ -69,7 +70,7 @@ export namespace DirectVolume {
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- function fromData(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean): DirectVolume {
|
|
|
+ function fromData(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean, axisOrder: Vec3): DirectVolume {
|
|
|
const boundingSphere = Sphere3D();
|
|
|
let currentHash = -1;
|
|
|
|
|
@@ -100,6 +101,7 @@ export namespace DirectVolume {
|
|
|
return boundingSphere;
|
|
|
},
|
|
|
packedGroup: ValueCell.create(packedGroup),
|
|
|
+ axisOrder: ValueCell.create(axisOrder),
|
|
|
setBoundingSphere(sphere: Sphere3D) {
|
|
|
Sphere3D.copy(boundingSphere, sphere);
|
|
|
currentHash = hashCode(directVolume);
|
|
@@ -108,7 +110,7 @@ export namespace DirectVolume {
|
|
|
return directVolume;
|
|
|
}
|
|
|
|
|
|
- function update(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean, directVolume: DirectVolume): DirectVolume {
|
|
|
+ function update(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean, axisOrder: Vec3, directVolume: DirectVolume): DirectVolume {
|
|
|
const width = texture.getWidth();
|
|
|
const height = texture.getHeight();
|
|
|
const depth = texture.getDepth();
|
|
@@ -125,6 +127,7 @@ export namespace DirectVolume {
|
|
|
ValueCell.update(directVolume.unitToCartn, unitToCartn);
|
|
|
ValueCell.update(directVolume.cartnToUnit, Mat4.invert(Mat4(), unitToCartn));
|
|
|
ValueCell.updateIfChanged(directVolume.packedGroup, packedGroup);
|
|
|
+ ValueCell.updateIfChanged(directVolume.axisOrder, Vec3.fromArray(directVolume.axisOrder.ref.value, axisOrder, 0));
|
|
|
return directVolume;
|
|
|
}
|
|
|
|
|
@@ -137,7 +140,8 @@ export namespace DirectVolume {
|
|
|
const texture = createNullTexture();
|
|
|
const stats = Grid.One.stats;
|
|
|
const packedGroup = false;
|
|
|
- return create(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, directVolume);
|
|
|
+ const axisOrder = Vec3.create(0, 1, 2);
|
|
|
+ return create(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder, directVolume);
|
|
|
}
|
|
|
|
|
|
export const Params = {
|
|
@@ -260,6 +264,7 @@ export namespace DirectVolume {
|
|
|
uCartnToUnit: directVolume.cartnToUnit,
|
|
|
uUnitToCartn: directVolume.unitToCartn,
|
|
|
dPackedGroup: directVolume.packedGroup,
|
|
|
+ dAxisOrder: ValueCell.create(directVolume.axisOrder.ref.value.join('')),
|
|
|
|
|
|
dIgnoreLight: ValueCell.create(props.ignoreLight),
|
|
|
dXrayShaded: ValueCell.create(props.xrayShaded),
|