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


Java ShaderProgram.setUniformi方法代码示例

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


在下文中一共展示了ShaderProgram.setUniformi方法的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: renderIrradiance

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private Cubemap renderIrradiance(Cubemap environmentCubemap) {
    ShaderProgram irradianceShader = new ShaderProgram(
            Gdx.files.internal("shaders/equi_to_cube_shader.vert"),
            Gdx.files.internal("shaders/irradiance_shader.frag"));

    FrameBufferCubemap frameBufferCubemap = FrameBufferCubemap.createFrameBufferCubemap(Pixmap.Format.RGB888,
            (int) irradianceWidth, (int) irradianceHeight, true);

    environmentCubemap.bind(0);
    irradianceShader.begin();
    irradianceShader.setUniformMatrix("u_projection", perspectiveCameras.first().projection);
    irradianceShader.setUniformi("u_environmentMap", 0);
    frameBufferCubemap.begin();
    for (int i = 0; i < 6; i++) {
        irradianceShader.setUniformMatrix("u_view", perspectiveCameras.get(i).view);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
        cubeMesh.render(irradianceShader, GL20.GL_TRIANGLES);
        frameBufferCubemap.nextSide();
    }
    frameBufferCubemap.end();
    irradianceShader.end();
    irradianceShader.dispose();

    return frameBufferCubemap.getColorBufferTexture();
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:26,代码来源:LightProbe.java

示例4: 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

示例5: begin

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void begin(ShaderProgram program, Camera camera, RenderContext context) {
	TextureAttribute textureAttribute = AmbientOcclusion.getTextureAttribute();

	ao_unit = context.textureBinder.bind(textureAttribute.textureDescription);
	program.setUniformi(u_aoTexture, ao_unit);

	program.setUniformf(u_aoUVTransform, textureAttribute.offsetU, textureAttribute.offsetV,
			textureAttribute.scaleU, textureAttribute.scaleV);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:WorldShaderProvider.java

示例6: begin

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void begin(ShaderProgram program, Camera camera, RenderContext context) {
  TextureAttribute textureAttribute = AmbientOcclusion.getTextureAttribute();

  ao_unit = context.textureBinder.bind(textureAttribute.textureDescription);
  program.setUniformi(u_aoTexture, ao_unit);

  program.setUniformf(u_aoUVTransform, textureAttribute.offsetU, textureAttribute.offsetV, textureAttribute.scaleU, textureAttribute.scaleV);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:10,代码来源:WorldShaderProvider.java

示例7: 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

示例8: applyToShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void applyToShader(ShaderProgram shader) {
    super.applyToShader(shader);
    final int textureNum = 10;
    if(fbo == null) buildFBO();
    fbo.getColorBufferTexture().bind(textureNum);
    shader.setUniformi("u_type", 2);
    shader.setUniformi("u_depthMapCube", textureNum);
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:10,代码来源:PointLightWrapper.java

示例9: 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

示例10: initShader

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private ShaderProgram initShader(Texture target, Texture blend, ShaderProgram shader) {
	shader.begin();
	{
		blend.bind(1);
		target.bind(0);
		super.batcher.setShader(shader);
		shader.setUniformi(this.blendMap, 1);
		shader.setUniformi(this.targetMap, 0);
		super.shaderLoader.accept(shader);
	}
	shader.end();
	return shader;
}
 
开发者ID:henryco,项目名称:Escapy,代码行数:14,代码来源:EscapyBlendRenderer.java

示例11: renderEnvironmentFromHDRData

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
private Cubemap renderEnvironmentFromHDRData(HDRData2 data) {
    Texture equirectangularTexture;
    ShaderProgram equiToCubeShader = new ShaderProgram(
            Gdx.files.internal("shaders/equi_to_cube_shader.vert"),
            Gdx.files.internal("shaders/equi_to_cube_shader.frag"));

    equirectangularTexture = data.getTexture();

    GLFrameBuffer.FrameBufferCubemapBuilder builder = new GLFrameBuffer.FrameBufferCubemapBuilder(
            (int) environmentWidth, (int) environmentHeight);
    builder.addColorTextureAttachment(GL30.GL_RGB8, GL30.GL_RGB, GL30.GL_UNSIGNED_BYTE);
    builder.addDepthRenderBufferAttachment();
    FrameBufferCubemap frameBufferCubemap = builder.build();

    equirectangularTexture.bind(0);
    equiToCubeShader.begin();
    equiToCubeShader.setUniformMatrix("u_projection", perspectiveCameras.first().projection);
    equiToCubeShader.setUniformi("u_equirectangularMap", 0);
    frameBufferCubemap.begin();
    for (int i = 0; i < 6; i++) {
        equiToCubeShader.setUniformMatrix("u_view", perspectiveCameras.get(i).view);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
        cubeMesh.render(equiToCubeShader, GL20.GL_TRIANGLES);
        frameBufferCubemap.nextSide();
    }
    frameBufferCubemap.end();
    equiToCubeShader.end();
    equiToCubeShader.dispose();

    return frameBufferCubemap.getColorBufferTexture();
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:32,代码来源:LightProbe.java

示例12: setSceneUniforms

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void setSceneUniforms(ShaderProgram program, int[] mutableId) {
    final int texNum = mutableId[0]++;
    String uniformName = uniformName();
    if(program.hasUniform(uniformName)) {
        getBufferContents().bind(texNum);
        program.setUniformi(uniformName, texNum);
    }
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:10,代码来源:DynamicRenderer.java

示例13: 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

示例14: 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

示例15: applyToShader

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


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