Welcome to Ray. A C++ program that can do Raytracing in the console. This is pure bit-beauty.
This program is licensed under the GNU GPL v3 License. Please read the License file to know about the usage terms and conditions.
License: GNU General Public License v3.0
I was trying to compile this amazing work, but on Unix there is slight difference in sleep function.
Sleep
is a Windows function
For Unix, nanosleep
or usleep
https://stackoverflow.com/questions/10976176/c-error-sleep-was-not-declared-in-this-scope
This is the line, where I ran into problem with compiling on Mint and g++ 9.3.0.
Line 207 in b6a9dbd
So, I replaced Sleep with usleep and uncomment #include <unistd.h>
line and it solved my problem.
I'm not a cpp guy, but I think this issue is on point. What do you think?
I tried running the code but the compiler logged errors showing that a lot was not defined. I noticed you didn't call "functions.cpp" in main... I tried but it still didn't work. please fix, I wanna see ray tracing on my potato pc
Hi,
I wanted to check out the demo video, but youtube says it is private. That's probably not intended because the link is in the readme. Could you make it public, please?
If I try to run this program, I always get collect2.exe: error: ld returned 1 exit status
error. Here is my terminal output -
g++ .\main.cpp -o ray.exe
In file included from .\main.cpp:3:
.\vector.h: In member function 'double Vector::setX(double)':
.\vector.h:33:37: warning: no return statement in function returning non-void [-Wreturn-type]
double setX(double x) { _x = x; }
^
.\vector.h: In member function 'double Vector::setY(double)':
.\vector.h:34:37: warning: no return statement in function returning non-void [-Wreturn-type]
double setY(double y) { _y = y; }
^
.\vector.h: In member function 'double Vector::setZ(double)':
.\vector.h:35:37: warning: no return statement in function returning non-void [-Wreturn-type]
double setZ(double z) { _z = z; }
^
In file included from .\camera.h:8,
from .\main.cpp:4:
.\ball.h: At global scope:
.\ball.h:11:1: warning: 'typedef' was ignored in this declaration
typedef struct Ball
^~~~~~~
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0xb3): undefined reference to `Vector::set(double, double, double)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x10a): undefined reference to `Vector::set(double, double, double)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x161): undefined reference to `Vector::set(double, double, double)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x27d): undefined reference to `Camera::Camera(double, double, double)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x2e2): undefined reference to `Vector::Vector(double, double, double)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x35b): undefined reference to `Vector::Vector(double, double, double)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x37c): undefined reference to `Vector::transformMatrixToVector(double const*)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x3b5): undefined reference to `Vector::~Vector()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x430): undefined reference to `Vector::set(double, double, double)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x43f): undefined reference to `Vector::normalize()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x492): undefined reference to `Camera::rayTrace(Vector&, Vector&, Ball*, int, double, double, int)'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x4f7): undefined reference to `Vector::~Vector()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x506): undefined reference to `Vector::~Vector()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x640): undefined reference to `Camera::~Camera()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x699): undefined reference to `Vector::~Vector()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x6ad): undefined reference to `Vector::~Vector()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text+0x6be): undefined reference to `Camera::~Camera()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text$_ZN4BallC1Ev[_ZN4BallC1Ev]+0x14): undefined reference to `Vector::Vector()'
C:\Users\MAHMUD~1\AppData\Local\Temp\ccpGug26.o:main.cpp:(.text$_ZN4BallD1Ev[_ZN4BallD1Ev]+0x14): undefined reference to `Vector::~Vector()'
collect2.exe: error: ld returned 1 exit status
What could be the problem? I've tried compiling in ubuntu too and got the same error.
Hi there!
It's looks so nice <3
Just add <unistd.h>
to if else statement, and maybe some readme
's for linux too ?
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
I've added 3d movements but it's using ncurses
Your "function.h" is impossible to include more than in one place, it will cause "multiple definition" error (I know you include it once, but what if someone else wants to reuse it). This happens because it contains declaration and implementation of functions. If you move implementations to pair functions.cpp file, you would solve this problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.