GithubHelp home page GithubHelp logo

pypoly's Introduction

PyPoly

A 3D software renderer for projecting obj files. The project is created in python using the pygame module

Controls

  • W - Move camera forwards
  • S - Move camera backwards
  • A - Move camera left
  • D - Move camera right
  • Up and Down Arrow - Rotate model around its x-axis
  • Left and Right Arrow - Rotate model around its y-axis
  • Z and X - Rotate model around its z-axis

Index

  1. Working
  2. Class files

Working

All the vertices are stored in a list and the faces are stored in another list. Using transformation matrices, the vertices are moved and rotated based on the button pressed. After transformation these points are passed through the projection matix to project them to 2d plane.

Class files

  1. main.py - This is the starting point of the project and it is responsible for importing all the other required classes and creating the pygame windows for drawing the graphics.
  2. settings.py - This class is just used to define parameters to be used by the game engine like window resolution and field of view.
  3. object.py - This imports the obj file and segregates the data in it into different variables.
  4. camera.py - This class is responsible for dealing with the movement of the camera and the model.
  5. scene_management.py - This class is used to calculate the vertex transformation and prjection. It uses the shoelace algorith to implement backface culling. In future normal vectors will be used for backface culling and lighting.
  6. wireframe_renderer.py - As the name suggests, this class is responsible for drawing the model in wireframe mode. With the data obtained from the scene_management class it draws the polygons. In future based on polygon normal and light vector, polygon will be colored to depict light shading.

pypoly's People

Contributors

uzairmukadam avatar

Watchers

 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.