If you think the Android project Schooner-3D listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2012 Dan Mercer/*www.java2s.com*/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package com.supermercerbros.gameengine.shaders;
publicclass ProgramSource {
publicstaticfinal String PRECISION_LOW = "precision lowp float;\n";
publicstaticfinal String PRECISION_MEDIUM = "precision mediump float;\n";
publicstaticfinal String PRECISION_HIGH = "precision highp float;\n";
publicstaticfinal String MAIN_HEADER = "void main() {\n";
publicstaticfinal String MAIN_FOOTER = "}\n";
privatestaticfinal String EMPTY = "";
publicfinal String varyings;
publicfinal String vertPrecision;
publicfinal String vertVars;
publicfinal String vertMain;
publicfinal String vertMethods;
publicfinal String fragMain;
publicfinal String fragVars;
publicfinal String fragPrecision;
publicfinal String fragMethods;
public ProgramSource(String varyings,
String vertPrecision, String vertVars, String vertSource,
String fragPrecision, String fragVars, String fragSource) {
this(varyings, vertPrecision, vertVars, vertSource, null, fragPrecision, fragVars, fragSource, null);
}
public ProgramSource(String varyings, String vertPrecision,
String vertVars, String vertSource, String vertMethods,
String fragPrecision, String fragVars, String fragSource,
String fragMethods) {
if (vertVars == null) {
thrownew IllegalArgumentException("vertVars == null");
}
if (varyings == null) {
this.varyings = EMPTY;
} else {
this.varyings = varyings;
}
this.vertVars = vertVars;
if (fragVars == null) {
this.fragVars = EMPTY;
} else {
this.fragVars = fragVars;
}
this.vertMain = vertSource;
this.fragMain = fragSource;
if (vertPrecision == null) {
this.vertPrecision = EMPTY;
} else {
this.vertPrecision = vertPrecision;
}
if (fragPrecision == null) {
this.fragPrecision = PRECISION_MEDIUM;
} else {
this.fragPrecision = fragPrecision;
}
if (vertMethods == null) {
this.vertMethods = EMPTY;
} else {
this.vertMethods = vertMethods;
}
if (fragMethods == null) {
this.fragMethods = EMPTY;
} else {
this.fragMethods = fragMethods;
}
}
}