PuzzleSDK
Material_setTechnique类 参考

#include <MaterialSystemTest.h>

+ 类 Material_setTechnique 继承关系图:
+ Material_setTechnique 的协作图:

Public 成员函数

 CREATE_FUNC (Material_setTechnique)
 
virtual void onEnter () override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 MaterialSystemBaseTest
virtual std::string title () const override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

Private 成员函数

void changeMaterial (float dt)
 

Private 属性

cocos2d::Sprite3D * _sprite
 
int _techniqueState
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 MaterialSystemTest.h101 行定义.

成员函数说明

◆ changeMaterial()

void Material_setTechnique::changeMaterial ( float  dt)
private

在文件 MaterialSystemTest.cpp326 行定义.

327{
328 // get it from Mesh 0
329 switch (_techniqueState)
330 {
331 case 0:
332 _sprite->getMaterial(0)->setTechnique("lit");
333 break;
334 case 1:
335 _sprite->getMaterial(0)->setTechnique("normal");
336 break;
337 case 2:
338 _sprite->getMaterial(0)->setTechnique("outline");
339 break;
340 default:
341 break;
342 }
343
345}
cocos2d::Sprite3D * _sprite

引用了 _sprite , 以及 _techniqueState.

被这些函数引用 onEnter().

+ 这是这个函数的调用关系图:

◆ CREATE_FUNC()

Material_setTechnique::CREATE_FUNC ( Material_setTechnique  )

◆ onEnter()

void Material_setTechnique::onEnter ( )
overridevirtual

重载 TestCase .

在文件 MaterialSystemTest.cpp292 行定义.

293{
295
296 auto sprite = Sprite3D::create("Sprite3DTest/boss1.obj");
297 sprite->setScale(6);
298 this->addChild(sprite);
299 sprite->setPositionNormalized(Vec2(0.5f,0.5f));
300 _sprite = sprite;
301
302
303 Material *mat = Material::createWithFilename("Materials/3d_effects.material");
304 sprite->setMaterial(mat);
305
306 // lights
307 auto light1 = AmbientLight::create(Color3B::RED);
308 addChild(light1);
309
310 auto light2 = DirectionLight::create(Vec3(-1,1,0), Color3B::GREEN);
311 addChild(light2);
312
313 this->schedule(CC_CALLBACK_1(Material_setTechnique::changeMaterial, this), 1, "cookie");
314 _techniqueState = 0;
315
316 auto rot = RotateBy::create(5, Vec3(30.0f,60.0f,270.0f));
317 auto repeat = RepeatForever::create(rot);
318 sprite->runAction(repeat);
319}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 _sprite, _techniqueState, changeMaterial() , 以及 TestCase::onEnter().

+ 函数调用图:

◆ subtitle()

std::string Material_setTechnique::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 MaterialSystemTest.cpp321 行定义.

322{
323 return "Testing setTechnique()";
324}

类成员变量说明

◆ _sprite

cocos2d::Sprite3D* Material_setTechnique::_sprite
private

在文件 MaterialSystemTest.h112 行定义.

被这些函数引用 changeMaterial() , 以及 onEnter().

◆ _techniqueState

int Material_setTechnique::_techniqueState
private

在文件 MaterialSystemTest.h113 行定义.

被这些函数引用 changeMaterial() , 以及 onEnter().


该类的文档由以下文件生成: