22726e4d |
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 COMBINER_BASE_H_ |
23 | #define COMBINER_BASE_H_ |
24 | |
25 | #include "CombinerStructs.h" |
26 | |
27 | //Forward declarations |
28 | struct TexEnvCombiner; |
29 | |
30 | //***************************************************************************** |
31 | //* CombinerBase |
32 | //! Base class and interface for combiners |
33 | //! @see AdvancedTexEnvCombiner |
34 | //! @see SimpleTexEnvCombiner |
35 | //! @see DummyCombiner |
36 | //***************************************************************************** |
37 | class CombinerBase |
38 | { |
39 | public: |
40 | |
41 | //Constructor / Destructor |
42 | CombinerBase(); |
43 | ~CombinerBase(); |
44 | |
45 | //Set colors |
46 | void setFillColor(float r, float g, float b, float a); |
47 | void setBlendColor(float r, float g, float b, float a); |
48 | void setPrimColor(float r, float g, float b, float a); |
49 | void setEnvColor(float r, float g, float b, float a); |
50 | |
51 | //Set prim LOD |
52 | void setPrimLodMin(unsigned int primLodMin) { m_primLodMin = primLodMin; }; |
53 | void setPrimLodFrac(float primLodFrac) { m_primLodFrac = primLodFrac; }; |
54 | |
55 | public: |
56 | |
57 | //Get Colors |
58 | //---------- |
59 | |
60 | //! Get Blend Color |
61 | //! @retval float* Returns blend color as <r,g,b,a> channels (0.0-1.0) |
62 | float* getBlendColor() { return m_blendColor; }; |
63 | |
64 | //! Get Fill Color |
65 | //! @retval float* Returns fill color as <r,g,b,a> channels (0.0-1.0) |
66 | float* getFillColor() { return m_fillColor; }; |
67 | |
68 | //! Get Prim Color |
69 | //! @retval float* Returns prim color as <r,g,b,a> channels (0.0-1.0) |
70 | float* getPrimColor() { return m_primColor; }; |
71 | |
72 | //! Get Environment Color |
73 | //! @retval float* Returns environment color as <r,g,b,a> channels (0.0-1.0) |
74 | float* getEnvColor() { return m_envColor; }; |
75 | |
76 | //Get Combiner color |
77 | void getCombinerColor(float out[4], short colorSource, short alphaSource); |
78 | |
79 | public: |
80 | |
81 | //Interface |
82 | //--------- |
83 | |
84 | //* Initialize |
85 | //! Used to initialize combiner |
86 | virtual void initialize() = 0; |
87 | |
88 | //* Begin Texture Environment |
89 | //! Called before texture channels are updated in the RDP |
90 | virtual void beginTextureUpdate() = 0; |
91 | |
92 | //* End Texture Environment |
93 | //! Called before texture channels are updated in the RDP |
94 | //! @param[in] texEnv Texture environment with textures channels to be enabled |
95 | virtual void endTextureUpdate(TexEnvCombiner* texEnv) = 0; |
96 | |
97 | //* Set Texture Environment Colors |
98 | //! Used to send combiner color to graphics API |
99 | virtual void setTextureEnviromentColors(TexEnvCombiner* texEnv) = 0; |
100 | |
101 | //* Set Texture Environment Environment |
102 | //! Used to enable textureing and set texture enviromnent for graphics API |
103 | //! @param[in] texEnv Texture environment with input data to graphics API |
104 | virtual void setTextureEnviroment(TexEnvCombiner* texEnv) = 0; |
105 | |
106 | //* Create New Texture Enviornment |
107 | //! Allocates a new texture enviroment |
108 | //! @param[in] colorCombiner How to combine and get a color |
109 | //! @param[in] alphaCombiner How to combine and get an alpha value |
110 | //! @return The texture enviroment that was created |
111 | virtual TexEnvCombiner* createNewTextureEnviroment(Combiner* colorCombiner, Combiner *alphaCombiner) = 0; |
112 | |
113 | protected: |
114 | |
115 | CombineData m_combineData; |
116 | |
117 | //Colors |
118 | float m_fillColor[4] ; //!< <r,g,b,a> |
119 | float m_blendColor[4]; //!< <r,g,b,a> |
120 | float m_primColor[4]; //!< <r,g,b,a> |
121 | float m_envColor[4]; //!< <r,g,b,a> |
122 | |
123 | //Prim |
124 | unsigned int m_primLodMin; |
125 | float m_primLodFrac; |
126 | |
127 | }; |
128 | |
129 | #endif |