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();
}
#ifdef RGSS2
void Bitmap::gradientFillRect(int x, int y,
int width, int height,
const Vec4 &color1, const Vec4 &color2,
@ -652,6 +654,8 @@ void Bitmap::radialBlur(int angle, int divisions)
modified();
}
#endif
void Bitmap::clear()
{
GUARD_DISPOSED;

View File

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

View File

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

View File

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

View File

@ -37,13 +37,16 @@
#include "../simpleColor.frag.xxd"
#include "../simpleAlpha.frag.xxd"
#include "../flashMap.frag.xxd"
#include "../blur.frag.xxd"
#include "../simple.vert.xxd"
#include "../simpleColor.vert.xxd"
#include "../sprite.vert.xxd"
#ifdef RGSS2
#include "../blur.frag.xxd"
#include "../simpleMatrix.vert.xxd"
#include "../blurH.vert.xxd"
#include "../blurV.vert.xxd"
#endif
#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()
{
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()
{
INIT_SHADER(blurH, blur);
@ -439,6 +444,7 @@ BlurShader::VPass::VPass()
ShaderBase::init();
}
#endif
BltShader::BltShader()

View File

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