mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-06-05 02:43:00 +00:00
TU19: merge Minecraft.Client/Textures
This commit is contained in:
parent
8f90088611
commit
362a43ddee
|
|
@ -90,7 +90,7 @@ BufferedImage::BufferedImage(const std::wstring& File,
|
|||
|
||||
/*char *pchUsrDir=getUsrDirPath();
|
||||
|
||||
std::wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
||||
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
||||
|
||||
if(bTitleUpdateTexture)
|
||||
{
|
||||
|
|
@ -139,7 +139,7 @@ BufferedImage::BufferedImage(const std::wstring& File,
|
|||
|
||||
const char* pchTextureName = wstringtofilename(name);
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
app.DebugPrintf("\n--- Loading TEXTURE - %s\n\n", pchTextureName);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
#include "Texture.h"
|
||||
#include "ClockTexture.h"
|
||||
|
||||
ClockTexture::ClockTexture() : StitchedTexture(L"compass") {
|
||||
ClockTexture::ClockTexture() : StitchedTexture(L"clock", L"clock") {
|
||||
rot = rota = 0.0;
|
||||
m_dataTexture = NULL;
|
||||
m_iPad = XUSER_INDEX_ANY;
|
||||
}
|
||||
|
||||
ClockTexture::ClockTexture(int iPad, ClockTexture* dataTexture)
|
||||
: StitchedTexture(L"compass") {
|
||||
: StitchedTexture(L"clock", L"clock") {
|
||||
rot = rota = 0.0;
|
||||
m_dataTexture = dataTexture;
|
||||
m_iPad = iPad;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
CompassTexture* CompassTexture::instance = NULL;
|
||||
|
||||
CompassTexture::CompassTexture() : StitchedTexture(L"compass") {
|
||||
CompassTexture::CompassTexture() : StitchedTexture(L"compass", L"compass") {
|
||||
instance = this;
|
||||
|
||||
m_dataTexture = NULL;
|
||||
|
|
@ -19,7 +19,7 @@ CompassTexture::CompassTexture() : StitchedTexture(L"compass") {
|
|||
}
|
||||
|
||||
CompassTexture::CompassTexture(int iPad, CompassTexture* dataTexture)
|
||||
: StitchedTexture(L"compass") {
|
||||
: StitchedTexture(L"compass", L"compass") {
|
||||
m_dataTexture = dataTexture;
|
||||
m_iPad = iPad;
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,8 @@ bool DLCTexturePack::hasFile(const std::wstring& name) {
|
|||
|
||||
bool DLCTexturePack::isTerrainUpdateCompatible() { return true; }
|
||||
|
||||
std::wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) {
|
||||
std::wstring DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/,
|
||||
const char* pchBDPatchFilename) {
|
||||
return L"";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,16 @@ public:
|
|||
|
||||
virtual std::wstring getResource(const std::wstring& name);
|
||||
virtual DLCPack* getDLCPack();
|
||||
virtual std::wstring getDesc1() {
|
||||
return m_stringTable->getString(L"IDS_TP_DESCRIPTION");
|
||||
}
|
||||
virtual std::wstring getName() {
|
||||
return m_stringTable->getString(L"IDS_DISPLAY_NAME");
|
||||
}
|
||||
virtual std::wstring getWorldName() {
|
||||
return m_stringTable->getString(L"IDS_WORLD_NAME");
|
||||
}
|
||||
|
||||
// Added for sound banks with MashUp packs
|
||||
#ifdef _XBOX
|
||||
IXACT3WaveBank* m_pStreamedWaveBank;
|
||||
|
|
@ -44,7 +54,8 @@ public:
|
|||
bool isTerrainUpdateCompatible();
|
||||
|
||||
// 4J Added
|
||||
virtual std::wstring getPath(bool bTitleUpdateTexture = false);
|
||||
virtual std::wstring getPath(bool bTitleUpdateTexture = false,
|
||||
const char* pchBDPatchFilename = NULL);
|
||||
virtual std::wstring getAnimationString(const std::wstring& textureName,
|
||||
const std::wstring& path);
|
||||
virtual BufferedImage* getImageResource(const std::wstring& File,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ bool FolderTexturePack::isTerrainUpdateCompatible() {
|
|||
return true;
|
||||
}
|
||||
|
||||
std::wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/) {
|
||||
std::wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/,
|
||||
const char* pchBDPatchFilename) {
|
||||
std::wstring wDrive;
|
||||
#ifdef _XBOX
|
||||
wDrive = L"GAME:\\" + file->getPath() + L"\\";
|
||||
|
|
@ -106,4 +107,4 @@ void FolderTexturePack::unloadUI() {
|
|||
}
|
||||
AbstractTexturePack::unloadUI();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,8 @@ public:
|
|||
bool isTerrainUpdateCompatible();
|
||||
|
||||
// 4J Added
|
||||
virtual std::wstring getPath(bool bTitleUpdateTexture = false);
|
||||
virtual std::wstring getPath(bool bTitleUpdateTexture = false,
|
||||
const char* pchBDPatchFilename = NULL);
|
||||
virtual void loadUI();
|
||||
virtual void unloadUI();
|
||||
};
|
||||
};
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
#include "../../Platform/stdafx.h"
|
||||
#include "TexturePack.h"
|
||||
|
||||
std::wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) {
|
||||
std::wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/,
|
||||
const char* pchBDPatchFileName /*= NULL*/) {
|
||||
std::wstring wDrive;
|
||||
#ifdef _XBOX
|
||||
if (bTitleUpdateTexture) {
|
||||
|
|
@ -21,16 +22,28 @@ std::wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/) {
|
|||
|
||||
// 4J-PB - we need to check for a BD patch - this is going to be an issue
|
||||
// for full DLC texture packs (Halloween)
|
||||
char* pchUsrDir = NULL;
|
||||
if (app.GetBootedFromDiscPatch() && pchBDPatchFileName != NULL) {
|
||||
pchUsrDir = app.GetBDUsrDirPath(pchBDPatchFileName);
|
||||
std::wstring wstr(pchUsrDir, pchUsrDir + strlen(pchUsrDir));
|
||||
|
||||
char* pchUsrDir = getUsrDirPath();
|
||||
if (bTitleUpdateTexture) {
|
||||
wDrive = wstr + L"\\Common\\res\\TitleUpdate\\";
|
||||
|
||||
std::wstring wstr(pchUsrDir, pchUsrDir + strlen(pchUsrDir));
|
||||
|
||||
if (bTitleUpdateTexture) {
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
wDrive = wstr + L"\\Common\\res\\TitleUpdate\\";
|
||||
} else {
|
||||
wDrive = wstr + L"/Common/";
|
||||
}
|
||||
} else {
|
||||
wDrive = wstr + L"/Common/";
|
||||
pchUsrDir = getUsrDirPath();
|
||||
|
||||
std::wstring wstr(pchUsrDir, pchUsrDir + strlen(pchUsrDir));
|
||||
|
||||
if (bTitleUpdateTexture) {
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
wDrive = wstr + L"\\Common\\res\\TitleUpdate\\";
|
||||
} else {
|
||||
wDrive = wstr + L"/Common/";
|
||||
}
|
||||
}
|
||||
|
||||
#elif __PSVITA__
|
||||
|
|
|
|||
47
Minecraft.Client/Textures/ResourceLocation.h
Normal file
47
Minecraft.Client/Textures/ResourceLocation.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#pragma once
|
||||
#include "Textures.h"
|
||||
|
||||
typedef arrayWithLength<_TEXTURE_NAME> textureNameArray;
|
||||
class ResourceLocation {
|
||||
private:
|
||||
textureNameArray m_texture;
|
||||
std::wstring m_path;
|
||||
bool m_preloaded;
|
||||
|
||||
public:
|
||||
ResourceLocation() {
|
||||
m_preloaded = false;
|
||||
m_path = L"";
|
||||
}
|
||||
|
||||
ResourceLocation(_TEXTURE_NAME texture) {
|
||||
m_texture = textureNameArray(1);
|
||||
m_texture[0] = texture;
|
||||
m_preloaded = true;
|
||||
}
|
||||
|
||||
ResourceLocation(std::wstring path) {
|
||||
m_path = path;
|
||||
m_preloaded = false;
|
||||
}
|
||||
|
||||
ResourceLocation(intArray textures) {
|
||||
m_texture = textureNameArray(textures.length);
|
||||
for (unsigned int i = 0; i < textures.length; ++i) {
|
||||
m_texture[i] = (_TEXTURE_NAME)textures[i];
|
||||
}
|
||||
m_preloaded = true;
|
||||
}
|
||||
|
||||
~ResourceLocation() { delete m_texture.data; }
|
||||
|
||||
_TEXTURE_NAME getTexture() { return m_texture[0]; }
|
||||
|
||||
_TEXTURE_NAME getTexture(int idx) { return m_texture[idx]; }
|
||||
|
||||
int getTextureCount() { return m_texture.length; }
|
||||
|
||||
std::wstring getPath() { return m_path; }
|
||||
|
||||
bool isPreloaded() { return m_preloaded; }
|
||||
};
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -30,8 +30,6 @@ private:
|
|||
std::vector<StitchedTexture*>
|
||||
animatedTextures; // = new ArrayList<StitchedTexture>();
|
||||
|
||||
std::vector<std::pair<std::wstring, std::wstring> > texturesToAnimate;
|
||||
|
||||
void loadUVs();
|
||||
|
||||
public:
|
||||
|
|
@ -40,6 +38,11 @@ public:
|
|||
BufferedImage* missingTexture, bool mipMap = false);
|
||||
|
||||
void stitch();
|
||||
|
||||
private:
|
||||
void makeTextureAnimated(TexturePack* texturePack, StitchedTexture* tex);
|
||||
|
||||
public:
|
||||
StitchedTexture* getTexture(const std::wstring& name);
|
||||
void cycleAnimationFrames();
|
||||
Texture* getStitchedTexture();
|
||||
|
|
|
|||
|
|
@ -13,11 +13,13 @@ StitchedTexture* StitchedTexture::create(const std::wstring& name) {
|
|||
} else if (name.compare(L"compass") == 0) {
|
||||
return new CompassTexture();
|
||||
} else {
|
||||
return new StitchedTexture(name);
|
||||
return new StitchedTexture(name, name);
|
||||
}
|
||||
}
|
||||
|
||||
StitchedTexture::StitchedTexture(const std::wstring& name) : name(name) {
|
||||
StitchedTexture::StitchedTexture(const std::wstring& name,
|
||||
const std::wstring& filename)
|
||||
: name(name) {
|
||||
// 4J Initialisers
|
||||
source = NULL;
|
||||
rotated = false;
|
||||
|
|
@ -36,6 +38,7 @@ StitchedTexture::StitchedTexture(const std::wstring& name) : name(name) {
|
|||
frameOverride = NULL;
|
||||
flags = 0;
|
||||
frames = NULL;
|
||||
m_fileName = filename;
|
||||
}
|
||||
|
||||
void StitchedTexture::freeFrameTextures() {
|
||||
|
|
@ -49,16 +52,10 @@ void StitchedTexture::freeFrameTextures() {
|
|||
}
|
||||
|
||||
StitchedTexture::~StitchedTexture() {
|
||||
// 4jcraft, added null check
|
||||
// the constructor does not allocate the frames vector.
|
||||
// in some scenarios the destructor/delete is called
|
||||
// without ever calling ::init()
|
||||
if (frames) {
|
||||
for (AUTO_VAR(it, frames->begin()); it != frames->end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
delete frames;
|
||||
for (AUTO_VAR(it, frames->begin()); it != frames->end(); ++it) {
|
||||
delete *it;
|
||||
}
|
||||
delete frames;
|
||||
}
|
||||
|
||||
void StitchedTexture::initUVs(float U0, float V0, float U1, float V1) {
|
||||
|
|
@ -181,7 +178,7 @@ void StitchedTexture::cycleFrames() {
|
|||
|
||||
Texture* StitchedTexture::getSource() { return source; }
|
||||
|
||||
Texture* StitchedTexture::getFrame(int i) { return frames->at(i); }
|
||||
Texture* StitchedTexture::getFrame(int i) { return frames->at(0); }
|
||||
|
||||
int StitchedTexture::getFrames() { return frames ? frames->size() : 0; }
|
||||
|
||||
|
|
@ -229,7 +226,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader* bufferedReader) {
|
|||
}
|
||||
//} catch (Exception e) {
|
||||
// System.err.println("Failed to read animation info for " + name + ": " +
|
||||
//e.getMessage());
|
||||
// e.getMessage());
|
||||
//}
|
||||
|
||||
if (!results->empty() &&
|
||||
|
|
@ -277,4 +274,4 @@ void StitchedTexture::setFlags(int flags) { this->flags = flags; }
|
|||
|
||||
int StitchedTexture::getFlags() const { return this->flags; }
|
||||
|
||||
bool StitchedTexture::hasOwnData() { return true; }
|
||||
bool StitchedTexture::hasOwnData() { return true; }
|
||||
|
|
@ -7,6 +7,9 @@ class StitchedTexture : public Icon {
|
|||
private:
|
||||
const std::wstring name;
|
||||
|
||||
public:
|
||||
std::wstring m_fileName;
|
||||
|
||||
protected:
|
||||
Texture* source;
|
||||
std::vector<Texture*>* frames;
|
||||
|
|
@ -44,7 +47,7 @@ public:
|
|||
~StitchedTexture();
|
||||
|
||||
protected:
|
||||
StitchedTexture(const std::wstring& name);
|
||||
StitchedTexture(const std::wstring& name, const std::wstring& filename);
|
||||
|
||||
public:
|
||||
void initUVs(float U0, float V0, float U1, float V1);
|
||||
|
|
@ -86,4 +89,4 @@ public:
|
|||
void setFlags(int flags); // 4J added
|
||||
virtual void freeFrameTextures(); // 4J added
|
||||
virtual bool hasOwnData(); // 4J Added
|
||||
};
|
||||
};
|
||||
|
|
@ -5,13 +5,14 @@
|
|||
#include "Texture.h"
|
||||
|
||||
#ifdef __PS3__
|
||||
#include "../Platform/PS3/SPU_Tasks/Texture_blit/Texture_blit.h"
|
||||
#include "../Platform/PS3/PS3Extras/C4JSpursJob.h"
|
||||
#include "PS3/SPU_Tasks/Texture_blit/Texture_blit.h"
|
||||
#include "C4JSpursJob.h"
|
||||
static const int sc_maxTextureBlits = 256;
|
||||
static Texture_blit_DataIn g_textureBlitDataIn[sc_maxTextureBlits]
|
||||
__attribute__((__aligned__(16)));
|
||||
static int g_currentTexBlit = 0;
|
||||
C4JSpursJobQueue::Port* g_texBlitJobQueuePort;
|
||||
// #define DISABLE_SPU_CODE
|
||||
#endif //__PS3__
|
||||
|
||||
#define MAX_MIP_LEVELS 5
|
||||
|
|
@ -129,7 +130,7 @@ void Texture::_init(const std::wstring& name, int mode, int width, int height,
|
|||
if (mipmapped) {
|
||||
for (unsigned int level = 1; level < m_iMipLevels; ++level) {
|
||||
int ww = width >> level;
|
||||
int hh = height >> level;
|
||||
int hh = height >> height;
|
||||
|
||||
byteArray tempBytes = byteArray(ww * hh * depth * 4);
|
||||
for (int index = 0; index < tempBytes.length; index++) {
|
||||
|
|
@ -292,7 +293,7 @@ void Texture::writeAsBMP(const std::wstring& name) {
|
|||
outStream->writeInt(0); // 0x0032: Number of important colors, 0 for all
|
||||
|
||||
// Pixels follow in inverted Y order
|
||||
byte[] bytes = new uint8_t[width * height * 4];
|
||||
uint8_t[] bytes = new uint8_t[width * height * 4];
|
||||
data.position(0);
|
||||
data.get(bytes);
|
||||
for (int y = height - 1; y >= 0; y--)
|
||||
|
|
@ -320,7 +321,7 @@ void Texture::writeAsPNG(const std::wstring& filename) {
|
|||
#if 0
|
||||
BufferedImage *image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
ByteBuffer *buffer = this->getData();
|
||||
byte[] bytes = new uint8_t[width * height * 4];
|
||||
uint8_t[] bytes = new uint8_t[width * height * 4];
|
||||
|
||||
buffer.position(0);
|
||||
buffer.get(bytes);
|
||||
|
|
@ -518,8 +519,9 @@ void Texture::transferFromImage(BufferedImage* image) {
|
|||
int imgHeight = image->getHeight();
|
||||
if (imgWidth > width || imgHeight > height) {
|
||||
// Minecraft::GetInstance().getLogger().warning("transferFromImage
|
||||
// called with a BufferedImage with dimensions (" + imgWidth + ", " +
|
||||
//imgHeight + ") larger than the Texture dimensions (" + width +
|
||||
// called with a BufferedImage with dimensions (" + imgWidth + ", "
|
||||
// +
|
||||
// imgHeight + ") larger than the Texture dimensions (" + width +
|
||||
// ", " + height + "). Ignoring.");
|
||||
app.DebugPrintf(
|
||||
"transferFromImage called with a BufferedImage with dimensions "
|
||||
|
|
@ -765,7 +767,7 @@ void Texture::updateOnGPU() {
|
|||
// if (height != 1 && depth != 1)
|
||||
//{
|
||||
// glTexImage3D(type, 0, format, width, height, depth, 0, format,
|
||||
//GL_UNSIGNED_BYTE, data);
|
||||
// GL_UNSIGNED_BYTE, data);
|
||||
//}
|
||||
// else if(height != 1)
|
||||
//{
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ public:
|
|||
|
||||
static const int TFLT_NEAREST = GL_NEAREST;
|
||||
static const int TFLT_LINEAR = GL_LINEAR;
|
||||
static const int TFLT_LINEAR_MIP_NEAREST = 0; // GL_LINEAR_MIPMAP_NEAREST;
|
||||
static const int TFLT_LINEAR_MIP_LINEAR = 0; // GL_LINEAR_MIPMAP_LINEAR;
|
||||
static const int TFLT_NEAREST_MIP_NEAREST = 0; // GL_NEAREST_MIPMAP_NEAREST;
|
||||
static const int TFLT_LINEAR_MIP_NEAREST = 0; // GL_LINEAR_MIPMAP_NEAREST;
|
||||
static const int TFLT_LINEAR_MIP_LINEAR = 0; // GL_LINEAR_MIPMAP_LINEAR;
|
||||
static const int TFLT_NEAREST_MIP_NEAREST =
|
||||
0; // GL_NEAREST_MIPMAP_NEAREST;
|
||||
static const int TFLT_NEAREST_MIP_LINEAR = GL_NEAREST_MIPMAP_LINEAR;
|
||||
|
||||
static const int TM_STATIC = 0;
|
||||
|
|
|
|||
6
Minecraft.Client/Textures/TextureAtlas.cpp
Normal file
6
Minecraft.Client/Textures/TextureAtlas.cpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include "TextureAtlas.h"
|
||||
#include "ResourceLocation.h"
|
||||
|
||||
ResourceLocation TextureAtlas::LOCATION_BLOCKS = ResourceLocation(TN_TERRAIN);
|
||||
ResourceLocation TextureAtlas::LOCATION_ITEMS = ResourceLocation(TN_GUI_ITEMS);
|
||||
9
Minecraft.Client/Textures/TextureAtlas.h
Normal file
9
Minecraft.Client/Textures/TextureAtlas.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
class ResourceLocation;
|
||||
|
||||
class TextureAtlas {
|
||||
public:
|
||||
static ResourceLocation LOCATION_BLOCKS;
|
||||
static ResourceLocation LOCATION_ITEMS;
|
||||
};
|
||||
|
|
@ -155,11 +155,11 @@ std::vector<Texture*>* TextureManager::createTextures(
|
|||
// return result;
|
||||
// } catch (FileNotFoundException e) {
|
||||
// Minecraft.getInstance().getLogger().warning("TextureManager.createTexture
|
||||
//called for file " + filename + ", but that file does not exist.
|
||||
//Ignoring."); } catch (IOException e) {
|
||||
// called for file " + filename + ", but that file does not exist.
|
||||
// Ignoring."); } catch (IOException e) {
|
||||
// Minecraft.getInstance().getLogger().warning("TextureManager.createTexture
|
||||
//encountered an IOException when " + "trying to read file " + filename + ".
|
||||
//Ignoring.");
|
||||
// encountered an IOException when " + "trying to read file " + filename +
|
||||
// ". Ignoring.");
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
|
@ -199,4 +199,4 @@ Texture* TextureManager::createTexture(const std::wstring& name, int mode,
|
|||
return createTexture(name, mode, width, height, Texture::WM_WRAP, format,
|
||||
Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
#include "../../Minecraft.World/IO/Streams/ByteBuffer.h"
|
||||
#include "Packs/TexturePack.h"
|
||||
#include "../GameState/Options.h"
|
||||
#include "MemTextureProcessor.h"
|
||||
#include "../Minecraft.Client/MemTextureProcessor.h"
|
||||
#include "MobSkinMemTextureProcessor.h"
|
||||
#include "Stitching/PreStitchedTextureMap.h"
|
||||
#include "Stitching/StitchedTexture.h"
|
||||
|
|
@ -16,6 +16,9 @@
|
|||
#include "../../Minecraft.World/Headers/net.minecraft.world.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.h"
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
#include "ResourceLocation.h"
|
||||
#include "../../Minecraft.World/Entities/ItemEntity.h"
|
||||
#include "TextureAtlas.h"
|
||||
|
||||
// Linux/PC port: disable mipmapping globally so textures are always sampled
|
||||
// from the full-resolution level 0 with GL_NEAREST, giving pixel-crisp
|
||||
|
|
@ -136,6 +139,44 @@ const wchar_t* Textures::preLoaded[TN_COUNT] = {
|
|||
L"mob/wolf_collar",
|
||||
L"mob/zombie_villager",
|
||||
|
||||
// 1.6.4
|
||||
L"item/lead_knot",
|
||||
|
||||
L"misc/beacon_beam",
|
||||
|
||||
L"mob/bat",
|
||||
|
||||
L"mob/horse/donkey",
|
||||
L"mob/horse/horse_black",
|
||||
L"mob/horse/horse_brown",
|
||||
L"mob/horse/horse_chestnut",
|
||||
L"mob/horse/horse_creamy",
|
||||
L"mob/horse/horse_darkbrown",
|
||||
L"mob/horse/horse_gray",
|
||||
L"mob/horse/horse_markings_blackdots",
|
||||
L"mob/horse/horse_markings_white",
|
||||
L"mob/horse/horse_markings_whitedots",
|
||||
L"mob/horse/horse_markings_whitefield",
|
||||
L"mob/horse/horse_skeleton",
|
||||
L"mob/horse/horse_white",
|
||||
L"mob/horse/horse_zombie",
|
||||
L"mob/horse/mule",
|
||||
|
||||
L"mob/horse/armor/horse_armor_diamond",
|
||||
L"mob/horse/armor/horse_armor_gold",
|
||||
L"mob/horse/armor/horse_armor_iron",
|
||||
|
||||
L"mob/witch",
|
||||
|
||||
L"mob/wither/wither",
|
||||
L"mob/wither/wither_armor",
|
||||
L"mob/wither/wither_invulnerable",
|
||||
|
||||
L"item/trapped",
|
||||
L"item/trapped_double",
|
||||
// L"item/christmas",
|
||||
// L"item/christmas_double",
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
L"misc/additionalmapicons",
|
||||
#endif
|
||||
|
|
@ -285,7 +326,7 @@ intArray Textures::loadTexturePixels(TEXTURE_NAME texId,
|
|||
// 4J - removed try/catch
|
||||
// try {
|
||||
intArray res;
|
||||
// std::wstring in = skin->getResource(resourceName);
|
||||
// wstring in = skin->getResource(resourceName);
|
||||
if (false) // 4J - removed - was ( in == NULL)
|
||||
{
|
||||
res = loadTexturePixels(missingNo);
|
||||
|
|
@ -366,7 +407,23 @@ void Textures::bindTexture(const std::wstring& resourceName) {
|
|||
}
|
||||
|
||||
// 4J Added
|
||||
void Textures::bindTexture(int resourceId) { bind(loadTexture(resourceId)); }
|
||||
void Textures::bindTexture(ResourceLocation* resource) {
|
||||
if (resource->isPreloaded()) {
|
||||
std::bind(loadTexture(resource->getTexture()));
|
||||
} else {
|
||||
std::bind(loadTexture(TN_COUNT, resource->getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
void Textures::bindTextureLayers(ResourceLocation* resource) {
|
||||
assert(resource->isPreloaded());
|
||||
|
||||
int layers = resource->getTextureCount();
|
||||
|
||||
for (int i = 0; i < layers; i++) {
|
||||
RenderManager.TextureBind(i, loadTexture(resource->getTexture(i)));
|
||||
}
|
||||
}
|
||||
|
||||
void Textures::bind(int id) {
|
||||
// if (id != lastBoundId)
|
||||
|
|
@ -377,6 +434,24 @@ void Textures::bind(int id) {
|
|||
}
|
||||
}
|
||||
|
||||
ResourceLocation* Textures::getTextureLocation(std::shared_ptr<Entity> entity) {
|
||||
std::shared_ptr<ItemEntity> item =
|
||||
std::dynamic_pointer_cast<ItemEntity>(entity);
|
||||
int iconType = item->getItem()->getIconType();
|
||||
return getTextureLocation(iconType);
|
||||
}
|
||||
|
||||
ResourceLocation* Textures::getTextureLocation(int iconType) {
|
||||
switch (iconType) {
|
||||
case Icon::TYPE_TERRAIN:
|
||||
return &TextureAtlas::LOCATION_BLOCKS;
|
||||
break;
|
||||
case Icon::TYPE_ITEM:
|
||||
return &TextureAtlas::LOCATION_ITEMS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Textures::clearLastBoundId() { lastBoundId = -1; }
|
||||
|
||||
int Textures::loadTexture(TEXTURE_NAME texId,
|
||||
|
|
@ -433,7 +508,7 @@ int Textures::loadTexture(TEXTURE_NAME texId,
|
|||
0; // resourceName.startsWith("%clamp%");
|
||||
if (clamp) pathName = resourceName.substr(7);
|
||||
|
||||
// std::wstring in = skins->getSelected()->getResource(pathName);
|
||||
// wstring in = skins->getSelected()->getResource(pathName);
|
||||
if (false) // 4J - removed was ( in == NULL)
|
||||
{
|
||||
loadTexture(missingNo, id, blur, clamp);
|
||||
|
|
@ -979,8 +1054,8 @@ MemTexture* Textures::addMemTexture(const std::wstring& name,
|
|||
return texture;
|
||||
}
|
||||
|
||||
// MemTexture *Textures::getMemTexture(const std::wstring& url,
|
||||
// MemTextureProcessor *processor)
|
||||
// MemTexture *Textures::getMemTexture(const wstring& url, MemTextureProcessor
|
||||
// *processor)
|
||||
// {
|
||||
// MemTexture *texture = memTextures[url];
|
||||
// if (texture != NULL)
|
||||
|
|
@ -1220,6 +1295,28 @@ TEXTURE_NAME TUImages[] = {
|
|||
TN_TILE_ENDER_CHEST, TN_ART_KZ, TN_MOB_WOLF_TAME, TN_MOB_WOLF_COLLAR,
|
||||
TN_PARTICLES, TN_MOB_ZOMBIE_VILLAGER,
|
||||
|
||||
TN_ITEM_LEASHKNOT,
|
||||
|
||||
TN_MISC_BEACON_BEAM,
|
||||
|
||||
TN_MOB_BAT,
|
||||
|
||||
TN_MOB_DONKEY, TN_MOB_HORSE_BLACK, TN_MOB_HORSE_BROWN,
|
||||
TN_MOB_HORSE_CHESTNUT, TN_MOB_HORSE_CREAMY, TN_MOB_HORSE_DARKBROWN,
|
||||
TN_MOB_HORSE_GRAY, TN_MOB_HORSE_MARKINGS_BLACKDOTS,
|
||||
TN_MOB_HORSE_MARKINGS_WHITE, TN_MOB_HORSE_MARKINGS_WHITEDOTS,
|
||||
TN_MOB_HORSE_MARKINGS_WHITEFIELD, TN_MOB_HORSE_SKELETON, TN_MOB_HORSE_WHITE,
|
||||
TN_MOB_HORSE_ZOMBIE, TN_MOB_MULE, TN_MOB_HORSE_ARMOR_DIAMOND,
|
||||
TN_MOB_HORSE_ARMOR_GOLD, TN_MOB_HORSE_ARMOR_IRON,
|
||||
|
||||
TN_MOB_WITCH,
|
||||
|
||||
TN_MOB_WITHER, TN_MOB_WITHER_ARMOR, TN_MOB_WITHER_INVULNERABLE,
|
||||
|
||||
TN_TILE_TRAP_CHEST, TN_TILE_LARGE_TRAP_CHEST,
|
||||
// TN_TILE_XMAS_CHEST,
|
||||
// TN_TILE_LARGE_XMAS_CHEST,
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
TN_MISC_ADDITIONALMAPICONS,
|
||||
#endif
|
||||
|
|
@ -1232,14 +1329,16 @@ TEXTURE_NAME TUImages[] = {
|
|||
};
|
||||
|
||||
// This is for any TU textures that aren't part of our enum indexed preload set
|
||||
const wchar_t* TUImagePaths[] = {L"font/Default", L"font/Mojangles_7",
|
||||
L"font/Mojangles_11",
|
||||
wchar_t* TUImagePaths[] = {L"font/Default", L"font/Mojangles_7",
|
||||
L"font/Mojangles_11",
|
||||
|
||||
// TU12
|
||||
L"armor/cloth_1.png", L"armor/cloth_1_b.png",
|
||||
L"armor/cloth_2.png", L"armor/cloth_2_b.png",
|
||||
// TU12
|
||||
L"armor/cloth_1.png", L"armor/cloth_1_b.png",
|
||||
L"armor/cloth_2.png", L"armor/cloth_2_b.png",
|
||||
|
||||
NULL};
|
||||
//
|
||||
|
||||
NULL};
|
||||
|
||||
bool Textures::IsTUImage(TEXTURE_NAME texId, const std::wstring& name) {
|
||||
int i = 0;
|
||||
|
|
@ -1269,9 +1368,9 @@ TEXTURE_NAME OriginalImages[] = {TN_MOB_CHAR, TN_MOB_CHAR1, TN_MOB_CHAR2,
|
|||
|
||||
TN_COUNT};
|
||||
|
||||
const wchar_t* OriginalImagesPaths[] = {L"misc/watercolor.png",
|
||||
wchar_t* OriginalImagesPaths[] = {L"misc/watercolor.png",
|
||||
|
||||
NULL};
|
||||
NULL};
|
||||
|
||||
bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::wstring& name) {
|
||||
int i = 0;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class Options;
|
|||
|
||||
class IntBuffer;
|
||||
class PreStitchedTextureMap;
|
||||
class ResourceLocation;
|
||||
|
||||
typedef enum _TEXTURE_NAME {
|
||||
TN__BLUR__MISC_PUMPKINBLUR,
|
||||
|
|
@ -110,7 +111,7 @@ typedef enum _TEXTURE_NAME {
|
|||
TN_TERRAIN_MOON_PHASES,
|
||||
|
||||
// 1.2.3
|
||||
TN_MOB_OZELOT,
|
||||
TN_MOB_OCELOT,
|
||||
TN_MOB_CAT_BLACK,
|
||||
TN_MOB_CAT_RED,
|
||||
TN_MOB_CAT_SIAMESE,
|
||||
|
|
@ -121,6 +122,43 @@ typedef enum _TEXTURE_NAME {
|
|||
TN_MOB_WOLF_COLLAR,
|
||||
TN_MOB_ZOMBIE_VILLAGER,
|
||||
|
||||
// 1.6.4
|
||||
TN_ITEM_LEASHKNOT,
|
||||
|
||||
TN_MISC_BEACON_BEAM,
|
||||
|
||||
TN_MOB_BAT,
|
||||
|
||||
TN_MOB_DONKEY,
|
||||
TN_MOB_HORSE_BLACK,
|
||||
TN_MOB_HORSE_BROWN,
|
||||
TN_MOB_HORSE_CHESTNUT,
|
||||
TN_MOB_HORSE_CREAMY,
|
||||
TN_MOB_HORSE_DARKBROWN,
|
||||
TN_MOB_HORSE_GRAY,
|
||||
TN_MOB_HORSE_MARKINGS_BLACKDOTS,
|
||||
TN_MOB_HORSE_MARKINGS_WHITE,
|
||||
TN_MOB_HORSE_MARKINGS_WHITEDOTS,
|
||||
TN_MOB_HORSE_MARKINGS_WHITEFIELD,
|
||||
TN_MOB_HORSE_SKELETON,
|
||||
TN_MOB_HORSE_WHITE,
|
||||
TN_MOB_HORSE_ZOMBIE,
|
||||
TN_MOB_MULE,
|
||||
TN_MOB_HORSE_ARMOR_DIAMOND,
|
||||
TN_MOB_HORSE_ARMOR_GOLD,
|
||||
TN_MOB_HORSE_ARMOR_IRON,
|
||||
|
||||
TN_MOB_WITCH,
|
||||
|
||||
TN_MOB_WITHER,
|
||||
TN_MOB_WITHER_ARMOR,
|
||||
TN_MOB_WITHER_INVULNERABLE,
|
||||
|
||||
TN_TILE_TRAP_CHEST,
|
||||
TN_TILE_LARGE_TRAP_CHEST,
|
||||
// TN_TILE_XMAS_CHEST,
|
||||
// TN_TILE_LARGE_XMAS_CHEST,
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
TN_MISC_ADDITIONALMAPICONS,
|
||||
#endif
|
||||
|
|
@ -250,11 +288,15 @@ private:
|
|||
|
||||
public:
|
||||
void bindTexture(const std::wstring& resourceName);
|
||||
void bindTexture(int resourceId); // 4J Added
|
||||
void bindTexture(ResourceLocation* resource); // 4J Added
|
||||
void bindTextureLayers(ResourceLocation* resource); // 4J added
|
||||
|
||||
// 4J Made public for use in XUI controls
|
||||
void bind(int id);
|
||||
|
||||
ResourceLocation* getTextureLocation(std::shared_ptr<Entity> entity);
|
||||
ResourceLocation* getTextureLocation(int iconType);
|
||||
|
||||
public:
|
||||
void clearLastBoundId();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue