Giter VIP home page Giter VIP logo

readobj's Introduction

readobj

Travis-CI Build Status CRAN_Status_Badge Downloads

Quick Start

For the impatient ...

# install CRAN version
install.packages("readobj")

# use
library(readobj)

# run examples
example("read.obj")

# get overview help for package
?readobj
# help for functions
?read.obj

# run tests
library(testthat)
test_package("readobj")

Installation

A released version is now available on CRAN.

install.packages("readobj")

Development version

You can use the remotes package to install the development version:

if (!require("remotes")) install.packages("remotes")
remotes::install_github("jefferis/readobj")

Note: You will need a development environment able to compile code C++ to install in this way. MacOS X users will likely need Xcode (see https://cran.r-project.org/). Windows users need Rtools to install this way.

Acknowledgements

This package wraps the tinyobjloader C++ library available at https://github.com/tinyobjloader/tinyobjloader. Kudos to its author, Syoyo Fujita!

tinyobjloader is released under a liberal 2 clause BSD license, which this package therefore inherits.

readobj's People

Contributors

dmurdoch avatar jefferis avatar trevorld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dmurdoch

readobj's Issues

R CMD check C/C++ pragma NOTE

Merging #8 (a newer version of tinyobjloader) leads to the following R CMD note

❯ checking pragmas in C/C++ headers and code ... NOTE
  File which contains pragma(s) suppressing diagnostics:
    ‘src/tiny_obj_loader.h’

@jefferis commented in that PR that

I'm afraid the second note will need an explanation and it's not guaranteed that CRAN will accept.

See xtensor-stack/Xtensor.R#11 for an example. I think this means at a minimum that we need to figure out what compiler a warning is being suppressed by turning off the #pragma.

Note that @tylermorganwall also embeds a recent version of tinyobjloader in both {rayrender} and {rayvertex} and I don't see such a NOTE in his R CMD check results so he may have already figured out a workaround:

Bug importing "pawn"-like shape

I've found an obj file that readobj::read.obj doesn't seem to import correctly. However rayrender::obj_model and rgl::readOBJ both seem to import correctly. Since both rayrender and readobj embed tinyobjloader maybe rayrender is using a newer version of tinyobjloader that has fixed a bug?

Github won't let me upload my obj file so here is a link to a zip file containing "pawn.obj": https://trevorldavis.com/share/tmp/readobj/pawn.zip

library("rayrender")
library("readobj")
library("rgl")

png("rayrender.png")
obj <- obj_model(filename = "pawn.obj", material=diffuse(color="black"))
render_scene(obj, lookfrom=c(0, 0, 3))
dev.off()

open3d()
view3d(theta = 0, phi = 0)
shade3d(readOBJ("pawn.obj"), material=list(lit=FALSE))
rgl.snapshot("readOBJ.png")

rgl.clear()
shade3d(read.obj("pawn.obj", convert.rgl=TRUE))
rgl.snapshot("read.obj.png")


Incorrect render using readobj::read.obj:

read obj

Correct render using rgl::readOBJ and rayrender::obj_model:

readOBJ

rayrender

Update version number (currently v0.3.2)

I recently was using readobj and wondering why my local version of the code wasn't returning texcoords when the code on Github said it should be, and realized there was a change even though the version numbers were the same. I'm just opening this issue to recommend you update the version number so people are aware the code has changed.

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.