Arachnoid GLESv1.1 plugin. Compile and run (a bit glitchy and no frameskip) on the...
[mupen64plus-pandora.git] / source / mupen64plus-video-arachnoid / src / RSP / RSPLightManager.h
CommitLineData
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 RSP_LIGHT_MANAGER_H_
23#define RSP_LIGHT_MANAGER_H_
24
25//Forward declarations
26class Memory;
27
28//-----------------------------------------------------------------------------
29//* Light
30//! Struct defining how lights are stored in RDRAM
31//-----------------------------------------------------------------------------
32struct RDRAMLight
33{
34 unsigned char pad0; //!< Padding
35 unsigned char b, g, r; //!< Color <blue, green, red>
36 unsigned char pad1; //!< Padding
37 unsigned char b2, g2, r2; //!< Color <blue, green, red>
38 char pad2; //!< Padding
39 char z, y, x; //!< Direction
40};
41
42//-----------------------------------------------------------------------------
43//* RSP Light
44//! Struct used to store information about lights
45//-----------------------------------------------------------------------------
46struct RSPLight
47{
48 float r, g, b; //Color
49 float x, y, z; //Direction
50};
51
52//*****************************************************************************
53//! RSP Light Manager
54//*****************************************************************************
55class RSPLightManager
56{
57public:
58
59 //Constructor / Destructor
60 RSPLightManager();
61 ~RSPLightManager();
62
63 bool initialize(Memory* memory);
64
65 void setLight( unsigned int lightIndex, unsigned int rdramAddress );
66 void setNumLights(int numLights);
67 void setLightColor( unsigned int lightIndex, unsigned int packedColor );
68 const float* getAmbientLight() { return &m_lights[m_numLights].r; }
69
70 //Get
71 int getNumLights() { return m_numLights; }
72 void setLightEnabled(bool enabled) { m_lightEnabled = enabled; }
73 bool getLightEnabled() { return m_lightEnabled; }
74 const float* getLightColor(int lightIndex) { return &m_lights[lightIndex].r; }
75 const float* getLightDirection(int lightIndex) { return &m_lights[lightIndex].x; }
76
77private:
78
79 Memory* m_memory;
80
81 //Light
82 bool m_lightEnabled;
83 RSPLight m_lights[8];
84 int m_numLights;
85
86};
87
88
89#endif