kandi background
Explore Kits

MaterialFactory | Gives the ability to create custom items | RecyclerView library

 by   Cybermaxke Java Version: Current License: No License

 by   Cybermaxke Java Version: Current License: No License

Download this library from

kandi X-RAY | MaterialFactory Summary

MaterialFactory is a Java library typically used in User Interface, RecyclerView, Unity, Minecraft applications. MaterialFactory has no bugs, it has no vulnerabilities and it has low support. However MaterialFactory build file is not available. You can download it from GitHub.
The material factory will expand the feature set provided by Bukkit. Which will allow you to create custom item types, attach additional data to item stacks, …​.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • MaterialFactory has a low active ecosystem.
  • It has 12 star(s) with 8 fork(s). There are 4 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 1 open issues and 2 have been closed. On average issues are closed in 726 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of MaterialFactory is current.
MaterialFactory Support
Best in #RecyclerView
Average in #RecyclerView
MaterialFactory Support
Best in #RecyclerView
Average in #RecyclerView

quality kandi Quality

  • MaterialFactory has 0 bugs and 0 code smells.
MaterialFactory Quality
Best in #RecyclerView
Average in #RecyclerView
MaterialFactory Quality
Best in #RecyclerView
Average in #RecyclerView

securitySecurity

  • MaterialFactory has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • MaterialFactory code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
MaterialFactory Security
Best in #RecyclerView
Average in #RecyclerView
MaterialFactory Security
Best in #RecyclerView
Average in #RecyclerView

license License

  • MaterialFactory does not have a standard license declared.
  • Check the repository for any license declaration and review the terms closely.
  • Without a license, all rights are reserved, and you cannot use the library in your applications.
MaterialFactory License
Best in #RecyclerView
Average in #RecyclerView
MaterialFactory License
Best in #RecyclerView
Average in #RecyclerView

buildReuse

  • MaterialFactory releases are not available. You will need to build from source code and install.
  • MaterialFactory has no build file. You will be need to create the build yourself to build the component from source.
  • It has 3469 lines of code, 409 functions and 80 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
MaterialFactory Reuse
Best in #RecyclerView
Average in #RecyclerView
MaterialFactory Reuse
Best in #RecyclerView
Average in #RecyclerView
Top functions reviewed by kandi - BETA

kandi has reviewed MaterialFactory and discovered the below as its top functions. This is intended to give you an instant insight into MaterialFactory implemented functionality, and help decide if they suit your requirements.

  • Loads the list of Tweakers .
  • Sets the item type .
  • Entry point for the agent .
  • Converts the given object into a pseudo - enum value .
  • Returns true if there is at least one path in the dataset .
  • Get a subset of the keys in this map .
  • Returns the data container
  • Sets the valueEquivalence property .
  • Registers a new item type .
  • Create an ExtendedItemStack from a given itemType .

MaterialFactory Key Features

Custom item types

Custom recipe types - Shaped, shapeless, fireworks, dyed, create your own!

Custom item data - Attach custom data to the item stacks.

…​

Community Discussions

Trending Discussions on MaterialFactory
  • How to draw a line between anchors on the plane with ARcore without arFragment
  • How to wait until all of a series of nested CompletableFutures are done?
  • Android Arcore Plane Tracker Target
Trending Discussions on MaterialFactory

QUESTION

How to draw a line between anchors on the plane with ARcore without arFragment

Asked 2020-Sep-30 at 12:29

I'm building my app around this Agora ARcore Demo based on Google's hello_ar_java Sample APP.

This application, capture user's taps and check if any planes in the scene were found. If so, create an anchor at that point.

I would like to draw a line between the various anchors.

Everything I find on the web uses sceneForm and arFragment.

At the moment I have managed to implement sceneForm without arFragment but the line is not showing, probably because of of this method that I don't know how to replace without arFragment: nodeToAdd.setParent(arFragment.getArSceneView().getScene());

To implement sceneform in my project I'm taking a cue from this project LineView Are there any other methods without using sceneform?

This is how I am proceeding:

public void onDrawFrame(GL10 gl) {
    // Clear screen to notify driver it should not load any pixels from previous frame.
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    if (mSession == null) {
        return;
    }
    // Notify ARCore session that the view size changed so that the perspective matrix and
    // the video background can be properly adjusted.
    mDisplayRotationHelper.updateSessionIfNeeded(mSession);

    try {
        // Obtain the current frame from ARSession. When the configuration is set to
        // UpdateMode.BLOCKING (it is by default), this will throttle the rendering to the
        // camera framerate.
        Frame frame = mSession.update();
        Camera camera = frame.getCamera();

        // Handle taps. Handling only one tap per frame, as taps are usually low frequency
        // compared to frame rate.
        MotionEvent tap = queuedSingleTaps.poll();
        if (tap != null && camera.getTrackingState() == TrackingState.TRACKING) {
            for (HitResult hit : frame.hitTest(tap)) {
                // Check if any plane was hit, and if it was hit inside the plane polygon
                Trackable trackable = hit.getTrackable();
                // Creates an anchor if a plane or an oriented point was hit.
                if ((trackable instanceof Plane && ((Plane) trackable).isPoseInPolygon(hit.getHitPose()))
                        || (trackable instanceof Point
                        && ((Point) trackable).getOrientationMode()
                        == Point.OrientationMode.ESTIMATED_SURFACE_NORMAL)) {
                    // Hits are sorted by depth. Consider only closest hit on a plane or oriented point.
                    // Cap the number of objects created. This avoids overloading both the
                    // rendering system and ARCore.
                    if (anchors.size() >= 250) {
                        anchors.get(0).detach();
                        anchors.remove(0);
                    }
                    // Adding an Anchor tells ARCore that it should track this position in
                    // space. This anchor is created on the Plane to place the 3D model
                    // in the correct position relative both to the world and to the plane.
                    anchors.add(hit.createAnchor());
                    break;
                }
            }
        }

        // Draw background.
        mBackgroundRenderer.draw(frame);

        // If not tracking, don't draw 3d objects.
        if (camera.getTrackingState() == TrackingState.PAUSED) {
            return;
        }

        // Get projection matrix.
        float[] projmtx = new float[16];
        camera.getProjectionMatrix(projmtx, 0, 0.1f, 100.0f);

        // Get camera matrix and draw.
        float[] viewmtx = new float[16];
        camera.getViewMatrix(viewmtx, 0);

        // Compute lighting from average intensity of the image.
        final float lightIntensity = frame.getLightEstimate().getPixelIntensity();

        if (isShowPointCloud()) {
            // Visualize tracked points.
            PointCloud pointCloud = frame.acquirePointCloud();
            mPointCloud.update(pointCloud);
            mPointCloud.draw(viewmtx, projmtx);

            // Application is responsible for releasing the point cloud resources after
            // using it.
            pointCloud.release();
        }

        // Check if we detected at least one plane. If so, hide the loading message.
        if (mMessageSnackbar != null) {
            for (Plane plane : mSession.getAllTrackables(Plane.class)) {
                if (plane.getType() == Plane.Type.HORIZONTAL_UPWARD_FACING
                        && plane.getTrackingState() == TrackingState.TRACKING) {
                    hideLoadingMessage();
                    break;
                }
            }
        }

        if (isShowPlane()) {
            // Visualize planes.
            mPlaneRenderer.drawPlanes(
                    mSession.getAllTrackables(Plane.class), camera.getDisplayOrientedPose(), projmtx);
        }

        // Visualize anchors created by touch.
        float scaleFactor = 1.0f;

        for (Anchor anchor : anchors) {
            if (anchor.getTrackingState() != TrackingState.TRACKING) {
                continue;
            }
            // Get the current pose of an Anchor in world space. The Anchor pose is updated
            // during calls to session.update() as ARCore refines its estimate of the world.
            anchor.getPose().toMatrix(mAnchorMatrix, 0);


            // Update and draw the model and its shadow.
            mVirtualObject.updateModelMatrix(mAnchorMatrix, mScaleFactor);
            mVirtualObjectShadow.updateModelMatrix(mAnchorMatrix, scaleFactor);
            mVirtualObject.draw(viewmtx, projmtx, lightIntensity);
            mVirtualObjectShadow.draw(viewmtx, projmtx, lightIntensity);
        }

        sendARViewMessage();
    } catch (Throwable t) {
        // Avoid crashing the application due to unhandled exceptions.
        Log.e(TAG, "Exception on the OpenGL thread", t);
    }
}

Then:

 public void drawLineButton(View view) {
    AnchorNode nodeToAdd;
    for (Anchor anchor : anchors) {
        anchorNode = new AnchorNode(anchor);
        anchorNodeList.add(anchorNode);
        //this is the problem imho
        //nodeToAdd.setParent(arFragment.getArSceneView().getScene());
        numberOfAnchors++;

    }

    if (numberOfAnchors == 2 ) {
        drawLine(anchorNodeList.get(0), anchorNodeList.get(1));
    }
}

Here the Nodes exist and are real. I don't find any errors, and the lines don't show:

private void drawLine(AnchorNode node1, AnchorNode node2) {
    //Here the knots exist and are real. I don't find any errors, and the lines don't show
    runOnUiThread(new Runnable() {

        @Override
        public void run() {

            Vector3 point1, point2;
            point1 = node1.getWorldPosition();
            point2 = node2.getWorldPosition();

            //First, find the vector extending between the two points and define a look rotation
            //in terms of this Vector.
            final Vector3 difference = Vector3.subtract(point1, point2);
            final Vector3 directionFromTopToBottom = difference.normalized();
            final Quaternion rotationFromAToB =
                    Quaternion.lookRotation(directionFromTopToBottom, Vector3.up());
            MaterialFactory.makeOpaqueWithColor(getApplicationContext(), new Color(0, 255, 244))
                    .thenAccept(
                            material -> {
                        /* Then, create a rectangular prism, using ShapeFactory.makeCube() and use the difference vector
                               to extend to the necessary length.  */
                                Log.d(TAG,"drawLine insie .thenAccept");
                                ModelRenderable model = ShapeFactory.makeCube(
                                        new Vector3(.01f, .01f, difference.length()),
                                        Vector3.zero(), material);
                        /* Last, set the world rotation of the node to the rotation calculated earlier and set the world position to
                               the midpoint between the given points . */
                                Anchor lineAnchor = node2.getAnchor();
                                nodeForLine = new Node();
                                nodeForLine.setParent(node1);
                                nodeForLine.setRenderable(model);
                                nodeForLine.setWorldPosition(Vector3.add(point1, point2).scaled(.5f));
                                nodeForLine.setWorldRotation(rotationFromAToB);
                            }
                    );



        }
    });


}

this is the example of my point1,poin2 and directionFromTopToBottom in the drawLine() function:

point1: [x=0.060496617, y=-0.39098215, z=-0.21526277]
point2: [x=0.05695567, y=-0.39132282, z=-0.33304527]
directionFromTopToBottom: [x=0.030049745, y=0.0028910497, z=0.9995442]

ANSWER

Answered 2020-Sep-30 at 12:09

You code is not calling your drawLineButton() function, is it? Anyway, it looks like you're trying to use some things from Sceneform (MaterialFactory, ModelRenderable, etc) while doing some pure OpenGL rendering as done in the hello_ar_java.

Mixing those will result in nothing good since Sceneform uses filament as rendering engine which could use OpenGL or Vulkan. So either go fully with Sceneform or fully with OpenGL (and understand how OpenGL and Android work).

Now, if you want to continue with hello_ar_java sample, follow an OpenGL tutorial in order to be able to generate a vertex for each anchor and draw them with GL_LINES with the line size you like. Here's a good OpenGL tutorial: https://learnopengl.com/ I recommend going through all the Getting Started section, but just keep in mind that it is OpenGL and Android uses OpenGL ES, there are some differences but the computer graphics principles are the same.

Source https://stackoverflow.com/questions/64046101

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install MaterialFactory

You can download it from GitHub.
You can use MaterialFactory like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the MaterialFactory component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.