/** Convenience method to create a model with an arrow. The resources the Material might contain are not managed, use * {@link Model#manageDisposable(Disposable)} to add those to the model. */ public Model createArrow (Vector3 from, Vector3 to, Material material, long attributes) { return createArrow(from.x, from.y, from.z, to.x, to.y, to.z, 0.1f, 0.1f, 5, GL20.GL_TRIANGLES, material, attributes); }
/** Convenience method to create a model with an arrow. The resources the Material might contain are not managed, use * {@link Model#manageDisposable(Disposable)} to add those to the model. */ public Model createArrow (Vector3 from, Vector3 to, Material material, long attributes) { return createArrow(from.x, from.y, from.z, to.x, to.y, to.z, 0.1f, 0.1f, 5, GL20.GL_TRIANGLES, material, attributes); }
/** Convenience method to create a model with an arrow. The resources the Material might contain are not managed, use * {@link Model#manageDisposable(Disposable)} to add those to the model. */ public Model createArrow (Vector3 from, Vector3 to, Material material, long attributes) { return createArrow(from.x, from.y, from.z, to.x, to.y, to.z, 0.1f, 0.1f, 5, GL20.GL_TRIANGLES, material, attributes); }
public TranslateTool(ProjectManager projectManager, GameObjectPicker goPicker, ToolHandlePicker handlePicker, ModelBatch batch, CommandHistory history) { super(projectManager, goPicker, handlePicker, batch, history); ModelBuilder modelBuilder = new ModelBuilder(); Model xHandleModel = modelBuilder.createArrow(0, 0, 0, 1, 0, 0, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS, GL20.GL_TRIANGLES, new Material(ColorAttribute.createDiffuse(COLOR_X)), VertexAttributes.Usage.Position); Model yHandleModel = modelBuilder.createArrow(0, 0, 0, 0, 1, 0, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS, GL20.GL_TRIANGLES, new Material(ColorAttribute.createDiffuse(COLOR_Y)), VertexAttributes.Usage.Position); Model zHandleModel = modelBuilder.createArrow(0, 0, 0, 0, 0, 1, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS, GL20.GL_TRIANGLES, new Material(ColorAttribute.createDiffuse(COLOR_Z)), VertexAttributes.Usage.Position); Model xzPlaneHandleModel = modelBuilder.createSphere(1, 1, 1, 20, 20, new Material(ColorAttribute.createDiffuse(COLOR_XZ)), VertexAttributes.Usage.Position); xHandle = new TranslateHandle(X_HANDLE_ID, xHandleModel); yHandle = new TranslateHandle(Y_HANDLE_ID, yHandleModel); zHandle = new TranslateHandle(Z_HANDLE_ID, zHandleModel); xzPlaneHandle = new TranslateHandle(XZ_HANDLE_ID, xzPlaneHandleModel); handles = new TranslateHandle[] { xHandle, yHandle, zHandle, xzPlaneHandle }; gameObjectModifiedEvent = new GameObjectModifiedEvent(null); }
public static Model buildCompassModel() { float compassScale = 5; ModelBuilder modelBuilder = new ModelBuilder(); Model arrow = modelBuilder.createArrow(Vector3.Zero, Vector3.Y.cpy().scl(compassScale), null, VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal); modelBuilder.begin(); Mesh zArrow = arrow.meshes.first().copy(false); zArrow.transform(new Matrix4().rotate(Vector3.X, 90)); modelBuilder.part("part1", zArrow, GL20.GL_TRIANGLES, new Material(ColorAttribute.createDiffuse(Color.BLUE))); modelBuilder.node(); Mesh yArrow = arrow.meshes.first().copy(false); modelBuilder.part("part2", yArrow, GL20.GL_TRIANGLES, new Material(ColorAttribute.createDiffuse(Color.GREEN))); modelBuilder.node(); Mesh xArrow = arrow.meshes.first().copy(false); xArrow.transform(new Matrix4().rotate(Vector3.Z, -90)); modelBuilder.part("part3", xArrow, GL20.GL_TRIANGLES, new Material(ColorAttribute.createDiffuse(Color.RED))); arrow.dispose(); return modelBuilder.end(); } }