the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 180 lines 4.6 kB view raw
1#pragma once 2class Minecraft; 3class Entity; 4class Random; 5class FloatBuffer; 6class ItemInHandRenderer; 7class DataLayer; 8class SparseLightStorage; 9class CompressedTileStorage; 10class SparseDataStorage; 11 12#include "..\Minecraft.World\SmoothFloat.h" 13#include "..\Minecraft.World\C4JThread.h" 14#include "ResourceLocation.h" 15 16class GameRenderer 17{ 18private: 19 static ResourceLocation RAIN_LOCATION; 20 static ResourceLocation SNOW_LOCATION; 21 22public: 23 static bool anaglyph3d; 24 static int anaglyphPass; 25 26private: 27 Minecraft *mc; 28 float renderDistance; 29public: 30 ItemInHandRenderer *itemInHandRenderer; 31private: 32 int _tick; 33 shared_ptr<Entity> hovered; 34 35 // smooth camera movement 36 SmoothFloat smoothTurnX; 37 SmoothFloat smoothTurnY; 38 39 // third-person distance etc 40 SmoothFloat smoothDistance; 41 SmoothFloat smoothRotation; 42 SmoothFloat smoothTilt; 43 SmoothFloat smoothRoll; 44 float thirdDistance; 45 float thirdDistanceO; 46 float thirdRotation; 47 float thirdRotationO; 48 float thirdTilt; 49 float thirdTiltO; 50 float accumulatedSmoothXO, accumulatedSmoothYO; 51 float tickSmoothXO, tickSmoothYO, lastTickA; 52 Vec3 *cameraPos; // 4J added 53 54 // fov modification 55 float fovOffset; 56 float fovOffsetO; 57 58 // roll modification 59 float cameraRoll; 60 float cameraRollO; 61 62 // 4J - changes brought forward from 1.8.2 63 static const int NUM_LIGHT_TEXTURES = 4;// * 3; 64 int lightTexture[NUM_LIGHT_TEXTURES]; // 4J - changed so that we have one lightTexture per level, to support split screen 65 int getLightTexture(int iPad, Level *level); // 4J added 66 intArray lightPixels[NUM_LIGHT_TEXTURES]; 67 68 float fov[4]; 69 float oFov[4]; 70 float tFov[4]; 71 72 float darkenWorldAmount; 73 float darkenWorldAmountO; 74 75 bool isInClouds; 76 77 float m_fov; 78public: 79 GameRenderer(Minecraft *mc); 80 ~GameRenderer(); 81 void SetFovVal(float fov); 82 float GetFovVal(); 83 84public: 85 void tick(bool bFirst); 86 void pick(float a); 87private: 88 void tickFov(); 89 float getFov(float a, bool applyEffects); 90 void bobHurt(float a); 91 void bobView(float a); 92 void moveCameraToPlayer(float a); 93 double zoom; 94 double zoom_x; 95 double zoom_y; 96public: 97 void zoomRegion(double zoom, double xa, double ya); 98 void unZoomRegion(); 99private: 100 void getFovAndAspect(float& fov, float& aspect, float a, bool applyEffects); // 4J added 101public: 102 void setupCamera(float a, int eye); 103private: 104 void renderItemInHand(float a, int eye); 105 __int64 lastActiveTime; 106 __int64 lastNsTime; 107 // 4J - changes brought forward from 1.8.2 108 bool _updateLightTexture; 109public: 110 float blr; 111 float blrt; 112 float blg; 113 float blgt; 114 void turnOffLightLayer(double alpha); 115 void turnOnLightLayer(double alpha); 116private: 117 void tickLightTexture(); 118 void updateLightTexture(float a); 119 float getNightVisionScale(shared_ptr<Player> player, float a); 120public: 121 void render(float a, bool bFirst); // 4J added bFirst 122 void renderLevel(float a); 123 void renderLevel(float a, __int64 until); 124private: 125 Random *random; 126 int rainSoundTime; 127 void prepareAndRenderClouds(LevelRenderer *levelRenderer, float a); 128 void tickRain(); 129private: 130 // 4J - brought forward from 1.8.2 131 float *rainXa; 132 float *rainZa; 133protected: 134 void renderSnowAndRain(float a); 135 volatile int xMod; 136 volatile int yMod; 137public: 138 void setupGuiScreen(int forceScale=-1); // 4J - added forceScale parameter 139 140 FloatBuffer *lb; 141 float fr; 142 float fg; 143 float fb; 144private: 145 void setupClearColor(float a); 146 float fogBrO, fogBr; 147 int cameraFlip; 148 149 void setupFog(int i, float alpha); 150 FloatBuffer *getBuffer(float a, float b, float c, float d); 151 static int getFpsCap(int option); 152public: 153 void updateAllChunks(); 154 155#ifdef MULTITHREAD_ENABLE 156 static C4JThread* m_updateThread; 157 static int runUpdate(LPVOID lpParam); 158 static C4JThread::EventArray* m_updateEvents; 159 enum EUpdateEvents 160 { 161 eUpdateCanRun, 162 eUpdateEventIsFinished, 163 eUpdateEventCount, 164 }; 165 static bool nearThingsToDo; 166 static bool updateRunning; 167#endif 168 static vector<byte *> m_deleteStackByte; 169 static vector<SparseLightStorage *> m_deleteStackSparseLightStorage; 170 static vector<CompressedTileStorage *> m_deleteStackCompressedTileStorage; 171 static vector<SparseDataStorage *> m_deleteStackSparseDataStorage; 172 static CRITICAL_SECTION m_csDeleteStack; 173 static void AddForDelete(byte *deleteThis); 174 static void AddForDelete(SparseLightStorage *deleteThis); 175 static void AddForDelete(CompressedTileStorage *deleteThis); 176 static void AddForDelete(SparseDataStorage *deleteThis); 177 static void FinishedReassigning(); 178 void EnableUpdateThread(); 179 void DisableUpdateThread(); 180};