1
0
Fork 0
Toy-Raytracer/main.cpp
trotFunky 2d396269e0 Pick back up and comment
Clean placeholder code to get it running.
Add comments to clarify working, add TODOs in main,
add some references for the maths.
2023-12-30 14:50:35 +01:00

41 lines
1.2 KiB
C++

#include <iostream>
#include "SFML/Graphics.hpp"
#include "World.h"
// TODO: Handle inputs to move player
// TODO: Raycast from player position
// TODO: Fix raycasts and use it correctly
// TODO: Render world in event loop
// TODO: Understand what the code was doing (looks like scale from fill column is the output of the raycast)
// Ref: https://lodev.org/cgtutor/raycasting.html
// Ref: http://yunes.informatique.univ-paris-diderot.fr/wp-content/uploads/cours/INFOGRAPHIE/08-Raycasting.pdf
// TODO: Update player for camera plane
// TODO: Camera plane represents screen, rays go through it proportional to the screen
// TODO: Find a way to go to edges instead of just equally split (?)
int main()
{
std::cout << "Hello, World!" << std::endl;
World world(10,10);
world.setBlock(BlockType::AIR,1,1,8,8);
world.setBlock(BlockType::WALL,4,4,2,2);
world.player.move(2,2);
std::cout << world << std::endl;
sf::RenderWindow window(sf::VideoMode(800,600),"Da raycasting");
world.render(window);
window.display();
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}