2 Copyright (C) 2002 Rice1964
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "CombinerDefs.h"
25 #include "CSortedList.h"
26 #include "DecodedMux.h"
30 extern const char* cycleTypeStrs[];
36 virtual ~CColorCombiner() {};
37 COLOR GetConstFactor(uint32 colorFlag, uint32 alphaFlag, uint32 defaultColor = 0);
38 virtual void InitCombinerMode(void);
40 virtual bool Initialize(void)=0;
41 virtual void CleanUp(void) {};
42 virtual void UpdateCombiner(uint32 dwMux0, uint32 dwMux1);
43 virtual void InitCombinerBlenderForSimpleTextureDraw(uint32 tile=0)=0;
44 virtual void DisableCombiner(void)=0;
47 virtual void DisplaySimpleMuxString(void);
48 virtual void DisplayMuxString(void);
51 DecodedMux *m_pDecodedMux;
53 CColorCombiner(CRender *pRender) :
54 m_pDecodedMux(NULL), m_bTex0Enabled(false),m_bTex1Enabled(false),m_bTexelsEnable(false),
55 m_bCycleChanged(false), m_supportedStages(1),m_bSupportMultiTexture(true),m_pRender(pRender)
59 virtual void InitCombinerCycleCopy(void)=0;
60 virtual void InitCombinerCycleFill(void)=0;
61 virtual void InitCombinerCycle12(void)=0;
67 bool m_bCycleChanged; // A flag will be set if cycle is changed to FILL or COPY
69 int m_supportedStages;
70 bool m_bSupportMultiTexture;
74 CSortedList<uint64, DecodedMux> m_DecodedMuxList;
77 uint32 GetTexelNumber(N64CombinerType &m);
78 int CountTexel1Cycle(N64CombinerType &m);
79 bool IsTxtrUsed(N64CombinerType &m);
81 void swap(uint8 &a, uint8 &b);
84 inline bool isEqual(uint8 val1, uint8 val2)
86 if( (val1&MUX_MASK) == (val2&MUX_MASK) )
92 inline bool isTexel(uint8 val)
94 if( (val&MUX_MASK) == MUX_TEXEL0 || (val&MUX_MASK) == MUX_TEXEL1 )
100 COLOR CalculateConstFactor(uint32 colorOp, uint32 alphaOp, uint32 curCol=0);