aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PreStitchedTextureMap.h
blob: 882a7eae3056da7e0ea4d4375a2e60937786f26f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
using namespace std;

#include "..\Minecraft.World\IconRegister.h"

class Icon;
class StitchedTexture;
class Texture;
class BufferedImage;

// 4J Added this class to stop having to do texture stitching at runtime
class PreStitchedTextureMap : public IconRegister
{
public:
	static const wstring NAME_MISSING_TEXTURE;

private:
	const int iconType;

	const wstring name;
	const wstring path;
	const wstring extension;

	bool m_mipMap;

	typedef unordered_map<wstring, Icon *> stringIconMap;
	stringIconMap texturesByName; //  = new HashMap<String, StitchedTexture>();
	BufferedImage *missingTexture; // = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB);
	StitchedTexture *missingPosition;
	Texture *stitchResult;
	vector<StitchedTexture *> animatedTextures; // = new ArrayList<StitchedTexture>();

	void loadUVs();
public:
	PreStitchedTextureMap(int type, const wstring &name, const wstring &path, BufferedImage *missingTexture, bool mipMap = false);

	void stitch();

private:
	void makeTextureAnimated(TexturePack *texturePack, StitchedTexture *tex);

public:
	StitchedTexture *getTexture(const wstring &name);
	void cycleAnimationFrames();
	Texture *getStitchedTexture();

	// 4J Stu - register is a reserved keyword in C++
	Icon *registerIcon(const wstring &name);

	int getIconType();
	Icon *getMissingIcon();

	int getFlags() const;
};