38 lines
2.5 KiB
JavaScript
38 lines
2.5 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$mesh$gl$GlMeshAdaptor = function(global, require, module, exports) {
|
|
global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
|
|
var Matrix = require("module$node_modules$pixi_DOT_js$lib$maths$matrix$Matrix"), compileHighShaderToProgram = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compileHighShaderToProgram"), localUniformBit = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$shader_bits$localUniformBit"), roundPixelsBit = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$shader_bits$roundPixelsBit"), textureBit = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$shader_bits$textureBit"),
|
|
Shader = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$shader$Shader"), Texture = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$Texture"), warn = require("module$node_modules$pixi_DOT_js$lib$utils$logging$warn");
|
|
"use strict";
|
|
class GlMeshAdaptor {
|
|
init() {
|
|
const glProgram = compileHighShaderToProgram.compileHighShaderGlProgram({name:"mesh", bits:[localUniformBit.localUniformBitGl, textureBit.textureBitGl, roundPixelsBit.roundPixelsBitGl]});
|
|
this._shader = new Shader.Shader({glProgram, resources:{uTexture:Texture.Texture.EMPTY.source, textureUniforms:{uTextureMatrix:{type:"mat3x3\x3cf32\x3e", value:new Matrix.Matrix()}}}});
|
|
}
|
|
execute(meshPipe, mesh) {
|
|
const renderer = meshPipe.renderer;
|
|
let shader = mesh._shader;
|
|
if (!shader) {
|
|
shader = this._shader;
|
|
const texture = mesh.texture, source = texture.source;
|
|
shader.resources.uTexture = source;
|
|
shader.resources.uSampler = source.style;
|
|
shader.resources.textureUniforms.uniforms.uTextureMatrix = texture.textureMatrix.mapCoord;
|
|
} else if (!shader.glProgram) {
|
|
warn.warn("Mesh shader has no glProgram", mesh.shader);
|
|
return;
|
|
}
|
|
shader.groups[100] = renderer.globalUniforms.bindGroup;
|
|
shader.groups[101] = meshPipe.localUniformsBindGroup;
|
|
renderer.encoder.draw({geometry:mesh._geometry, shader, state:mesh.state});
|
|
}
|
|
destroy() {
|
|
this._shader.destroy(!0);
|
|
this._shader = null;
|
|
}
|
|
}
|
|
GlMeshAdaptor.extension = {type:[global.ExtensionType.WebGLPipesAdaptor], name:"mesh"};
|
|
exports.GlMeshAdaptor = GlMeshAdaptor;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$mesh$gl$GlMeshAdaptor.js.map
|