Start ifdef'ing out RGSS2 functionality

This commit is contained in:
Jonas Kulla 2013-10-02 22:40:09 +02:00
parent 751b9c3ae5
commit d8dab9c429
6 changed files with 56 additions and 35 deletions

View File

@ -439,6 +439,8 @@ void Bitmap::fillRect(const IntRect &rect, const Vec4 &color)
modified(); modified();
} }
#ifdef RGSS2
void Bitmap::gradientFillRect(int x, int y, void Bitmap::gradientFillRect(int x, int y,
int width, int height, int width, int height,
const Vec4 &color1, const Vec4 &color2, const Vec4 &color1, const Vec4 &color2,
@ -652,6 +654,8 @@ void Bitmap::radialBlur(int angle, int divisions)
modified(); modified();
} }
#endif
void Bitmap::clear() void Bitmap::clear()
{ {
GUARD_DISPOSED; GUARD_DISPOSED;

View File

@ -61,7 +61,7 @@ public:
const Vec4 &color); const Vec4 &color);
void fillRect(const IntRect &rect, const Vec4 &color); void fillRect(const IntRect &rect, const Vec4 &color);
/* RGSS2 */ #ifdef RGSS2
void gradientFillRect(int x, int y, void gradientFillRect(int x, int y,
int width, int height, int width, int height,
const Vec4 &color1, const Vec4 &color2, const Vec4 &color1, const Vec4 &color2,
@ -77,7 +77,7 @@ public:
void blur(); void blur();
void radialBlur(int angle, int divisions); void radialBlur(int angle, int divisions);
/* ----- */ #endif
void clear(); void clear();

View File

@ -69,16 +69,19 @@ struct GlobalStatePrivate
SimpleColorShader simpleColorShader; SimpleColorShader simpleColorShader;
SimpleAlphaShader simpleAlphaShader; SimpleAlphaShader simpleAlphaShader;
SimpleSpriteShader simpleSpriteShader; SimpleSpriteShader simpleSpriteShader;
SimpleMatrixShader simpleMatrixShader;
SpriteShader spriteShader; SpriteShader spriteShader;
PlaneShader planeShader; PlaneShader planeShader;
FlashMapShader flashMapShader; FlashMapShader flashMapShader;
TransShader transShader; TransShader transShader;
SimpleTransShader sTransShader; SimpleTransShader sTransShader;
HueShader hueShader; HueShader hueShader;
BlurShader blurShader;
BltShader bltShader; BltShader bltShader;
#ifdef RGSS2
SimpleMatrixShader simpleMatrixShader;
BlurShader blurShader;
#endif
TexPool texPool; TexPool texPool;
FontPool fontPool; FontPool fontPool;
@ -190,19 +193,22 @@ GSATT(SimpleShader&, simpleShader)
GSATT(SimpleColorShader&, simpleColorShader) GSATT(SimpleColorShader&, simpleColorShader)
GSATT(SimpleAlphaShader&, simpleAlphaShader) GSATT(SimpleAlphaShader&, simpleAlphaShader)
GSATT(SimpleSpriteShader&, simpleSpriteShader) GSATT(SimpleSpriteShader&, simpleSpriteShader)
GSATT(SimpleMatrixShader&, simpleMatrixShader)
GSATT(SpriteShader&, spriteShader) GSATT(SpriteShader&, spriteShader)
GSATT(PlaneShader&, planeShader) GSATT(PlaneShader&, planeShader)
GSATT(FlashMapShader&, flashMapShader) GSATT(FlashMapShader&, flashMapShader)
GSATT(TransShader&, transShader) GSATT(TransShader&, transShader)
GSATT(SimpleTransShader&, sTransShader) GSATT(SimpleTransShader&, sTransShader)
GSATT(HueShader&, hueShader) GSATT(HueShader&, hueShader)
GSATT(BlurShader&, blurShader)
GSATT(BltShader&, bltShader) GSATT(BltShader&, bltShader)
GSATT(TexPool&, texPool) GSATT(TexPool&, texPool)
GSATT(FontPool&, fontPool) GSATT(FontPool&, fontPool)
GSATT(Quad&, gpQuad) GSATT(Quad&, gpQuad)
#ifdef RGSS2
GSATT(SimpleMatrixShader&, simpleMatrixShader)
GSATT(BlurShader&, blurShader)
#endif
void GlobalState::setBindingData(void *data) void GlobalState::setBindingData(void *data)
{ {
p->bindingData = data; p->bindingData = data;

View File

@ -88,16 +88,19 @@ struct GlobalState
SimpleColorShader &simpleColorShader(); SimpleColorShader &simpleColorShader();
SimpleAlphaShader &simpleAlphaShader(); SimpleAlphaShader &simpleAlphaShader();
SimpleSpriteShader &simpleSpriteShader(); SimpleSpriteShader &simpleSpriteShader();
SimpleMatrixShader &simpleMatrixShader();
SpriteShader &spriteShader(); SpriteShader &spriteShader();
PlaneShader &planeShader(); PlaneShader &planeShader();
FlashMapShader &flashMapShader(); FlashMapShader &flashMapShader();
TransShader &transShader(); TransShader &transShader();
SimpleTransShader &sTransShader(); SimpleTransShader &sTransShader();
HueShader &hueShader(); HueShader &hueShader();
BlurShader &blurShader();
BltShader &bltShader(); BltShader &bltShader();
#ifdef RGSS2
SimpleMatrixShader &simpleMatrixShader();
BlurShader &blurShader();
#endif
TexPool &texPool(); TexPool &texPool();
FontPool &fontPool(); FontPool &fontPool();

View File

@ -37,13 +37,16 @@
#include "../simpleColor.frag.xxd" #include "../simpleColor.frag.xxd"
#include "../simpleAlpha.frag.xxd" #include "../simpleAlpha.frag.xxd"
#include "../flashMap.frag.xxd" #include "../flashMap.frag.xxd"
#include "../blur.frag.xxd"
#include "../simple.vert.xxd" #include "../simple.vert.xxd"
#include "../simpleColor.vert.xxd" #include "../simpleColor.vert.xxd"
#include "../sprite.vert.xxd" #include "../sprite.vert.xxd"
#ifdef RGSS2
#include "../blur.frag.xxd"
#include "../simpleMatrix.vert.xxd" #include "../simpleMatrix.vert.xxd"
#include "../blurH.vert.xxd" #include "../blurH.vert.xxd"
#include "../blurV.vert.xxd" #include "../blurV.vert.xxd"
#endif
#define INIT_SHADER(vert, frag) \ #define INIT_SHADER(vert, frag) \
@ -230,21 +233,6 @@ void SimpleSpriteShader::setSpriteMat(const float value[16])
} }
SimpleMatrixShader::SimpleMatrixShader()
{
INIT_SHADER(simpleMatrix, simpleAlpha);
ShaderBase::init();
GET_U(matrix);
}
void SimpleMatrixShader::setMatrix(const float value[16])
{
glUniformMatrix4fv(u_matrix, 1, GL_FALSE, value);
}
TransShader::TransShader() TransShader::TransShader()
{ {
INIT_SHADER(simple, trans); INIT_SHADER(simple, trans);
@ -425,6 +413,23 @@ void HueShader::setInputTexture(TEX::ID tex)
} }
#ifdef RGSS2
SimpleMatrixShader::SimpleMatrixShader()
{
INIT_SHADER(simpleMatrix, simpleAlpha);
ShaderBase::init();
GET_U(matrix);
}
void SimpleMatrixShader::setMatrix(const float value[16])
{
glUniformMatrix4fv(u_matrix, 1, GL_FALSE, value);
}
BlurShader::HPass::HPass() BlurShader::HPass::HPass()
{ {
INIT_SHADER(blurH, blur); INIT_SHADER(blurH, blur);
@ -439,6 +444,7 @@ BlurShader::VPass::VPass()
ShaderBase::init(); ShaderBase::init();
} }
#endif
BltShader::BltShader() BltShader::BltShader()

View File

@ -118,17 +118,6 @@ private:
GLint u_spriteMat; GLint u_spriteMat;
}; };
class SimpleMatrixShader : public ShaderBase
{
public:
SimpleMatrixShader();
void setMatrix(const float value[16]);
private:
GLint u_matrix;
};
class TransShader : public ShaderBase class TransShader : public ShaderBase
{ {
public: public:
@ -210,6 +199,18 @@ private:
GLint u_hueAdjust, u_inputTexture; GLint u_hueAdjust, u_inputTexture;
}; };
#ifdef RGSS2
class SimpleMatrixShader : public ShaderBase
{
public:
SimpleMatrixShader();
void setMatrix(const float value[16]);
private:
GLint u_matrix;
};
/* Gaussian blur */ /* Gaussian blur */
struct BlurShader struct BlurShader
{ {
@ -228,6 +229,7 @@ struct BlurShader
HPass pass1; HPass pass1;
VPass pass2; VPass pass2;
}; };
#endif
/* Bitmap blit */ /* Bitmap blit */
class BltShader : public ShaderBase class BltShader : public ShaderBase