mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-04-30 17:43:30 +00:00
Extremely Big Update - fileshredder
(MAJOR)Added Java Beta/Normal Shading, toggleble in settings Fixed and restored the unused Item Switching Animation, toggleble in tweaks too Added Dynamic Texture for Lava Added option to use Block Outline Selection which was unused normally Added Split Touch Controls into Options Mobs will now drop cooked variants of their meat if they died by fire Fixed Untranslated Strings in Settings (MAJOR) Ravines and Lava/Water pools have been fixed and renabled Tweaked BasicTree to hopefully speed up generation a bit, might disable them temporarily if they keep being slow You can now grow Fancy Oak Trees using saplings.
This commit is contained in:
@@ -153,7 +153,20 @@ options.group.tweaks=Tweaks
|
|||||||
options.allowSprint=Allow sprint
|
options.allowSprint=Allow sprint
|
||||||
options.barOnTop=HUD above inventory
|
options.barOnTop=HUD above inventory
|
||||||
options.rpiCursor=Show Raspberry PI cursor
|
options.rpiCursor=Show Raspberry PI cursor
|
||||||
options.foliageTint=Tint Grass and Leaves
|
options.foliagetint=Foliage Tinting
|
||||||
|
options.javaHud=Beta Java hotbar tweaks
|
||||||
|
options.blockOutline=Block Outline Selection
|
||||||
|
options.fogType=Fog/Sky Color
|
||||||
|
options.fogType.vanilla=Vanilla
|
||||||
|
options.fogType.java=Beta Java
|
||||||
|
options.fogType.unused=Unused
|
||||||
|
|
||||||
|
options.restoredAnims=Restored Animations
|
||||||
|
|
||||||
|
options.normalLighting=Java Beta/Normals Shading
|
||||||
|
|
||||||
|
options.isJoyTouchArea=Use Split Controls
|
||||||
|
|
||||||
options.autoJump=Auto Jump
|
options.autoJump=Auto Jump
|
||||||
options.thirdperson=Third Person
|
options.thirdperson=Third Person
|
||||||
options.servervisible=Server Visible
|
options.servervisible=Server Visible
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/client/player/RemotePlayer.cpp \
|
../../../src/client/player/RemotePlayer.cpp \
|
||||||
../../../src/client/player/input/KeyboardInput.cpp \
|
../../../src/client/player/input/KeyboardInput.cpp \
|
||||||
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
||||||
|
../../../src/client/renderer/Lighting.cpp \
|
||||||
../../../src/client/renderer/Chunk.cpp \
|
../../../src/client/renderer/Chunk.cpp \
|
||||||
../../../src/client/renderer/EntityTileRenderer.cpp \
|
../../../src/client/renderer/EntityTileRenderer.cpp \
|
||||||
../../../src/client/renderer/GameRenderer.cpp \
|
../../../src/client/renderer/GameRenderer.cpp \
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/client/player/RemotePlayer.cpp \
|
../../../src/client/player/RemotePlayer.cpp \
|
||||||
../../../src/client/player/input/KeyboardInput.cpp \
|
../../../src/client/player/input/KeyboardInput.cpp \
|
||||||
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
||||||
|
../../../src/client/renderer/Lighting.cpp \
|
||||||
../../../src/client/renderer/Chunk.cpp \
|
../../../src/client/renderer/Chunk.cpp \
|
||||||
../../../src/client/renderer/EntityTileRenderer.cpp \
|
../../../src/client/renderer/EntityTileRenderer.cpp \
|
||||||
../../../src/client/renderer/GameRenderer.cpp \
|
../../../src/client/renderer/GameRenderer.cpp \
|
||||||
|
|||||||
@@ -745,6 +745,7 @@ void Minecraft::tickInput() {
|
|||||||
int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
||||||
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CHEATS
|
#ifdef CHEATS
|
||||||
if (key == Keyboard::KEY_U) {
|
if (key == Keyboard::KEY_U) {
|
||||||
onGraphicsReset();
|
onGraphicsReset();
|
||||||
@@ -1128,6 +1129,8 @@ void Minecraft::init()
|
|||||||
textures = new Textures(&options, platform());
|
textures = new Textures(&options, platform());
|
||||||
textures->addDynamicTexture(new WaterTexture());
|
textures->addDynamicTexture(new WaterTexture());
|
||||||
textures->addDynamicTexture(new WaterSideTexture());
|
textures->addDynamicTexture(new WaterSideTexture());
|
||||||
|
textures->addDynamicTexture(new LavaTexture());
|
||||||
|
textures->addDynamicTexture(new LavaSideTexture());
|
||||||
textures->addDynamicTexture(new FireTexture());
|
textures->addDynamicTexture(new FireTexture());
|
||||||
gui.texturesLoaded(textures);
|
gui.texturesLoaded(textures);
|
||||||
|
|
||||||
|
|||||||
@@ -54,18 +54,24 @@ OptionBool limitFramerate("limitFramerate", false);
|
|||||||
OptionBool vsync("vsync", true);
|
OptionBool vsync("vsync", true);
|
||||||
OptionBool fancyGraphics("fancyGraphics", true);
|
OptionBool fancyGraphics("fancyGraphics", true);
|
||||||
OptionBool viewBobbing("viewBobbing", true);
|
OptionBool viewBobbing("viewBobbing", true);
|
||||||
OptionBool ambientOcclusion("ao", false);
|
OptionBool ambientOcclusion("ao", true);
|
||||||
|
|
||||||
|
OptionBool useNormalLighting("normalLighting", true);
|
||||||
|
|
||||||
OptionBool useTouchscreen("useTouchscreen", true);
|
OptionBool useTouchscreen("useTouchscreen", true);
|
||||||
|
|
||||||
OptionBool serverVisible("servervisible", true);
|
OptionBool serverVisible("servervisible", true);
|
||||||
|
|
||||||
OptionBool foliageTint("foliagetint", false);
|
OptionBool foliageTint("foliagetint", true);
|
||||||
|
|
||||||
OptionInt fogType("fogType", 0, 0, 2);
|
OptionInt fogType("fogType", 0, 0, 2);
|
||||||
|
|
||||||
OptionBool javaHud("javaHud", false);
|
OptionBool javaHud("javaHud", false);
|
||||||
|
|
||||||
|
OptionBool blockOutline("blockOutline", false);
|
||||||
|
|
||||||
|
OptionBool restoredAnims("restoredAnims", true);
|
||||||
|
|
||||||
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
||||||
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
||||||
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
||||||
@@ -142,7 +148,11 @@ void Options::initTable() {
|
|||||||
|
|
||||||
m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen;
|
m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen;
|
||||||
|
|
||||||
|
m_options[OPTIONS_BLOCK_OUTLINE] = &blockOutline;
|
||||||
|
|
||||||
|
m_options[OPTIONS_NORMAL_LIGHTING] = &useNormalLighting;
|
||||||
|
|
||||||
|
m_options[OPTIONS_RESTORED_ANIMS] = &restoredAnims;
|
||||||
|
|
||||||
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ enum OptionId {
|
|||||||
OPTIONS_LIMIT_FRAMERATE,
|
OPTIONS_LIMIT_FRAMERATE,
|
||||||
OPTIONS_VSYNC,
|
OPTIONS_VSYNC,
|
||||||
OPTIONS_FANCY_GRAPHICS,
|
OPTIONS_FANCY_GRAPHICS,
|
||||||
|
OPTIONS_NORMAL_LIGHTING,
|
||||||
|
|
||||||
// Cheats / debug
|
// Cheats / debug
|
||||||
OPTIONS_FLY_SPEED,
|
OPTIONS_FLY_SPEED,
|
||||||
@@ -56,6 +57,7 @@ enum OptionId {
|
|||||||
OPTIONS_IS_FLYING,
|
OPTIONS_IS_FLYING,
|
||||||
|
|
||||||
// Control
|
// Control
|
||||||
|
OPTIONS_BLOCK_OUTLINE,
|
||||||
OPTIONS_USE_MOUSE_FOR_DIGGING,
|
OPTIONS_USE_MOUSE_FOR_DIGGING,
|
||||||
OPTIONS_IS_LEFT_HANDED,
|
OPTIONS_IS_LEFT_HANDED,
|
||||||
OPTIONS_IS_JOY_TOUCH_AREA,
|
OPTIONS_IS_JOY_TOUCH_AREA,
|
||||||
@@ -87,6 +89,7 @@ enum OptionId {
|
|||||||
OPTIONS_FOLIAGE_TINT,
|
OPTIONS_FOLIAGE_TINT,
|
||||||
OPTIONS_FOG_TYPE,
|
OPTIONS_FOG_TYPE,
|
||||||
OPTIONS_JAVA_HUD,
|
OPTIONS_JAVA_HUD,
|
||||||
|
OPTIONS_RESTORED_ANIMS,
|
||||||
// Should be last!
|
// Should be last!
|
||||||
OPTIONS_COUNT
|
OPTIONS_COUNT
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -382,6 +382,7 @@ void Gui::renderVignette(float br, int w, int h) {
|
|||||||
|
|
||||||
void Gui::renderSlot(int slot, int x, int y, float a) {
|
void Gui::renderSlot(int slot, int x, int y, float a) {
|
||||||
ItemInstance* item = minecraft->player->inventory->getItem(slot);
|
ItemInstance* item = minecraft->player->inventory->getItem(slot);
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
//LOGW("Warning: item @ Gui::renderSlot is NULL\n");
|
//LOGW("Warning: item @ Gui::renderSlot is NULL\n");
|
||||||
return;
|
return;
|
||||||
@@ -595,8 +596,11 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen
|
|||||||
ItemInstance* currentItem = minecraft->player->inventory->getSelected();
|
ItemInstance* currentItem = minecraft->player->inventory->getSelected();
|
||||||
bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false;
|
bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false;
|
||||||
bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false;
|
bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false;
|
||||||
|
//if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)
|
||||||
|
// || (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI))
|
||||||
if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)
|
if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)
|
||||||
|| (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
|| (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI))
|
||||||
|
{
|
||||||
minecraft->textures->loadAndBindTexture("gui/icons.png");
|
minecraft->textures->loadAndBindTexture("gui/icons.png");
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
|
|||||||
@@ -36,6 +36,16 @@ void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) {
|
|||||||
}
|
}
|
||||||
text += ": " + scaleText;
|
text += ": " + scaleText;
|
||||||
}
|
}
|
||||||
|
if (m_optionId == OPTIONS_FOG_TYPE) {
|
||||||
|
int value = minecraft->options.getIntValue(OPTIONS_FOG_TYPE);
|
||||||
|
std::string scaleText;
|
||||||
|
switch (value) {
|
||||||
|
case 0: scaleText = I18n::get("options.fogType.vanilla"); break;
|
||||||
|
case 1: scaleText = I18n::get("options.fogType.java"); break;
|
||||||
|
case 2: scaleText = I18n::get("options.fogType.unused"); break;
|
||||||
|
}
|
||||||
|
text += ": " + scaleText;
|
||||||
|
}
|
||||||
|
|
||||||
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
||||||
super::render(minecraft, xm, ym);
|
super::render(minecraft, xm, ym);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ void CreditsScreen::init() {
|
|||||||
_lines.push_back("karson");
|
_lines.push_back("karson");
|
||||||
_lines.push_back("deepfriedwaffles");
|
_lines.push_back("deepfriedwaffles");
|
||||||
_lines.push_back("EpikIzCool");
|
_lines.push_back("EpikIzCool");
|
||||||
|
_lines.push_back("fileshredder");
|
||||||
_lines.push_back("");
|
_lines.push_back("");
|
||||||
// avoid color tags around the URL so it isn't mangled by the parser please
|
// avoid color tags around the URL so it isn't mangled by the parser please
|
||||||
_lines.push_back("Join our Discord server: https://discord.gg/c58YesBxve");
|
_lines.push_back("Join our Discord server: https://discord.gg/c58YesBxve");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "IngameBlockSelectionScreen.h"
|
#include "IngameBlockSelectionScreen.h"
|
||||||
#include "../../renderer/TileRenderer.h"
|
#include "../../renderer/TileRenderer.h"
|
||||||
|
#include "../../renderer/Lighting.h"
|
||||||
#include "../../player/LocalPlayer.h"
|
#include "../../player/LocalPlayer.h"
|
||||||
#include "../../renderer/gles.h"
|
#include "../../renderer/gles.h"
|
||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
@@ -80,10 +81,10 @@ void IngameBlockSelectionScreen::renderSlots()
|
|||||||
|
|
||||||
blitOffset = -90;
|
blitOffset = -90;
|
||||||
|
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
glEnable2(GL_RESCALE_NORMAL);
|
||||||
//glPushMatrix2();
|
//glPushMatrix2();
|
||||||
//glRotatef2(180, 1, 0, 0);
|
//glRotatef2(180, 1, 0, 0);
|
||||||
//Lighting::turnOn();
|
Lighting::turnOn(minecraft);
|
||||||
//glPopMatrix2();
|
//glPopMatrix2();
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
||||||
@@ -122,8 +123,8 @@ void IngameBlockSelectionScreen::renderSlots()
|
|||||||
//w.stop();
|
//w.stop();
|
||||||
//w.printEvery(1000, "render-blocksel");
|
//w.printEvery(1000, "render-blocksel");
|
||||||
|
|
||||||
//glDisable2(GL_RESCALE_NORMAL);
|
glDisable2(GL_RESCALE_NORMAL);
|
||||||
//Lighting::turnOn();
|
Lighting::turnOn(minecraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
|
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
|
||||||
|
|||||||
@@ -208,7 +208,9 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
// // Controls Pane
|
// // Controls Pane
|
||||||
optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft)
|
optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft)
|
||||||
.addOptionItem(OPTIONS_USE_TOUCHSCREEN, minecraft)
|
.addOptionItem(OPTIONS_USE_TOUCHSCREEN, minecraft)
|
||||||
.addOptionItem(OPTIONS_AUTOJUMP, minecraft);
|
.addOptionItem(OPTIONS_AUTOJUMP, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_BLOCK_OUTLINE, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_IS_JOY_TOUCH_AREA, minecraft);
|
||||||
|
|
||||||
for (int i = OPTIONS_KEY_FORWARD; i <= OPTIONS_KEY_USE; i++) {
|
for (int i = OPTIONS_KEY_FORWARD; i <= OPTIONS_KEY_USE; i++) {
|
||||||
optionPanes[2]->addOptionItem((OptionId)i, minecraft);
|
optionPanes[2]->addOptionItem((OptionId)i, minecraft);
|
||||||
@@ -224,14 +226,16 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
||||||
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
||||||
.addOptionItem(OPTIONS_VIEW_BOBBING, minecraft)
|
.addOptionItem(OPTIONS_VIEW_BOBBING, minecraft)
|
||||||
.addOptionItem(OPTIONS_AMBIENT_OCCLUSION, minecraft);
|
.addOptionItem(OPTIONS_AMBIENT_OCCLUSION, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_NORMAL_LIGHTING, minecraft);
|
||||||
|
|
||||||
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
||||||
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
||||||
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft)
|
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_JAVA_HUD, minecraft)
|
.addOptionItem(OPTIONS_JAVA_HUD, minecraft)
|
||||||
.addOptionItem(OPTIONS_FOG_TYPE, minecraft);
|
.addOptionItem(OPTIONS_FOG_TYPE, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_RESTORED_ANIMS, minecraft);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ void ModelPart::compile( float scale )
|
|||||||
void ModelPart::draw()
|
void ModelPart::draw()
|
||||||
{
|
{
|
||||||
#ifdef OPENGL_ES
|
#ifdef OPENGL_ES
|
||||||
drawArrayVT_NoState(vboId, cubes.size() * 2 * 3 * 6, 24);
|
drawArrayVTN_NoState(vboId, cubes.size() * 2 * 3 * 6, 28);
|
||||||
#else
|
#else
|
||||||
glCallList(list);
|
glCallList(list);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ void PolygonQuad::mirror() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PolygonQuad::render(Tesselator& t, float scale, int vboId /* = -1 */) {
|
void PolygonQuad::render(Tesselator& t, float scale, int vboId /* = -1 */) {
|
||||||
|
Vec3 v0 = vertices[0].pos - vertices[1].pos;
|
||||||
|
Vec3 v1 = vertices[2].pos - vertices[1].pos;
|
||||||
|
Vec3 n = v1.cross(v0).normalized();
|
||||||
|
if (_flipNormal == true)
|
||||||
|
{
|
||||||
|
t.normal(-n.x , -n.y , -n.z );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t.normal(n.x , n.y , n.z );
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
VertexPT& v = vertices[i];
|
VertexPT& v = vertices[i];
|
||||||
t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v);
|
t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,11 +21,12 @@
|
|||||||
#include "../../world/item/BowItem.h"
|
#include "../../world/item/BowItem.h"
|
||||||
#include "../../world/level/tile/LeafTile.h"
|
#include "../../world/level/tile/LeafTile.h"
|
||||||
#include "entity/HumanoidMobRenderer.h"
|
#include "entity/HumanoidMobRenderer.h"
|
||||||
|
#include "Lighting.h"
|
||||||
|
|
||||||
//static StopwatchHandler handler;
|
//static StopwatchHandler handler;
|
||||||
|
|
||||||
ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
||||||
: mc(mc),
|
: mc(mc),
|
||||||
lastSlot(-1),
|
lastSlot(-1),
|
||||||
height(0),
|
height(0),
|
||||||
oHeight(0),
|
oHeight(0),
|
||||||
@@ -49,21 +50,47 @@ ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
|||||||
void ItemInHandRenderer::tick()
|
void ItemInHandRenderer::tick()
|
||||||
{
|
{
|
||||||
oHeight = height;
|
oHeight = height;
|
||||||
item.id = 0;
|
//item.id = 0;
|
||||||
|
|
||||||
ItemInstance* itemInHand = mc->player->inventory->getSelected();
|
ItemInstance* itemInHand = mc->player->inventory->getSelected();
|
||||||
if (itemInHand && itemInHand->count > 0) {
|
bool sameItem = (itemInHand && item.id == itemInHand->id && item.getAuxValue() == itemInHand->getAuxValue());
|
||||||
item.id = itemInHand->id;
|
|
||||||
item.setAuxValue(itemInHand->getAuxValue());
|
|
||||||
|
|
||||||
|
if (mc->options.getBooleanValue(OPTIONS_RESTORED_ANIMS)) // if enabled, restores and fixes item switching animation
|
||||||
|
{
|
||||||
|
if (!itemInHand && item.id == 0) sameItem = true;
|
||||||
|
float max = 0.4f;
|
||||||
|
float tHeight = sameItem ? 1 : 0;
|
||||||
|
float dd = tHeight - height;
|
||||||
|
if (dd < -max) dd = -max;
|
||||||
|
if (dd > max) dd = max;
|
||||||
|
|
||||||
|
height += dd;
|
||||||
|
|
||||||
|
if (height < 0.1){
|
||||||
|
if (itemInHand && itemInHand->count > 0) {
|
||||||
|
item.id = itemInHand->id;
|
||||||
|
item.setAuxValue(itemInHand->getAuxValue());
|
||||||
|
} else {
|
||||||
|
item.id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else // otherwise use vanilla broken behaviour where it instantly switches items/blocks
|
||||||
|
{
|
||||||
|
if (itemInHand && itemInHand->count > 0) {
|
||||||
|
item.id = itemInHand->id;
|
||||||
|
item.setAuxValue(itemInHand->getAuxValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
float max = 0.4f;
|
||||||
|
float tHeight = 1;//matches ? 1 : 0;
|
||||||
|
float dd = tHeight - height;
|
||||||
|
if (dd < -max) dd = -max;
|
||||||
|
if (dd > max) dd = max;
|
||||||
|
|
||||||
|
height += dd;
|
||||||
}
|
}
|
||||||
|
|
||||||
float max = 0.4f;
|
|
||||||
float tHeight = 1;//matches ? 1 : 0;
|
|
||||||
float dd = tHeight - height;
|
|
||||||
if (dd < -max) dd = -max;
|
|
||||||
if (dd > max) dd = max;
|
|
||||||
|
|
||||||
height += dd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
||||||
@@ -139,9 +166,9 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
float v1 = (vp * 16 + 15.99f) / 256.0f;
|
float v1 = (vp * 16 + 15.99f) / 256.0f;
|
||||||
|
|
||||||
float r = 1.0f;
|
float r = 1.0f;
|
||||||
// float xo = 0.0f;
|
// float xo = 0.0f;
|
||||||
// float yo = 0.3f;
|
// float yo = 0.3f;
|
||||||
/*
|
/*
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
//glEnable2(GL_RESCALE_NORMAL);
|
||||||
glTranslatef2(-xo, -yo, 0);
|
glTranslatef2(-xo, -yo, 0);
|
||||||
float s = 1.5f;
|
float s = 1.5f;
|
||||||
@@ -150,19 +177,28 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
glRotatef2(50, 0, 1, 0);
|
glRotatef2(50, 0, 1, 0);
|
||||||
glRotatef2(45 + 290, 0, 0, 1);
|
glRotatef2(45 + 290, 0, 0, 1);
|
||||||
glTranslatef2(-15 / 16.0f, -1 / 16.0f, 0);
|
glTranslatef2(-15 / 16.0f, -1 / 16.0f, 0);
|
||||||
*/
|
*/
|
||||||
float dd = 1 / 16.0f;
|
float dd = 1 / 16.0f;
|
||||||
|
float col = 1.0f;
|
||||||
|
float br = mc->player->getBrightness(0);
|
||||||
|
|
||||||
|
|
||||||
|
t.color(col*br,col*br,col*br,1.0f);
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
t.vertexUV(0, 0, 0, u0, v1);
|
t.vertexUV(0, 0, 0, u0, v1);
|
||||||
t.vertexUV(r, 0, 0, u1, v1);
|
t.vertexUV(r, 0, 0, u1, v1);
|
||||||
t.vertexUV(r, 1, 0, u1, v0);
|
t.vertexUV(r, 1, 0, u1, v0);
|
||||||
t.vertexUV(0, 1, 0, u0, v0);
|
t.vertexUV(0, 1, 0, u0, v0);
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
t.vertexUV(0, 1, 0 - dd, u0, v0);
|
t.vertexUV(0, 1, 0 - dd, u0, v0);
|
||||||
t.vertexUV(r, 1, 0 - dd, u1, v0);
|
t.vertexUV(r, 1, 0 - dd, u1, v0);
|
||||||
t.vertexUV(r, 0, 0 - dd, u1, v1);
|
t.vertexUV(r, 0, 0 - dd, u1, v1);
|
||||||
t.vertexUV(0, 0, 0 - dd, u0, v1);
|
t.vertexUV(0, 0, 0 - dd, u0, v1);
|
||||||
|
|
||||||
|
col = 0.8f;
|
||||||
|
t.color(col*br,col*br,col*br,1.0f);
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
||||||
@@ -172,6 +208,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(xx, 1, 0, uu, v0);
|
t.vertexUV(xx, 1, 0, uu, v0);
|
||||||
t.vertexUV(xx, 1, 0 - dd, uu, v0);
|
t.vertexUV(xx, 1, 0 - dd, uu, v0);
|
||||||
}
|
}
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
||||||
@@ -181,6 +218,10 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(xx, 0, 0, uu, v1);
|
t.vertexUV(xx, 0, 0, uu, v1);
|
||||||
t.vertexUV(xx, 0, 0 - dd, uu, v1);
|
t.vertexUV(xx, 0, 0 - dd, uu, v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
col = 0.6f;
|
||||||
|
t.color(col*br,col*br,col*br,1.0f);
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
||||||
@@ -190,6 +231,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(r, yy, 0 - dd, u1, vv);
|
t.vertexUV(r, yy, 0 - dd, u1, vv);
|
||||||
t.vertexUV(0, yy, 0 - dd, u0, vv);
|
t.vertexUV(0, yy, 0 - dd, u0, vv);
|
||||||
}
|
}
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
||||||
@@ -219,7 +261,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
}
|
}
|
||||||
mc->textures->loadAndBindTexture(renderObject.texture);
|
mc->textures->loadAndBindTexture(renderObject.texture);
|
||||||
|
|
||||||
drawArrayVT_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount);
|
drawArrayVTN_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount);
|
||||||
if (renderObject.isFlat)
|
if (renderObject.isFlat)
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
@@ -227,6 +269,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
//handler.printEvery(100);
|
//handler.printEvery(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ItemInHandRenderer::render( float a )
|
void ItemInHandRenderer::render( float a )
|
||||||
{
|
{
|
||||||
//return;
|
//return;
|
||||||
@@ -241,6 +284,8 @@ void ItemInHandRenderer::render( float a )
|
|||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
|
glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
|
||||||
glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0);
|
glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0);
|
||||||
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
Lighting::turnOn(mc);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
|
|
||||||
float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
|
float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
|
||||||
@@ -369,8 +414,8 @@ void ItemInHandRenderer::render( float a )
|
|||||||
playerRenderer->renderHand();
|
playerRenderer->renderHand();
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
//glDisable2(GL_RESCALE_NORMAL);
|
glDisable2(GL_RESCALE_NORMAL);
|
||||||
//Lighting.turnOff();
|
Lighting::turnOff();
|
||||||
//w.stop();
|
//w.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -513,14 +513,14 @@ void LevelRenderer::render(const AABB& b) const
|
|||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
glColor4f2(1, 1, 1, 1);
|
// glColor4f2(1, 1, 1, 1);
|
||||||
|
|
||||||
textures->loadAndBindTexture("terrain.png");
|
// textures->loadAndBindTexture("terrain.png"); // uh need to check java - shredder
|
||||||
|
|
||||||
//t.begin();
|
//t.begin();
|
||||||
t.color(255, 255, 255, 255);
|
// t.color(255, 255, 255, 255); // again not needed, for some reason the vanilla source code tints it... white? maybe this was used for something else in MCPE's dev at one point? - shredder
|
||||||
|
|
||||||
t.offset(((Mob*)mc->player)->getPos(0).negated());
|
// t.offset(((Mob*)mc->player)->getPos(0).negated()); // why does this even exist normally, it just makes the thing... not render
|
||||||
|
|
||||||
t.begin(GL_LINE_STRIP);
|
t.begin(GL_LINE_STRIP);
|
||||||
t.vertex(b.x0, b.y0, b.z0);
|
t.vertex(b.x0, b.y0, b.z0);
|
||||||
|
|||||||
48
src/client/renderer/Lighting.cpp
Normal file
48
src/client/renderer/Lighting.cpp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#include "Lighting.h"
|
||||||
|
#include "gles.h"
|
||||||
|
#include "../Minecraft.h"
|
||||||
|
|
||||||
|
void Lighting::turnOff() {
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glDisable(GL_LIGHT0);
|
||||||
|
glDisable(GL_LIGHT1);
|
||||||
|
glDisable(GL_COLOR_MATERIAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lighting::turnOn(Minecraft* minecraft) {
|
||||||
|
if (!minecraft->options.getBooleanValue(OPTIONS_NORMAL_LIGHTING)){ // if normal lighting is false, then just dont use the lighting system at all like in vanilla - shredder
|
||||||
|
turnOff();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// if normal lighting is true then enable GLES/OpenGL states to setup lighting
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
glEnable(GL_LIGHT0);
|
||||||
|
glEnable(GL_LIGHT1);
|
||||||
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
|
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
|
||||||
|
|
||||||
|
constexpr float a = 0.4f;
|
||||||
|
constexpr float d = 0.6f;
|
||||||
|
constexpr float s = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
|
//Vec3 l = world::phys::Vec3{0.2, 1.0, -0.7}.normalize();
|
||||||
|
constexpr float lightmodel_ambient[] = {a, a, a, 1.0f};
|
||||||
|
constexpr float diffuse[] = {d, d, d, 1.0f};
|
||||||
|
constexpr float ambient[] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||||
|
constexpr float specular[] = {s, s, s, 1.0f};
|
||||||
|
|
||||||
|
constexpr float pos0[] = {(float)(0.16169041989141428), (float)(0.8084520874101966), (float)(-0.5659164515496377), 0.0f};
|
||||||
|
glLightfv(GL_LIGHT0, GL_POSITION, pos0);
|
||||||
|
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
|
||||||
|
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
|
||||||
|
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
|
||||||
|
|
||||||
|
constexpr float pos1[] = {(float)(-0.16169041989141428), (float)(0.8084520874101966), (float)(0.5659164515496377), 0.0f};
|
||||||
|
glLightfv(GL_LIGHT1, GL_POSITION, pos1);
|
||||||
|
glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
|
||||||
|
glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
|
||||||
|
glLightfv(GL_LIGHT1, GL_SPECULAR, specular);
|
||||||
|
glShadeModel(GL_FLAT);
|
||||||
|
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lightmodel_ambient);
|
||||||
|
}
|
||||||
12
src/client/renderer/Lighting.h
Normal file
12
src/client/renderer/Lighting.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__
|
||||||
|
#define NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__
|
||||||
|
|
||||||
|
class Minecraft;
|
||||||
|
class Lighting
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void turnOff();
|
||||||
|
static void turnOn(Minecraft* minecraft);
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__*/
|
||||||
@@ -278,9 +278,9 @@ void Tesselator::vertex( float x, float y, float z )
|
|||||||
if (hasColor) {
|
if (hasColor) {
|
||||||
dst.color = src.color;
|
dst.color = src.color;
|
||||||
}
|
}
|
||||||
//if (hasNormal) {
|
if (hasNormal) {
|
||||||
// dst.normal = src.normal;
|
dst.normal = src.normal;
|
||||||
//}
|
}
|
||||||
|
|
||||||
dst.x = src.x;
|
dst.x = src.x;
|
||||||
dst.y = src.y;
|
dst.y = src.y;
|
||||||
@@ -301,9 +301,9 @@ void Tesselator::vertex( float x, float y, float z )
|
|||||||
if (hasColor) {
|
if (hasColor) {
|
||||||
vertex.color = _color;
|
vertex.color = _color;
|
||||||
}
|
}
|
||||||
//if (hasNormal) {
|
if (hasNormal) {
|
||||||
// vertex.normal = _normal;
|
vertex.normal = _normal;
|
||||||
//}
|
}
|
||||||
|
|
||||||
vertex.x = _sx * (x + xo);
|
vertex.x = _sx * (x + xo);
|
||||||
vertex.y = _sy * (y + yo);
|
vertex.y = _sy * (y + yo);
|
||||||
@@ -332,10 +332,10 @@ void Tesselator::setAccessMode(int mode)
|
|||||||
|
|
||||||
void Tesselator::normal( float x, float y, float z )
|
void Tesselator::normal( float x, float y, float z )
|
||||||
{
|
{
|
||||||
static int _warn_t = 0;
|
//static int _warn_t = 0;
|
||||||
if ((++_warn_t & 32767) == 1)
|
//if ((++_warn_t & 32767) == 1)
|
||||||
LOGI("WARNING: Can't use normals (Tesselator::normal)\n");
|
// LOGI("WARNING: Can't use normals (Tesselator::normal)\n");
|
||||||
return;
|
//return;
|
||||||
|
|
||||||
if (!tesselating) printf("But..");
|
if (!tesselating) printf("But..");
|
||||||
hasNormal = true;
|
hasNormal = true;
|
||||||
@@ -404,10 +404,10 @@ void Tesselator::draw()
|
|||||||
//glColorPointer2(4, GL_UNSIGNED_BYTE, VertexSizeBytes, (GLvoid*) &_varray->color);
|
//glColorPointer2(4, GL_UNSIGNED_BYTE, VertexSizeBytes, (GLvoid*) &_varray->color);
|
||||||
glEnableClientState2(GL_COLOR_ARRAY);
|
glEnableClientState2(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
//if (hasNormal) {
|
if (hasNormal) {
|
||||||
// glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4));
|
glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4));
|
||||||
// glEnableClientState2(GL_NORMAL_ARRAY);
|
glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
//}
|
}
|
||||||
//glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, (GLvoid*)&_varray);
|
//glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, (GLvoid*)&_varray);
|
||||||
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
||||||
glEnableClientState2(GL_VERTEX_ARRAY);
|
glEnableClientState2(GL_VERTEX_ARRAY);
|
||||||
@@ -421,7 +421,7 @@ void Tesselator::draw()
|
|||||||
glDisableClientState2(GL_VERTEX_ARRAY);
|
glDisableClientState2(GL_VERTEX_ARRAY);
|
||||||
if (hasTexture) glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
if (hasTexture) glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
if (hasColor) glDisableClientState2(GL_COLOR_ARRAY);
|
if (hasColor) glDisableClientState2(GL_COLOR_ARRAY);
|
||||||
//if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY);
|
if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
extern const int VertexSizeBytes;
|
extern const int VertexSizeBytes;
|
||||||
|
|
||||||
typedef VertexDeclPTC VERTEX;
|
typedef VertexDeclPTCN VERTEX;
|
||||||
typedef std::map<GLuint, GLsizei> IntGLMap;
|
typedef std::map<GLuint, GLsizei> IntGLMap;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ bool TileRenderer::tesselateTorchInWorld( Tile* tt, int x, int y, int z )
|
|||||||
|
|
||||||
bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||||
{
|
{
|
||||||
// @todo: fire alpha transparency seems to be scuffed, also it seems i might have messed up the second layer while porting from lce/java , need to look into it - shredder
|
// fire transparency has been fixed - shredder
|
||||||
|
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
@@ -2309,29 +2309,53 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
t.color(0xff, 0xff, 0xff);
|
t.color(0xff, 0xff, 0xff); // i disabled this, this is normally enabled in normal mcpe see if this fits OPTION_NORMAL_LIGHTING - shredder
|
||||||
int shape = tile->getRenderShape();
|
int shape = tile->getRenderShape();
|
||||||
|
|
||||||
if (shape == Tile::SHAPE_BLOCK) {
|
if (shape == Tile::SHAPE_BLOCK) {
|
||||||
tile->updateDefaultShape();
|
tile->updateDefaultShape();
|
||||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);// most normal calls in this file has been added me since they existed in java - shredder
|
||||||
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0, data));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0, data));
|
||||||
|
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1, data));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1, data));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2, data));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2, data));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3, data));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3, data));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4, data));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4, data));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5, data));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5, data));
|
||||||
t.draw();
|
t.draw();
|
||||||
|
|
||||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) { // uhh java has this but is this even ever used??? - shredder
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
|
|
||||||
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||||
t.draw();
|
t.draw();
|
||||||
} else if(shape == Tile::SHAPE_STEM) {
|
} else if(shape == Tile::SHAPE_STEM) {
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
|
|
||||||
tile->updateDefaultShape();
|
tile->updateDefaultShape();
|
||||||
tesselateStemTexture(tile, data, tile->yy1, -0.5f, -0.5f, -0.5f);
|
tesselateStemTexture(tile, data, tile->yy1, -0.5f, -0.5f, -0.5f);
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2340,16 +2364,39 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
t.offset(-0.5f, -0.5f, -0.5f);
|
t.offset(-0.5f, -0.5f, -0.5f);
|
||||||
float s = 1 / 16.0f;
|
float s = 1 / 16.0f;
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
|
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
|
||||||
t.addOffset(0, 0, s);
|
t.addOffset(0, 0, s);
|
||||||
|
|
||||||
|
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
t.addOffset(0, 0, -s);
|
t.addOffset(0, 0, -s);
|
||||||
t.addOffset(0, 0, -s);
|
t.addOffset(0, 0, -s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
t.addOffset(0, 0, s);
|
t.addOffset(0, 0, s);
|
||||||
t.addOffset(s, 0, 0);
|
t.addOffset(s, 0, 0);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
t.addOffset(-s, 0, 0);
|
t.addOffset(-s, 0, 0);
|
||||||
t.addOffset(-s, 0, 0);
|
t.addOffset(-s, 0, 0);
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
@@ -2363,7 +2410,7 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
//} else if (shape == Tile::SHAPE_TORCH) {
|
//} else if (shape == Tile::SHAPE_TORCH) {
|
||||||
//// t.begin();
|
//// t.begin();
|
||||||
//// t.normal(0, -1, 0);
|
//// t.normal(0, -1, 0);
|
||||||
//// tesselateTorch(tile, -0.5f, -0.5f, -0.5f, 0, 0);
|
/// tesselateTorch(tile, -0.5f, -0.5f, -0.5f, 0, 0);
|
||||||
//// t.end();
|
//// t.end();
|
||||||
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
||||||
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
||||||
@@ -2375,11 +2422,23 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f);
|
if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f);
|
||||||
if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1);
|
if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1);
|
||||||
|
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
|
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2396,12 +2455,23 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2);
|
if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2);
|
||||||
if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2);
|
if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2);
|
||||||
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||||
@@ -2415,12 +2485,23 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1);
|
if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1);
|
||||||
if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2);
|
if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2);
|
||||||
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(0));
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||||
@@ -2469,7 +2550,7 @@ void TileRenderer::renderGuiTile( Tile* tile, int data )
|
|||||||
|
|
||||||
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
||||||
t.begin();
|
t.begin();
|
||||||
//t.normal(0, -1, 0);
|
t.normal(0, -1, 0);
|
||||||
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||||
//t.end();
|
//t.end();
|
||||||
t.draw();
|
t.draw();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
#include "../../Option.h"
|
#include "../../Option.h"
|
||||||
|
|
||||||
|
#include "../Lighting.h"
|
||||||
EntityRenderDispatcher* EntityRenderer::entityRenderDispatcher = NULL;
|
EntityRenderDispatcher* EntityRenderer::entityRenderDispatcher = NULL;
|
||||||
|
|
||||||
EntityRenderer::EntityRenderer()
|
EntityRenderer::EntityRenderer()
|
||||||
@@ -134,7 +135,7 @@ void EntityRenderer::postRender(Entity* entity, float x, float y, float z, float
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) {
|
void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) {
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
int tex = ((Tile*)Tile::fire)->tex;
|
int tex = ((Tile*)Tile::fire)->tex;
|
||||||
|
|
||||||
int xt = (tex & 0xf) << 4;
|
int xt = (tex & 0xf) << 4;
|
||||||
@@ -176,7 +177,7 @@ void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a)
|
|||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
// glEnable2(GL_LIGHTING);
|
glEnable2(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { //
|
void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { //
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float
|
|||||||
else if (item->count > 1) count = 2;
|
else if (item->count > 1) count = 2;
|
||||||
|
|
||||||
glTranslatef2((float) x, (float) y + bob, (float) z);
|
glTranslatef2((float) x, (float) y + bob, (float) z);
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
glEnable2(GL_RESCALE_NORMAL);
|
||||||
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
||||||
glRotatef2(spin, 0, 1, 0);
|
glRotatef2(spin, 0, 1, 0);
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float
|
|||||||
}
|
}
|
||||||
glRotatef2(180 - entityRenderDispatcher->playerRotY, 0, 1, 0);
|
glRotatef2(180 - entityRenderDispatcher->playerRotY, 0, 1, 0);
|
||||||
t.begin();
|
t.begin();
|
||||||
//t.normal(0, 1, 0);
|
t.normal(0, 1, 0);
|
||||||
t.vertexUV(0 - xo, 0 - yo, 0, u0, v1);
|
t.vertexUV(0 - xo, 0 - yo, 0, u0, v1);
|
||||||
t.vertexUV(r - xo, 0 - yo, 0, u1, v1);
|
t.vertexUV(r - xo, 0 - yo, 0, u1, v1);
|
||||||
t.vertexUV(r - xo, 1 - yo, 0, u1, v0);
|
t.vertexUV(r - xo, 1 - yo, 0, u1, v0);
|
||||||
@@ -118,7 +118,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float
|
|||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//glDisable2(GL_RESCALE_NORMAL);
|
glDisable2(GL_RESCALE_NORMAL);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ void PlayerRenderer::render(Entity* mob_, float x, float y, float z, float rot,
|
|||||||
model = desired;
|
model = desired;
|
||||||
humanoidModel = desired;
|
humanoidModel = desired;
|
||||||
}
|
}
|
||||||
LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n",
|
// LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n", // don't log it always, only for debug - shredder
|
||||||
((Player*)mob)->name.c_str(), mob->getTexture().c_str(),
|
// ((Player*)mob)->name.c_str(), mob->getTexture().c_str(),
|
||||||
humanoidModel->texWidth, humanoidModel->texHeight,
|
// humanoidModel->texWidth, humanoidModel->texHeight,
|
||||||
(desired == playerModel64 ? "64" : "32"));
|
// (desired == playerModel64 ? "64" : "32"));
|
||||||
HumanoidMobRenderer::render(mob_, x, y, z, rot, a);
|
HumanoidMobRenderer::render(mob_, x, y, z, rot, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,41 @@ void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize /* = 24 */)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void drawArrayVTN(int bufferId, int vertices, int vertexSize /* = 24 */) {
|
||||||
|
//if (Options::debugGl) LOGI("drawArray\n");
|
||||||
|
//LOGI("draw-vtc: %d, %d, %d\n", bufferId, vertices, vertexSize);
|
||||||
|
glEnableClientState2(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
//glEnableClientState2(GL_COLOR_ARRAY);
|
||||||
|
glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
||||||
|
|
||||||
|
glVertexPointer2( 3, GL_FLOAT, vertexSize, 0);
|
||||||
|
glTexCoordPointer2(2, GL_FLOAT, vertexSize, (GLvoid*) (3 * 4));
|
||||||
|
//glColorPointer2(4, GL_UNSIGNED_BYTE, vertexSize, (GLvoid*) (5*4));
|
||||||
|
glNormalPointer(GL_BYTE, vertexSize, (GLvoid*) (6 * 4));
|
||||||
|
|
||||||
|
glDrawArrays2(GL_TRIANGLES, 0, vertices);
|
||||||
|
|
||||||
|
glDisableClientState2(GL_VERTEX_ARRAY);
|
||||||
|
glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
//glDisableClientState2(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState2(GL_NORMAL_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef drawArrayVTN_NoState
|
||||||
|
void drawArrayVTCN_NoState(int bufferId, int vertices, int vertexSize /* = 24 */) {
|
||||||
|
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
||||||
|
|
||||||
|
glVertexPointer2( 3, GL_FLOAT, vertexSize, 0);
|
||||||
|
glTexCoordPointer2(2, GL_FLOAT, vertexSize, (GLvoid*) (3 * 4));
|
||||||
|
//glColorPointer2(4, GL_UNSIGNED_BYTE, vertexSize, (GLvoid*) (5*4));
|
||||||
|
glNormalPointer(GL_BYTE, vertexSize, (GLvoid*) (6 * 4));
|
||||||
|
|
||||||
|
glDrawArrays2(GL_TRIANGLES, 0, vertices);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,13 +55,18 @@ void anGenBuffers(GLsizei n, GLuint* buffer);
|
|||||||
#ifdef USE_VBO
|
#ifdef USE_VBO
|
||||||
#define drawArrayVT_NoState drawArrayVT
|
#define drawArrayVT_NoState drawArrayVT
|
||||||
#define drawArrayVTC_NoState drawArrayVTC
|
#define drawArrayVTC_NoState drawArrayVTC
|
||||||
void drawArrayVT(int bufferId, int vertices, int vertexSize = 24, unsigned int mode = GL_TRIANGLES);
|
#define drawArrayVTN_NoState drawArrayVTN
|
||||||
|
void drawArrayVT(int bufferId, int vertices, int vertexSize = 28, unsigned int mode = GL_TRIANGLES);
|
||||||
#ifndef drawArrayVT_NoState
|
#ifndef drawArrayVT_NoState
|
||||||
//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 24);
|
//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 28);
|
||||||
#endif
|
#endif
|
||||||
void drawArrayVTC(int bufferId, int vertices, int vertexSize = 24);
|
void drawArrayVTC(int bufferId, int vertices, int vertexSize = 28);
|
||||||
#ifndef drawArrayVTC_NoState
|
#ifndef drawArrayVTC_NoState
|
||||||
void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 24);
|
void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 28);
|
||||||
|
#endif
|
||||||
|
void drawArrayVTN(int bufferId, int vertices, int vertexSize = 28);
|
||||||
|
#ifndef drawArrayVTN_NoState
|
||||||
|
void drawArrayVTCN_NoState(int bufferId, int vertices, int vertexSize = 28);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -114,6 +119,7 @@ int glhUnProjectf( float winx, float winy, float winz,
|
|||||||
#define glVertexPointer2 glVertexPointer
|
#define glVertexPointer2 glVertexPointer
|
||||||
#define glColorPointer2 glColorPointer
|
#define glColorPointer2 glColorPointer
|
||||||
#define glTexCoordPointer2 glTexCoordPointer
|
#define glTexCoordPointer2 glTexCoordPointer
|
||||||
|
#define glNormalPointer2 glNormalPointer
|
||||||
#define glEnableClientState2 glEnableClientState
|
#define glEnableClientState2 glEnableClientState
|
||||||
#define glDisableClientState2 glDisableClientState
|
#define glDisableClientState2 glDisableClientState
|
||||||
#define glDrawArrays2 glDrawArrays
|
#define glDrawArrays2 glDrawArrays
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// DynamicTexture
|
// DynamicTexture
|
||||||
//
|
//
|
||||||
DynamicTexture::DynamicTexture(int tex_)
|
DynamicTexture::DynamicTexture(int tex_)
|
||||||
: tex(tex_),
|
: tex(tex_),
|
||||||
replicate(1)
|
replicate(1)
|
||||||
{
|
{
|
||||||
memset(pixels, 0, 16*16*4);
|
memset(pixels, 0, 16*16*4);
|
||||||
@@ -29,8 +29,8 @@ void DynamicTexture::bindTexture(Textures* tex) {
|
|||||||
/*
|
/*
|
||||||
WaterTexture::WaterTexture()
|
WaterTexture::WaterTexture()
|
||||||
: super(Tile::water->tex),
|
: super(Tile::water->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ void WaterTexture::tick() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
WaterTexture::WaterTexture()
|
WaterTexture::WaterTexture()
|
||||||
: super(Tile::water->tex),
|
: super(Tile::water->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
@@ -76,55 +76,55 @@ void WaterTexture::tick()
|
|||||||
next[x + y * 16] = pow / 3.3f + heat[x + y * 16] * 0.8f;
|
next[x + y * 16] = pow / 3.3f + heat[x + y * 16] * 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
for (int y = 0; y < 16; y++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
||||||
|
|
||||||
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
||||||
heata[x + y * 16] -= 0.1f;
|
heata[x + y * 16] -= 0.1f;
|
||||||
if (Mth::random() < 0.05f) {
|
if (Mth::random() < 0.05f) {
|
||||||
heata[x + y * 16] = 0.5f;
|
heata[x + y * 16] = 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
float* tmp = next;
|
float* tmp = next;
|
||||||
next = current;
|
next = current;
|
||||||
current = tmp;
|
current = tmp;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
float pow = current[i];
|
float pow = current[i];
|
||||||
if (pow > 1) pow = 1;
|
if (pow > 1) pow = 1;
|
||||||
if (pow < 0) pow = 0;
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
float pp = pow * pow;
|
float pp = pow * pow;
|
||||||
|
|
||||||
int r = (int) (32 + pp * 32);
|
int r = (int) (32 + pp * 32);
|
||||||
int g = (int) (50 + pp * 64);
|
int g = (int) (50 + pp * 64);
|
||||||
int b = (int) (255);
|
int b = (int) (255);
|
||||||
int a = (int) (146 + pp * 50);
|
int a = (int) (146 + pp * 50);
|
||||||
|
|
||||||
//if (anaglyph3d) {
|
//if (anaglyph3d) {
|
||||||
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
// int gg = (r * 30 + g * 70) / (100);
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
// int bb = (r * 30 + b * 70) / (100);
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
// r = rr;
|
// r = rr;
|
||||||
// g = gg;
|
// g = gg;
|
||||||
// b = bb;
|
// b = bb;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pixels[i * 4 + 0] = r;
|
pixels[i * 4 + 0] = r;
|
||||||
pixels[i * 4 + 1] = g;
|
pixels[i * 4 + 1] = g;
|
||||||
pixels[i * 4 + 2] = b;
|
pixels[i * 4 + 2] = b;
|
||||||
pixels[i * 4 + 3] = a;
|
pixels[i * 4 + 3] = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// WaterSideTexture
|
// WaterSideTexture
|
||||||
//
|
//
|
||||||
WaterSideTexture::WaterSideTexture()
|
WaterSideTexture::WaterSideTexture()
|
||||||
: super(Tile::water->tex + 1),
|
: super(Tile::water->tex + 1),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0),
|
_frame(0),
|
||||||
_tickCount(0)
|
_tickCount(0)
|
||||||
@@ -164,51 +164,237 @@ void WaterSideTexture::tick() {
|
|||||||
next[x + y * 16] = pow / 3.2f + heat[x + y * 16] * 0.8f;
|
next[x + y * 16] = pow / 3.2f + heat[x + y * 16] * 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
for (int y = 0; y < 16; y++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
||||||
|
|
||||||
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
||||||
heata[x + y * 16] -= 0.3f;
|
heata[x + y * 16] -= 0.3f;
|
||||||
if (Mth::random() < 0.2) {
|
if (Mth::random() < 0.2) {
|
||||||
heata[x + y * 16] = 0.5f;
|
heata[x + y * 16] = 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
float* tmp = next;
|
||||||
float* tmp = next;
|
next = current;
|
||||||
next = current;
|
current = tmp;
|
||||||
current = tmp;
|
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
float pow = current[(i - _tickCount * 16) & 255];
|
float pow = current[(i - _tickCount * 16) & 255];
|
||||||
if (pow > 1) pow = 1;
|
if (pow > 1) pow = 1;
|
||||||
if (pow < 0) pow = 0;
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
float pp = pow * pow;
|
float pp = pow * pow;
|
||||||
|
|
||||||
int r = (int) (32 + pp * 32);
|
int r = (int) (32 + pp * 32);
|
||||||
int g = (int) (50 + pp * 64);
|
int g = (int) (50 + pp * 64);
|
||||||
int b = (int) (255);
|
int b = (int) (255);
|
||||||
int a = (int) (146 + pp * 50);
|
int a = (int) (146 + pp * 50);
|
||||||
|
|
||||||
//if (anaglyph3d) {
|
//if (anaglyph3d) {
|
||||||
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
// int gg = (r * 30 + g * 70) / (100);
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
// int bb = (r * 30 + b * 70) / (100);
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
// r = rr;
|
// r = rr;
|
||||||
// g = gg;
|
// g = gg;
|
||||||
// b = bb;
|
// b = bb;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pixels[i * 4 + 0] = r;
|
pixels[i * 4 + 0] = r;
|
||||||
pixels[i * 4 + 1] = g;
|
pixels[i * 4 + 1] = g;
|
||||||
pixels[i * 4 + 2] = b;
|
pixels[i * 4 + 2] = b;
|
||||||
pixels[i * 4 + 3] = a;
|
pixels[i * 4 + 3] = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Lava Texture
|
||||||
|
///
|
||||||
|
|
||||||
|
LavaTexture::LavaTexture()
|
||||||
|
: super(Tile::lava->tex),
|
||||||
|
_tick(0),
|
||||||
|
_frame(0)
|
||||||
|
{
|
||||||
|
current = new float[16*16];
|
||||||
|
next = new float[16*16];
|
||||||
|
heat = new float[16*16];
|
||||||
|
heata = new float[16*16];
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i) {
|
||||||
|
current[i] = 0;
|
||||||
|
next[i] = 0;
|
||||||
|
heat[i] = 0;
|
||||||
|
heata[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LavaTexture::~LavaTexture() {
|
||||||
|
delete[] current;
|
||||||
|
delete[] next;
|
||||||
|
delete[] heat;
|
||||||
|
delete[] heata;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LavaTexture::tick()
|
||||||
|
{
|
||||||
|
for (int x = 0; x < 16; x++)
|
||||||
|
for (int y = 0; y < 16; y++) {
|
||||||
|
float pow = 0;
|
||||||
|
int xxo = (int)(Mth::sin((float)(y) * (float)(Mth::PI) * 2.0f / 16.0f) * 1.2f);
|
||||||
|
int yyo = (int)(Mth::sin((float)(x) * (float)(Mth::PI) * 2.0f / 16.0f) * 1.2f);
|
||||||
|
for (int xx = x - 1; xx <= x + 1; xx++) {
|
||||||
|
for (int yy = y - 1; yy <= y + 1; yy++) {
|
||||||
|
int xi = xx + xxo & 15;
|
||||||
|
int yi = yy + yyo & 15;
|
||||||
|
pow += current[xi + yi * 16];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next[x + y * 16] = pow / 10.0f + (heat[(x + 0 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 1 & 15) * 16] + heat[(x + 0 & 15) + (y + 1 & 15) * 16]) / 4.0f * 0.8f;
|
||||||
|
heat[x + y * 16] = heat[x + y * 16] + heata[x + y * 16] * 0.01f;
|
||||||
|
if (heat[x + y * 16] < 0.0f) {
|
||||||
|
heat[x + y * 16] = 0.0f;
|
||||||
|
}
|
||||||
|
heata[x + y * 16] = heata[x + y * 16] - 0.06f;
|
||||||
|
if (Mth::random() < 0.005) {
|
||||||
|
heata[x + y * 16] = 1.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float* tmp = next;
|
||||||
|
next = current;
|
||||||
|
current = tmp;
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; i++) {
|
||||||
|
float pow = current[i] * 2.0f;
|
||||||
|
if (pow > 1) pow = 1;
|
||||||
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
|
float pp = pow * pow;
|
||||||
|
|
||||||
|
int r = (int) (pow * 100.0f + 155.0f);
|
||||||
|
int g = (int) (pp * 255.0f);
|
||||||
|
int b = (int) (pp * pp * 128.0f);
|
||||||
|
|
||||||
|
//if (anaglyph3d) {
|
||||||
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
|
// r = rr;
|
||||||
|
// g = gg;
|
||||||
|
// b = bb;
|
||||||
|
//}
|
||||||
|
|
||||||
|
pixels[i * 4 + 0] = r;
|
||||||
|
pixels[i * 4 + 1] = g;
|
||||||
|
pixels[i * 4 + 2] = b;
|
||||||
|
pixels[i * 4 + 3] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Lava Side Texture
|
||||||
|
///
|
||||||
|
|
||||||
|
LavaSideTexture::LavaSideTexture()
|
||||||
|
: super(Tile::lava->tex + 1),
|
||||||
|
_tick(0),
|
||||||
|
_frame(0),
|
||||||
|
_tickCount(0)
|
||||||
|
{
|
||||||
|
replicate = 2;
|
||||||
|
|
||||||
|
current = new float[16*16];
|
||||||
|
next = new float[16*16];
|
||||||
|
heat = new float[16*16];
|
||||||
|
heata = new float[16*16];
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i) {
|
||||||
|
current[i] = 0;
|
||||||
|
next[i] = 0;
|
||||||
|
heat[i] = 0;
|
||||||
|
heata[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LavaSideTexture::~LavaSideTexture() {
|
||||||
|
delete[] current;
|
||||||
|
delete[] next;
|
||||||
|
delete[] heat;
|
||||||
|
delete[] heata;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LavaSideTexture::tick() {
|
||||||
|
++_tickCount;
|
||||||
|
for (int x = 0; x < 16; x++)
|
||||||
|
for (int y = 0; y < 16; y++) {
|
||||||
|
float pow = 0;
|
||||||
|
int yl = (int)(Mth::sin((float)(y) * (float)(Mth::PI)* 2.0f / 16.0f) * 1.2f); // var2 is y
|
||||||
|
int xl = (int)(Mth::sin((float)(x) * (float)(Mth::PI)* 2.0f / 16.0f) * 1.2f); // var1 is x
|
||||||
|
for (int yy = x - 1; yy <= x + 1; yy++) {
|
||||||
|
for (int xx = y - 1; xx <= y + 1; xx++) {
|
||||||
|
int xi = (yy + yl) & 15; // var8
|
||||||
|
int yi = (xx + xl) & 15; //var9
|
||||||
|
pow += current[xi + yi * 16];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next[x + y * 16] =
|
||||||
|
next[x + y * 16] =
|
||||||
|
pow / 10.0f + (
|
||||||
|
heat[(x + 0 & 15) + (y + 0 & 15) *
|
||||||
|
16] + heat[
|
||||||
|
(x + 1 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 1 & 15) *
|
||||||
|
16] + heat[
|
||||||
|
(x + 0 & 15) + (y + 1 & 15) * 16]) / 4.0f
|
||||||
|
* 0.8f;
|
||||||
|
heat[x + y * 16] = heat[x + y * 16] + heata[x + y * 16] * 0.01f;
|
||||||
|
|
||||||
|
if (heat[x + y * 16] < 0.0f) {
|
||||||
|
heat[x + y * 16] = 0.0f;
|
||||||
|
}
|
||||||
|
heata[x + y * 16] = heata[x + y * 16] - 0.06f;
|
||||||
|
|
||||||
|
if (Mth::random() < 0.005) {
|
||||||
|
heata[x + y * 16] = 1.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float* tmp = next;
|
||||||
|
next = current;
|
||||||
|
current = tmp;
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; i++) {
|
||||||
|
float pow = current[(i - _tickCount / 3 * 16) & 255] * 2.0f;
|
||||||
|
if (pow > 1) pow = 1;
|
||||||
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
|
float pp = pow * pow;
|
||||||
|
|
||||||
|
int r = (int) (pow * 100.0f + 155.0f);
|
||||||
|
int g = (int) (pow * pow * 255.0f);
|
||||||
|
int b = (int) (pow * pow * pow * pow * 128.0f);
|
||||||
|
// int a = (int) (146 + pp * 50);
|
||||||
|
|
||||||
|
//if (anaglyph3d) {
|
||||||
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
|
// r = rr;
|
||||||
|
// g = gg;
|
||||||
|
// b = bb;
|
||||||
|
//}
|
||||||
|
|
||||||
|
pixels[i * 4 + 0] = r;
|
||||||
|
pixels[i * 4 + 1] = g;
|
||||||
|
pixels[i * 4 + 2] = b;
|
||||||
|
pixels[i * 4 + 3] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FireTexture::FireTexture()
|
FireTexture::FireTexture()
|
||||||
: super(((Tile*)Tile::fire)->tex),
|
: super(((Tile*)Tile::fire)->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
@@ -236,63 +422,63 @@ FireTexture::~FireTexture() {
|
|||||||
// oh boy time to implement fire textures, i am so fucked - shredder
|
// oh boy time to implement fire textures, i am so fucked - shredder
|
||||||
|
|
||||||
void FireTexture::tick() {
|
void FireTexture::tick() {
|
||||||
// loop generates fire texture on the empty texture grid, hopefully shouldnt be too taxing on older hardware - shredder
|
// loop generates fire texture on the empty texture grid, hopefully shouldnt be too taxing on older hardware - shredder
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
for (int y = 0; y < 20; y++) {
|
for (int y = 0; y < 20; y++) {
|
||||||
int count = 18;
|
int count = 18;
|
||||||
float pow = this->current[x + (y + 1) % 20 * 16] * (float)(count);
|
float pow = this->current[x + (y + 1) % 20 * 16] * (float)(count);
|
||||||
for (int xx = x - 1; xx <= x + 1; xx++) {
|
for (int xx = x - 1; xx <= x + 1; xx++) {
|
||||||
for (int yy = y; yy <= y + 1; yy++) {
|
for (int yy = y; yy <= y + 1; yy++) {
|
||||||
if (xx >= 0 && yy >= 0 && xx < 16 && yy < 20) {
|
if (xx >= 0 && yy >= 0 && xx < 16 && yy < 20) {
|
||||||
pow += this->current[xx + yy * 16];
|
pow += this->current[xx + yy * 16];
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->next[x + y * 16] = pow / (float(count) * 1.06f);
|
this->next[x + y * 16] = pow / (float(count) * 1.06f);
|
||||||
if (y >= 19) {
|
if (y >= 19) {
|
||||||
this->next[x + y * 16] = float(Mth::random() * Mth::random() * Mth::random() * 4.0 + Mth::random() * 0.1f + 0.2f);
|
this->next[x + y * 16] = float(Mth::random() * Mth::random() * Mth::random() * 4.0 + Mth::random() * 0.1f + 0.2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hopefully this doesn't cause any mysterious issues - shredder
|
// hopefully this doesn't cause any mysterious issues - shredder
|
||||||
float* tmp = next;
|
float* tmp = next;
|
||||||
next = current;
|
next = current;
|
||||||
current = tmp;
|
current = tmp;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
float pow = this->current[i] * 1.8f;
|
float pow = this->current[i] * 1.8f;
|
||||||
if (pow > 1.0f) {
|
if (pow > 1.0f) {
|
||||||
pow = 1.0f;
|
pow = 1.0f;
|
||||||
}
|
}
|
||||||
if (pow < 0.0f) {
|
if (pow < 0.0f) {
|
||||||
pow = 0.0f;
|
pow = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int r = (int) (pow * 155.0f + 100.0f);
|
int r = (int) (pow * 155.0f + 100.0f);
|
||||||
int g = (int)(pow * pow * 255.0f);
|
int g = (int)(pow * pow * 255.0f);
|
||||||
int b = (int)(pow * pow * pow * pow * pow * pow * pow * pow * pow * pow * 255.0f);
|
int b = (int)(pow * pow * pow * pow * pow * pow * pow * pow * pow * pow * 255.0f);
|
||||||
int a = 255;
|
int a = 255;
|
||||||
if (pow < 0.5f) {
|
if (pow < 0.5f) {
|
||||||
a = 0;
|
a = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: cant be arsed rn to implement the anaglyph3d check would be nice to check if it does - shredder
|
// @TODO: cant be arsed rn to implement the anaglyph3d check would be nice to check if it does - shredder
|
||||||
//if (this->anaglyph3d) {
|
//if (this->anaglyph3d) {
|
||||||
// float rr = (r * 30 + g * 59 + b * 11) / 100;
|
// float rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
// float gg = (r * 30 + g * 70) / 100;
|
// float gg = (r * 30 + g * 70) / 100;
|
||||||
// float bb = (r * 30 + b * 70) / 100;
|
// float bb = (r * 30 + b * 70) / 100;
|
||||||
// r = rr;
|
// r = rr;
|
||||||
// g = gg;
|
// g = gg;
|
||||||
// b = bb;
|
// b = bb;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pixels[i * 4 + 0] = r;
|
pixels[i * 4 + 0] = r;
|
||||||
pixels[i * 4 + 1] = g;
|
pixels[i * 4 + 1] = g;
|
||||||
pixels[i * 4 + 2] = b;
|
pixels[i * 4 + 2] = b;
|
||||||
pixels[i * 4 + 3] = a;
|
pixels[i * 4 + 3] = a;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,44 @@ public:
|
|||||||
void tick();
|
void tick();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LavaTexture: public DynamicTexture
|
||||||
|
{
|
||||||
|
typedef DynamicTexture super;
|
||||||
|
int _tick;
|
||||||
|
int _frame;
|
||||||
|
|
||||||
|
float* current;
|
||||||
|
float* next;
|
||||||
|
float* heat;
|
||||||
|
float* heata;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LavaTexture();
|
||||||
|
~LavaTexture();
|
||||||
|
|
||||||
|
void tick();
|
||||||
|
};
|
||||||
|
|
||||||
|
class LavaSideTexture: public DynamicTexture
|
||||||
|
{
|
||||||
|
typedef DynamicTexture super;
|
||||||
|
int _tick;
|
||||||
|
int _frame;
|
||||||
|
int _tickCount;
|
||||||
|
|
||||||
|
float* current;
|
||||||
|
float* next;
|
||||||
|
float* heat;
|
||||||
|
float* heata;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LavaSideTexture();
|
||||||
|
~LavaSideTexture();
|
||||||
|
|
||||||
|
void tick();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class FireTexture: public DynamicTexture
|
class FireTexture: public DynamicTexture
|
||||||
{
|
{
|
||||||
typedef DynamicTexture super;
|
typedef DynamicTexture super;
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ void Chicken::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ )
|
|||||||
spawnAtLocation(Item::feather->id, 1);
|
spawnAtLocation(Item::feather->id, 1);
|
||||||
}
|
}
|
||||||
//// and some meat
|
//// and some meat
|
||||||
//if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire
|
if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire
|
||||||
//else
|
else
|
||||||
spawnAtLocation(Item::chicken_raw->id, 1);
|
spawnAtLocation(Item::chicken_raw->id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ void Cow::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ ) {
|
|||||||
// and some meat
|
// and some meat
|
||||||
count = random.nextInt(3) + 1;
|
count = random.nextInt(3) + 1;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
// if (isOnFire()) { //@fire
|
if (isOnFire()) { //@fire
|
||||||
// spawnAtLocation(Item::beef_cooked->id, 1);
|
spawnAtLocation(Item::beef_cooked->id, 1);
|
||||||
// } else {
|
} else {
|
||||||
spawnAtLocation(Item::beef_raw->id, 1);
|
spawnAtLocation(Item::beef_raw->id, 1);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ std::string Pig::getDeathSound()
|
|||||||
int Pig::getDeathLoot()
|
int Pig::getDeathLoot()
|
||||||
{
|
{
|
||||||
//@fire
|
//@fire
|
||||||
//if (isOnFire())
|
if (isOnFire())
|
||||||
// return Item::porkChop_cooked->id;
|
return Item::porkChop_cooked->id;
|
||||||
return Item::porkChop_raw->id;
|
return Item::porkChop_raw->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void CanyonFeature::addTunnel( int xOffs, int zOffs, unsigned char* blocks, floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks)
|
void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs, unsigned char* blocks, int blocksSize)
|
||||||
{
|
{
|
||||||
if (random.nextInt(15) != 0) return;
|
if (random.nextInt(15) != 0) return;
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ class CanyonFeature: public LargeFeature {
|
|||||||
|
|
||||||
/*protected*/
|
/*protected*/
|
||||||
void addTunnel(int xOffs, int zOffs, unsigned char* blocks, float xCave, float yCave, float zCave, float thickness, float yRot, float xRot, int step, int dist, float yScale);
|
void addTunnel(int xOffs, int zOffs, unsigned char* blocks, float xCave, float yCave, float zCave, float thickness, float yRot, float xRot, int step, int dist, float yScale);
|
||||||
|
|
||||||
/*protected*/
|
/*protected*/
|
||||||
void addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks);
|
void addFeature(Level* level, int x, int z, int xOffs, int zOffs, unsigned char* blocks, int blocksSize);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@ class LevelChunk;
|
|||||||
|
|
||||||
#include "../chunk/ChunkSource.h"
|
#include "../chunk/ChunkSource.h"
|
||||||
#include "LargeCaveFeature.h"
|
#include "LargeCaveFeature.h"
|
||||||
|
#include "CanyonFeature.h"
|
||||||
#include "synth/PerlinNoise.h"
|
#include "synth/PerlinNoise.h"
|
||||||
#include "../../../SharedConstants.h"
|
#include "../../../SharedConstants.h"
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
//Biome** biomes;
|
//Biome** biomes;
|
||||||
LargeCaveFeature caveFeature;
|
LargeCaveFeature caveFeature;
|
||||||
|
CanyonFeature canyonFeature;
|
||||||
int waterDepths[16+16][16+16];
|
int waterDepths[16+16][16+16];
|
||||||
private:
|
private:
|
||||||
ChunkMap chunkMap;
|
ChunkMap chunkMap;
|
||||||
@@ -92,6 +94,7 @@ private:
|
|||||||
float* fi;
|
float* fi;
|
||||||
float* fis;
|
float* fis;
|
||||||
///*private*/ float[] temperatures;
|
///*private*/ float[] temperatures;
|
||||||
|
float* temperatures; // normally unused like above, but restored this maybe might come handy - shredder
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerformanceTestChunkSource : public ChunkSource
|
class PerformanceTestChunkSource : public ChunkSource
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ private:
|
|||||||
int origin[3];
|
int origin[3];
|
||||||
int height;
|
int height;
|
||||||
int trunkHeight;
|
int trunkHeight;
|
||||||
double trunkHeightScale;
|
float trunkHeightScale;
|
||||||
double branchDensity;
|
float branchDensity;
|
||||||
double branchSlope;
|
float branchSlope;
|
||||||
double widthScale;
|
float widthScale;
|
||||||
double foliageDensity;
|
float foliageDensity;
|
||||||
int trunkWidth;
|
int trunkWidth;
|
||||||
int heightVariance;
|
int heightVariance;
|
||||||
int foliageHeight;
|
int foliageHeight;
|
||||||
@@ -38,7 +38,7 @@ private:
|
|||||||
void prepare(){
|
void prepare(){
|
||||||
trunkHeight = (int) (height * trunkHeightScale);
|
trunkHeight = (int) (height * trunkHeightScale);
|
||||||
if (trunkHeight >= height) trunkHeight = height - 1;
|
if (trunkHeight >= height) trunkHeight = height - 1;
|
||||||
int clustersPerY = (int) (1.382 + pow(foliageDensity * height / 13.0, 2));
|
int clustersPerY = (int) (1.382f + pow(foliageDensity * height / 13.0, 2));
|
||||||
if (clustersPerY < 1) clustersPerY = 1;
|
if (clustersPerY < 1) clustersPerY = 1;
|
||||||
int **tempFoliageCoords = new int *[clustersPerY * height];
|
int **tempFoliageCoords = new int *[clustersPerY * height];
|
||||||
for( int i = 0; i < clustersPerY * height; i++ )
|
for( int i = 0; i < clustersPerY * height; i++ )
|
||||||
@@ -68,19 +68,19 @@ private:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
double originOffset = 0.5;
|
float originOffset = 0.5f;
|
||||||
while (num < clustersPerY)
|
while (num < clustersPerY)
|
||||||
{
|
{
|
||||||
double radius = widthScale * (shapefac * (rnd->nextFloat() + 0.328));
|
float radius = widthScale * (shapefac * (rnd->nextFloat() + 0.328f));
|
||||||
double angle = rnd->nextFloat() * 2.0 * 3.14159;
|
float angle = rnd->nextFloat() * 2.0f * 3.14159f;
|
||||||
int x = Mth::floor(radius * sin(angle) + origin[0] + originOffset);
|
int x = Mth::floor(radius * sin(angle) + origin[0] + originOffset);
|
||||||
int z = Mth::floor(radius * cos(angle) + origin[2] + originOffset);
|
int z = Mth::floor(radius * cos(angle) + origin[2] + originOffset);
|
||||||
int checkStart[] = { x, y, z };
|
int checkStart[] = { x, y, z };
|
||||||
int checkEnd[] = { x, y + foliageHeight, z };
|
int checkEnd[] = { x, y + foliageHeight, z };
|
||||||
if (checkLine(checkStart, checkEnd) == -1) {
|
if (checkLine(checkStart, checkEnd) == -1) {
|
||||||
int checkBranchBase[] = { origin[0], origin[1], origin[2] };
|
int checkBranchBase[] = { origin[0], origin[1], origin[2] };
|
||||||
double distance = sqrt(pow(abs(origin[0] - checkStart[0]), 2.0) + pow(abs(origin[2] - checkStart[2]), 2.0));
|
float distance = sqrt(pow(abs(origin[0] - checkStart[0]), 2.0f) + pow(abs(origin[2] - checkStart[2]), 2.0f));
|
||||||
double branchHeight = distance * branchSlope;
|
float branchHeight = distance * branchSlope;
|
||||||
if ((checkStart[1] - branchHeight) > trunkTop)
|
if ((checkStart[1] - branchHeight) > trunkTop)
|
||||||
{
|
{
|
||||||
checkBranchBase[1] = trunkTop;
|
checkBranchBase[1] = trunkTop;
|
||||||
@@ -134,7 +134,9 @@ private:
|
|||||||
offset2 = -rad;
|
offset2 = -rad;
|
||||||
while (offset2 <= rad)
|
while (offset2 <= rad)
|
||||||
{
|
{
|
||||||
double thisdistance = pow(abs(offset1) + 0.5, 2) + pow(abs(offset2) + 0.5, 2);
|
float off1 = (float)offset1 + 0.5f;
|
||||||
|
float off2 = (float)offset2 + 0.5f;
|
||||||
|
float thisdistance = (off1 * off1) + (off2 * off2);
|
||||||
if (thisdistance > radius * radius)
|
if (thisdistance > radius * radius)
|
||||||
{
|
{
|
||||||
offset2++;
|
offset2++;
|
||||||
@@ -159,14 +161,14 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
float treeShape(int y){
|
float treeShape(int y){
|
||||||
if (y < (((float) height) * 0.3)) return (float) -1.618;
|
if (y < (((float) height) * 0.3f)) return (float) -1.618f;
|
||||||
float radius = ((float) height) / ((float) 2.0);
|
float radius = ((float) height) / ((float) 2.0f);
|
||||||
float adjacent = (((float) height) / ((float) 2.0)) - y;
|
float adjacent = (((float) height) / ((float) 2.0f)) - y;
|
||||||
float distance;
|
float distance;
|
||||||
if (adjacent == 0) distance = radius;
|
if (adjacent == 0) distance = radius;
|
||||||
else if (abs(adjacent) >= radius) distance = (float) 0.0;
|
else if (abs(adjacent) >= radius) distance = (float) 0.0f;
|
||||||
else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2));
|
else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2));
|
||||||
distance *= (float) 0.5;
|
distance *= (float) 0.5f;
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
float foliageShape(int y){
|
float foliageShape(int y){
|
||||||
@@ -207,8 +209,8 @@ private:
|
|||||||
char primsign;
|
char primsign;
|
||||||
if (delta[primidx] > 0) primsign = 1;
|
if (delta[primidx] > 0) primsign = 1;
|
||||||
else primsign = -1;
|
else primsign = -1;
|
||||||
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]);
|
||||||
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]);
|
||||||
int coordinate[] = { 0, 0, 0 };
|
int coordinate[] = { 0, 0, 0 };
|
||||||
int primoffset = 0;
|
int primoffset = 0;
|
||||||
int endoffset = delta[primidx] + primsign;
|
int endoffset = delta[primidx] + primsign;
|
||||||
@@ -312,8 +314,8 @@ private:
|
|||||||
char primsign;
|
char primsign;
|
||||||
if (delta[primidx] > 0) primsign = 1;
|
if (delta[primidx] > 0) primsign = 1;
|
||||||
else primsign = -1;
|
else primsign = -1;
|
||||||
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]);
|
||||||
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]);
|
||||||
int coordinate[] = { 0, 0, 0 };
|
int coordinate[] = { 0, 0, 0 };
|
||||||
int primoffset = 0;
|
int primoffset = 0;
|
||||||
int endoffset = delta[primidx] + primsign;
|
int endoffset = delta[primidx] + primsign;
|
||||||
@@ -373,11 +375,11 @@ private:
|
|||||||
public:
|
public:
|
||||||
BasicTree(bool doUpdate){
|
BasicTree(bool doUpdate){
|
||||||
axisConversionArray[0] = 2;
|
axisConversionArray[0] = 2;
|
||||||
axisConversionArray[1] = 0;
|
axisConversionArray[1] = 0;
|
||||||
axisConversionArray[2] = 0;
|
axisConversionArray[2] = 0;
|
||||||
axisConversionArray[3] = 1;
|
axisConversionArray[3] = 1;
|
||||||
axisConversionArray[4] = 2;
|
axisConversionArray[4] = 2;
|
||||||
axisConversionArray[5] = 1;
|
axisConversionArray[5] = 1;
|
||||||
rnd = new Random();
|
rnd = new Random();
|
||||||
origin[0] = 0;
|
origin[0] = 0;
|
||||||
origin[1] = 0;
|
origin[1] = 0;
|
||||||
@@ -405,7 +407,7 @@ public:
|
|||||||
delete [] foliageCoords;
|
delete [] foliageCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void init(double heightInit, double widthInit, double foliageDensityInit){
|
virtual void init(float heightInit, float widthInit, float foliageDensityInit){
|
||||||
|
|
||||||
heightVariance = (int) (heightInit * 12);
|
heightVariance = (int) (heightInit * 12);
|
||||||
if (heightInit > 0.5) foliageHeight = 5;
|
if (heightInit > 0.5) foliageHeight = 5;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "../levelgen/feature/SpruceFeature.h"
|
#include "../levelgen/feature/SpruceFeature.h"
|
||||||
#include "../levelgen/feature/BirchFeature.h"
|
#include "../levelgen/feature/BirchFeature.h"
|
||||||
#include "../levelgen/feature/TreeFeature.h"
|
#include "../levelgen/feature/TreeFeature.h"
|
||||||
|
#include "../levelgen/feature/BasicTree.h"
|
||||||
|
|
||||||
class Sapling: public Bush
|
class Sapling: public Bush
|
||||||
{
|
{
|
||||||
@@ -90,9 +91,9 @@ public:
|
|||||||
// f = new TreeFeature(true, 4 + random.nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false);
|
// f = new TreeFeature(true, 4 + random.nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false);
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
//if (random->nextInt(10) == 0) {
|
if (random->nextInt(10) == 0) {
|
||||||
// f = new BasicTree(true);
|
f = new BasicTree(true);
|
||||||
//} else
|
} else
|
||||||
f = new TreeFeature(true);
|
f = new TreeFeature(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user