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


Java DepthShaderProvider类代码示例

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


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

示例1: PerspectiveRenderer

import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider; //导入依赖的package包/类
/**
 * Renderer for all visible 3D components.
 * 
 * @param camera
 * @param boardController
 *            handles interactions between the behind the scenes logic and
 *            what is drawn
 * @param piecePlacement
 *            array of 64 shorts defining the contents of all 64 board
 *            locations
 */
public PerspectiveRenderer(Camera camera, BoardController boardController, short[] piecePlacement) {

	mCamera = camera;
	mBoardController = boardController;

	mShadowBatch = new ModelBatch(new DepthShaderProvider());
	mCubeMapBatch = new ModelBatch(Gdx.files.internal("shaders/cubevertex.glsl"), Gdx.files.internal("shaders/cubefragment.glsl"));
	mBackgroundBatch = new ModelBatch();
	mEnvironment = new Environment();
	mBackgroundEnvironment = new Environment();
	mDrawables = new Array<ABaseObject>();
	mGraveyard = new ChessPieceGraveyard();
	mLightDirection = new Vector3(11.0f, -9.0f, 11.0f);

	configureEnvironments();
	createGameObjects(piecePlacement);
}
 
开发者ID:nkarasch,项目名称:ChessGDX,代码行数:29,代码来源:PerspectiveRenderer.java

示例2: GameRenderer

import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider; //导入依赖的package包/类
public GameRenderer(Viewport viewport, Camera camera, GameEngine engine) {
	this.viewport = viewport;
	this.camera = camera;
	this.engine = engine;

	shapeRenderer = new MyShapeRenderer();
	shapeRenderer.setAutoShapeType(true);

	spriteBatch = new SpriteBatch();
	font = new BitmapFont();
	font.setColor(Color.WHITE);
	font.setUseIntegerPositions(false);
	font.getData().setScale(0.01f);
	shadowBatch = new ModelBatch(new DepthShaderProvider());

	ShaderProgram.pedantic = false;
	final String vertUber = Gdx.files.internal("shaders/uber.vert").readString();
	final String fragUber = Gdx.files.internal("shaders/uber.frag").readString();
	modelBatch = new ModelBatch(new DefaultShaderProvider(vertUber, fragUber) {
		@Override
		protected Shader createShader(final Renderable renderable) {
			return new UberShader(renderable, config);
		}
	});
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:26,代码来源:GameRenderer.java

示例3: create

import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider; //导入依赖的package包/类
@Override
public void create () {
	modelBatch = new ModelBatch();
	environment = new Environment();
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
	environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
	environment.add((shadowLight = new DirectionalShadowLight(1024, 1024, 30f, 30f, 1f, 100f)).set(0.8f, 0.8f, 0.8f, -1f, -.8f,
		-.2f));
	environment.shadowMap = shadowLight;

	cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	cam.position.set(0f, 7f, 10f);
	cam.lookAt(0, 0, 0);
	cam.near = 1f;
	cam.far = 50f;
	cam.update();

	ModelBuilder modelBuilder = new ModelBuilder();
	modelBuilder.begin();
	MeshPartBuilder mpb = modelBuilder.part("parts", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal | Usage.Color,
		new Material(ColorAttribute.createDiffuse(Color.WHITE)));
	mpb.setColor(1f, 1f, 1f, 1f);
	mpb.box(0, -1.5f, 0, 10, 1, 10);
	mpb.setColor(1f, 0f, 1f, 1f);
	mpb.sphere(2f, 2f, 2f, 10, 10);
	model = modelBuilder.end();
	instance = new ModelInstance(model);

	shadowBatch = new ModelBatch(new DepthShaderProvider());

	Gdx.input.setInputProcessor(camController = new CameraInputController(cam));
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:33,代码来源:ShadowMappingTest.java

示例4: createBatchs

import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider; //导入依赖的package包/类
public static void createBatchs() {
	Config modelConfigShader = new Config(Gdx.files.classpath(VERTEX_SHADER).readString(),
			Gdx.files.classpath(FRAGMENT_SHADER).readString());

	modelConfigShader.numBones = MAX_BONES;
	modelConfigShader.numDirectionalLights = 0;
	modelConfigShader.numPointLights = 0;
	modelConfigShader.numSpotLights = 0;

	modelBatch = new ModelBatch(new DefaultShaderProvider(modelConfigShader));

	shadowBatch = new ModelBatch(new DepthShaderProvider());
	floorBatch = new ModelBatch(new DefaultShaderProvider(Gdx.files.classpath(VERTEX_SHADER),
			Gdx.files.classpath(FLOOR_FRAGMENT_SHADER)));
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:16,代码来源:Sprite3DRenderer.java

示例5: create

import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider; //导入依赖的package包/类
@Override
public void create () {
	super.create();
	lights = new Environment();
	lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
	lights.add((shadowLight = new DirectionalShadowLight(1024, 1024, 30f, 30f, 1f, 100f))
		.set(0.8f, 0.8f, 0.8f, -.4f, -.4f, -.4f));
	lights.shadowMap = shadowLight;
	inputController.rotateLeftKey = inputController.rotateRightKey = inputController.forwardKey = inputController.backwardKey = 0;
	cam.position.set(25, 25, 25);
	cam.lookAt(0, 0, 0);
	cam.update();
	modelsWindow.setVisible(false);
	assets.load("data/g3d/skydome.g3db", Model.class);
	assets.load("data/g3d/concrete.png", Texture.class);
	assets.load("data/tree.png", Texture.class);
	loading = true;
	trForward.translation.set(0, 0, 8f);
	trBackward.translation.set(0, 0, -8f);
	trLeft.rotation.setFromAxis(Vector3.Y, 90);
	trRight.rotation.setFromAxis(Vector3.Y, -90);

	ModelBuilder builder = new ModelBuilder();
	builder.begin();
	builder.node().id = "floor";
	MeshPartBuilder part = builder.part("floor", GL20.GL_TRIANGLES, Usage.Position | Usage.TextureCoordinates | Usage.Normal,
		new Material("concrete"));
	((MeshBuilder)part).ensureRectangles(1600);
	for (float x = -200f; x < 200f; x += 10f) {
		for (float z = -200f; z < 200f; z += 10f) {
			part.rect(x, 0, z + 10f, x + 10f, 0, z + 10f, x + 10f, 0, z, x, 0, z, 0, 1, 0);
		}
	}
	builder.node().id = "tree";
	part = builder.part("tree", GL20.GL_TRIANGLES, Usage.Position | Usage.TextureCoordinates | Usage.Normal,
		new Material("tree"));
	part.rect( 0f, 0f, -10f, 10f, 0f, -10f, 10f, 10f, -10f,  0f, 10f, -10f, 0, 0, 1f);
	part.setUVRange(1, 0, 0, 1);
	part.rect(10f, 0f, -10f,  0f, 0f, -10f,  0f, 10f, -10f, 10f, 10f, -10f, 0, 0, -1f);
	floorModel = builder.end();

	shadowBatch = new ModelBatch(new DepthShaderProvider());
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:44,代码来源:Animation3DTest.java

示例6: GameLevelScreen

import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider; //导入依赖的package包/类
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();
}
 
开发者ID:macbury,项目名称:BotLogic,代码行数:50,代码来源:GameLevelScreen.java


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