Giter Club home page Giter Club logo

ofxquad's Introduction

ofxQuad

ofxQuad is an OpenFrameworks addon for creating meshes based on quads instead of triangles. ofxQuad also contains an implementation of the Catmull-Clark subdivision surface algorithm for subdividing a mesh into a smoother mesh.

Example

The following code creates a cube using six quad faces:

Quad quad;

auto v0 = quad.addVertex({100.0, -100.0, 100.0});
auto v1 = quad.addVertex({100.0, 100.0, 100.0});
auto v2 = quad.addVertex({-100.0, 100.0, 100.0});
auto v3 = quad.addVertex({-100.0, -100.0, 100.0});
auto v4 = quad.addVertex({100.0, -100.0, -100.0});
auto v5 = quad.addVertex({-100.0, -100.0, -100.0});
auto v6 = quad.addVertex({-100.0, 100.0, -100.0});
auto v7 = quad.addVertex({100.0, 100.0, -100.0});

quad.addFace(v0, v1, v2, v3);
quad.addFace(v4, v5, v6, v7);
quad.addFace(v0, v4, v7, v1);
quad.addFace(v3, v2, v6, v5);
quad.addFace(v1, v7, v6, v2);
quad.addFace(v0, v3, v5, v4);

which rendered as a wireframe looks like this:

Rendering with one subdivision surface iteration creates a smoother mesh:

rendering with four subdivision surface iterations:

rendering with four iterations and flat shading:

rendering with four iterations and smooth shading:

Another Example

A cube with edge loops to create rounded edges:

Demo

The "example" directory contains a demo program that shows how to use ofxQuad.

ofxquad's People

Contributors

jayvius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

n1ckfg ofxyz

ofxquad's Issues

Missing Boost String Lib Fix for Mac OS X High Sierra Xcode

thanks jayvius. That's what I'm looking for. Trying to implement .fbx support
Check the video to fix boost/string lib path in your project - video
Also, update main.cpp as follows;

ofAppGLFWWindow window;
ofGLWindowSettings settings;
settings.setGLVersion(2,1); // set the correct version to your needs
ofCreateWindow(settings);
ofRunApp(new QuadDemo(meshName, numSubdivisions, wireframe, smooth));

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.