UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

69 lines (67 loc) 1.73 kB
function createThinInstanceFragment(hasInstanceColor) { const attrs = [ { _name: "world0", _type: "vec4<f32>", _gpuFormat: "float32x4", _arrayStride: 64, _stepMode: "instance", _bufferGroup: "ti-matrix", _offset: 0 }, { _name: "world1", _type: "vec4<f32>", _gpuFormat: "float32x4", _arrayStride: 64, _stepMode: "instance", _bufferGroup: "ti-matrix", _offset: 16 }, { _name: "world2", _type: "vec4<f32>", _gpuFormat: "float32x4", _arrayStride: 64, _stepMode: "instance", _bufferGroup: "ti-matrix", _offset: 32 }, { _name: "world3", _type: "vec4<f32>", _gpuFormat: "float32x4", _arrayStride: 64, _stepMode: "instance", _bufferGroup: "ti-matrix", _offset: 48 } ]; if (hasInstanceColor) { attrs.push({ _name: "instanceColor", _type: "vec4<f32>", _gpuFormat: "float32x4", _arrayStride: 16, _stepMode: "instance", _bufferGroup: "ti-color", _offset: 0 }); } return { _id: "thin-instance", _vertexAttributes: attrs, _varyings: hasInstanceColor ? [{ _name: "vInstanceColor", _type: "vec4<f32>" }] : [], _vertexSlots: { VW: `let instanceWorld = mat4x4<f32>(world0, world1, world2, world3); finalWorld = mesh.world * instanceWorld;`, VB: hasInstanceColor ? `out.vInstanceColor = instanceColor;` : "" }, _fragmentSlots: hasInstanceColor ? { AT: `baseColor *= input.vInstanceColor.rgb; alpha *= input.vInstanceColor.a;` } : {} }; } export { createThinInstanceFragment }; //# sourceMappingURL=thin-instance-fragment-AwHktOAp.esm.js.map