| 1 | /****************************************************************************** |
| 2 | * Arachnoid Graphics Plugin for Mupen64Plus |
| 3 | * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/ |
| 4 | * |
| 5 | * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson |
| 6 | * |
| 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. |
| 11 | * |
| 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. |
| 16 | * |
| 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 | *****************************************************************************/ |
| 21 | |
| 22 | #ifndef ADVANCED_COMBINER_MANAGER_H_ |
| 23 | #define ADVANCED_COMBINER_MANAGER_H_ |
| 24 | |
| 25 | #include "GBIDefs.h" |
| 26 | #include "CombinerStructs.h" |
| 27 | #include "CombinerCache.h" |
| 28 | |
| 29 | //Forward declarations |
| 30 | struct TexEnvCombiner; |
| 31 | struct CombineCycle; |
| 32 | struct CombinerStage; |
| 33 | struct Combiner; |
| 34 | class AdvancedTexEnvCombiner; |
| 35 | class CombinerCache; |
| 36 | class CombinerBase; |
| 37 | |
| 38 | //***************************************************************************** |
| 39 | //! Advanced Texture Environment Combiner |
| 40 | //! Class used to select sutible combiners and sending input to selected |
| 41 | //! Combiners. |
| 42 | //***************************************************************************** |
| 43 | class AdvancedCombinerManager |
| 44 | { |
| 45 | public: |
| 46 | |
| 47 | //Constructor / Destructor |
| 48 | AdvancedCombinerManager(); |
| 49 | ~AdvancedCombinerManager(); |
| 50 | |
| 51 | //Initialize / Dispose |
| 52 | void initialize(); |
| 53 | void dispose(); |
| 54 | |
| 55 | //Set Mux |
| 56 | void setMux(unsigned long long muxs, unsigned int cycleType); |
| 57 | void setMux(unsigned int muxs0, unsigned int muxs1, unsigned int cycleType); |
| 58 | |
| 59 | //Select Combiner |
| 60 | void selectCombine(unsigned int cycleType); |
| 61 | |
| 62 | //Update |
| 63 | void update(unsigned int cycleType); |
| 64 | void updateCombineColors(); |
| 65 | |
| 66 | //Begin / End Texture update |
| 67 | void beginTextureUpdate(); |
| 68 | void endTextureUpdate(); |
| 69 | |
| 70 | //Get Combiner Colors which will be assigned to vertices |
| 71 | void getCombinerColor(float out[4]); |
| 72 | void getSecondaryCombinerColor(float out[4]); |
| 73 | |
| 74 | //Set / Get Colors |
| 75 | void setFillColor (float r, float g, float b, float a); |
| 76 | void setBlendColor(float r, float g, float b, float a); |
| 77 | void setPrimColor (float r, float g, float b, float a); |
| 78 | void setEnvColor (float r, float g, float b, float a); |
| 79 | float* getFillColor(); |
| 80 | float* getBlendColor(); |
| 81 | float* getPrimColor(); |
| 82 | |
| 83 | //Set Prim LOD |
| 84 | void setPrimLodMin(unsigned int primLodMin); |
| 85 | void setPrimLodFrac(float primLodFrac); |
| 86 | |
| 87 | //! @return True if combiner wish to use texture channel 0 |
| 88 | bool getUsesTexture0() { return currentTexEnv->usesT0; } |
| 89 | |
| 90 | //! @return True if combiner wish to use texture channel 1 |
| 91 | bool getUsesTexture1() { return currentTexEnv->usesT1; } |
| 92 | |
| 93 | private: |
| 94 | |
| 95 | //Private Members |
| 96 | CombineData m_combineData; //!< Combiner Input (How to combine colors andset up enviroment) |
| 97 | TexEnvCombiner* currentTexEnv; //!< Texture Enviroment |
| 98 | CombinerBase* m_combiner; //!< Combiner |
| 99 | CombinerCache m_combinerCache; //!< Cache used to store old combiners for reuse |
| 100 | |
| 101 | }; |
| 102 | |
| 103 | #endif |