1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
#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;
float cameraRollO;
// 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();
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();
};
|