add animation support to texture-mesh geometry

This commit is contained in:
Alexander Rose
2026-04-27 22:30:58 -07:00
parent 6a7f892d60
commit dfcc4e400d
3 changed files with 8 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ import { WebGLContext } from '../../../mol-gl/webgl/context';
import { createEmptyEmissive } from '../emissive-data';
import { createEmptyWiggle } from '../wiggle-data';
import { createInteriorValues, getInteriorParam, updateInteriorValues } from '../interior';
import { getAnimationParam, createAnimationValues, updateAnimationValues } from '../animation';
export interface TextureMesh {
readonly kind: 'texture-mesh',
@@ -131,6 +132,7 @@ export namespace TextureMesh {
bumpFrequency: PD.Numeric(0, { min: 0, max: 10, step: 0.1 }, BaseGeometry.ShadingCategory),
bumpAmplitude: PD.Numeric(1, { min: 0, max: 5, step: 0.1 }, BaseGeometry.ShadingCategory),
interior: getInteriorParam(),
animation: getAnimationParam(),
};
export type Params = typeof Params
@@ -253,6 +255,7 @@ export namespace TextureMesh {
meta: ValueCell.create(textureMesh.meta),
...createInteriorValues(props.interior),
...createAnimationValues(props.animation),
};
}
@@ -274,6 +277,7 @@ export namespace TextureMesh {
ValueCell.updateIfChanged(values.uBumpFrequency, props.bumpFrequency);
ValueCell.updateIfChanged(values.uBumpAmplitude, props.bumpAmplitude);
updateInteriorValues(values, props.interior);
updateAnimationValues(values, props.animation);
}
function updateBoundingSphere(values: TextureMeshValues, textureMesh: TextureMesh) {

View File

@@ -7,7 +7,7 @@
import { Renderable, RenderableState, createRenderable } from '../renderable';
import { WebGLContext } from '../webgl/context';
import { createGraphicsRenderItem, Transparency } from '../webgl/render-item';
import { GlobalUniformSchema, BaseSchema, DefineSpec, Values, InternalSchema, InternalValues, UniformSpec, TextureSpec, GlobalTextureSchema, ValueSpec, GlobalDefineValues, GlobalDefines, GlobalDefineSchema, InteriorSchema } from './schema';
import { GlobalUniformSchema, BaseSchema, DefineSpec, Values, InternalSchema, InternalValues, UniformSpec, TextureSpec, GlobalTextureSchema, ValueSpec, GlobalDefineValues, GlobalDefines, GlobalDefineSchema, InteriorSchema, AnimationSchema } from './schema';
import { MeshShaderCode } from '../shader-code';
import { ValueCell } from '../../mol-util';
@@ -30,6 +30,7 @@ export const TextureMeshSchema = {
meta: ValueSpec('unknown'),
...InteriorSchema,
...AnimationSchema,
};
export type TextureMeshSchema = typeof TextureMeshSchema
export type TextureMeshValues = Values<TextureMeshSchema>

View File

@@ -11,9 +11,9 @@ mat4 modelView = uView * model;
#else
vec3 position = aPosition;
#endif
#ifndef dGeometryType_image
// #ifndef dGeometryType_image
position = applyWiggle(position, group, aInstance);
#endif
// #endif
vec4 position4 = vec4(position, 1.0);
// for accessing tColorGrid in vert shader and for clipping in frag shader
vModelPosition = (model * position4).xyz;