Java Code Examples for com.badlogic.gdx.graphics.g3d.utils.ModelBuilder#createBox()
The following examples show how to use
com.badlogic.gdx.graphics.g3d.utils.ModelBuilder#createBox() .
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: ScaleTool.java From Mundus with Apache License 2.0 | 6 votes |
public ScaleTool(ProjectManager projectManager, GameObjectPicker goPicker, ToolHandlePicker handlePicker, ShapeRenderer shapeRenderer, ModelBatch batch, CommandHistory history) { super(projectManager, goPicker, handlePicker, batch, history); this.shapeRenderer = shapeRenderer; ModelBuilder modelBuilder = new ModelBuilder(); Model xPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_X)), Vector3.Zero, new Vector3(15, 0, 0)); Model yPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_Y)), Vector3.Zero, new Vector3(0, 15, 0)); Model zPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_Z)), Vector3.Zero, new Vector3(0, 0, 15)); Model xyzPlaneHandleModel = modelBuilder.createBox(3, 3, 3, new Material(ColorAttribute.createDiffuse(COLOR_XYZ)), VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal); xHandle = new ScaleHandle(X_HANDLE_ID, xPlaneHandleModel); yHandle = new ScaleHandle(Y_HANDLE_ID, yPlaneHandleModel); zHandle = new ScaleHandle(Z_HANDLE_ID, zPlaneHandleModel); xyzHandle = new ScaleHandle(XYZ_HANDLE_ID, xyzPlaneHandleModel); handles = new ScaleHandle[] { xHandle, yHandle, zHandle, xyzHandle }; }
Example 2
Source File: GameRenderer.java From Radix with MIT License | 5 votes |
private void drawBlockSelection() { int curProgressInt = Math.round(RadixClient.getInstance().getPlayer().getBreakPercent() * 10) - 1; if ((blockBreakModel == null || blockBreakStage != curProgressInt) && curProgressInt >= 0) { if (blockBreakModel != null) blockBreakModel.dispose(); blockBreakStage = curProgressInt; ModelBuilder builder = new ModelBuilder(); blockBreakModel = builder.createBox(1f, 1f, 1f, new Material(TextureAttribute.createDiffuse(blockBreakStages[blockBreakStage]), new BlendingAttribute(), FloatAttribute.createAlphaTest(0.25f)), VertexAttributes.Usage.Position | VertexAttributes.Usage.TextureCoordinates); blockBreakModelInstance = new ModelInstance(blockBreakModel); } Vec3i curBlk = RadixClient.getInstance().getSelectedBlock(); if (curBlk != null && curProgressInt >= 0) { Gdx.gl.glPolygonOffset(100000, 2000000); blockOverlayBatch.begin(RadixClient.getInstance().getCamera()); blockBreakModelInstance.transform.translate(curBlk.x + 0.5f, curBlk.y + 0.5f, curBlk.z + 0.5f); blockOverlayBatch.render(blockBreakModelInstance); blockBreakModelInstance.transform.translate(-(curBlk.x + 0.5f), -(curBlk.y + 0.5f), -(curBlk.z + 0.5f)); blockOverlayBatch.end(); Gdx.gl.glPolygonOffset(100000, -2000000); } }
Example 3
Source File: Skybox.java From Mundus with Apache License 2.0 | 5 votes |
private Model createModel() { ModelBuilder modelBuilder = new ModelBuilder(); Model model = modelBuilder.createBox(1, 1, 1, new Material(new CubemapAttribute(CubemapAttribute.EnvironmentMap, cubemap)), VertexAttributes.Usage.Position); return model; }
Example 4
Source File: FluidSimulatorGeneric.java From fluid-simulator-v2 with Apache License 2.0 | 5 votes |
public FluidSimulatorGeneric(FluidSimulatorStarter fluidSimulatorStarter) { this.game = fluidSimulatorStarter; // LibGDX single batches cannot have a size more than 5460 batch = new SpriteBatch(IS_DESKTOP ? 5460 : ANDROID_SIZE); font = new BitmapFont(); camera = new OrthographicCamera(WORLD_WIDTH, WORLD_HEIGHT); camera.position.set(0, (WORLD_HEIGHT / 2) - 1, 0); immediateRenderer = new ImmediateModeRenderer20(SIZE*6, false, true, 0); irt = new Renderer20(SIZE*6, false, true, 1); irt2 = new ImmediateModeRenderer20(SIZE*11, false, true, 1); shapeRenderer = new ShapeRenderer(SIZE); renderer = new Box2DDebugRenderer(true, true, false, true, false, false); //3D camera3D = new PerspectiveCamera(67, WORLD_WIDTH, WORLD_HEIGHT); camera3D.position.set(0, 130f, 250f); camera3D.lookAt(0,150f,0); camera3D.near = 0.1f; camera3D.far = 500f; camera3D.update(); ModelBuilder modelBuilder = new ModelBuilder(); // model = modelBuilder.createSphere(5f, 5f, 5f, 4, 4, GL10.GL_TRIANGLES, // new Material(ColorAttribute.createDiffuse(Color.GREEN)), // Usage.Position | Usage.Normal); model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); instance = new ModelInstance(model); modelBatch = new ModelBatch(); 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, 0, -0.8f, -0.2f)); camController = new Camera3DController(camera3D); camController.setFluidSimulator(this); world = new World(new Vector2(0, -9.8f), false); world.setContactListener(this); }