UNPKG

mdx-m3-viewer

Version:

A browser WebGL model viewer. Mainly focused on models of the games Warcraft 3 and Starcraft 2.

30 lines (24 loc) 1.17 kB
import { VEC3_ZERO, VEC3_ONE, QUAT_DEFAULT } from '../../../common/gl-matrix-addon'; import MdlxTextureAnimation from '../../../parsers/mdlx/textureanimation'; import AnimatedObject from './animatedobject'; import MdxModel from './model'; /** * An MDX texture animation. */ export default class TextureAnimation extends AnimatedObject { constructor(model: MdxModel, textureAnimation: MdlxTextureAnimation) { super(model, textureAnimation); this.addVariants('KTAT', 'translation'); this.addVariants('KTAR', 'rotation'); this.addVariants('KTAS', 'scale'); } getTranslation(out: Float32Array, sequence: number, frame: number, counter: number) { return this.getVectorValue(out, 'KTAT', sequence, frame, counter, <Float32Array>VEC3_ZERO); } getRotation(out: Float32Array, sequence: number, frame: number, counter: number) { return this.getQuatValue(out, 'KTAR', sequence, frame, counter, <Float32Array>QUAT_DEFAULT); } getScale(out: Float32Array, sequence: number, frame: number, counter: number) { return this.getVectorValue(out, 'KTAS', sequence, frame, counter, <Float32Array>VEC3_ONE); } }