1 /******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
5 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *****************************************************************************/
22 #ifndef TEXTURE_LOADER_H_
23 #define TEXTURE_LOADER_H_
27 //Forward declarations
31 //*****************************************************************************
33 //! Used to store information about texture image
34 //*****************************************************************************
46 format = size = width = bpl = 0;
51 //*****************************************************************************
53 //! Struct used to store information used then loading textures.
54 //*****************************************************************************
57 unsigned int format, size, line, tmem, palette;
63 unsigned int mirrort : 1;
64 unsigned int clampt : 1;
65 unsigned int pad0 : 30;
66 unsigned int mirrors : 1;
67 unsigned int clamps : 1;
68 unsigned int pad1 : 30;
72 unsigned int cmt, cms;
76 //FrameBuffer *frameBuffer;
77 unsigned int maskt, masks;
78 unsigned int shiftt, shifts;
79 float fuls, fult, flrs, flrt;
80 unsigned int uls, ult, lrs, lrt;
82 unsigned int getWidth() { return lrs - uls + 1; }
83 unsigned int getHeight() { return lrt - ult + 1; }
88 format = size = line = tmem = palette = 0;
91 fuls = fult = flrs = flrt = 0;
92 uls = ult = lrs = lrt = 0;
96 //*****************************************************************************
98 //! Class for loading texturs from RDRAM to Texture Memory
99 //*****************************************************************************
104 //Constructor / Destructor
108 bool initialize(RDP* rdp, Memory* memory);
111 void setTextureImage(unsigned int format, unsigned int size, unsigned int width, unsigned int segmentAddress);
114 void setTile(int format, int size, int line, int tmem, int tile, int palette,
115 int clampS, int clampT, int mirrorS, int mirrorT, int maskS,
116 int maskT, int shiftS, int shiftT);
119 void setTileSize(int tile, unsigned int s0, unsigned int t0, unsigned int s1, unsigned int t1);
122 void loadTile(int tile, int s0, int t0, int s1, int t1);
125 void loadBlock(int tile, int s0, int t0, int s1, int t1);
127 //Load Texture Look up table
128 void loadTLUT(int tile, int s0, int t0, int s1, int t1);
132 //! Returns information about current texture image
133 TextureImage* getTextureImage() { return &m_textureImage; }
135 //! Returns previusly loaded tile
136 RDPTile* getCurrentTile() { return m_currentTile; }
139 //! @param tile which of the eight tiles to return.
140 RDPTile* getTile(unsigned int tile) { return &m_tiles[tile]; }
144 Memory* m_memory; //!< Pointer to Memory Manager
145 RDP* m_rdp; //!< Pointer to Reality Signal Processor
148 RDPTile m_tiles[8]; //!< Eight tiles
149 RDPTile* m_currentTile; //!< Previusly loaded tile
150 TextureImage m_textureImage; //!< Texture Image