axmol/tests/cpp-tests/Classes/ShaderTest/ShaderTest.h

176 lines
3.8 KiB
C
Raw Normal View History

#ifndef _SHADER_TEST_H_
#define _SHADER_TEST_H_
#include "../testBasic.h"
#include "extensions/cocos-ext.h"
#include "../BaseTest.h"
USING_NS_CC_EXT;
class ShaderTestDemo : public BaseTest
{
public:
ShaderTestDemo(void);
virtual std::string title() const override;
virtual std::string subtitle() const override;
void restartCallback(Ref* sender);
void nextCallback(Ref* sender);
void backCallback(Ref* sender);
CREATE_FUNC(ShaderTestDemo);
};
class ShaderMonjori : public ShaderTestDemo
{
public:
ShaderMonjori();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
class ShaderMandelbrot : public ShaderTestDemo
{
public:
ShaderMandelbrot();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
class ShaderJulia : public ShaderTestDemo
{
public:
ShaderJulia();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
class ShaderHeart : public ShaderTestDemo
{
public:
ShaderHeart();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
class ShaderFlower : public ShaderTestDemo
{
public:
ShaderFlower();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
class ShaderPlasma : public ShaderTestDemo
{
public:
ShaderPlasma();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
class SpriteBlur;
class ShaderBlur : public ShaderTestDemo
{
public:
ShaderBlur();
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
ControlSlider* createSliderCtl();
void sliderAction(Ref* sender, Control::EventType controlEvent);
protected:
SpriteBlur* _blurSprite;
ControlSlider* _sliderCtl;
};
class ShaderRetroEffect : public ShaderTestDemo
{
public:
ShaderRetroEffect();
virtual std::string title() const override;
virtual std::string subtitle() const override;
bool init();
2012-06-08 13:55:28 +08:00
void update(float dt);
protected:
Label* _label;
float _accum;
};
class ShaderNode : public Node
{
public:
static ShaderNode* shaderNodeWithVertex(const std::string &vert, const std::string &frag);
2012-06-08 13:55:28 +08:00
virtual void update(float dt);
2014-04-15 16:16:14 +08:00
virtual void setPosition(const Vector2 &newPosition);
2014-04-08 22:07:35 +08:00
virtual void draw(Renderer *renderer, const Matrix &transform, bool transformUpdated) override;
2013-12-25 16:38:43 +08:00
protected:
ShaderNode();
~ShaderNode();
bool initWithVertex(const std::string &vert, const std::string &frag);
void loadShaderVertex(const std::string &vert, const std::string &frag);
2014-04-10 10:16:16 +08:00
void onDraw(const Matrix &transform, bool transformUpdated);
2014-04-02 15:25:50 +08:00
Vector2 _center;
Vector2 _resolution;
float _time;
std::string _vertFileName;
std::string _fragFileName;
CustomCommand _customCommand;
};
class ShaderTestScene : public TestScene
{
public:
virtual void runThisTest();
};
class ShaderLensFlare : public ShaderTestDemo
2014-05-10 02:48:11 +08:00
{
public:
ShaderLensFlare();
2014-05-10 02:48:11 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
2014-05-14 03:55:34 +08:00
class ShaderGlow : public ShaderTestDemo
2014-05-10 02:48:11 +08:00
{
public:
2014-05-14 03:55:34 +08:00
ShaderGlow();
2014-05-10 02:48:11 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
2014-05-14 03:55:34 +08:00
class ShaderMultiTexture : public ShaderTestDemo
2014-05-10 02:48:11 +08:00
{
public:
2014-05-14 03:55:34 +08:00
ShaderMultiTexture();
2014-05-10 02:48:11 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual bool init();
};
#endif