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


Java FrameBuffer类代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.glutils.FrameBuffer的典型用法代码示例。如果您正苦于以下问题:Java FrameBuffer类的具体用法?Java FrameBuffer怎么用?Java FrameBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: VRCamera

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public VRCamera(int width, int height, int viewportWidth, int viewportHeight) {
    leftCamera = new PerspectiveCamera(90, viewportWidth, viewportHeight);
    rightCamera = new PerspectiveCamera(90, viewportWidth, viewportHeight);
    leftBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, true);
    rightBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, true);
    leftTexture = new TextureRegion();
    rightTexture = new TextureRegion();
    batch = new SpriteBatch();
    this.width = width;
    this.height = height;
    this.viewportWidth = viewportWidth;
    this.viewportHeight = viewportHeight;
    tmpVector3 = new Vector3();
    position = new Vector3(250, 20, 250);
    positionLeft = new Vector3(249.5f, 20, 250);
    positionRight = new Vector3(250.5f, 20, 250);
    direction = new Vector3();
    up = new Vector3(0, 1, 0);
    eyeDistance = 0.5f;
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:21,代码来源:VRCamera.java

示例2: initialize

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
@Override
protected void initialize() {
    batch = new SpriteBatch(4000);
    new ShapeRenderer();

    planetPixel = new TextureRegion(new Texture("planetcell.png"), 1, 1);

    dirtyMask = new int[SIMULATION_WIDTH * SIMULATION_HEIGHT];

    frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, SIMULATION_WIDTH, SIMULATION_HEIGHT, false);
    frameBuffer.getColorBufferTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
    frameBuffer.begin();
    Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    frameBuffer.end();

    vboCamera = new OrthographicCamera(SIMULATION_WIDTH, SIMULATION_HEIGHT);
    vboCamera.setToOrtho(true, SIMULATION_WIDTH, SIMULATION_HEIGHT);
    vboCamera.update();
}
 
开发者ID:DaanVanYperen,项目名称:odb-little-fortune-planet,代码行数:21,代码来源:PlanetRenderSystem.java

示例3: render

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
@Override
public void render(Texture source, FrameBuffer destination) {

	switch (effects.size) {
	case 0:
		// No effect: make some simple copy
		if (copy == null)
			copy = new Copy();
		copy.render(source, destination);
		break;
	case 1:
		effects.first().render(source, destination);
		break;
	default:
		effects.first().render(source, buffer.getCurrentBuffer());
		for (int i = 1; i < effects.size - 1; i++)
			effects.get(i).render(buffer.getResultTexture(), buffer.getCurrentBuffer());
		effects.peek().render(buffer.getResultTexture(), destination);
		break;
	}
}
 
开发者ID:spookygames,项目名称:gdx-gfx,代码行数:22,代码来源:MultiVisualEffect.java

示例4: render

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
@Override
public void render(Texture source, FrameBuffer destination) {

	// Draw outlined to buffer
	buffer.getCurrentTexture().bind(0);
	buffer.begin();
	
	Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	renderOutlined();
	
	buffer.end();

	filter.render(buffer.getResultTexture(), buffer.getCurrentBuffer());

	// mix original scene and outlines
	superimpose.setAdditionalInput(buffer.getResultTexture());
	superimpose.render(source, destination);
}
 
开发者ID:spookygames,项目名称:gdx-gfx,代码行数:20,代码来源:Outline.java

示例5: init

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
@Override
public void init(final GraphicsService graphicsService, final GameMap map) {
    lightingShader.begin();
    lightingShader.setUniformf(
            "resolution",
            Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight()
    );
    lightingShader.setUniformi("u_lightmap", 1);
    lightingShader.setUniformf("ambientColor", ambientColor.x, ambientColor.y, ambientColor.z, ambientIntensity);
    lightingShader.end();
    frameBuffer = new FrameBuffer(
            Pixmap.Format.RGBA8888,
            graphicsService.getResolutionWidth(),
            graphicsService.getResolutionHeight(),
            false
    );
}
 
开发者ID:JayStGelais,项目名称:jrpg-engine,代码行数:19,代码来源:LightingEffect.java

示例6: setLightSource

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public AbsStdLight setLightSource(EscapyLightType light) {

		this.updState();
		this.lightSource = light;
		this.interCam = new EscapyGdxCamera((int) this.lightSource.getWidth(), (int) this.lightSource.getHeight());
		this.fbo = new StandartFBO(id, (int) this.lightSource.getWidth(), (int) this.lightSource.getHeight(), "<AbsLightTexture_FBUFFER>");
		FrameBuffer tmpBuff = new FrameBuffer(Pixmap.Format.RGBA8888, (int) this.lightSource.getWidth(),(int) this.lightSource.getHeight(), false);
		tmpBuff.begin();
		Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		tmpBuff.end();
		FrameBuffer bgBuff = new FrameBuffer(Pixmap.Format.RGBA8888, (int) this.lightSource.getWidth(),(int) this.lightSource.getHeight(), false);
		bgBuff.begin();
		Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		bgBuff.end();

		this.lightSprite = new Sprite(tmpBuff.getColorBufferTexture());
		this.bgSprite = new Sprite(bgBuff.getColorBufferTexture());

		System.out.println(lightSource.setName(Integer.toString(getID())));
		return this;
	}
 
开发者ID:henryco,项目名称:Escapy,代码行数:24,代码来源:AbsStdLight.java

示例7: LightMap

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public LightMap(RayHandler rayHandler, int fboWidth, int fboHeight) {
	this.rayHandler = rayHandler;

	if (fboWidth <= 0)
		fboWidth = 1;
	if (fboHeight <= 0)
		fboHeight = 1;
	frameBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
			fboHeight, false);
	pingPongBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
			fboHeight, false);

	lightMapMesh = createLightMapMesh();

	shadowShader = ShadowShader.createShadowShader();
	diffuseShader = DiffuseShader.createShadowShader();

	withoutShadowShader = WithoutShadowShader.createShadowShader();

	blurShader = Gaussian.createBlurShader(fboWidth, fboHeight);

}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:23,代码来源:LightMap.java

示例8: renderBRDF

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
private Texture renderBRDF() {
    ShaderProgram brdfShader = new ShaderProgram(
            Gdx.files.internal("shaders/brdf_shader.vert"),
            Gdx.files.internal("shaders/brdf_shader.frag"));

    FrameBuffer frameBuffer = FrameBuffer.createFrameBuffer(Pixmap.Format.RGB888, (int) brdfWidth, (int) brdfHeight, true);

    brdfShader.begin();
    frameBuffer.begin();
    Gdx.gl.glViewport(0, 0, (int) brdfWidth, (int) brdfHeight);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
    quadMesh.render(brdfShader, GL20.GL_TRIANGLES);
    frameBuffer.end();
    brdfShader.end();
    brdfShader.dispose();

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

示例9: CrtMonitor

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public CrtMonitor (int fboWidth, int fboHeight, boolean barrelDistortion, boolean performBlur, RgbMode mode, int effectsSupport) {
	doblur = performBlur;

	if (doblur) {
		pingPongBuffer = PostProcessor.newPingPongBuffer(fboWidth, fboHeight, PostProcessor.getFramebufferFormat(), false, false);
		blur = new Blur(fboWidth, fboHeight);
		blur.setPasses(1);
		blur.setAmount(1f);
		// blur.setType( BlurType.Gaussian3x3b ); // high defocus
		blur.setType(BlurType.Gaussian3x3); // modern machines defocus
	} else {
		buffer = new FrameBuffer(PostProcessor.getFramebufferFormat(), fboWidth, fboHeight, false);
	}

	combine = new Combine();
	crt = new CrtScreen(barrelDistortion, mode, effectsSupport);
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:18,代码来源:CrtMonitor.java

示例10: applyPasses

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public FrameBuffer applyPasses (SpriteBatch batch, FrameBuffer inputBuffer, FrameBuffer outputBuffer) {
	batch.begin();
	batch.setProjectionMatrix(matrix);
	FrameBuffer iBuffer = inputBuffer;
	FrameBuffer oBuffer = outputBuffer;
	for (int i = 0; i < passes.size; i++) {
		oBuffer.begin();
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		batch.setShader(RavTech.sceneHandler.shaderManager.get(passes.get(i)));
		batch.draw(iBuffer.getColorBufferTexture(), 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		batch.setShader(RavTech.sceneHandler.shaderManager.get("default"));
		oBuffer.end();
		FrameBuffer tempBuffer = oBuffer;
		oBuffer = iBuffer;
		iBuffer = tempBuffer;
	}
	batch.end();
	return oBuffer;
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:21,代码来源:PostProcessingEffect.java

示例11: ShaderManager

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public ShaderManager (String shaderDir, AssetManager am, boolean addProcessors) {
	shaders = new ObjectMap<String, ShaderProgram>();
	shaderPaths = new ObjectMap<String, String>();
	sourcesVert = new ObjectMap<String, String>();
	sourcesFrag = new ObjectMap<String, String>();
	frameBuffers = new ObjectMap<String, FrameBuffer>();
	openedFrameBuffers = new Array<String>(true, MAX_FRAMEBUFFERS);
	screenCamera = new OrthographicCamera(Gdx.graphics.getWidth() + 2, Gdx.graphics.getHeight() + 2);
	createScreenQuad();
	screenCamera.translate(0, -1);
	screenCamera.update();
	setShaderDir(shaderDir);
	setAssetManager(am);
	// add("empty", "empty.vert", "empty.frag");
	// add("default", "default.vert", "default.frag");
	if (addProcessors && (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet
		|| Gdx.app.getType() == ApplicationType.WebGL)) {
		/*
		 * add("processor", "processor.vert", "processor.frag"); add("processor_blur", "processor.vert", "processor_blur.frag");
		 * add("copy", "processor.vert", "copy.frag"); add("processor_draw", "processor.vert", "processor_draw.frag");
		 * add("processor_fill", "processor.vert", "processor_fill.frag");
		 */
	}
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:25,代码来源:ShaderManager.java

示例12: resize

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
/** Resizes internal RavCamera for framebuffer use, call this in you ApplicationListener's resize.
 * 
 * @param width - new screen width
 * @param height - new screen height
 * @param resizeFramebuffers - whether all of the framebuffers should be recreated to match new screen size */
public void resize (int width, int height, boolean resizeFramebuffers) {
	// ?????
	if (resizeFramebuffers) {
		Keys<String> keys = frameBuffers.keys();
		while (keys.hasNext) {
			String key = keys.next();
			FrameBuffer fb = frameBuffers.get(key);
			int oldWidth = fb.getWidth();
			int oldHeight = fb.getHeight();
			Format format = fb.getColorBufferTexture().getTextureData().getFormat();
			fb.dispose();
			frameBuffers.put(key, null);
			float factorX = 1f * width / screenCamera.viewportWidth;
			float factorY = 1f * height / screenCamera.viewportHeight;
			createFB(key, format, (int)(factorX * oldWidth), (int)(factorY * oldHeight));
			// System.out.println("Recreated FB '" + key + "' from " +
			// oldWidth + "x" + oldHeight + " to " +
			// frameBuffers.get(key).getWidth() + "x" +
			// frameBuffers.get(key).getHeight());
		}
	}
	screenCamera = new OrthographicCamera(width, height);
	createScreenQuad();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:30,代码来源:ShaderManager.java

示例13: CrtMonitor

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public CrtMonitor(int fboWidth, int fboHeight, boolean barrelDistortion, boolean performBlur, RgbMode mode,
      int effectsSupport) {
   doblur = performBlur;

   if (doblur) {
      pingPongBuffer = PostProcessor.newPingPongBuffer(fboWidth, fboHeight, PostProcessor.getFramebufferFormat(),
            false);
      blur = new Blur(fboWidth, fboHeight);
      blur.setPasses(1);
      blur.setAmount(1f);
      // blur.setType( BlurType.Gaussian3x3b ); // high defocus
      blur.setType(BlurType.Gaussian3x3); // modern machines defocus
   } else {
      buffer = new FrameBuffer(PostProcessor.getFramebufferFormat(), fboWidth, fboHeight, false);
   }

   combine = new Combine();
   crt = new CrtScreen(barrelDistortion, mode, effectsSupport);
}
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:20,代码来源:CrtMonitor.java

示例14: render

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
public void render(Batch batch, float delta, FrameBuffer buffer) {
   if (isEnabled()) {
      if (shaderManager.hasEffects()) {
         shaderManager.begin();
         this.batch.setProjectionMatrix(camera.combined);
         this.batch.begin();
         this.batch.draw(buffer.getColorBufferTexture(), 0f, 0f);
         this.batch.end();
         layer.render(batch, delta);
         shaderManager.end(buffer);
      } else {
         buffer.begin();
         layer.render(batch, delta);
         buffer.end();
      }
   }
}
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:18,代码来源:CombinedRenderPipe.java

示例15: create

import com.badlogic.gdx.graphics.glutils.FrameBuffer; //导入依赖的package包/类
@Override
 public RenderPipeline create() {
    ShaderConfig config = mock(ShaderConfig.class);
    PostProcessor processorMock = mock(PostProcessor.class);
    FrameBufferFactory factory = mock(FrameBufferFactory.class);
    FrameBuffer buffer = mock(FrameBuffer.class);
    Texture mockTexture = mock(Texture.class);
    ViewportFactory viewportFactory = mock(ViewportFactory.class);
    Viewport viewport = mock(Viewport.class);
    when(factory.create(Mockito.anyInt(), Mockito.anyInt())).thenReturn(buffer);
    Mockito.doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
	return null;
}    	  
    }).when(viewport).update(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyBoolean());
    when(viewportFactory.create(Mockito.anyInt(), Mockito.anyInt())).thenReturn(viewport);
    when(buffer.getColorBufferTexture()).thenReturn(mockTexture);
    return new CombinedRenderPipeline(config, processorMock, factory, mock(SpriteBatch.class),
          mock(OrthographicCamera.class), viewportFactory);
 }
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:22,代码来源:MockedCombinedRenderPipelineFactory.java


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