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


Java RenderContext类代码示例

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


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

示例1: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin(Camera camera, RenderContext context) {
    this.camera = camera;

    context.setCullFace(GL20.GL_BACK);
    context.setDepthTest(GL20.GL_LEQUAL);
    context.setDepthMask(true);
    //Gdx.gl.glViewport(0, 0, (int) camera.viewportWidth, (int) camera.viewportHeight);

    lightGrid.setFrustums(((PerspectiveCamera) camera));
    makeLightTexture();

    super.begin(camera, context);
    program.setUniform3fv("u_lightPositions", getLightPositions(), 0, lights.size * 3);
    program.setUniform3fv("u_lightDirections", getLightDirections(), 0, lights.size * 3);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:17,代码来源:PBRShader.java

示例2: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin(Camera camera, RenderContext context) {
	program.begin();
	viewProjTrans.set(camera.combined);

	program.setUniformf(u_cameraPosition, camera.position.x, camera.position.y, 
			camera.position.z, 1);
	program.setUniformf(u_worldLightDir, lightDirection.x, lightDirection.y, lightDirection.z, 0);

	context.setDepthTest(GL20.GL_LEQUAL);
	context.setCullFace(GL20.GL_BACK);
	context.setBlending(shouldFadeEnds ? true : false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

	texture.bind(0);
	program.setUniformi(u_texture, 0);

	specLUT.getTexture().bind(1);
	program.setUniformi(u_specularPowerLUTTexture, 1);

}
 
开发者ID:CypherCove,项目名称:DoubleHelix,代码行数:21,代码来源:SubsurfaceScatteringShader.java

示例3: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin(Camera camera, RenderContext context) {
       context.setDepthTest(GL20.GL_NONE);

	program.begin();
	viewProjTrans.set(camera.combined);

	context.setCullFace(GL20.GL_BACK);
	context.setBlending(false, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

	texture.bind(0);
	program.setUniformi(u_texture, 0);

       program.setUniformf(u_color, color.r, color.g, color.b);
       program.setUniformf(u_ambient, MainRenderer.AMBIENT_BRIGHTNESS);
}
 
开发者ID:CypherCove,项目名称:DoubleHelix,代码行数:17,代码来源:BackgroundShader.java

示例4: onInitialize

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
protected void onInitialize() {
  if (removeOld) {
    clearOld();
  }

  ForgE.blocks.loadAtlasAndUvsIfNull();
  this.levelEnv            = new LevelEnv();
  this.shader              = (TerrainShader)ForgE.shaders.get("block-preview");

  this.renderContext       = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
  this.camera              = new PerspectiveCamera(40, PREVIEW_SIZE/2, PREVIEW_SIZE/2);
  //this.buffer              = new FrameBuffer(Pixmap.Format.RGBA8888, PREVIEW_SIZE, PREVIEW_SIZE, true);
  camera.near = 0.01f;
  camera.far  = 5f;
  camera.position.set(0f, 2.5f, 0f);
  camera.lookAt(new Vector3(0.2f,2.35f,0.2f));
  camera.update();

  this.blocks = ForgE.blocks.list();
  this.i      = 1;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:23,代码来源:BlockPreviews.java

示例5: renderFB

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
public void renderFB(RenderContext renderContext, LevelEnv env, String outputFrameBufferId, String shaderName) {
  BaseShader baseShader = ForgE.shaders.get(shaderName);
  if (FrameBufferShader.class.isInstance(baseShader)) {
    FrameBufferShader shader = (FrameBufferShader)baseShader;
    renderContext.begin(); {
      begin(outputFrameBufferId); {
        ForgE.graphics.clearAll(Color.CLEAR);
        shader.begin(screenCamera, renderContext, env); {
          shader.render(screenQuad, GL30.GL_TRIANGLE_STRIP);
        } shader.end();
      } end();
    } renderContext.end();
  } else {
    throw new GdxRuntimeException(shaderName + " is not FrameBufferShader");
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:17,代码来源:FrameBufferManager.java

示例6: Level

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
public Level(LevelState state, TerrainGeometryProvider geometryProvider) {
  this.colorShaderProvider      = new ShaderProvider();
  this.depthShaderProvider      = new DepthShaderProvider();

  this.env                      = state.env;
  this.state                    = state;
  this.terrainMap               = state.terrainMap;
  this.terrainGeometryProvider  = geometryProvider;
  this.postProcessing           = new PostProcessingManager(ForgE.files.internal("postprocessing:default.json"));
  this.renderContext            = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));

  this.octree                   = OctreeNode.root();

  this.batch                    = new VoxelBatch(renderContext, colorShaderProvider);
  this.camera                   = env.mainCamera;
  this.frustrumDebugger         = new FrustrumDebugAndRenderer();
  frustrumDebugger.add(camera);
  frustrumDebugger.add(env.mainLight.getShadowCamera());
  this.terrainEngine            = new TerrainEngine(this);
  this.entities                 = new EntitySystemsManager(this);

  octree.setBounds(terrainMap.getBounds(ChunkMap.TERRAIN_TILE_SIZE));
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:24,代码来源:Level.java

示例7: initialize

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
protected void initialize() {
  displayableCollections = new Array<Array<? extends Displayable>>();

  modelDisplayables = new Array<ModelDisplayable>();
  displayableCollections.add(modelDisplayables);

  decalDisplayables = new Array<DecalDisplayable>();
  displayableCollections.add(decalDisplayables);

  renderContext = new RenderContext(
      new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED));
  renderContext.setCullFace(GL20.GL_BACK);

  modelBatch = new ModelBatch(renderContext,
                              new DefaultShaderProvider(),
                              new HelixRenderableSorter());

  decalBatch = new DecalBatch(new CameraGroupStrategy(camera));

  spriteBatch = new SpriteBatch();
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:23,代码来源:RenderingSystem.java

示例8: render

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
public void render(RenderContext context, PerspectiveCamera camera) {
  invView.set(camera.view);

  invView.val[Matrix4.M03] = 0;
  invView.val[Matrix4.M13] = 0;
  invView.val[Matrix4.M23] = 0;

  invView.inv().tra();

  mvp.set(camera.projection);
  mvp.mul(invView);

  context.begin();
    context.setCullFace(GL20.GL_FRONT);
    context.setDepthMask(false);
    shader.begin();
      shader.setUniformMatrix(u_mvpMatrix, mvp);
      shader.setUniformi(s_cubemap, context.textureBinder.bind(cubeMap));

      mesh.render(shader, GL20.GL_TRIANGLE_STRIP);
    shader.end();
  context.end();
}
 
开发者ID:macbury,项目名称:BotLogic,代码行数:24,代码来源:SkyBox.java

示例9: setup

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public boolean setup() {

	modelBatch = new ModelBatch(new DefaultShaderProvider());

	lights = new Environment();
	lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 1.0f, 1.0f, 1.0f, 1.f));
	lights.add(new DirectionalLight().set(0.3f, 0.3f, 0.3f, 0, 1, -0.2f));

	cam = new MapCamera(mMap);

	renderContext =
	        new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));

	// shader = new DefaultShader(renderable.material,
	// renderable.mesh.getVertexAttributes(), true, false, 1, 0, 0, 0);
	// shader.init();

	return true;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:21,代码来源:GdxModelRenderer.java

示例10: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin(Camera camera, RenderContext context) {
	super.begin(camera, context);
	if (Cubes.getClient() == null) {
		program.setUniformf(u_sunlight, 1f);
	} else {
		program.setUniformf(u_sunlight, Cubes.getClient().world.getWorldSunlight());
	}
	program.setUniformf(u_lightoverride, -1f);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:WorldShaderProvider.java

示例11: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin(Camera camera, RenderContext context) {
  super.begin(camera, context);
  if (Cubes.getClient() == null) {
    program.setUniformf(u_sunlight, 1f);
  } else {
    program.setUniformf(u_sunlight, Cubes.getClient().world.getWorldSunlight());
  }
  program.setUniformf(u_lightoverride, -1f);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:11,代码来源:WorldShaderProvider.java

示例12: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin(final Camera camera, final RenderContext context) {
    super.begin(camera, context);

    //context.setBlending(true, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    //context.setDepthTest(GL20.GL_LEQUAL);
    //context.setDepthMask(true);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:9,代码来源:ParticleShader.java

示例13: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin(Camera camera, RenderContext context) {
    this.camera=camera;
    this.context=context;

    program.begin();
    program.setUniformMatrix(u_projTrans, camera.combined);

    context.setDepthTest(GL20.GL_LEQUAL); /* context.setDepthTest(0) per disabilitare */
    context.setCullFace(GL20.GL_BACK);
}
 
开发者ID:PWorlds,项目名称:LibGDX-PBR,代码行数:12,代码来源:PBRShader.java

示例14: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
public void begin (Camera camera, RenderContext context) {
	super.begin(camera, context);
	program.setUniformf("invDistFog", InGame.invDistFog);
	program.setUniformf("u_fogColor", InGame.solFog);
	// Gdx.gl20.glEnable(GL20.GL_POLYGON_OFFSET_FILL);
	// Gdx.gl20.glPolygonOffset(2.f, 100.f);
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:9,代码来源:ModelShader.java

示例15: begin

import com.badlogic.gdx.graphics.g3d.utils.RenderContext; //导入依赖的package包/类
@Override
	public void begin (Camera camera, RenderContext context) {
		super.begin(camera, context);
//		program.setUniformf("invDistFog", InGame.invDistFog);
//		program.setUniformf("u_fogColor", InGame.solFog);
		// Gdx.gl20.glEnable(GL20.GL_POLYGON_OFFSET_FILL);
		// Gdx.gl20.glPolygonOffset(2.f, 100.f);
	}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:9,代码来源:DefShader.java


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