123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import Check from "../Core/Check.js";
- function getClipAndStyleCode(
- samplerUniformName,
- matrixUniformName,
- styleUniformName
- ) {
-
- Check.typeOf.string("samplerUniformName", samplerUniformName);
- Check.typeOf.string("matrixUniformName", matrixUniformName);
- Check.typeOf.string("styleUniformName", styleUniformName);
-
- var shaderCode =
- " float clipDistance = clip(gl_FragCoord, " +
- samplerUniformName +
- ", " +
- matrixUniformName +
- "); \n" +
- " vec4 clippingPlanesEdgeColor = vec4(1.0); \n" +
- " clippingPlanesEdgeColor.rgb = " +
- styleUniformName +
- ".rgb; \n" +
- " float clippingPlanesEdgeWidth = " +
- styleUniformName +
- ".a; \n" +
- " if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) \n" +
- " { \n" +
- " gl_FragColor = clippingPlanesEdgeColor;\n" +
- " } \n";
- return shaderCode;
- }
- export default getClipAndStyleCode;
|