Some more rayview cleanup.
This commit is contained in:
parent
dd3952d5c1
commit
91ab5eb624
3 changed files with 28 additions and 24 deletions
|
|
@ -24,6 +24,14 @@ struct CameraLOL {
|
|||
using SpriteRender = std::pair<std::shared_ptr<sf::Sprite>, std::shared_ptr<sf::Shader>>;
|
||||
|
||||
struct Raycaster {
|
||||
sf::Texture $view_texture;
|
||||
sf::Sprite $view_sprite;
|
||||
int $width;
|
||||
int $height;
|
||||
int $screen_pos_x;
|
||||
int $screen_pos_y;
|
||||
std::vector<double> $zbuffer; // width
|
||||
|
||||
int $pitch=0;
|
||||
sf::Clock $clock;
|
||||
std::shared_ptr<sf::Shader> $brightness = nullptr;
|
||||
|
|
@ -37,18 +45,11 @@ struct Raycaster {
|
|||
// the 2d raycaster version of camera plane
|
||||
double $plane_x = 0.0;
|
||||
double $plane_y = 0.66;
|
||||
sf::Texture $view_texture;
|
||||
sf::Sprite $view_sprite;
|
||||
Point aiming_at{0,0};
|
||||
Point camera_at{0,0};
|
||||
CameraLOL $camera;
|
||||
|
||||
std::unique_ptr<RGBA[]> $pixels = nullptr;
|
||||
|
||||
int $width;
|
||||
int $height;
|
||||
int $screen_pos_x = RAY_VIEW_X;
|
||||
int $screen_pos_y = RAY_VIEW_Y;
|
||||
std::unordered_map<DinkyECS::Entity, textures::SpriteTexture> $sprites;
|
||||
// BUG: this can be way better I think
|
||||
std::vector<SpriteRender> $sprites_to_render;
|
||||
|
|
@ -57,9 +58,8 @@ struct Raycaster {
|
|||
GameDB::Level $level;
|
||||
Matrix $tiles;
|
||||
Matrix $walls;
|
||||
std::vector<double> $zbuffer; // width
|
||||
|
||||
Raycaster(int width, int height);
|
||||
Raycaster(int x, int y, int width, int height);
|
||||
|
||||
void cast_rays();
|
||||
void draw_ceiling_floor();
|
||||
|
|
@ -93,4 +93,5 @@ struct Raycaster {
|
|||
|
||||
// BUG: these should go away when Bug #42 is solved
|
||||
void apply_sprite_effect(std::shared_ptr<sf::Shader> effect, float width, float height);
|
||||
std::shared_ptr<sf::Shader> apply_lighting_effect(components::Position& sprite_pos, matrix::Matrix &lights);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue