Skip to content

subokita/Three.cpp-Rev-2

Repository files navigation

This is my upcoming project: https://plusplusone.herokuapp.com

Please register your email address if you're interested in it.


Notifications:

  • After updating to XCode 6, seems like the library can't show anything on screen anymore. I'm investigating and working to fix it now. Please be patient. [Fixed it's just my silly mistake].
  • I found out there's something wrong with the shadow on the newest version, I'm working to fix it now. [QUICKLY FIXED, WILL REVISIT THE LOGIC IN THE FUTURE]

Three.cpp (Rev 2)

A port of Three.js into C++.

Rev 2, because originally I tried to import by porting JavaScript code directly starting from the more modular ones (e.g. Math packages) to the more encompassing classes (e.g. Renderer), however it backfired, because of JavaScript's dynamic typing, everything becomes more confusing, data members can be added way later and hidden in the codes. In Rev 2 approach, I try to create a working example as soon as possible.

Overview

This is an effort to port Three.js to OpenGL. The main idea is not to create the fastest 3D engine out there, but to create a 3D engine that's simple enough to instantiate, so that other field of computing could use it rapidly for prototyping. Thus reducing the unnecessary hoops for OpenGL newcomers when it comes to thing such as context creation, loading shaders, etc.

I'm not a 3D programmer, I wanted to have a 3D library that I can use to show the results of SLAM / PTAM or Bundle Adjustment, while most sample codes out there use pre OpenGL 3.0 for visualization, and most of them implement their own 3D viewers.

Just be warned that I haven't tried out the part where it automatically installs Homebrew and all the necessary libraries. And for now it's only for OS X, because I don't have a Windows PC

After cloning the repository, go to build/ and run install.sh, it should install Homebrew and the necessary libraries (e.g. glfw3, glm, etc) when it's needed. After that it will proceed to run cmake and make to build the three.cpp library, and run a test program

The code is doing okay, might not be game developers' level, but it works, it shows what it needs to show, and it's quite straightforward.

Working Examples

Simple primitives

Texture and normal Mappings

Environment map

Shadow mapping

Loading PLY Models

Ray casting

Integration with FontStash

Read more about it here: https://github.com/subokita/Three.cpp-Rev-2/wiki/FAQs

About

Reboot of the attempt to port Three.cpp

Resources

Stars

Watchers

Forks

Packages

No packages published