MCPcopy Index your code
hub / github.com/processing/processing / preprocessVertexSource

Method preprocessVertexSource

core/src/processing/opengl/PGL.java:1948–1985  ·  view source on GitHub ↗
(String[] vertSrc0,
                                                   int version,
                                                   String versionSuffix)

Source from the content-addressed store, hash-verified

1946 }
1947
1948 protected static String[] preprocessVertexSource(String[] vertSrc0,
1949 int version,
1950 String versionSuffix) {
1951 if (containsVersionDirective(vertSrc0)) {
1952 // The user knows what she or he is doing
1953 return vertSrc0;
1954 }
1955
1956 String[] vertSrc;
1957
1958 if (version < 130) {
1959 Pattern[] search = { };
1960 String[] replace = { };
1961 int offset = 1;
1962
1963 vertSrc = preprocessShaderSource(vertSrc0, search, replace, offset);
1964 vertSrc[0] = "#version " + version + versionSuffix;
1965 } else {
1966 // We need to replace 'texture' uniform by 'texMap' uniform and
1967 // 'textureXXX()' functions by 'texture()' functions. Order of these
1968 // replacements is important to prevent collisions between these two.
1969 Pattern[] search = new Pattern[] {
1970 Pattern.compile(String.format(GLSL_ID_REGEX, "varying")),
1971 Pattern.compile(String.format(GLSL_ID_REGEX, "attribute")),
1972 Pattern.compile(String.format(GLSL_ID_REGEX, "texture")),
1973 Pattern.compile(String.format(GLSL_FN_REGEX, "texture2DRect|texture2D|texture3D|textureCube"))
1974 };
1975 String[] replace = new String[] {
1976 "out", "in", "texMap", "texture",
1977 };
1978 int offset = 1;
1979
1980 vertSrc = preprocessShaderSource(vertSrc0, search, replace, offset);
1981 vertSrc[0] = "#version " + version + versionSuffix;
1982 }
1983
1984 return vertSrc;
1985 }
1986
1987
1988 protected static final String GLSL_ID_REGEX = "(?<![0-9A-Z_a-z])(%s)(?![0-9A-Z_a-z]|\\s*\\()";

Callers 3

initTex2DShaderMethod · 0.95
initTexRectShaderMethod · 0.95
loadVertexShaderMethod · 0.80

Calls 4

formatMethod · 0.65
compileMethod · 0.45

Tested by

no test coverage detected