mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-04-04 14:33:36 +00:00
Added Foliage and Grass Color tinting, Started Basic Work on restoring ravines, New Option to Toggle Tinting.
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
#include "../../world/level/Region.h"
|
||||
#include "../../world/level/chunk/LevelChunk.h"
|
||||
#include "../../util/Mth.h"
|
||||
|
||||
#include "../../world/level/biome/BiomeSource.h"
|
||||
|
||||
#include "../../world/level/Level.h"
|
||||
//#include "../../platform/time.h"
|
||||
|
||||
/*static*/ int Chunk::updates = 0;
|
||||
@@ -260,3 +264,6 @@ void Chunk::resetUpdates()
|
||||
updates = 0;
|
||||
//swRebuild.reset();
|
||||
}
|
||||
BiomeSource* Region::getBiomeSource() {
|
||||
return level->getBiomeSource();
|
||||
}
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "../../client/player/LocalPlayer.h"
|
||||
|
||||
#include "../../world/level/GrassColor.h"
|
||||
|
||||
#ifdef GFX_SMALLER_CHUNKS
|
||||
/* static */ const int LevelRenderer::CHUNK_SIZE = 8;
|
||||
#else
|
||||
@@ -143,6 +145,10 @@ void LevelRenderer::setLevel( Level* level )
|
||||
level->addListener(this);
|
||||
allChanged();
|
||||
}
|
||||
if (mc->options.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION)) {
|
||||
mc->useAmbientOcclusion = !mc->useAmbientOcclusion;
|
||||
allChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void LevelRenderer::allChanged()
|
||||
@@ -155,6 +161,11 @@ void LevelRenderer::allChanged()
|
||||
Tile::leaves_carried->setFancy(fancy);
|
||||
lastViewDistance = mc->options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
||||
|
||||
bool tint = mc->options.getBooleanValue(OPTIONS_FOLIAGE_TINT);
|
||||
FoliageColor::setUseTint(tint);
|
||||
GrassColor::setUseTint(tint);
|
||||
|
||||
|
||||
int dist = (512 >> 3) << (3 - lastViewDistance);
|
||||
if (lastViewDistance <= 2 && mc->isPowerVR())
|
||||
dist = (int)((float)dist * 0.8f);
|
||||
|
||||
@@ -249,6 +249,37 @@ int Textures::crispBlend( int c0, int c1 )
|
||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
// shredder here, moved the code from minecraft.cpp bcus that isnt the right place
|
||||
// had to implement this because i couldn't find a similar function in the code to do this
|
||||
int* Textures::loadTexturePixels(TextureId texId, const std::string& resourceName){
|
||||
|
||||
const TextureData* texture = getTemporaryTextureData(texId); // storing raw pixels
|
||||
|
||||
int size = texture->w * texture->h; // gets the size of our funny lil guy
|
||||
int* pixels = new int[size]; // memory leaks be galore
|
||||
unsigned char* raw = texture->data; // storing raw data into our beloved variable
|
||||
for (int i = 0; i < (texture->w * texture->h); i++){
|
||||
// my head hurts i hate working with this
|
||||
|
||||
|
||||
// uh since each pixel stores r g b a, aka the color channels which are each one byte, we multiply them by 4 to move from one pixel to another
|
||||
|
||||
int r = raw[i * 4 + 0]; // gets us the first channel aka red
|
||||
int g = raw[i * 4 + 1]; // gets us the second channel green
|
||||
int b = raw[i * 4 + 2]; // gets us the third channel blue
|
||||
int a = raw[i * 4 + 3]; // gets us the alpha channel
|
||||
|
||||
// woohoo pixels uh should have been seperated into their colors now hopefully
|
||||
|
||||
// r g b a
|
||||
// ugh we now got to turn it into the AA RR GGBB format aak 0xAARRGGBB
|
||||
// b gets 0 - 7 (8 bits), g gets 7 - 15 (8 bits), r gets 16 - 23 (8 bits), alpha gets the last ones 24 - 31 (8 bits),
|
||||
pixels[i] = (a << 24) | (r << 16) | (g << 8) | (b); // shuld combine them into one 32 bit int unless i did something dumb
|
||||
}
|
||||
return pixels; // your meal has been prepared john colors
|
||||
}
|
||||
|
||||
|
||||
///*public*/ int loadHttpTexture(std::string url, std::string backup) {
|
||||
// HttpTexture texture = httpTextures.get(url);
|
||||
// if (texture != NULL) {
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
TextureId assignTexture(const std::string& resourceName, const TextureData& img);
|
||||
const TextureData* getTemporaryTextureData(TextureId id);
|
||||
|
||||
int* loadTexturePixels(TextureId texId, const std::string& resourceName);
|
||||
|
||||
void tick(bool uploadToGraphicsCard);
|
||||
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user