All files / engine/Source/Renderer ShaderDestination.js

100% Statements 7/7
100% Branches 4/4
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52                1x                         1x   84670x     84669x                         1x   84482x     84481x              
import Check from "../Core/Check.js";
 
/**
 * An enum describing whether a variable should be added to the
 * vertex shader, the fragment shader, or both.
 *
 * @private
 */
const ShaderDestination = {
  VERTEX: 0,
  FRAGMENT: 1,
  BOTH: 2,
};
 
/**
 * Check if a variable should be included in the vertex shader.
 *
 * @param {ShaderDestination} destination The ShaderDestination to check
 * @return {boolean} <code>true</code> if the variable appears in the vertex shader, or <code>false</code> otherwise
 * @private
 */
ShaderDestination.includesVertexShader = function (destination) {
  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.number("destination", destination);
  //>>includeEnd('debug');
 
  return (
    destination === ShaderDestination.VERTEX ||
    destination === ShaderDestination.BOTH
  );
};
 
/**
 * Check if a variable should be included in the vertex shader.
 *
 * @param {ShaderDestination} destination The ShaderDestination to check
 * @return {boolean} <code>true</code> if the variable appears in the vertex shader, or <code>false</code> otherwise
 * @private
 */
ShaderDestination.includesFragmentShader = function (destination) {
  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.number("destination", destination);
  //>>includeEnd('debug');
  //
  return (
    destination === ShaderDestination.FRAGMENT ||
    destination === ShaderDestination.BOTH
  );
};
 
export default Object.freeze(ShaderDestination);