Giter Site home page Giter Site logo

ianmackenzie / elm-3d-camera Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 1.0 290 KB

Camera type for doing 3D rendering in Elm

Home Page: http://package.elm-lang.org/packages/ianmackenzie/elm-3d-camera/latest

License: Mozilla Public License 2.0

Elm 98.89% Nix 1.11%
point vector opensolid webgl elm matrix

elm-3d-camera's Introduction

Hey! ๐Ÿ‘‹

I work as a software developer at Generative, and I maintain several open-source Elm packages including:

I'm interested in:

  • 3D geometry
  • Computer-aided design (CAD)
  • Computer-aided manufacturing (CAM)
  • Using those to help address the climate crisis!

You can generally find me (@ianmackenzie) on the Elm Slack; I tend to hang out mostly in the #geometry and #webgl channels.

elm-3d-camera's People

Contributors

ianmackenzie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

glennneiger

elm-3d-camera's Issues

Add examples of how to construct screen rectangle for Camera3d.ray

Cover simple case of window at the top left of the screen, as well as more complex case of a scene somewhere within the page (perhaps with scrolling involved).

Possible way to describe the logic: use Rectangle2d.from p1 p2, where p1 has the coordinates that you'd get if you clicked the lower left corner of the rectangle and p2 has the coordinates you'd get if you clicked the upper right corner.

Change viewPlane to return a Plane3d, not a SketchPlane3d

Instead of projecting directly into a SketchPlane3d, projection should really be done using the various toScreenSpace functions so that both perspective and orthographic cameras are handled properly. It would likely be more useful for viewPlane to return a Plane3d with the normal direction equal to viewDirection, to allow for code like

pointDepth =
    point |> Point3d.signedDistanceFrom (Camera3d.viewPlane camera)

which would be useful for checking if a given 3D point is (for example) between a near and a far clip plane.

Add Camera3d.projectionMatrix

Unless I've misunderstood something, there doesn't seem to be any way to get the projection matrix of a camera. This means while I can use Camera3d to get the model and view matrix, I have to resort to Math.Matrix4.makePerspective from elm-explorations/linear-algebra for the last part.

I think while adding this, it would also make sense to have Camera3d.viewProjectionMatrix and Camera3d.modelViewProjectionMatrix.

Don't store near/far clip plane in Camera3d

Not all uses of Camera3d will care about near/far clip planes (really only WebGL will, most likely), so probably better to construct Camera3d values without them and then pass them separately when calling projectionMatrix etc.

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.