import { vec3 } from 'gl-matrix' ; import { Buffer } from './Buffer' ; export class MeshBuffer extends Buffer { public static bytes = 20 ; constructor ( length ) { super ( 2 , length ) ; } public append ( meshData ) { this . appendI ( meshData . faceCount ) ; this . appendI ( meshData . vertexOffset ) ; this . appendI ( meshData . slabCount ?? 0 ) ; this . appendI ( meshData . slabOffset ?? 0 ) ; this . appendF ( meshData . specularExponent ?? 100 ) ; this . pad ( 3 ) ; this . appendF ( meshData . diffuseColor [ 0 ] || 0 ) ; this . appendF ( meshData . diffuseColor [ 1 ] || 0 ) ; this . appendF ( meshData . diffuseColor [ 2 ] || 0 ) ; this . pad ( 1 ) ; this . appendF ( meshData . specularColor [ 0 ] || 0 ) ; this . appendF ( meshData . specularColor [ 1 ] || 0 ) ; this . appendF ( meshData . specularColor [ 2 ] || 0 ) ; this . pad ( 1 ) ; this . appendF ( meshData . refractionColor [ 0 ] || 0 ) ; this . appendF ( meshData . refractionColor [ 1 ] || 0 ) ; this . appendF ( meshData . refractionColor [ 2 ] || 0 ) ; this . pad ( 1 ) ; } }