28#include "../BaseTest.h"
29#include "../Sprite3DTest/DrawNode3D.h"
31#include "renderer/backend/ProgramState.h"
32#include "renderer/backend/Types.h"
85 virtual void onEnter()
override;
86 virtual void onExit()
override;
88 virtual void update(
float dt)
override;
91 virtual std::string
title()
const override;
92 virtual std::string
subtitle()
const override;
98 cocos2d::EventListenerTouchOneByOne*
_lis;
108 virtual void onEnter()
override;
109 virtual void onExit()
override;
111 virtual std::string
title()
const override;
112 void addNewSpriteWithCoords(cocos2d::Vec3 p,std::string fileName,
bool playAnimation=
false,
float scale=1.0f,
bool bindCamera=
false);
114 void onTouchesBegan(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
115 void onTouchesMoved(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
116 void onTouchesEnded(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
122 void move3D(
float elapsedTime);
124 bool isState(
unsigned int state,
unsigned int bit)
const;
127 bool onTouchesCommon(cocos2d::Touch* touch, cocos2d::Event* event,
bool* touchProperty);
165 virtual void onEnter()
override;
166 virtual void onExit()
override;
168 virtual void update(
float dt)
override;
171 virtual std::string
title()
const override;
199 virtual void onEnter()
override;
200 virtual void onExit()
override;
202 virtual void update(
float dt)
override;
205 virtual std::string
title()
const override;
209 void onTouchsMoved(
const std::vector<cocos2d::Touch*> &touchs, cocos2d::Event *event);
211 void calculateArcBall( cocos2d::Vec3 & axis,
float & angle,
float p1x,
float p1y,
float p2x,
float p2y );
236 virtual void onEnter()
override;
237 virtual void onExit()
override;
239 virtual void update(
float dt)
override;
242 virtual std::string
title()
const override;
244 void onTouchesMoved(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
257#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
282 virtual std::string
title()
const override;
283 virtual std::string
subtitle()
const override;
285 virtual void onEnter()
override;
DEFINE_TEST_SUITE(Camera3DTests)
virtual ~BackgroundColorBrushTest()
virtual void onEnter() override
virtual std::string title() const override
virtual std::string subtitle() const override
BackgroundColorBrushTest()
CREATE_FUNC(BackgroundColorBrushTest)
void SwitchViewCallback(cocos2d::Ref *sender, CameraType cameraType)
bool onTouchesZoomIn(cocos2d::Touch *touch, cocos2d::Event *event)
cocos2d::Label * _ZoomOutlabel
bool onTouchesRotateLeft(cocos2d::Touch *touch, cocos2d::Event *event)
bool onTouchesZoomOut(cocos2d::Touch *touch, cocos2d::Event *event)
void updateState(float elapsedTime)
cocos2d::MenuItem * _incRot
bool onTouchesCommon(cocos2d::Touch *touch, cocos2d::Event *event, bool *touchProperty)
bool isState(unsigned int state, unsigned int bit) const
CREATE_FUNC(Camera3DTestDemo)
virtual ~Camera3DTestDemo()
cocos2d::Label * _ZoomInlabel
virtual void onEnter() override
cocos2d::Layer * _layer3D
cocos2d::MoveTo * _moveAction
void addNewSpriteWithCoords(cocos2d::Vec3 p, std::string fileName, bool playAnimation=false, float scale=1.0f, bool bindCamera=false)
cocos2d::Camera * _camera
void onTouchesBegan(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
void onTouchesEnded(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
cocos2d::Label * _RotateLeftlabel
void scaleCameraCallback(cocos2d::Ref *sender, float value)
cocos2d::Sprite3D * _sprite3D
void rotateCameraCallback(cocos2d::Ref *sender, float value)
virtual std::string title() const override
void updateCamera(float fDelta)
void onTouchesRotateRightEnd(cocos2d::Touch *touch, cocos2d::Event *event)
void onTouchesZoomOutEnd(cocos2d::Touch *touch, cocos2d::Event *event)
void move3D(float elapsedTime)
void onTouchesRotateLeftEnd(cocos2d::Touch *touch, cocos2d::Event *event)
bool onTouchesRotateRight(cocos2d::Touch *touch, cocos2d::Event *event)
void onTouchesZoomInEnd(cocos2d::Touch *touch, cocos2d::Event *event)
virtual void onExit() override
cocos2d::MenuItem * _decRot
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
cocos2d::Label * _RotateRightlabel
void onTouchsMoved(const std::vector< cocos2d::Touch * > &touchs, cocos2d::Event *event)
cocos2d::Quaternion _rotationQuat
float projectToSphere(float r, float x, float y)
virtual void onEnter() override
void updateCameraTransform()
CREATE_FUNC(CameraArcBallDemo)
cocos2d::Camera * _camera
void switchTargetCallback(cocos2d::Ref *sender)
cocos2d::DrawNode3D * _drawGrid
virtual std::string title() const override
void switchOperateCallback(cocos2d::Ref *sender)
cocos2d::Layer * _layer3D
void calculateArcBall(cocos2d::Vec3 &axis, float &angle, float p1x, float p1y, float p2x, float p2y)
virtual void onExit() override
cocos2d::Sprite3D * _sprite3D2
virtual ~CameraArcBallDemo()
virtual void update(float dt) override
cocos2d::Sprite3D * _sprite3D1
cocos2d::BillBoard * bill1
cocos2d::BillBoard * bill2
cocos2d::DrawNode3D * _drawFrustum
CREATE_FUNC(CameraCullingDemo)
cocos2d::Layer * _layer3D
cocos2d::Camera * _cameraFirst
virtual ~CameraCullingDemo()
void addSpriteCallback(cocos2d::Ref *sender)
virtual void update(float dt) override
void switchViewCallback(cocos2d::Ref *sender)
virtual void onEnter() override
void delSpriteCallback(cocos2d::Ref *sender)
cocos2d::DrawNode3D * _drawAABB
cocos2d::Camera * _cameraThird
virtual void onExit() override
cocos2d::Label * _labelSprite3DCount
virtual std::string title() const override
std::vector< cocos2d::Sprite3D * > _objects
cocos2d::MoveBy * _moveAction
cocos2d::Node * _camControlNode
virtual ~CameraRotationTest()
CREATE_FUNC(CameraRotationTest)
cocos2d::EventListenerTouchOneByOne * _lis
virtual void update(float dt) override
virtual void onExit() override
virtual std::string title() const override
virtual std::string subtitle() const override
virtual void onEnter() override
cocos2d::backend::ProgramState * _programState1
void switchTypeCallback(cocos2d::Ref *sender, int type)
cocos2d::Layer * _layer3D
virtual std::string title() const override
cocos2d::Camera * _camera
cocos2d::EventListenerCustom * _backToForegroundListener
cocos2d::Sprite3D * _sprite3D1
cocos2d::Sprite3D * _sprite3D2
cocos2d::backend::ProgramState * _programState2
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
virtual void onEnter() override
virtual void update(float dt) override
virtual void onExit() override