GithubHelp home page GithubHelp logo

three_cpp's People

Contributors

elwinarens avatar jdduke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

three_cpp's Issues

osx 10.9 : make error : 'gluErrorString' is deprecated

Hi, I tried to compile three_cpp with osx 10.9 and got this error.
I had to force the deployment target down to 10.8 to compile successfully.

[±] 67d22h47m > make                                                                            ruby-1.9.3-p327 * master dfaa824
Scanning dependencies of target three
[  4%] Building CXX object CMakeFiles/three.dir/three/impl/src.cpp.o
In file included from /Users/kikko/Dev/cpp/three_cpp/three/impl/src.cpp:2:
In file included from /Users/kikko/Dev/cpp/three_cpp/./three/impl/src.hpp:23:
In file included from /Users/kikko/Dev/cpp/three_cpp/./three/materials/impl/uniform.ipp:13:
/Users/kikko/Dev/cpp/three_cpp/./three/gl.hpp:57:54: fatal error: 'gluErrorString' is deprecated: first deprecated in OS X 10.9
      [-Wdeprecated-declarations]
                     << ": "                      << gluErrorString( err );
                                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Headers/glu.h:260:24: note:
      'gluErrorString' declared here
extern const GLubyte * gluErrorString (GLenum error) OPENGL_DEPRECATED(10_0, 10_9);
                       ^
1 error generated.
make[2]: *** [CMakeFiles/three.dir/three/impl/src.cpp.o] Error 1
make[1]: *** [CMakeFiles/three.dir/all] Error 2
make: *** [all] Error 2

Problem compiling on Mac OS X 10.8

Hi, after make I get the following messages :

Scanning dependencies of target three
[ 4%] Building CXX object CMakeFiles/three.dir/three/impl/src.cpp.o
[ 9%] Building CXX object CMakeFiles/three.dir/three/impl/src_extras.cpp.o
Linking CXX static library ../lib/x64/libthree.a
[ 9%] Built target three
Scanning dependencies of target custom_attributes_particles
[ 13%] Building CXX object examples/CMakeFiles/custom_attributes_particles.dir/custom_attributes_particles.cpp.o
Linking CXX executable ../../bin/x64/custom_attributes_particles
Undefined symbols for architecture x86_64:
"main", referenced from:
implicit entry/start for main executable
(maybe you meant: SDL_main, stbi_loadf_main(stbi, int
, int_, int_, int) )
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [../bin/x64/custom_attributes_particles] Error 1
make[1]: *** [examples/CMakeFiles/custom_attributes_particles.dir/all] Error 2
make: *** [all] Error 2

sdl needs an update for msvc

I have fresh VS install and it won't build the code as is. Picking up recent (4167) build from here and cmake ../ -G "Visual Studio 15 2017 Win64" does solve build errors for me.

(this is 3 years old issue, that is 1 year later than last commit here)

Compiling on GCC, 64 bit Ubuntu

I got the following error compiling

 stu  beezlebub  ~  projects  external  three_cpp  build  master  $ make
Scanning dependencies of target three
[  4%] Building CXX object CMakeFiles/three.dir/three/impl/src.cpp.o
[  9%] Building CXX object CMakeFiles/three.dir/three/impl/src_extras.cpp.o
In file included from /home/stu/projects/external/three_cpp/./three/impl/src_extras.hpp:12:0,
                 from /home/stu/projects/external/three_cpp/three/impl/src_extras.cpp:2:
/home/stu/projects/external/three_cpp/./three/extras/utils/impl/font.ipp: In function ‘std::vector<unsigned char> three::detail::load(const string&)’:
/home/stu/projects/external/three_cpp/./three/extras/utils/impl/font.ipp:29:38: error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
   fread( buffer.data(), 1, size, fp );
                                      ^
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/three.dir/three/impl/src_extras.cpp.o] Error 1
make[1]: *** [CMakeFiles/three.dir/all] Error 2
make: *** [all] Error 2

This patch fixes it, but it's probably a workaround - either the warning should be disabled, or probably add some code that does something better in the error state (not sure what threejs does if you try and load a font thats not available).

diff --git a/three/extras/utils/impl/font.ipp b/three/extras/utils/impl/font.ipp
index 3626724..9683e79 100644
--- a/three/extras/utils/impl/font.ipp
+++ b/three/extras/utils/impl/font.ipp
@@ -26,7 +26,10 @@ inline std::vector<unsigned char> load( const std::string& file ) {
   fseek( fp, 0, SEEK_SET );

   std::vector<unsigned char> buffer( size );
-  fread( buffer.data(), 1, size, fp );
+  int sizeRead = fread( buffer.data(), 1, size, fp );
+  if (sizeRead != size) {
+      printf("Error loading font");
+  }
   fclose( fp );
   return buffer;
 }
@@ -244,4 +247,4 @@ const Texture::Ptr& Font::texture() const {

 } // namespace three

-#endif // THREE_FONT2_IPP
\ No newline at end of file
+#endif // THREE_FONT2_IPP

Implementing shadows

Heya, I'm hacking on this repo here, and the main thing that I've come across is lack of shadows. Any pointers how I'd go about implementing them? I have Three.cpp-rev-2 (and the javascript three.js r65 sources) to use as a reference, but are there any gotchas I should look for?

I freaking love this project, I've been having a great time hacking on three code in c++! It's nice doing gl stuff without causing my macbook (with 650m) to turn into a hovercraft.

This is my a-frame / janusvr renderer using three.cpp:

screen shot 2017-04-15 at 9 39 47 pm

Windows compilation. How to?

Sorry for the strange question, but which compiler should be used to compile under windows? And what libraries are not enough there to work?
Do you use G ++ or something else?

THREE_GLES build

is three_cpp ever meant to function without glew?

glCreateBuffer, glCreateTexture, and other vital parts of three_cpp are only defined if THREE_GLES isn't (which replaces THREE_GLEW), according to gl.hpp:63

In Jetson nano, when i do cmake ../ ~~~

In Jetson nano, when i do "CMAKE ../ -DTHREE_HEADER_ONLY:BOOL=OFF"

jetson nano say
-- Could NOT find Threads (missing: Threads_FOUND)
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find SDL (missing: SDL_LIBRARY SDL_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmaek-3.10/Modules/FindSDL.cmake:190 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeList.txt:174 (find_package)

-- Configuring incomplete, errors occurred!

what should i do?

C#

Hi,
do you know how i can use this engine also in a c# project if its possible?

GLES2 compatibility

Hi there! Do you plan to continue developing this lib?I could give a hand ,though my JS sucks.But I would like to make it GLES2 compatible to be compiled on Emscripten as well.

Potential use with React Native

I just stumbled across this as I was looking at potential libraries that would act as a native layer for React Native, as a plug-in replacement for react-three. Are you still accepting PRs for this repo?

I think this is a much worthwhile project...

I would be more than willing to help keep this baby alive... I have this fantasy that I could customize/hack a transpiler/build system into semi-automagically generating a Portable Native Client implementation of any given JS code-base... What would you (as someone who has done simular porting by hand) say to such malarkey?

The work you have done in directly (not just in spirit) porting ThreeJS and all of its JS idioms may not have been in vien. I have a feeling this might be of much use to me in enabling the NaCl/PNaCl code to work in harmony with the original JS code-base (this may turn out not to be all that needed though).

I see this "Generator" also spitting out a native-implemented node module for use with server side/offline rendering or perhaps with the likes of atom-shell (or whatever it is now) and Node-Webkit (NW.JS).

I would love to know what insights you may have into this being a worthwhile endeavor, or if such a thing would be all that useful. People seem to pump out a lot of Chrome only "experiments" that fail to leverage Chrome's full capabilities.

Short of the magical compiler ecosystem thingy majiggy I would like to further what you have done here in order to put together a PoC Native Client build of ThreeJS in order to factor the true performance benefits. Chrome/Chromium would seem to be a massively easy platform for cross platform distribution of 3D, especially if one did not have to create a custom build to accomplish this.

And if a user can just land on the site with a Blink based browser and run the app with 99% native code execution.. well, I just dont know what to say.

Using three_cpp as Three.js accelerator

This is a cool project but how to make it really useful?

Export a renderer to Web assembly so people can still use regular three.js and this library will work as a significant performance booster.

Use case:

  1. Programmer create their scene and objects in regular three.js
  2. Programmer starts an instance of WebGlCPPRenderer instead of regular renderer
    -WebGlCPPRenderer creates a worker and sends scene data using SharedArrayBuffer (or transferable objects because of current Meltdown situation on each frame)
    -worker does all the updates, matrices multiplying, skinned mesh vertices computation and renders scene in Canvas using OffscreenCanvas

Performance boost will be synergetic because it's not only wasm and SIMD perfomance gain, but also freeing main thread by utilising OffscreenCanvas.

Programmer is unaware of how worker version works and uses Three.js just as usual but gets extreme performance boost as all heavy computations happen in workerised renderer!

Animation delta-time is always 0

Since mElapsedTime in clock.hpp is not initialized, it is set to a random value. Because of this the delta-time calculation in anim.ipp yields incorrect results. In my case this leads to delta-time in the bound std::function to always be 0, effectively stopping all animations.

cppreference (http://en.cppreference.com/w/cpp/chrono/duration/duration) says that the default constructor of std::chrono::duration is defaulted so above behavior can be expected.

This issue can be solved by initializing mElapsedTime in the initializer list of Clock as follows: mElapsedTime( Duration::zero() ).

I hope you can find the time to incorporate a fix, otherwise I can do a pull-request. But it is a very small thing, really.

By the way: good effort on porting three.js to C++ and good use of C++11 features! Very inspirational.

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.