当前位置: 首页>>代码示例>>Java>>正文


Java ShaderProgram.setUniformf方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.glutils.ShaderProgram.setUniformf方法的典型用法代码示例。如果您正苦于以下问题:Java ShaderProgram.setUniformf方法的具体用法?Java ShaderProgram.setUniformf怎么用?Java ShaderProgram.setUniformf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.glutils.ShaderProgram的用法示例。


在下文中一共展示了ShaderProgram.setUniformf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private ShaderProgram initShader(Texture colorMapTex, Texture maskMapTex, Texture normalMapTex, TransVec dim,
		float amIntensity, float dirIntensity, float shadIntensity, float sprtSize, float lum, float thresh, ShaderProgram shader) {
	shader.begin();
	{
		maskMapTex.bind(2);
		normalMapTex.bind(1);
		colorMapTex.bind(0);
		super.batcher.setShader(shader);

		shader.setUniformi(maskMap, 2);
		shader.setUniformi(normalMap, 1);
		shader.setUniformi(colorMap, 0);

		shader.setUniformf(fieldSize, dim.x, dim.y);
		shader.setUniformf(ambientIntensity, amIntensity);
		shader.setUniformf(directIntensity, dirIntensity);
		shader.setUniformf(shadowIntensity, shadIntensity);
		shader.setUniformf(spriteSize, sprtSize);
		shader.setUniformf(height, lum);
		shader.setUniformf(threshold, thresh);
	}
	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:25,代码来源:EscapyVolumeRenderer.java

示例2: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture lMap, ShaderProgram shader, 
		Color color, TransVec angles, TransVec fSize, float coeff, 
		float correction, TransVec radius, TransVec umbra) {
	shader.begin();
	{
		lMap.bind(0);
		super.batcher.setShader(shader);
		
		shader.setUniformi(LIGHTMAP, 0);
		shader.setUniformf("u_color", color.r, color.g, color.b);
		shader.setUniformf("u_angles", angles.x, angles.y);
		shader.setUniformf("u_fieldSize", fSize.x, fSize.y);
		shader.setUniformf("u_coeff", coeff);
		shader.setUniformf("u_angCorrect", correction);
		shader.setUniformf("u_radius", radius.x, radius.y);
		shader.setUniformf("u_umbra", umbra.x, umbra.y);
	}
	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:21,代码来源:EscapyLightSrcRenderer.java

示例3: run

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void run (ShaderProgram program) {
	int texId = sm.getCurrentTextureId();
	fbo.begin();
	program.begin();
	fbo2.getColorBufferTexture().bind(texId);
	program.setUniformi("u_texture", sm.getCurrentTextureId());
	program.setUniformf("u_viewport", width, height);
	addUniforms(program);
	quad.render(program, GL20.GL_TRIANGLES);
	if (saveBytes)
		data = getFrameBufferPixels(0, 0, width, height, false, data);
	program.end();
	fbo.end();
	swapBuffers();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:17,代码来源:BufferedProcessor.java

示例4: begin

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void begin(ShaderProgram program, Camera camera, RenderContext context) {
	WorldClient worldClient = ((WorldClient) Cubes.getClient().world);
	float distance = Settings.getIntegerSettingValue(Settings.GRAPHICS_VIEW_DISTANCE) * Area.SIZE_BLOCKS;
	float fogDistance = MathUtils.clamp(distance * 0.1f, 8f, 16f);

	program.setUniformf(u_cameraposition, Cubes.getClient().player.position);
	program.setUniformf(u_skycolor, worldClient.getSkyColour());
	program.setUniformf(u_fogdistance, fogDistance);
	program.setUniformf(u_minfogdistance, distance - fogDistance);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:12,代码来源:WorldShaderProvider.java

示例5: 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();
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:13,代码来源:ShaderBatch.java

示例6: drawToBuffer

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/**
 * Draws the given gradient {@link Texture} to the given {@link FrameBuffer}, using the given {@link Color} with the given percent.
 * <p>
 * This is achieved via a gradient shader.
 *
 * @param buffer      the {@link FrameBuffer} to be drawn to
 * @param color       the {@link Color} which should be drawn
 * @param gradient    the gradient texture which should be drawn
 * @param perc        the percent the gradient texture should be drawn
 * @param shaderBatch the {@link SpriteBatch} to use
 * @param shader      the {@link ShaderProgram} to use
 * @param projection  projection matrix for pixel perfect rendering
 */
private static void drawToBuffer(FrameBuffer buffer, Color color, Texture gradient, float perc, SpriteBatch shaderBatch, ShaderProgram shader, Matrix4 projection) {
    buffer.begin();
    AL.graphics.getGL20().glClearColor(0, 0, 0, 0);
    AL.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT);

    shaderBatch.setProjectionMatrix(projection);
    shaderBatch.begin();
    shaderBatch.setColor(color);
    shader.setUniformf("u_gradient", perc);
    shaderBatch.draw(gradient, -buffer.getWidth() / 2, -buffer.getHeight() / 2);
    shaderBatch.end();
    buffer.end();
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:27,代码来源:CharacterRenderer.java

示例7: begin

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void begin(ShaderProgram program, Camera camera, RenderContext context) {
  WorldClient worldClient = ((WorldClient) Cubes.getClient().world);
  float distance = Settings.getIntegerSettingValue(Settings.GRAPHICS_VIEW_DISTANCE) * Area.SIZE_BLOCKS;
  float fogDistance = MathUtils.clamp(distance * 0.1f, 8f, 16f);

  program.setUniformf(u_cameraposition, Cubes.getClient().player.position);
  program.setUniformf(u_skycolor, worldClient.getSkyColour());
  program.setUniformf(u_fogdistance, fogDistance);
  program.setUniformf(u_minfogdistance, distance - fogDistance);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:12,代码来源:WorldShaderProvider.java

示例8: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture srcMap, ShaderProgram program, 
		float widht, float height, float dirX, float dirY) {
	
	program.begin();
	{
		srcMap.bind(0);
		super.batcher.setShader(program);
		program.setUniformi(SOURCEMAP, 0);
		program.setUniformf("u_fieldSize", widht, height);
		program.setUniformf("u_direction", dirX, dirY);
	}	program.end();
	return program;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:14,代码来源:EscapyBlurRenderer.java

示例9: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture sourceMap, float lwidht, float lheight,
		TransVec angles, float correct, ShaderProgram shader) {
	
	shader.begin();
	{
		sourceMap.bind(0);
		super.batcher.setShader(shader);
		shader.setUniformi(SOURCEMAP, 0);
		shader.setUniformf("resolution", lwidht, lheight);
		shader.setUniformf("u_angles", angles.x, angles.y);
		shader.setUniformf("u_angCorrect", correct);
	}	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:15,代码来源:EscapyShadowMapRenderer.java

示例10: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected ShaderProgram initShader(Texture sourceMap, float lwidht, float lheight,
		float threshold, TransVec angles, float correct, ShaderProgram shader) {

	shader.begin();
	{
		sourceMap.bind(0);
		super.batcher.setShader(shader);
		shader.setUniformi(SOURCEMAP, 0);
		shader.setUniformf("resolution", lwidht, lheight);
        shader.setUniformf("u_THRESHOLD", threshold);
	}	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:14,代码来源:EscapyStdShadowMapRenderer.java

示例11: render

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public void render() {

		boolean needed = rayHandler.lightRenderedLastFrame > 0;


		if (lightMapDrawingDisabled)
			return;
		frameBuffer.getColorBufferTexture().bind(0);

		// at last lights are rendered over scene
		if (rayHandler.shadows) {
			final Color c = rayHandler.ambientLight;
			ShaderProgram shader = shadowShader;
			if (RayHandler.isDiffuse) {
				shader = diffuseShader;
				shader.begin();
				rayHandler.diffuseBlendFunc.apply();
				shader.setUniformf("ambient", c.r, c.g, c.b, c.a);
			} else {
				shader.begin();
				rayHandler.shadowBlendFunc.apply();
				shader.setUniformf("ambient", c.r * c.a, c.g * c.a,
						c.b * c.a, 1f - c.a);
			}
		//	shader.setUniformi("u_texture", 0);
			lightMapMesh.render(shader, GL20.GL_TRIANGLE_FAN);
			shader.end();
		} else if (needed) {
			rayHandler.simpleBlendFunc.apply();
			withoutShadowShader.begin();
		//	withoutShadowShader.setUniformi("u_texture", 0);
			lightMapMesh.render(withoutShadowShader, GL20.GL_TRIANGLE_FAN);
			withoutShadowShader.end();
		}

		Gdx.gl20.glDisable(GL20.GL_BLEND);
	}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:38,代码来源:LightMap.java

示例12: applyToShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void applyToShader(ShaderProgram program) {
    final int texNum = 3;
    fbo().getColorBufferTexture().bind(texNum);
    program.setUniformi("u_depthMapDir", texNum);
    program.setUniformMatrix("u_lightTrans", camera().combined);
    program.setUniformf("u_type", 1);
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:9,代码来源:SpotLight.java

示例13: applyToShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void applyToShader(ShaderProgram shader) {
    super.applyToShader(shader);
    shader.setUniformf("u_light.cutoffAngle", light.cutoffAngle);
    shader.setUniformf("u_light.exponent", light.exponent);
    final int textureNum = 9;
    fbo.getColorBufferTexture().bind(textureNum);
    shader.setUniformi("u_type", 1);
    shader.setUniformi("u_depthMapDir", textureNum);
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:11,代码来源:SpotLightWrapper.java

示例14: addUniformsArray

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
protected void addUniformsArray (ShaderProgram program, String key, Object[] values) {
	if (values == null || values.length == 0)
		return;
	Object val = values[0];
	String cls = val.getClass().getName();
	if (cls.equals("java.lang.Integer"))
		switch (values.length) {
			case 1:
				program.setUniformi(key, (Integer)values[0]);
				break;
			case 2:
				program.setUniformi(key, (Integer)values[0], (Integer)values[1]);
				break;
			case 3:
				program.setUniformi(key, (Integer)values[0], (Integer)values[1], (Integer)values[2]);
				break;
			case 4:
				program.setUniformi(key, (Integer)values[0], (Integer)values[1], (Integer)values[2], (Integer)values[3]);
				break;
		}
	else if (cls.equals("java.lang.Float"))
		switch (values.length) {
			case 1:
				program.setUniformf(key, (Float)values[0]);
				break;
			case 2:
				program.setUniformf(key, (Float)values[0], (Float)values[1]);
				break;
			case 3:
				program.setUniformf(key, (Float)values[0], (Float)values[1], (Float)values[2]);
				break;
			case 4:
				program.setUniformf(key, (Float)values[0], (Float)values[1], (Float)values[2], (Float)values[3]);
				break;
		}
	else
		throw new GdxRuntimeException("Class " + cls + " as uniform: not implemented yet!");
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:39,代码来源:Processor.java

示例15: run

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public void run (ShaderProgram program) {
	int texId = sm.getCurrentTextureId();
	fbo.begin();
	program.begin();
	getResult().bind(texId);
	program.setUniformi("u_texture", texId);
	program.setUniformf("u_viewport", width, height);
	addUniforms(program);
	quad.render(program, GL20.GL_TRIANGLES);
	if (saveBytes)
		data = getFrameBufferPixels(0, 0, width, height, false, data);
	program.end();
	fbo.end();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:15,代码来源:Processor.java


注:本文中的com.badlogic.gdx.graphics.glutils.ShaderProgram.setUniformf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。