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


Java ShaderProgram.setUniformMatrix方法代码示例

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


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

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

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

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

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

示例5: apply

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void apply(ShaderProgram shader) {
	shader.setUniformMatrix(name, value);
}
 
开发者ID:spookygames,项目名称:gdx-gfx,代码行数:5,代码来源:Matrix3ShaderParameter.java

示例6: prepareRender

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/**
 * Prepare all lights for rendering.
 *
 * <p>You should need to use this method only if you want to render lights
 * on a frame buffer object. Use {@link #render()} otherwise.
 *
 * <p><b>NOTE!</b> Don't call this inside of any begin/end statements.
 *
 * @see #renderOnly()
 * @see #render()
 */
public void prepareRender() {
	lightRenderedLastFrame = 0;

	Gdx.gl.glDepthMask(false);
	Gdx.gl.glEnable(GL20.GL_BLEND);
	simpleBlendFunc.apply();

	boolean useLightMap = (shadows || blur);
	if (useLightMap) {
		lightMap.frameBuffer.begin();
		Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	}

	ShaderProgram shader = customLightShader != null ? customLightShader : lightShader;
	shader.begin();
	{
		shader.setUniformMatrix("u_projTrans", combined);
		if (customLightShader != null) updateLightShader();
		for (Light light : lightList) {
			if (customLightShader != null) updateLightShaderPerLight(light);
			light.render();
		}
	}
	shader.end();

	if (useLightMap) {
		if (customViewport) {
			lightMap.frameBuffer.end(
				viewportX,
				viewportY,
				viewportWidth,
				viewportHeight);
		} else {
			lightMap.frameBuffer.end();
		}

		boolean needed = lightRenderedLastFrame > 0;
		// this way lot less binding
		if (needed && blur)
			lightMap.gaussianBlur();
	}
}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:55,代码来源:RayHandler.java

示例7: render

import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public void render(Camera camera, float jour, boolean invY, ShaderProgram shader) {

		
		Gdx.gl20.glDisable(GL20.GL_DEPTH_TEST);
		Gdx.gl20.glDisable(GL20.GL_CULL_FACE);
		shader.begin();
		

		// Bind the texture
		Gdx.gl20.glActiveTexture(SKYBOX_TEXTURE_ACTIVE_UNIT);
		Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, textureId);

		Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MAG_FILTER, GL20.GL_LINEAR);
		Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_LINEAR);


		model.setToTranslation(camera.position);
//		model.translate(0, -0.06f*(1.0f-jour), 0);
	//	model.scale(0, -1f, 0);
		if(InGame.vitesseDay<0.02) {
			model.rotate(Vector3.Y, InGame.timeInDay/24f*360f);				
		}
		
	//	model.rotate(camera.up.cpy().crs(camera.direction), -InGame3D.decAngleYInfini );
	//	model.rotate(camera.up, -InGame3D.decAngleInfini );	
	//	model.rotate( 0.0f, 0.0f, 1.0f, angleZ );*/
//		
		shader.setUniformMatrix("u_M", model);
		
		shader.setUniformMatrix("u_VP", camera.combined);
		shader.setUniformi("u_sampler", SKYBOX_TEXTURE_UNIT);
		if(shader==skyboxShaderDeffered) {
			System.out.println("aller :p");
			tmpv.set(InGame.sunDirection.x/InGame.width(), InGame.sunDirection.y/InGame.height(), 0);
			shader.setUniformf("position",tmpv);

			
			shader.setUniformf("resolution", InGame.sizev2);
		}
		
		shader.setUniformf("jour", jour);
		shader.setUniformf("invY", invY ? -1.0f : 1.0f);
		shader.setUniformf("minfog", 1.0f-1.0f/Math.max(1f, InGame.fogAmount*0.7f));
		shader.setUniformf("u_fogColor",InGame.solFog);

		for (Mesh mesh : meshes) {
			mesh.render(shader, GL20.GL_TRIANGLE_STRIP);
		}
		shader.end();
		
		Gdx.gl20.glEnable(GL20.GL_DEPTH_TEST);
	}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:53,代码来源:Skybox.java


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