Coder Social home page Coder Social logo

obj-parser's Introduction

.OBJ-Parser

OBJ file parser written in Python. Converts OBJ files to vector and texture coordinates to plot in OpenGL with glDrawArrays.

Example .obj file format

The Parser currently only examines lines that begin with "v" (vertex), "vt" (vertex texture), and "f" (faces). Furthermore the faces should consist of the standard .obj format of v/vt/n/... where the values are separated by slashes.
v -0.257682 -1.674006 0.731635
v -0.132727 -1.662367 0.777859
v -0.467796 -1.580605 0.795138

vt 0.336677 0.109069
vt 0.323670 0.086280
vt 0.333450 0.154337

f 1/1/1 5/2/2 6/3/3 2/4/4
f 2/4/4 6/3/3 2/5/5 1/6/6
f 5/2/2 6/7/7 4/8/8 6/3/3

The code is currently optimized for quaderateral faces. Given faces f=[0, 1, 2, 3] the parser will return appropiate vertex and texture coordinates for the two triangles [0, 1, 2] and [0, 2, 3].

Output

Two files are produced. The first file conists of the vertex coordinates and the second file the texture coordinates. The terminal prints the total number of vertices for explicitly allocating array memory.

obj-parser's People

Contributors

kohterai avatar

Watchers

James Cloos avatar Rizwan Asif avatar

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.