Java 类com.badlogic.gdx.graphics.g3d.utils.DefaultTextureBinder 实例源码

项目:ForgE    文件:BlockPreviews.java   
@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;
}
项目:ForgE    文件:Level.java   
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));
}
项目:HelixEngine    文件:RenderingSystem.java   
@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();
}
项目:vtm    文件:GdxModelRenderer.java   
@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;
}
项目:vtm    文件:GdxRenderer3D.java   
@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;
}
项目:libgdxcn    文件:ModelBatch.java   
/** Construct a ModelBatch, using this constructor makes you responsible for calling context.begin() and context.end() yourself.
 * @param context The {@link RenderContext} to use.
 * @param shaderProvider The {@link ShaderProvider} to use, will be disposed when this ModelBatch is disposed.
 * @param sorter The {@link RenderableSorter} to use. */
public ModelBatch (final RenderContext context, final ShaderProvider shaderProvider, final RenderableSorter sorter) {
    this.sorter = (sorter == null) ? new DefaultRenderableSorter() : sorter;
    this.ownContext = (context == null);
    this.context = (context == null) ? new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1)) : context;
    this.shaderProvider = (shaderProvider == null) ? new DefaultShaderProvider() : shaderProvider;
}
项目:ForgE    文件:PreviewScreen.java   
@Override
protected void onInitialize() {
  this.renderContext       = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
  this.camera              = new PerspectiveCamera(67, 64, 64);
}
项目:BotLogic    文件:GameLevelScreen.java   
public GameLevelScreen(LevelFile levelDef) {
  this.gameObjectsTweenManager = new TweenManager();
  this.uiTweenManager          = new TweenManager();
  this.renderContext      = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
  this.entities           = new ArrayList<Entity>();
  this.perspectiveCamera  = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

  levelDefinition         = levelDef;

  this.map                = new Map(levelDefinition.geometryFile());
  perspectiveCamera.position.set(0, 0, 0);
  perspectiveCamera.near = 0.1f;
  perspectiveCamera.far = 50f;
  perspectiveCamera.update(true);

  this.cameraController = new RTSCameraController();
  cameraController.setCamera(perspectiveCamera);
  cameraController.setCenter(0, 0);
  cameraController.setEnabled(true);

  environment = new Environment();
  environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1f));

  this.cellShadingCompositor = new LevelCompositor(renderContext);

  this.robot = BotLogic.entities.robot();
  this.robot.led = BotLogic.entities.led();

  addEntity(this.robot);
  addEntity(this.robot.led);

  colorModelBatch = new ModelBatch(renderContext);
  decalBatch      = new DecalBatch();

  decalBatch.setGroupStrategy(new CameraGroupStrategy(perspectiveCamera));

  DepthShader.Config depthConfig     = new DepthShader.Config(Gdx.files.internal("shaders/depth.vertex").readString(), Gdx.files.internal("shaders/depth.frag").readString());
  depthConfig.defaultCullFace        = GL20.GL_BACK;
  depthConfig.depthBufferOnly        = false;
  depthModelBatch = new ModelBatch(renderContext, new DepthShaderProvider(depthConfig));

  map.environment = environment;
  this.controller = new GameController(this);
  reset();

  environment.set(new ColorAttribute(ColorAttribute.Fog, 0f, 0f, 0f, 1f));
  environment.add(new DirectionalLight().set(new Color(.4f,.4f, .4f, 0.1f), new Vector3(1,-1,0)));
  BotLogic.audio.mainMenuMusic.play();
}