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;
}
java类com.badlogic.gdx.graphics.glutils.FrameBuffer的实例源码
VRCamera.java 文件源码
项目:Tower-Defense-Galaxy
阅读 28
收藏 0
点赞 0
评论 0
PlanetRenderSystem.java 文件源码
项目:odb-little-fortune-planet
阅读 84
收藏 0
点赞 0
评论 0
@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();
}
MultiVisualEffect.java 文件源码
项目:gdx-gfx
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
}
Outline.java 文件源码
项目:gdx-gfx
阅读 30
收藏 0
点赞 0
评论 0
@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);
}
LightingEffect.java 文件源码
项目:jrpg-engine
阅读 23
收藏 0
点赞 0
评论 0
@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
);
}
AbsStdLight.java 文件源码
项目:Escapy
阅读 19
收藏 0
点赞 0
评论 0
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;
}
LightMap.java 文件源码
项目:rbcgj-2016
阅读 31
收藏 0
点赞 0
评论 0
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);
}
LightProbe.java 文件源码
项目:nhglib
阅读 23
收藏 0
点赞 0
评论 0
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();
}
CrtMonitor.java 文件源码
项目:exterminate
阅读 21
收藏 0
点赞 0
评论 0
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);
}
LightMap.java 文件源码
项目:fabulae
阅读 39
收藏 0
点赞 0
评论 0
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);
}
PostProcessingEffect.java 文件源码
项目:RavTech
阅读 15
收藏 0
点赞 0
评论 0
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;
}
ShaderManager.java 文件源码
项目:RavTech
阅读 28
收藏 0
点赞 0
评论 0
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");
*/
}
}
ShaderManager.java 文件源码
项目:RavTech
阅读 26
收藏 0
点赞 0
评论 0
/** 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();
}
CrtMonitor.java 文件源码
项目:braingdx
阅读 19
收藏 0
点赞 0
评论 0
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);
}
CombinedRenderPipe.java 文件源码
项目:braingdx
阅读 20
收藏 0
点赞 0
评论 0
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();
}
}
}
MockedCombinedRenderPipelineFactory.java 文件源码
项目:braingdx
阅读 29
收藏 0
点赞 0
评论 0
@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);
}
OrthogonalTiledMapRendererWithObjects.java 文件源码
项目:swampmachine
阅读 29
收藏 0
点赞 0
评论 0
public OrthogonalTiledMapRendererWithObjects(TiledMap map) {
super(map);
this.occlusionFbo = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, false);
this.shadowmapFbo = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth() / 2, 1, false);
this.shadowmapTex = shadowmapFbo.getColorBufferTexture();
this.shadowmapTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
this.shadowmapTex.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
//this.orthoCam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//this.orthoCam.setToOrtho(Y_DOWN);
this.lights = new ArrayList<Light>();
this.mouseLight = new Light(0, 0, Color.WHITE);
}
GaussianBlur.java 文件源码
项目:LWPTools
阅读 30
收藏 0
点赞 0
评论 0
private static FrameBuffer getLinearFrameBuffer(int width, int height, boolean hasDepth){
if (try8888) {
try {
FrameBuffer frameBuffer = new FrameBuffer(
Pixmap.Format.RGBA8888, width, height, hasDepth);
return frameBuffer;
} catch (IllegalStateException e) {
try8888 = false;
Gdx.app.log("GaussianBlur.getLinearFrameBuffer",
"Could not create RGBA8888 FrameBuffer. Switching to RGB565.");
}
}
return new FrameBuffer(
Pixmap.Format.RGB565, width, height, hasDepth);
}
GaussianBlur.java 文件源码
项目:LWPTools
阅读 28
收藏 0
点赞 0
评论 0
private void doBlurPass(FrameBuffer fboInput, boolean vertical) {
GL20 gl = Gdx.gl20;
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
spriteBatch.setShader(blurPassShaderProgram);
gl.glDisable(GL20.GL_BLEND);
spriteBatch.begin();
if (useInverseTarget) {
blurPassShaderProgram.setUniformf("u_size",
vertical ? horizontalOnePixelSize : verticalOnePixelSize,
0);
} else {
blurPassShaderProgram.setUniformf("u_size",
vertical ? 0 : horizontalOnePixelSize,
vertical ? verticalOnePixelSize : 0);
}
blurPassShaderProgram.setUniform4fv("u_offsets", offsets, 0, 4);
blurPassShaderProgram.setUniformf("u_weightAtCenter", weightAtCenter);
blurPassShaderProgram.setUniform4fv("u_weights", weights, 0, 4);
spriteBatch.draw(fboInput.getColorBufferTexture(), -1, -1, 2, 2);
spriteBatch.end();
spriteBatch.setShader(null);
}
AndroidGraphics.java 文件源码
项目:libgdxcn
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void onSurfaceCreated (javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) {
eglContext = ((EGL10)EGLContext.getEGL()).eglGetCurrentContext();
setupGL(gl);
logConfig(config);
updatePpi();
Mesh.invalidateAllMeshes(app);
Texture.invalidateAllTextures(app);
Cubemap.invalidateAllCubemaps(app);
ShaderProgram.invalidateAllShaderPrograms(app);
FrameBuffer.invalidateAllFrameBuffers(app);
logManagedCachesStatus();
Display display = app.getWindowManager().getDefaultDisplay();
this.width = display.getWidth();
this.height = display.getHeight();
this.mean = new WindowedMean(5);
this.lastFrameTime = System.nanoTime();
gl.glViewport(0, 0, this.width, this.height);
}
FrameBufferTest.java 文件源码
项目:libgdxcn
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void create () {
mesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(Usage.ColorPacked, 4,
"a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
float c1 = Color.toFloatBits(255, 0, 0, 255);
float c2 = Color.toFloatBits(255, 0, 0, 255);
float c3 = Color.toFloatBits(0, 0, 255, 255);
mesh.setVertices(new float[] {-0.5f, -0.5f, 0, c1, 0, 0, 0.5f, -0.5f, 0, c2, 1, 0, 0, 0.5f, 0, c3, 0.5f, 1});
stencilMesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(
Usage.ColorPacked, 4, "a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
stencilMesh.setVertices(new float[] {-0.5f, 0.5f, 0, c1, 0, 0, 0.5f, 0.5f, 0, c2, 1, 0, 0, -0.5f, 0, c3, 0.5f, 1});
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
spriteBatch = new SpriteBatch();
frameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false);
stencilFrameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false, true);
createShader(Gdx.graphics);
}
MapManager.java 文件源码
项目:libgdx-maps
阅读 36
收藏 0
点赞 0
评论 0
public MapManager(AbstractTileInfo info, TileListener listener, ByteCache cache, float width, float height, float mapX, float mapY) {
this.info = info;
this.listener = listener;
this.cache = cache;
this.width = width;
this.height = height;
this.mapX = mapX;
this.mapY = mapY;
tiledMap = new TiledMap();
renderer = new OrthogonalTiledMapRenderer(tiledMap, 1f);
buffer = new FrameBuffer(Pixmap.Format.RGB888, (int)width, (int)height, false);
camera = new OrthographicCamera(width, height);
camera.position.set(width*0.5f, height*0.5f, 0);
mapRegion = new TextureRegion();
// Initialize map
updateTiles();
}
LightMap.java 文件源码
项目:box2dlights
阅读 24
收藏 0
点赞 0
评论 0
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);
}
SGRFov.java 文件源码
项目:gaiasky
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void render(SceneGraphRenderer sgr, ICamera camera, double t, int rw, int rh, FrameBuffer fb, PostProcessBean ppb) {
boolean postproc = postprocessCapture(ppb, fb, rw, rh);
/** FIELD OF VIEW CAMERA - we only render the star group process **/
FovCamera cam = ((CameraManager) camera).fovCamera;
int fovmode = camera.getMode().getGaiaFovMode();
if (fovmode == 1 || fovmode == 3) {
cam.dirindex = 0;
sgr.renderSystem(camera, t, rc, StarGroupRenderSystem.class);
}
if (fovmode == 2 || fovmode == 3) {
cam.dirindex = 1;
sgr.renderSystem(camera, t, rc, StarGroupRenderSystem.class);
}
postprocessRender(ppb, fb, postproc, camera, rw, rh);
}
SGRStereoscopic.java 文件源码
项目:gaiasky
阅读 29
收藏 0
点赞 0
评论 0
public SGRStereoscopic() {
super();
// INIT VIEWPORT
stretchViewport = new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
// INIT FRAME BUFFER FOR 3D MODE
fb3D = new HashMap<Integer, FrameBuffer>();
fb3D.put(getKey(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight()), new FrameBuffer(Format.RGB888, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight(), true));
// Init anaglyphic effect
anaglyphic = new Anaglyphic();
// Aux vectors
aux1 = new Vector3();
aux2 = new Vector3();
aux3 = new Vector3();
aux1d = new Vector3d();
aux2d = new Vector3d();
aux3d = new Vector3d();
aux4d = new Vector3d();
aux5d = new Vector3d();
EventManager.instance.subscribe(this, Events.FRAME_SIZE_UDPATE, Events.SCREENSHOT_SIZE_UDPATE);
}
GameLevelScreen.java 文件源码
项目:BotLogic
阅读 28
收藏 0
点赞 0
评论 0
public void renderDecalsForBufferAndBatch(FrameBuffer buffer, DecalBatch batch) {
buffer.begin();
renderContext.begin();
renderContext.end();
renderContext.begin();
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glViewport(0, 0, buffer.getWidth(), buffer.getHeight());
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
for (Entity entity : entities) {
if (EntityDecalRenderable.class.isInstance(entity)) {
EntityDecalRenderable en = (EntityDecalRenderable)entity;
en.renderBatch(batch, environment);
}
}
batch.flush();
renderContext.end();
buffer.end();
}
GameLevelScreen.java 文件源码
项目:BotLogic
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void resize(int width, int height) {
perspectiveCamera.viewportWidth = width;
perspectiveCamera.viewportHeight = height;
perspectiveCamera.update(true);
if (this.colorBuffer != null) {
this.colorBuffer.dispose();
}
if (this.depthBuffer != null) {
this.depthBuffer.dispose();
}
if (this.decalBuffer != null) {
this.decalBuffer.dispose();
}
this.colorBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
this.depthBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
this.decalBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
cellShadingCompositor.resize(width, height);
}
ShaderTest.java 文件源码
项目:seventh
阅读 24
收藏 0
点赞 0
评论 0
/**
*
*/
public ShaderTest() {
ShaderProgram.pedantic = false;
vertBlur = loadShader("blurv.frag");
horBlur = loadShader("blurh.frag");
light = loadShader("light.frag");
shader = loadShader("inprint.frag");
this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
this.camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
// camera.setToOrtho(false);
transform = new Matrix4();
camera.update();
batch = new SpriteBatch();//1024, shader);
batch.setShader(null);
batch.setProjectionMatrix(camera.combined);
batch.setTransformMatrix(transform);
this.buffer = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
this.fboPing = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
this.fboPong = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
}
PostProcessing.java 文件源码
项目:Stray-core
阅读 18
收藏 0
点赞 0
评论 0
/**
* gaussian blur on the entire screen
*
* @param batch
* @param buffer
* @param blurshader
* @param radius
* amount in pixels to blur
*/
public static void twoPassBlur(Batch batch, FrameBuffer buffer, ShaderProgram blurshader,
float radius, float x, float y, float drawWidth, float drawHeight, int u, int v,
int width, int height) {
buffer.begin();
batch.setShader(blurshader);
blurshader.setUniformf("radius", (float) radius);
blurshader.setUniformf("dir", 1f, 0f);
batch.draw(buffer.getColorBufferTexture(), x, y, drawWidth, drawHeight, u, v, width,
height, false, true);
batch.flush();
buffer.end();
buffer.begin();
blurshader.setUniformf("dir", 0f, 1f);
batch.draw(buffer.getColorBufferTexture(), x, y, drawWidth, drawHeight, u, v, width,
height, false, true);
batch.setShader(null);
buffer.end();
batch.draw(buffer.getColorBufferTexture(), 0, Gdx.graphics.getHeight(), buffer.getWidth(),
-buffer.getHeight());
batch.flush();
}
SimpleShaderManager.java 文件源码
项目:craft
阅读 22
收藏 0
点赞 0
评论 0
private void drawTo(FrameBuffer buffer, float delta, Batch batch, Shader<?> shader, ShadeArea area) {
// Apply the current shader
if (shader != null) {
batch.setShader(shader.getProgram());
} else {
batch.setShader(null);
}
batch.begin();
if (shader != null) // Update shader
shader.update(delta);
if (buffer != null) // Draw buffer
batch.draw(buffer.getColorBufferTexture(), 0f, 0f);
if (area != null) // Draw area
area.draw(batch, delta);
batch.end();
// Send the data directly through the graphics pipeline
batch.flush();
// Reset the current shader
batch.setShader(null);
}