UNPKG

@deck.gl/experimental-layers

Version:

Experimental layers for deck.gl

9 lines (8 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _default = "\n#define SHADER_NAME bitmap-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec2 texCoords;\n\nattribute float instanceBitmapIndex;\n\nattribute vec3 instanceCenter;\nattribute vec3 instanceRotation;\n\nvarying vec2 vTexCoord;\n\nvarying float vBitmapIndex;\n\nmat3 getRotationMatrix(vec3 rotation) {\n float sr = sin(rotation.x);\n float sp = sin(rotation.y);\n float sw = sin(rotation.z);\n\n float cr = cos(rotation.x);\n float cp = cos(rotation.y);\n float cw = cos(rotation.z);\n\n return mat3(\n cw * cp, // 0,0\n sw * cp, // 1,0\n -sp, // 2,0\n -sw * cr + cw * sp * sr, // 0,1\n cw * cr + sw * sp * sr, // 1,1\n cp * sr, // 2,1\n sw * sr + cw * sp * cr, // 0,2\n -cw * sr + sw * sp * cr, // 1,2\n cp * cr // 2,2\n );\n}\n\nvoid main(void) {\n mat3 rotationMatrix = getRotationMatrix(instanceRotation);\n \n // Calculate vertex position\n vec3 pos = positions * rotationMatrix + instanceCenter;\n vec3 vertex = project_position(pos);\n \n // Apply projection matrix\n gl_Position = project_to_clipspace(vec4(vertex, 1.0));\n\n vTexCoord = texCoords;\n vBitmapIndex = instanceBitmapIndex;\n}\n"; exports.default = _default; //# sourceMappingURL=bitmap-layer-vertex.js.map