skybox: added moon and stars

This commit is contained in:
MihailRis
2024-01-26 02:49:42 +03:00
parent b42a517cc6
commit a4a5aef422
22 changed files with 258 additions and 52 deletions
+30 -3
View File
@@ -1,25 +1,52 @@
#ifndef FRONTEND_GRAPHICS_SKYBOX_H_
#define FRONTEND_GRAPHICS_SKYBOX_H_
#include <memory>
#include <string>
#include <vector>
#include "../../typedefs.h"
#include "../../maths/fastmaths.h"
#include "../../graphics/GfxContext.h"
class Mesh;
class Shader;
class Assets;
class Camera;
class Batch3D;
struct skysprite {
std::string texture;
float phase;
float distance;
bool emissive;
};
class Skybox {
uint fbo;
uint cubemap;
uint size;
Mesh* mesh;
Shader* shader;
bool ready = false;
FastRandom random;
std::unique_ptr<Mesh> mesh;
std::unique_ptr<Batch3D> batch3d;
std::vector<skysprite> sprites;
void drawStars(Camera* camera, float angle, float opacity);
void drawBackground(Camera* camera, Assets* assets, int width, int height);
public:
Skybox(uint size, Shader* shader);
~Skybox();
void draw(Shader* shader);
void draw(
const GfxContext& pctx,
Camera* camera,
Assets* assets,
float daytime,
float fog);
void refresh(float t, float mie, uint quality);
void refresh(const GfxContext& pctx, float t, float mie, uint quality);
void bind() const;
void unbind() const;
bool isReady() const {