Code Monkey home page Code Monkey logo

Comments (8)

andypotato avatar andypotato commented on May 18, 2024 1

@kalwalt @MikiDi I pushed a very detailed example on how to use this library with Three.js here:

https://github.com/andypotato/artoolkit5-js-demo/

Also I have a bit of time now so I will implement the remaining NFT features and add a couple of demos.

from artoolkit5-js.

andypotato avatar andypotato commented on May 18, 2024 1

Now that NFT markers are available more example code should be created. I'll add some examples to the demo repository but other contributions are welcome.

from artoolkit5-js.

kalwalt avatar kalwalt commented on May 18, 2024

@andypotato i created this gist as a starting point, if you have other resources let me know.

from artoolkit5-js.

andypotato avatar andypotato commented on May 18, 2024

@kalwalt @MikiDi I have updated the documentation to better describe the interface. Examples will follow!

from artoolkit5-js.

kalwalt avatar kalwalt commented on May 18, 2024

@andypotato great! Thank you very much!

from artoolkit5-js.

kalwalt avatar kalwalt commented on May 18, 2024

Thank you @andypotato i will try it! and can't wait for NFT .... 😄

from artoolkit5-js.

felixniemeyer avatar felixniemeyer commented on May 18, 2024

I just had a look at the demo repository because I have troubles with getting the transformation matrices right in portrait orientation.

The demo project unfortunately suffers from the same problem:
andypotato/artoolkit5-js-demo#29 (comment)

from artoolkit5-js.

felixniemeyer avatar felixniemeyer commented on May 18, 2024

I found a workaround which looks like this

// on every resize
      if(screenRatio < 1) {
        arController.orientation = 'portrait'
        mat4.mul(projectionMatrix, correction, cameraMatrix)
      } else {
        arController.orientation = 'landscape'
        mat4.copy(projectionMatrix, cameraMatrix)
      }

where the correction appied in case of portrait orientation is a 90 degree rotation around Z

  let correction = mat4.create()
  mat4.fromZRotation(correction, Math.PI / 2)

I think that compensates the rotation made when copying into the heap here:

if(this.orientation === 'portrait') {
this.ctx.translate(this.canvas.width, 0);
this.ctx.rotate(Math.PI / 2);
this.ctx.drawImage(sourceImage, 0, 0, this.canvas.height, this.canvas.width); // draw video
} else {

But yea, it adds to the complexity of this already quite complex topic of ar.
Shouldn't artoolkit be able to natively handle all kinds of resolutions from 640x480 to 480x640 and beyond?

Thank you for all your sweat and thoughts that have flown into this.

from artoolkit5-js.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.