Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/Combiner.h
2 views
/*1Copyright (C) 2002 Rice196423This program is free software; you can redistribute it and/or4modify it under the terms of the GNU General Public License5as published by the Free Software Foundation; either version 26of the License, or (at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program; if not, write to the Free Software15Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1617*/1819#ifndef _COMBINER_H_20#define _COMBINER_H_2122#include "typedefs.h"23#include "CombinerDefs.h"24#include "CSortedList.h"25#include "DecodedMux.h"2627class CRender;2829extern const char* cycleTypeStrs[];3031class CColorCombiner32{33friend class CRender;34public:35virtual ~CColorCombiner() {};36COLOR GetConstFactor(uint32 colorFlag, uint32 alphaFlag, uint32 defaultColor = 0);37virtual void InitCombinerMode(void);3839virtual bool Initialize(void)=0;40virtual void CleanUp(void) {};41virtual void UpdateCombiner(uint32 dwMux0, uint32 dwMux1);42virtual void InitCombinerBlenderForSimpleTextureDraw(uint32 tile=0)=0;43virtual void DisableCombiner(void)=0;4445#ifdef DEBUGGER46virtual void DisplaySimpleMuxString(void);47virtual void DisplayMuxString(void);48#endif4950DecodedMux *m_pDecodedMux;51protected:52CColorCombiner(CRender *pRender) :53m_pDecodedMux(NULL), m_bTex0Enabled(false),m_bTex1Enabled(false),m_bTexelsEnable(false),54m_bCycleChanged(false), m_supportedStages(1),m_bSupportMultiTexture(true),m_pRender(pRender)55{56}5758virtual void InitCombinerCycleCopy(void)=0;59virtual void InitCombinerCycleFill(void)=0;60virtual void InitCombinerCycle12(void)=0;6162bool m_bTex0Enabled;63bool m_bTex1Enabled;64bool m_bTexelsEnable;6566bool m_bCycleChanged; // A flag will be set if cycle is changed to FILL or COPY6768int m_supportedStages;69bool m_bSupportMultiTexture;7071CRender *m_pRender;7273CSortedList<uint64, DecodedMux> m_DecodedMuxList;74};7576uint32 GetTexelNumber(N64CombinerType &m);77int CountTexel1Cycle(N64CombinerType &m);78bool IsTxtrUsed(N64CombinerType &m);7980void swap(uint8 &a, uint8 &b);818283inline bool isEqual(uint8 val1, uint8 val2)84{85if( (val1&MUX_MASK) == (val2&MUX_MASK) )86return true;87else88return false;89}9091inline bool isTexel(uint8 val)92{93if( (val&MUX_MASK) == MUX_TEXEL0 || (val&MUX_MASK) == MUX_TEXEL1 )94return true;95else96return false;97}9899COLOR CalculateConstFactor(uint32 colorOp, uint32 alphaOp, uint32 curCol=0);100101#endif102103104105