|
@@ -32,23 +32,22 @@ export interface Isosurface {
|
|
|
readonly groupCount: ValueCell<number>,
|
|
|
|
|
|
readonly geoTextureDim: ValueCell<Vec2>,
|
|
|
- readonly vertexTexture: ValueCell<Texture>,
|
|
|
+ /** texture has vertex positions in XYZ and group id in W */
|
|
|
+ readonly vertexGroupTexture: ValueCell<Texture>,
|
|
|
readonly normalTexture: ValueCell<Texture>,
|
|
|
- readonly groupTexture: ValueCell<Texture>,
|
|
|
|
|
|
readonly boundingSphere: ValueCell<Sphere3D>,
|
|
|
}
|
|
|
|
|
|
export namespace Isosurface {
|
|
|
- export function create(vertexCount: number, groupCount: number, vertexTexture: Texture, normalTexture: Texture, groupTexture: Texture, boundingSphere: Sphere3D, isosurface?: Isosurface): Isosurface {
|
|
|
- const { width, height } = vertexTexture
|
|
|
+ export function create(vertexCount: number, groupCount: number, vertexGroupTexture: Texture, normalTexture: Texture, boundingSphere: Sphere3D, isosurface?: Isosurface): Isosurface {
|
|
|
+ const { width, height } = vertexGroupTexture
|
|
|
if (isosurface) {
|
|
|
ValueCell.update(isosurface.vertexCount, vertexCount)
|
|
|
ValueCell.update(isosurface.groupCount, groupCount)
|
|
|
ValueCell.update(isosurface.geoTextureDim, Vec2.set(isosurface.geoTextureDim.ref.value, width, height))
|
|
|
- ValueCell.update(isosurface.vertexTexture, vertexTexture)
|
|
|
+ ValueCell.update(isosurface.vertexGroupTexture, vertexGroupTexture)
|
|
|
ValueCell.update(isosurface.normalTexture, normalTexture)
|
|
|
- ValueCell.update(isosurface.groupTexture, groupTexture)
|
|
|
ValueCell.update(isosurface.boundingSphere, boundingSphere)
|
|
|
return isosurface
|
|
|
} else {
|
|
@@ -57,9 +56,8 @@ export namespace Isosurface {
|
|
|
vertexCount: ValueCell.create(vertexCount),
|
|
|
groupCount: ValueCell.create(groupCount),
|
|
|
geoTextureDim: ValueCell.create(Vec2.create(width, height)),
|
|
|
- vertexTexture: ValueCell.create(vertexTexture),
|
|
|
+ vertexGroupTexture: ValueCell.create(vertexGroupTexture),
|
|
|
normalTexture: ValueCell.create(normalTexture),
|
|
|
- groupTexture: ValueCell.create(groupTexture),
|
|
|
boundingSphere: ValueCell.create(boundingSphere),
|
|
|
}
|
|
|
}
|
|
@@ -101,11 +99,10 @@ export namespace Isosurface {
|
|
|
|
|
|
return {
|
|
|
uGeoTexDim: isosurface.geoTextureDim,
|
|
|
- tPosition: isosurface.vertexTexture,
|
|
|
+ tPositionGroup: isosurface.vertexGroupTexture,
|
|
|
tNormal: isosurface.normalTexture,
|
|
|
- tGroup: isosurface.groupTexture,
|
|
|
|
|
|
- // aGroup is used as a triangle index here and the group id is retirieved from the tGroup texture
|
|
|
+ // aGroup is used as a vertex index here and the group id is retirieved from tPositionGroup
|
|
|
aGroup: ValueCell.create(fillSerial(new Float32Array(isosurface.vertexCount.ref.value))),
|
|
|
boundingSphere: ValueCell.create(transformBoundingSphere),
|
|
|
invariantBoundingSphere: isosurface.boundingSphere,
|