TombEngine/TombEngine/Renderer/RenderView/RenderView.h
Jakub a668d49331
Implemented fog bulb (#1110)
* Added fog bulbs

* WIP raymarch

* constant fog formula with simplex noise

* Improved fog formula and handling

* Raymarch less expansive;
Added fog bulbs to sprites;
Removed premultiplication of fog density by color at load time;

* Avoid raymarch if fog > 1

* Sorting fog bulbs front to back;
Performance improvements;

* Added frustum culling for fog bulbs

* Tryiing without raymarch

* Refactored fog code;
Added noise and wibble to fog;
Fixed sprites;

* Disabled wibble for fog

* Removed noise

* Fof bulbs like TR5

* Fixed Pascal Case in RenderView;
Fixed formatting things;
Fixed sprites;

* Optimizations

* Fixed sprites in fog bulbs

* Fixed project paths

* Fix compiler warning

* Fixed repository

* Fog bulbs for sky and horizon

* Sky tessellation

* Update Renderer11Draw.cpp

---------

Co-authored-by: MontyTRC89 <montyhammet@hotmail.it>
Co-authored-by: Raildex <n@a.com>
Co-authored-by: Lwmte <3331699+Lwmte@users.noreply.github.com>
2023-05-31 09:12:20 +01:00

65 lines
2 KiB
C++

#pragma once
#include <vector>
#include <d3d11.h>
#include <SimpleMath.h>
#include "Game/camera.h"
#include "Frustum.h"
#include "ConstantBuffers/CameraMatrixBuffer.h"
#include "Specific/memory/LinearArrayBuffer.h"
#include "RendererSprites.h"
#include "RendererTransparentFace.h"
#include "Renderer/Structures/RendererFogBulb.h"
namespace TEN::Renderer
{
struct RendererStatic;
struct RendererItem;
struct RendererLight;
struct RendererEffect;
struct RendererRoom;
struct RendererTransparentFace;
constexpr auto MAX_ROOMS_DRAW = 256;
constexpr auto MAX_STATICS_DRAW = 128;
constexpr auto MAX_EFFECTS_DRAW = 16;
constexpr auto MAX_ITEMS_DRAW = 128;
constexpr auto MAX_LIGHTS_DRAW = 48;
constexpr auto MAX_SPRITES_DRAW = 512;
using DirectX::SimpleMath::Vector3;
using DirectX::SimpleMath::Vector2;
using DirectX::SimpleMath::Matrix;
struct RenderViewCamera
{
Matrix ViewProjection;
Matrix View;
Matrix Projection;
Vector3 WorldPosition;
Vector3 WorldDirection;
Vector2 ViewSize;
Vector2 InvViewSize;
int RoomNumber;
Frustum Frustum;
float NearPlane;
float FarPlane;
RenderViewCamera(CAMERA_INFO* cam, float roll, float fov, float n, float f, int w, int h);
RenderViewCamera(const Vector3& pos, const Vector3& dir, const Vector3& up, int room, int width, int height, float fov, float n, float f);
};
struct RenderView
{
RenderViewCamera Camera;
D3D11_VIEWPORT Viewport;
std::vector<RendererRoom*> RoomsToDraw;
std::vector<RendererLight*> LightsToDraw;
std::vector<RendererFogBulb> FogBulbsToDraw;
std::vector<RendererSpriteToDraw> SpritesToDraw;
std::vector<RendererStatic*> StaticsToDraw;
std::map<int, std::vector<RendererStatic*>> SortedStatics;
RenderView(CAMERA_INFO* cam, float roll, float fov, float nearPlane, float farPlane, int w, int h);
RenderView(const Vector3& pos, const Vector3& dir, const Vector3& up, int w, int h, int room, float nearPlane, float farPlane, float fov);
void fillConstantBuffer(CCameraMatrixBuffer& bufferToFill);
void clear();
};
}