本文整理汇总了Java中com.badlogic.gdx.graphics.glutils.ShaderProgram.pedantic方法的典型用法代码示例。如果您正苦于以下问题:Java ShaderProgram.pedantic方法的具体用法?Java ShaderProgram.pedantic怎么用?Java ShaderProgram.pedantic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.glutils.ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram.pedantic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupRendering
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private void setupRendering() {
ShaderProgram.pedantic = false;
gameCamera = new OrthographicCamera();
gameCamera.setToOrtho(false, BUFFER_WIDTH, BUFFER_HEIGHT);
gameCamera.translate(EDITOR_OFFSET, 0);
gameCamera.update();
starCamera = new OrthographicCamera();
starCamera.setToOrtho(false, BUFFER_WIDTH, BUFFER_HEIGHT);
starCamera.translate(STAR_EDITOR_OFFSET, 0);
starCamera.update();
screenCamera = new OrthographicCamera();
screenCamera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
screenCamera.update();
batch = new SpriteBatch();
pixelBuffer = new PixelBuffer();
}
示例2: createShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
static final public ShaderProgram createShader(String vertexName,
String fragmentName) {
/*String vertexShader = Gdx.files.classpath(
"bloom/bloomshaders/" + vertexName
+ ".vertex.glsl").readString();
String fragmentShader = Gdx.files.classpath(
"bloom/bloomshaders/" + fragmentName
+ ".fragment.glsl").readString();*/
String vertexShader = Gdx.files.internal(
"data/bloomshaders/" + vertexName
+ ".vertex.glsl").readString();
String fragmentShader = Gdx.files.internal(
"data/bloomshaders/" + fragmentName
+ ".fragment.glsl").readString();
ShaderProgram.pedantic = false;
ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
if (!shader.isCompiled()) {
System.out.println(shader.getLog());
Gdx.app.exit();
} else
Gdx.app.log("shader compiled", shader.getLog());
return shader;
}
示例3: create
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void create() {
//Load UI
gameHud = new GameHud(this, world);
ShaderProgram.pedantic = false;
program = new ShaderProgram(Gdx.files.internal("shaders/sepia.vsh"), Gdx.files.internal("shaders/sepia.fsh"));
if (!program.isCompiled()) {
System.out.println(program.getLog());
}
camera = new OrthoCamera();
Timer.startGameTime();
resize(Settings.getWidth(), Settings.getHeight());
}
示例4: ShaderBatch
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public ShaderBatch(float brightness, float contrast)
{
ShaderProgram.pedantic = false;
ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
setShader(shader);
shader.begin();
int brightnessLoc = shader.getUniformLocation("brightness");
int contrastLoc = shader.getUniformLocation("contrast");
shader.setUniformf(brightnessLoc, brightness);
shader.setUniformf(contrastLoc, contrast);
shader.end();
}
示例5: initShaderProgram
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public EscapyShaderRender initShaderProgram(String VERTEX, String FRAGMENT) {
ShaderProgram.pedantic = false;
this.blurProgram = new ShaderProgram(new FileHandle(VERTEX), new FileHandle(FRAGMENT));
super.checkStatus(blurProgram);
return this;
}
示例6: createLightShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
static final public ShaderProgram createLightShader() {
String gamma = "";
if (RayHandler.getGammaCorrection())
gamma = "sqrt";
final String vertexShader =
"attribute vec4 vertex_positions;\n" //
+ "attribute vec4 quad_colors;\n" //
+ "attribute float s;\n"
+ "uniform mat4 u_projTrans;\n" //
+ "varying vec4 v_color;\n" //
+ "void main()\n" //
+ "{\n" //
+ " v_color = s * quad_colors;\n" //
+ " gl_Position = u_projTrans * vertex_positions;\n" //
+ "}\n";
final String fragmentShader = "#ifdef GL_ES\n" //
+ "precision lowp float;\n" //
+ "#define MED mediump\n"
+ "#else\n"
+ "#define MED \n"
+ "#endif\n" //
+ "varying vec4 v_color;\n" //
+ "void main()\n"//
+ "{\n" //
+ " gl_FragColor = "+gamma+"(v_color);\n" //
+ "}";
ShaderProgram.pedantic = false;
ShaderProgram lightShader = new ShaderProgram(vertexShader,
fragmentShader);
if (lightShader.isCompiled() == false) {
Gdx.app.log("ERROR", lightShader.getLog());
}
return lightShader;
}
示例7: EscapyStdShaderRenderer
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/**
* Instantiates a new escapy std shader renderer.
*/
public EscapyStdShaderRenderer() {
super();
ShaderProgram.pedantic = false;
this.stdProgram = SpriteBatch.createDefaultShader();
}
示例8: initShaderProgram
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public EscapyShaderRender initShaderProgram(String VERTEX, String FRAGMENT) {
ShaderProgram.pedantic = false;
this.stdProgram = new ShaderProgram(new FileHandle(VERTEX), new FileHandle(FRAGMENT));
super.checkStatus(stdProgram);
return this;
}
示例9: initShaderProgram
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public EscapyLightSrcRenderer initShaderProgram(String VERTEX, String FRAGMENT) {
ShaderProgram.pedantic = false;
this.colorizeShader = new ShaderProgram(new FileHandle(VERTEX), new FileHandle(FRAGMENT));
super.checkStatus(colorizeShader);
return this;
}
示例10: createShadowShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
static final public ShaderProgram createShadowShader() {
final String vertexShader = "attribute vec4 a_position;\n" //
+ "attribute vec2 a_texCoord;\n" //
+ "varying vec2 v_texCoords;\n" //
+ "\n" //
+ "void main()\n" //
+ "{\n" //
+ " v_texCoords = a_texCoord;\n" //
+ " gl_Position = a_position;\n" //
+ "}\n";
final String fragmentShader = "#ifdef GL_ES\n" //
+ "precision lowp float;\n" //
+ "#define MED mediump\n"
+ "#else\n"
+ "#define MED \n"
+ "#endif\n" //
+ "varying MED vec2 v_texCoords;\n" //
+ "uniform sampler2D u_texture;\n" //
+ "void main()\n"//
+ "{\n" //
+ "gl_FragColor = texture2D(u_texture, v_texCoords);\n"
+ "}\n";
ShaderProgram.pedantic = false;
ShaderProgram woShadowShader = new ShaderProgram(vertexShader,
fragmentShader);
if (woShadowShader.isCompiled() == false) {
Gdx.app.log("ERROR", woShadowShader.getLog());
}
return woShadowShader;
}
示例11: createShadowShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
static final public ShaderProgram createShadowShader() {
final String vertexShader = "attribute vec4 a_position;\n" //
+ "attribute vec2 a_texCoord;\n" //
+ "varying vec2 v_texCoords;\n" //
+ "\n" //
+ "void main()\n" //
+ "{\n" //
+ " v_texCoords = a_texCoord;\n" //
+ " gl_Position = a_position;\n" //
+ "}\n";
final String fragmentShader = "#ifdef GL_ES\n" //
+ "precision lowp float;\n" //
+ "#define MED mediump\n"
+ "#else\n"
+ "#define MED \n"
+ "#endif\n" //
+ "varying MED vec2 v_texCoords;\n" //
+ "uniform sampler2D u_texture;\n" //
+ "uniform vec4 ambient;\n"
+ "void main()\n"//
+ "{\n" //
+ "vec4 c = texture2D(u_texture, v_texCoords);\n"//
+ "gl_FragColor.rgb = c.rgb * c.a + ambient.rgb;\n"//
+ "gl_FragColor.a = ambient.a - c.a;\n"//
+ "}\n";
ShaderProgram.pedantic = false;
ShaderProgram shadowShader = new ShaderProgram(vertexShader,
fragmentShader);
if (shadowShader.isCompiled() == false) {
Gdx.app.log("ERROR", shadowShader.getLog());
}
return shadowShader;
}
示例12: fromString
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public static ShaderProgram fromString( String vertex, String fragment, String vertexName, String fragmentName, String defines ) {
ShaderProgram.pedantic = ShaderLoader.Pedantic;
ShaderProgram shader = new ShaderProgram( defines + "\n" + vertex, defines + "\n" + fragment );
if( !shader.isCompiled() ) {
Gdx.app.error( "ShaderLoader", shader.getLog() );
System.exit( -1 );
}
return shader;
}
示例13: setupShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public static ShaderProgram setupShader(String prefix) {
ShaderProgram.pedantic = false;
FileHandle vertHandle = Gdx.files.internal(String.format(shaderPathFormat, prefix, "vert"));
FileHandle fragHandle = Gdx.files.internal(String.format(shaderPathFormat, prefix, "frag"));
System.out.println(vertHandle.file().getAbsolutePath());
System.out.println(fragHandle.file().getAbsolutePath());
return new ShaderProgram(vertHandle, fragHandle);
}
示例14: createShadowShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
static final public ShaderProgram createShadowShader() {
final String vertexShader = "attribute vec4 a_position;\n" //
+ "attribute vec2 a_texCoord;\n" //
+ "varying vec2 v_texCoords;\n" //
+ "\n" //
+ "void main()\n" //
+ "{\n" //
+ " v_texCoords = a_texCoord;\n" //
+ " gl_Position = a_position;\n" //
+ "}\n";
// this is allways perfect precision
final String fragmentShader = "#ifdef GL_ES\n" //
+ "precision lowp float;\n" //
+ "#define MED mediump\n"
+ "#else\n"
+ "#define MED \n"
+ "#endif\n" //
+ "varying MED vec2 v_texCoords;\n" //
+ "uniform sampler2D u_texture;\n" //
+ "uniform vec4 ambient;\n"
+ "void main()\n"//
+ "{\n" //
+ "gl_FragColor.rgb = (ambient.rgb + texture2D(u_texture, v_texCoords).rgb);\n"
+ "}\n";
ShaderProgram.pedantic = false;
ShaderProgram shadowShader = new ShaderProgram(vertexShader,
fragmentShader);
if (shadowShader.isCompiled() == false) {
Gdx.app.log("ERROR", shadowShader.getLog());
}
return shadowShader;
}
示例15: create
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void create() {
batch = new SpriteBatch();
ShaderProgram.pedantic = false;
//read vertex pass-through shader
final String VERT_SRC = Gdx.files.internal("data/pass.vert").readString();
// renders occluders to 1D shadow map
shadowMapShader = createShader(VERT_SRC, Gdx.files.internal("data/shadowMap.frag").readString());
// samples 1D shadow map to create the blurred soft shadow
shadowRenderShader = createShader(VERT_SRC, Gdx.files.internal("data/shadowRender.frag").readString());
//the occluders
casterSprites = new Texture("data/cat4.png");
//the light sprite
light = new Texture("data/light.png");
//build frame buffers
occludersFBO = new FrameBuffer(Format.RGBA8888, lightSize, lightSize, false);
occluders = new TextureRegion(occludersFBO.getColorBufferTexture());
occluders.flip(false, true);
//our 1D shadow map, lightSize x 1 pixels, no depth
shadowMapFBO = new FrameBuffer(Format.RGBA8888, lightSize, 1, false);
Texture shadowMapTex = shadowMapFBO.getColorBufferTexture();
//use linear filtering and repeat wrap mode when sampling
shadowMapTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
shadowMapTex.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
//for debugging only; in order to render the 1D shadow map FBO to screen
shadowMap1D = new TextureRegion(shadowMapTex);
shadowMap1D.flip(false, true);
font = new BitmapFont();
cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.setToOrtho(false);
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean touchDown(int x, int y, int pointer, int button) {
float mx = x;
float my = Gdx.graphics.getHeight() - y;
lights.add(new Light(mx, my, randomColor()));
return true;
}
public boolean keyDown(int key) {
if (key==Keys.SPACE){
clearLights();
return true;
} else if (key==Keys.A){
additive = !additive;
return true;
} else if (key==Keys.S){
softShadows = !softShadows;
return true;
}
return false;
}
});
clearLights();
}