world previews demo
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#include "../core/Texture.h"
|
||||
#include "../core/Viewport.h"
|
||||
|
||||
ImageData* BlocksPreview::draw(
|
||||
std::unique_ptr<ImageData> BlocksPreview::draw(
|
||||
const ContentGfxCache* cache,
|
||||
Shader* shader,
|
||||
Framebuffer* fbo,
|
||||
|
||||
@@ -17,7 +17,7 @@ class Shader;
|
||||
class ContentGfxCache;
|
||||
|
||||
class BlocksPreview {
|
||||
static ImageData* draw(
|
||||
static std::unique_ptr<ImageData> draw(
|
||||
const ContentGfxCache* cache,
|
||||
Shader* shader,
|
||||
Framebuffer* framebuffer,
|
||||
|
||||
@@ -42,7 +42,6 @@ WorldRenderer::WorldRenderer(Engine* engine, LevelFrontend* frontend, Player* pl
|
||||
level(frontend->getLevel()),
|
||||
player(player)
|
||||
{
|
||||
postProcessing = std::make_unique<PostProcessing>();
|
||||
frustumCulling = std::make_unique<Frustum>();
|
||||
lineBatch = std::make_unique<LineBatch>();
|
||||
renderer = std::make_unique<ChunksRenderer>(
|
||||
@@ -148,6 +147,7 @@ void WorldRenderer::renderLevel(
|
||||
Assets* assets = engine->getAssets();
|
||||
Atlas* atlas = assets->getAtlas("blocks");
|
||||
Shader* shader = assets->getShader("main");
|
||||
|
||||
auto indices = level->content->getIndices();
|
||||
|
||||
float fogFactor = 15.0f / ((float)settings.chunks.loadDistance.get()-2);
|
||||
@@ -265,7 +265,15 @@ void WorldRenderer::renderDebugLines(
|
||||
lineBatch->render();
|
||||
}
|
||||
|
||||
void WorldRenderer::draw(const GfxContext& pctx, Camera* camera, bool hudVisible){
|
||||
void WorldRenderer::draw(
|
||||
const GfxContext& pctx,
|
||||
Camera* camera,
|
||||
bool hudVisible,
|
||||
PostProcessing* postProcessing
|
||||
){
|
||||
const Viewport& vp = pctx.getViewport();
|
||||
camera->aspect = vp.getWidth() / static_cast<float>(vp.getHeight());
|
||||
|
||||
EngineSettings& settings = engine->getSettings();
|
||||
skybox->refresh(pctx, level->getWorld()->daytime, 1.0f+fog*2.0f, 4);
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ class WorldRenderer {
|
||||
Engine* engine;
|
||||
Level* level;
|
||||
Player* player;
|
||||
std::unique_ptr<PostProcessing> postProcessing;
|
||||
std::unique_ptr<Frustum> frustumCulling;
|
||||
std::unique_ptr<LineBatch> lineBatch;
|
||||
std::unique_ptr<ChunksRenderer> renderer;
|
||||
@@ -40,16 +39,6 @@ class WorldRenderer {
|
||||
bool drawChunk(size_t index, Camera* camera, Shader* shader, bool culling);
|
||||
void drawChunks(Chunks* chunks, Camera* camera, Shader* shader);
|
||||
|
||||
/// @brief Render level without diegetic interface
|
||||
/// @param context graphics context
|
||||
/// @param camera active camera
|
||||
/// @param settings engine settings
|
||||
void renderLevel(
|
||||
const GfxContext& context,
|
||||
Camera* camera,
|
||||
const EngineSettings& settings
|
||||
);
|
||||
|
||||
/// @brief Render block selection lines
|
||||
/// @param camera active camera
|
||||
/// @param linesShader shader used
|
||||
@@ -70,9 +59,24 @@ public:
|
||||
WorldRenderer(Engine* engine, LevelFrontend* frontend, Player* player);
|
||||
~WorldRenderer();
|
||||
|
||||
void draw(const GfxContext& context, Camera* camera, bool hudVisible);
|
||||
void draw(
|
||||
const GfxContext& context,
|
||||
Camera* camera,
|
||||
bool hudVisible,
|
||||
PostProcessing* postProcessing
|
||||
);
|
||||
void drawBorders(int sx, int sy, int sz, int ex, int ey, int ez);
|
||||
|
||||
/// @brief Render level without diegetic interface
|
||||
/// @param context graphics context
|
||||
/// @param camera active camera
|
||||
/// @param settings engine settings
|
||||
void renderLevel(
|
||||
const GfxContext& context,
|
||||
Camera* camera,
|
||||
const EngineSettings& settings
|
||||
);
|
||||
|
||||
static float fog;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user