Coder Social home page Coder Social logo

mesh-loader's Introduction

3D Mesh Loading and Rendering

This program renders a world consisting of a set of polygonal meshes, where each mesh is defined in a separate file with ".off" suffix.

Features

  • parallel/perspective projection
  • animate/freeze mesh
  • animate/freeze light
  • flat/smooth shading
  • zoom in/out
  • vertex mode
  • edge mode
  • face mode
  • Left mouse click-and-drag rotation of the universe
  • Animate/freeze light source

Complie

Standard Compilation - use make (make clean removes unnecessary files):

make
./meshloader [file_names]

Usage

This program accepts a list of file names as command line inputs. Usage:

./meshloader [file_names]

Example:

./meshloader venus.off eight.off

The format of a polygon-mesh text file is expected to follow the format below: number-of-vertices number-of-faces //int int //for each vertex: x y z //3 doubles //for each face: list of vertices by index //int list

User Interaction: (keyboard shortcuts) 'p': parallel/perspective projection 'a': animate/freeze mesh 'l': animate/freeze light 's': flat/smooth shading 'UP': zoom in 'DOWN': zoom out 'v': vertex mode 'e': edge mode 'f': face mode q/Q/escape: quit

FILES

  • README
  • C++ files: main.cpp vector.cpp vertex.cpp edge.cpp face.cpp mesh.cpp
  • Header files: main.h vector.h vertex.h edge.h face.h mesh.h mats.h
  • Executable C program: meshloader
  • Makefile

This program is divided into 6 separate files

  1. vector.cpp This is our self-constructed vector library.

  2. vertex.cpp This class represents a single node of vertex. It stores the position of vertex, the vertex norm, the index, and a list of pointers to its adjacent faces.

  3. face.cpp This class represents a single node of face. It stores the face norm, and a list of the adjacent vertices.

  4. edge.cpp This class represents a single node of edge. It stores two vertices and two adjacent faces.

  5. mesh.cpp This class represents a single node of mesh to be drawn. It stores lists of vertices, faces, and edges required for a polygonal mesh.

  6. main.cpp This is where the main() is at. For user-interactive purpose it handles situations with mouse and keyboard input.

mesh-loader's People

Contributors

jacyxli 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.