Java Code Examples for com.badlogic.gdx.graphics.g3d.utils.ModelBuilder#createRect()

The following examples show how to use com.badlogic.gdx.graphics.g3d.utils.ModelBuilder#createRect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleRoom.java    From gdx-vr with Apache License 2.0 6 votes vote down vote up
@Override
public void create() {
	assets = new AssetManager();
	String model = "Bambo_House.g3db";
	assets.load(model, Model.class);
	assets.finishLoading();
	modelInstance = new ModelInstance(assets.get(model, Model.class), new Matrix4().setToScaling(0.6f, 0.6f, 0.6f));

	DefaultShader.Config config = new Config();
	config.defaultCullFace = GL20.GL_NONE;
	ShaderProvider shaderProvider = new DefaultShaderProvider(config);
	modelBatch = new ModelBatch(shaderProvider);

	ModelBuilder builder = new ModelBuilder();
	float groundSize = 1000f;
	ground = new ModelInstance(builder.createRect(-groundSize, 0, groundSize, groundSize, 0, groundSize, groundSize, 0, -groundSize, -groundSize, 0, -groundSize, 0,
			1, 0, new Material(), Usage.Position | Usage.Normal), new Matrix4().setToTranslation(0, -0.01f, 0));
	environment = new Environment();
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
	environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));

	VirtualReality.renderer.listeners.add(this);
	// VirtualReality.head.setCyclops(true);
}
 
Example 2
Source File: Shadow.java    From gdx-proto with Apache License 2.0 6 votes vote down vote up
public static void init() {
	list = new Array<>();
	ModelBuilder mb = new ModelBuilder();
	Vector3 norm = new Vector3(0f, 1f, 0f);
	Texture texture = Assets.manager.get("textures/shadow.png", Texture.class);
	Material material = new Material(TextureAttribute.createDiffuse(texture));
	material.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, 0.7f));
	//material.set(new DepthTestAttribute(0)); // disable depth testing
	long attr = Usage.Position | Usage.TextureCoordinates;
	float s = 1f;
	model = mb.createRect(
			-s, 0f, -s,// bl
			-s, 0f, s, // tl
			s, 0f, s,  // tr
			s, 0f, -s,  // br
			norm.x, norm.y, norm.z,
			material,
			attr
	);
}