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 #include "CachedTexture.h"
27 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
30 CachedTexture::CachedTexture()
32 m_id = 0; //!< id used by OpenGL to identify texture
33 m_textureSize = 0; //!< Size of texture in bytes
36 offsetS = offsetT = 0;
39 mirrorS = mirrorT = 0;
42 format = 0; //!< Texture format
44 palette = 0; //!< What Texture Look Up Table to use
45 width = height = 0; // N64 width and height
46 clampWidth = clampHeight = 0; // Size to clamp to
47 realWidth = realHeight = 0; // Actual texture size
48 scaleS = scaleT = 0; // Scale to map to 0.0-1.0
49 shiftScaleS = shiftScaleT = 0; // Scale to shift
52 //-----------------------------------------------------------------------------
54 //-----------------------------------------------------------------------------
55 CachedTexture::~CachedTexture()
60 //-----------------------------------------------------------------------------
62 //-----------------------------------------------------------------------------
63 void CachedTexture::activate()
65 glEnable(GL_TEXTURE_2D);
66 glBindTexture( GL_TEXTURE_2D, m_id );
69 //-----------------------------------------------------------------------------
70 //! Deactivate texture
71 //-----------------------------------------------------------------------------
72 void CachedTexture::deactivate()
74 glDisable(GL_TEXTURE_2D);
75 glBindTexture( GL_TEXTURE_2D, 0 );
78 //-----------------------------------------------------------------------------
80 //-----------------------------------------------------------------------------
81 bool CachedTexture::operator == (const CachedTexture& t) const
83 return( crc == t.crc &&
86 clampWidth == t.clampWidth &&
87 clampHeight == t.clampHeight &&
90 mirrorS == t.mirrorS &&
91 mirrorT == t.mirrorT &&
94 format == t.format /* &&
98 //-----------------------------------------------------------------------------
100 //-----------------------------------------------------------------------------
101 CachedTexture& CachedTexture::operator = (const CachedTexture& v)
109 clampWidth = v.clampWidth;
110 clampHeight = v.clampHeight;
112 /* cache.current[tile]->fulS = gSP.textureTile[tile]->fulS;
113 cache.current[tile]->fulT = gSP.textureTile[tile]->fulT;
114 cache.current[tile]->ulS = gSP.textureTile[tile]->ulS;
115 cache.current[tile]->ulT = gSP.textureTile[tile]->ulT;
116 cache.current[tile]->lrS = gSP.textureTile[tile]->lrS;
117 cache.current[tile]->lrT = gSP.textureTile[tile]->lrT;*/
126 //lastDList = RSP.DList;
127 //frameBufferTexture = FALSE;