Files
neoLegacy/Minecraft.Client/GameRenderer.h
T
Tranqlmao 9abd52985e TU53 + Bug Fixes (Many)
Patch Notes:
Blocks
+ Colored shulker boxes
+ Concrete powder
+ Concrete
+ Glazed terracotta
Items
+ Shulker shell
+ Iron nugget
UI Changes
+ Added Custom Controls to Keyboard & Mouse, as well as Controller
+ Added Custom SuperFlat
+ Added Edit Server Menu
+ Added Firework Crafting
Feature Changes
+ Host Options
+ Added Pick Block
+ Added off-hand slot for maps and arrows.
Bug Fixes & changes
+ TU47: Banner hitbox wrong (and inventory model fixed)
+ TU47/48: Ice not melting properly
+ TU48: Dead bushes not dropping sticks
+ TU48: Guardians and polar bears not dropping cooked fish when on fire
+ TU48: Bonus chest missing saplings and seeds
+ TU48: Frosted ice obtainable
+ TU48: Hoppers not collecting items
+ TU48: Wither skeletons spawning in 2-high gaps
+ TU48: End crystals exploding with “TNT Explodes” off
+ TU48: Tamed ocelots staying hostile
+ TU48: Signs not placing on tall grass
+ TU51: Skeleton hitbox wrong
+ TU53: Fall damage in shallow water
+ TU53: Squids not spawning in man-made pools
+ Elytra has been improved to be more accurate to the source material
+ Removed Spectral Arrow from crafting
+ Fixed several broken item descriptions
+ You can no longer cook Pufferfish or Clownfish
+ Fixed scaling issue with paperdoll and chat
+ Iron and gold armor can now be smelted into nuggets.
+ More items can now be used as fuel in a furnace.
+ Using a firework rocket while gliding with elytra will now give the player a boost.
+ Changed the color of dyes, wool, carpets, and banners.
+ Reordered all colored blocks and items in the Creative inventory. Banners now have the same order of colors as all other colored blocks and items.
+ Fishing rods can now hook on entities without causing knockback or pseudo-damage.
+ Fixed banner crafting
+ Fixed Map colors for certain blocks
+ Fixed Path block height
+ Fixed String block issues
+ Fixed Item frame culling.
+ Fixed Tutorial world NBT/Block State issues
+ Fixed World Slider
+ Fixed Enderman AI
+ Fixed Player animation bug
+ HUD Flash text changes
+ Generation accuracy changes
+ Many other small accuracy changes and fixes
2026-11-24 13:44:06 -05:00

207 lines
5.1 KiB
C++

#pragma once
#ifdef _WIN64
#include <d3d11.h>
#endif
class Minecraft;
class Entity;
class Random;
class FloatBuffer;
class ItemInHandRenderer;
class DataLayer;
class SparseLightStorage;
class CompressedTileStorage;
class SparseDataStorage;
#include "../Minecraft.World/SmoothFloat.h"
#include "../Minecraft.World/C4JThread.h"
#include "ResourceLocation.h"
class GameRenderer
{
private:
static ResourceLocation RAIN_LOCATION;
static ResourceLocation SNOW_LOCATION;
public:
static bool anaglyph3d;
static int anaglyphPass;
private:
Minecraft *mc;
float renderDistance;
public:
ItemInHandRenderer *itemInHandRenderer;
private:
int _tick;
shared_ptr<Entity> hovered;
// smooth camera movement
SmoothFloat smoothTurnX;
SmoothFloat smoothTurnY;
// third-person distance etc
SmoothFloat smoothDistance;
SmoothFloat smoothRotation;
SmoothFloat smoothTilt;
SmoothFloat smoothRoll;
float thirdDistance;
float thirdDistanceO;
float thirdRotation;
float thirdRotationO;
float thirdTilt;
float thirdTiltO;
float accumulatedSmoothXO, accumulatedSmoothYO;
float tickSmoothXO, tickSmoothYO, lastTickA;
Vec3 *cameraPos; // 4J added
// fov modification
float fovOffset;
float fovOffsetO;
// roll modification
float cameraRoll[4];
float cameraRollO[4];
float m_yBob[4];
float m_yBobO[4];
float m_elytaCamShift[4];
int camIdx();
// 4J - changes brought forward from 1.8.2
static const int NUM_LIGHT_TEXTURES = 4;// * 3;
int lightTexture[NUM_LIGHT_TEXTURES]; // 4J - changed so that we have one lightTexture per level, to support split screen
int getLightTexture(int iPad, Level *level); // 4J added
intArray lightPixels[NUM_LIGHT_TEXTURES];
float fov[4];
float oFov[4];
float tFov[4];
float darkenWorldAmount;
float darkenWorldAmountO;
// Gamma caching
float m_cachedGammaPerPlayer[NUM_LIGHT_TEXTURES];
static float ComputeGammaFromSlider(float slider0to100);
void CachePlayerGammas();
#ifdef _WINDOWS64
void RunWorldPostProcess() const;
#endif
public:
void ApplyGammaPostProcess() const;
private:
bool ComputeViewportForPlayer(int j, D3D11_VIEWPORT& outViewport) const;
uint32_t BuildPlayerViewports(D3D11_VIEWPORT* outViewports, float* outGammas, UINT maxCount) const;
bool isInClouds;
float m_fov;
public:
GameRenderer(Minecraft *mc);
~GameRenderer();
void SetFovVal(float fov);
float GetFovVal();
public:
void tick(bool bFirst);
void pick(float a);
private:
void tickFov();
float getFov(float a, bool applyEffects);
void bobHurt(float a);
void bobView(float a);
void moveCameraToPlayer(float a);
double zoom;
double zoom_x;
double zoom_y;
public:
void zoomRegion(double zoom, double xa, double ya);
void unZoomRegion();
private:
void getFovAndAspect(float& fov, float& aspect, float a, bool applyEffects); // 4J added
public:
void setupCamera(float a, int eye);
private:
void renderItemInHand(float a, int eye);
int64_t lastActiveTime;
int64_t lastNsTime;
// 4J - changes brought forward from 1.8.2
bool _updateLightTexture;
public:
float blr;
float blrt;
float blg;
float blgt;
void turnOffLightLayer(double alpha);
void turnOnLightLayer(double alpha);
private:
void tickLightTexture();
void updateLightTexture(float a);
float getNightVisionScale(shared_ptr<Player> player, float a);
public:
void render(float a, bool bFirst); // 4J added bFirst
void renderLevel(float a);
void renderLevel(float a, int64_t until);
private:
Random *random;
int rainSoundTime;
void prepareAndRenderClouds(LevelRenderer *levelRenderer, float a);
void tickRain();
private:
// 4J - brought forward from 1.8.2
float *rainXa;
float *rainZa;
protected:
void renderSnowAndRain(float a);
volatile int xMod;
volatile int yMod;
public:
void setupGuiScreen(int forceScale=-1); // 4J - added forceScale parameter
FloatBuffer *lb;
float fr;
float fg;
float fb;
private:
void setupClearColor(float a);
float fogBrO, fogBr;
int cameraFlip;
void setupFog(int i, float alpha);
FloatBuffer *getBuffer(float a, float b, float c, float d);
static int getFpsCap(int option);
public:
void updateAllChunks();
#ifdef MULTITHREAD_ENABLE
static C4JThread* m_updateThread;
static int runUpdate(LPVOID lpParam);
static C4JThread::EventArray* m_updateEvents;
enum EUpdateEvents
{
eUpdateCanRun,
eUpdateEventIsFinished,
eUpdateEventCount,
};
static bool nearThingsToDo;
static bool updateRunning;
#endif
static vector<byte *> m_deleteStackByte;
static vector<SparseLightStorage *> m_deleteStackSparseLightStorage;
static vector<CompressedTileStorage *> m_deleteStackCompressedTileStorage;
static vector<SparseDataStorage *> m_deleteStackSparseDataStorage;
static CRITICAL_SECTION m_csDeleteStack;
static void AddForDelete(byte *deleteThis);
static void AddForDelete(SparseLightStorage *deleteThis);
static void AddForDelete(CompressedTileStorage *deleteThis);
static void AddForDelete(SparseDataStorage *deleteThis);
static void FinishedReassigning();
void EnableUpdateThread();
void DisableUpdateThread();
};