Merge branch 'v3' of github.com:super626/cocos2d-x into v3

This commit is contained in:
lvlong 2015-03-24 16:07:42 +08:00
commit 5c20d49cd7
22 changed files with 399 additions and 54 deletions

View File

@ -816,6 +816,8 @@
B2507B6C192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
B609E67319C18DAD003D0074 /* BillBoardTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B609E67119C18DAD003D0074 /* BillBoardTest.cpp */; };
B609E67419C18DAD003D0074 /* BillBoardTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B609E67119C18DAD003D0074 /* BillBoardTest.cpp */; };
B6337DF71ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */; };
B6337DF81ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */; };
B639932E1A490EC700B07923 /* Particle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B639932C1A490EC700B07923 /* Particle3DTest.cpp */; };
B639932F1A490EC700B07923 /* Particle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B639932C1A490EC700B07923 /* Particle3DTest.cpp */; };
B63993311A49359F00B07923 /* Particle3D in Resources */ = {isa = PBXBuildFile; fileRef = B63993301A49359F00B07923 /* Particle3D */; };
@ -1752,6 +1754,8 @@
B2507B6A192589AF00FA4972 /* Shaders3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Shaders3D; path = "../tests/cpp-tests/Resources/Shaders3D"; sourceTree = "<group>"; };
B609E67119C18DAD003D0074 /* BillBoardTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BillBoardTest.cpp; path = BillBoardTest/BillBoardTest.cpp; sourceTree = "<group>"; };
B609E67219C18DAD003D0074 /* BillBoardTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BillBoardTest.h; path = BillBoardTest/BillBoardTest.h; sourceTree = "<group>"; };
B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceParticle3DTest.cpp; sourceTree = "<group>"; };
B6337DF61ABA9B44005AEF24 /* PerformanceParticle3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceParticle3DTest.h; sourceTree = "<group>"; };
B639932C1A490EC700B07923 /* Particle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Particle3DTest.cpp; path = Particle3DTest/Particle3DTest.cpp; sourceTree = "<group>"; };
B639932D1A490EC700B07923 /* Particle3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Particle3DTest.h; path = Particle3DTest/Particle3DTest.h; sourceTree = "<group>"; };
B63993301A49359F00B07923 /* Particle3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Particle3D; path = "../tests/cpp-tests/Resources/Particle3D"; sourceTree = "<group>"; };
@ -2939,6 +2943,8 @@
1AC35AC118CECF0C00F37B72 /* PerformanceTest */ = {
isa = PBXGroup;
children = (
B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */,
B6337DF61ABA9B44005AEF24 /* PerformanceParticle3DTest.h */,
1AC35AC218CECF0C00F37B72 /* PerformanceAllocTest.cpp */,
1AC35AC318CECF0C00F37B72 /* PerformanceAllocTest.h */,
1AF152D718FD252A00A52F3D /* PerformanceCallbackTest.cpp */,
@ -4866,6 +4872,7 @@
182C5CBA1A95B2FD00C30D34 /* CocosStudio3DTest.cpp in Sources */,
1AC35C5D18CECF0C00F37B72 /* Ball.cpp in Sources */,
1AC35B7B18CECF0C00F37B72 /* GameOverScene.cpp in Sources */,
B6337DF71ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */,
1AC35BF318CECF0C00F37B72 /* ExtensionsTest.cpp in Sources */,
1AC35B3518CECF0C00F37B72 /* TestEntries.cpp in Sources */,
1AC35B2D18CECF0C00F37B72 /* Box2dTest.cpp in Sources */,
@ -5118,6 +5125,7 @@
1AC35C3E18CECF0C00F37B72 /* PhysicsTest.cpp in Sources */,
3825CC4A1A2C982A00C92EA8 /* CustomRootNode.cpp in Sources */,
29080DC6191B595E0066F8DF /* UIScene_Editor.cpp in Sources */,
B6337DF81ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */,
29080DB2191B595E0066F8DF /* UILayoutTest.cpp in Sources */,
1AC35B6A18CECF0C00F37B72 /* ButtonTestLayer.cpp in Sources */,
29080DB6191B595E0066F8DF /* UIListViewTest.cpp in Sources */,

View File

@ -932,6 +932,8 @@ void Label::createSpriteWithFontDefinition()
texture->initWithString(_originalUTF8String.c_str(),_fontDefinition);
_textSprite = Sprite::createWithTexture(texture);
//set camera mask using label's camera mask, because _textSprite may be null when setting camera mask to label
_textSprite->setCameraMask(getCameraMask());
_textSprite->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
this->setContentSize(_textSprite->getContentSize());
texture->release();
@ -1073,6 +1075,8 @@ void Label::drawTextSprite(Renderer *renderer, uint32_t parentFlags)
{
_shadowNode->setBlendFunc(_blendFunc);
}
//set camera mask using label's mask. Because _shadowNode may be null when setting the label's camera mask
_shadowNode->setCameraMask(getCameraMask());
_shadowNode->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
_shadowNode->setColor(_shadowColor);
_shadowNode->setOpacity(_shadowOpacity * _displayedOpacity);

View File

@ -375,16 +375,17 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
return false;
}
MeshData* meshData = nullptr;
for(unsigned int i = 0; i < meshSize ; i++ )
{
MeshData* meshData = new (std::nothrow) MeshData();
unsigned int attribSize=0;
// read mesh data
if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1)
{
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
return false;
goto FAILED;
}
meshData = new (std::nothrow) MeshData();
meshData->attribCount = attribSize;
meshData->attribs.resize(meshData->attribCount);
for (ssize_t j = 0; j < meshData->attribCount; j++)
@ -394,7 +395,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
if (_binaryReader.read(&vSize, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
return false;
goto FAILED;
}
std::string type = _binaryReader.readString();
attribute=_binaryReader.readString();
@ -408,14 +409,14 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
if (_binaryReader.read(&vertexSizeInFloat, 4, 1) != 1 || vertexSizeInFloat == 0)
{
CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
return false;
goto FAILED;
}
meshData->vertex.resize(vertexSizeInFloat);
if (_binaryReader.read(&meshData->vertex[0], 4, vertexSizeInFloat) != vertexSizeInFloat)
{
CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
return false;
goto FAILED;
}
// Read index data
@ -431,13 +432,13 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
{
CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
return false;
goto FAILED;
}
indexArray.resize(nIndexCount);
if (_binaryReader.read(&indexArray[0], 2, nIndexCount) != nIndexCount)
{
CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
return false;
goto FAILED;
}
meshData->subMeshIndices.push_back(indexArray);
meshData->numIndex = (int)meshData->subMeshIndices.size();
@ -449,7 +450,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
if (_binaryReader.read(aabb, 4, 6) != 6)
{
CCLOG("warning: Failed to read meshdata: aabb '%s'.", _path.c_str());
return false;
goto FAILED;
}
meshData->subMeshAABB.push_back(AABB(Vec3(aabb[0], aabb[1], aabb[2]), Vec3(aabb[3], aabb[4], aabb[5])));
}
@ -461,6 +462,16 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
meshdatas.meshDatas.push_back(meshData);
}
return true;
FAILED:
{
CC_SAFE_DELETE(meshData);
for (auto& meshdata : meshdatas.meshDatas) {
delete meshdata;
}
meshdatas.meshDatas.clear();
return false;
}
}
bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
{

View File

@ -49,7 +49,25 @@ struct MeshVertexAttrib
};
struct ModelData;
/** model node data, since 3.3 */
struct ModelData
{
std::string subMeshId;
std::string matrialId;
std::vector<std::string> bones;
std::vector<Mat4> invBindPose;
virtual ~ModelData()
{
resetData();
}
virtual void resetData()
{
bones.clear();
invBindPose.clear();
}
};
/** Node data, since 3.3 */
struct NodeData
{
@ -71,29 +89,16 @@ struct NodeData
delete it;
}
children.clear();
for(auto& modeldata : modelNodeDatas)
{
delete modeldata;
}
modelNodeDatas.clear();
}
};
/** model node data, since 3.3 */
struct ModelData
{
std::string subMeshId;
std::string matrialId;
std::vector<std::string> bones;
std::vector<Mat4> invBindPose;
virtual ~ModelData()
{
resetData();
}
virtual void resetData()
{
bones.clear();
invBindPose.clear();
}
};
/** node datas, since 3.3 */
struct NodeDatas
{

View File

@ -150,14 +150,15 @@ void Sprite3D::afterAsyncLoad(void* param)
}
Sprite3DCache::getInstance()->addSprite3DData(asyncParam->modlePath, data);
meshdatas = nullptr;
CC_SAFE_DELETE(meshdatas);
materialdatas = nullptr;
nodeDatas = nullptr;
}
}
delete meshdatas;
delete materialdatas;
delete nodeDatas;
CC_SAFE_DELETE(meshdatas);
CC_SAFE_DELETE(materialdatas);
CC_SAFE_DELETE(nodeDatas);
if (asyncParam->texPath != "")
{
@ -290,6 +291,7 @@ bool Sprite3D::initWithFile(const std::string &path)
}
Sprite3DCache::getInstance()->addSprite3DData(path, data);
delete meshdatas;
return true;
}
}

View File

@ -98,6 +98,7 @@ void main(void)
// Apply spot attenuation
attenuation *= smoothstep(u_SpotLightSourceOuterAngleCos[i], u_SpotLightSourceInnerAngleCos[i], spotCurrentAngleCos);
attenuation = clamp(attenuation, 0.0, 1.0);
combinedColor.xyz += computeLighting(normal, vertexToSpotLightDirection, u_SpotLightSourceColor[i], attenuation);
}
\n#endif\n

View File

@ -98,6 +98,7 @@ void main(void)
// Apply spot attenuation
attenuation *= smoothstep(u_SpotLightSourceOuterAngleCos[i], u_SpotLightSourceInnerAngleCos[i], spotCurrentAngleCos);
attenuation = clamp(attenuation, 0.0, 1.0);
combinedColor.xyz += computeLighting(normal, vertexToSpotLightDirection, u_SpotLightSourceColor[i], attenuation);
}
\n#endif\n

View File

@ -51,11 +51,13 @@ void PUDoAffectorEventHandler::handle (PUParticleSystem3D* particleSystem, PUPar
auto children = system->getChildren();
for(auto iter : children)
{
technique = static_cast<PUParticleSystem3D *>(iter);
affector = technique->getAffector(_affectorName);
if (affector)
{
break;
technique = dynamic_cast<PUParticleSystem3D *>(iter);
if (technique){
affector = technique->getAffector(_affectorName);
if (affector)
{
break;
}
}
}
}

View File

@ -138,8 +138,8 @@ void PUDoEnableComponentEventHandler::handle (PUParticleSystem3D* particleSystem
if (system){
auto children = system->getChildren();
for (auto iter : children){
PUParticleSystem3D *child = static_cast<PUParticleSystem3D *>(iter);
if (child->getName() == _componentName){
PUParticleSystem3D *child = dynamic_cast<PUParticleSystem3D *>(iter);
if (child && child->getName() == _componentName){
child->setEnabled(_componentEnabled);
break;
}

View File

@ -80,7 +80,7 @@ void PUDoPlacementParticleEventHandler::handle (PUParticleSystem3D* particleSyst
auto children = parentSystem->getChildren();
for(auto iter : children)
{
PUParticleSystem3D *child = static_cast<PUParticleSystem3D *>(iter);
PUParticleSystem3D *child = dynamic_cast<PUParticleSystem3D *>(iter);
if (child){
system = child;
emitter = system->getEmitter(_forceEmitterName);

View File

@ -155,6 +155,7 @@ set(TESTS_SRC
Classes/PerformanceTest/PerformanceAllocTest.cpp
Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp
Classes/PerformanceTest/PerformanceParticleTest.cpp
Classes/PerformanceTest/PerformanceParticle3DTest.cpp
Classes/PerformanceTest/PerformanceSpriteTest.cpp
Classes/PerformanceTest/PerformanceTest.cpp
Classes/PerformanceTest/PerformanceTextureTest.cpp

View File

@ -882,8 +882,9 @@ void CameraCullingDemo::update(float dt)
void CameraCullingDemo::reachEndCallBack()
{
_cameraFirst->stopActionByTag(100);
auto inverse = (MoveTo*)_moveAction->reverse();
auto inverse = MoveTo::create(4.f, Vec2(-_cameraFirst->getPositionX(), 0));
inverse->retain();
_moveAction->release();
_moveAction = inverse;
auto rot = RotateBy::create(1.f, Vec3(0.f, 180.f, 0.f));
@ -902,7 +903,7 @@ void CameraCullingDemo::switchViewCallback(Ref* sender)
_cameraFirst->setCameraFlag(CameraFlag::USER8);
_cameraFirst->setPosition3D(Vec3(-100,0,0));
_cameraFirst->lookAt(Vec3(1000,0,0));
_moveAction = MoveTo::create(4.f, Vec2(100, 0));
_moveAction = MoveTo::create(4.f, Vec2(-_cameraFirst->getPositionX(), 0));
_moveAction->retain();
auto seq = Sequence::create(_moveAction, CallFunc::create(CC_CALLBACK_0(CameraCullingDemo::reachEndCallBack, this)), nullptr);
seq->setTag(100);

View File

@ -0,0 +1,204 @@
#include "PerformanceParticle3DTest.h"
#include "Particle3D/PU/CCPUParticleSystem3D.h"
static int kTagInfoLayer = 1;
static int kTagMenuLayer = 1000;
static int kTagParticleSystem = 1001;
static int test_Count = 2;
static int kMaxParticles = 14000;
static int kNodesIncrease = 1;
static int s_parCurIdx = 0;
////////////////////////////////////////////////////////
//
// ParticleMenuLayer
//
////////////////////////////////////////////////////////
Particle3DMenuLayer::Particle3DMenuLayer(bool isControlMenuVisible, int maxCases, int curCase)
: PerformBasicLayer(isControlMenuVisible, maxCases, curCase)
{
}
void Particle3DMenuLayer::showCurrentTest()
{
auto scene = (Particle3DMainScene*)getParent();
int subTest = scene->getSubTestNum();
int parNum = scene->getParticlesNum();
Particle3DMainScene* pNewScene = nullptr;
switch (_curCase)
{
case 0:
pNewScene = new (std::nothrow) Particle3DPerformTest;
break;
}
s_parCurIdx = _curCase;
if (pNewScene)
{
pNewScene->initWithSubTest(subTest, parNum);
Director::getInstance()->replaceScene(pNewScene);
pNewScene->release();
}
}
////////////////////////////////////////////////////////
//
// ParticleMainScene
//
////////////////////////////////////////////////////////
void Particle3DMainScene::initWithSubTest(int asubtest, int particles)
{
//srandom(0);
_subtestNumber = asubtest;
auto s = Director::getInstance()->getWinSize();
_lastRenderedCount = 0;
_quantityParticles = 0;
MenuItemFont::setFontSize(65);
auto decrease = MenuItemFont::create(" - ", [=](Ref *sender) {
_quantityParticles -= kNodesIncrease;
if( _quantityParticles < 0 )
_quantityParticles = 0;
updateQuantityLabel();
removeChildByTag(kTagParticleSystem + _quantityParticles, true);
});
decrease->setColor(Color3B(0,200,20));
auto increase = MenuItemFont::create(" + ", [=](Ref *sender) {
_quantityParticles += kNodesIncrease;
if( _quantityParticles > kMaxParticles )
_quantityParticles = kMaxParticles;
updateQuantityLabel();
createParticleSystem(_quantityParticles - 1);
});
increase->setColor(Color3B(0,200,20));
auto menu = Menu::create(decrease, increase, nullptr);
menu->alignItemsHorizontally();
menu->setPosition(Vec2(s.width/2, s.height/2+15));
addChild(menu, 1);
auto infoLabel = Label::createWithTTF("0 Particle Systems", "fonts/Marker Felt.ttf", 30);
infoLabel->setColor(Color3B(0,200,20));
infoLabel->setPosition(Vec2(s.width/2, s.height - 90));
addChild(infoLabel, 1, kTagInfoLayer);
// Next Prev Test
auto menuLayer = new (std::nothrow) Particle3DMenuLayer(true, test_Count, s_parCurIdx);
addChild(menuLayer, 1, kTagMenuLayer);
menuLayer->release();
auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32);
addChild(label, 1);
label->setPosition(Vec2(s.width/2, s.height-50));
auto camera = Camera::createPerspective(30.0f, s.width / s.height, 1.0f, 1000.0f);
camera->setPosition3D(Vec3(0.0f, 0.0f, 150.0f));
camera->lookAt(Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f));
camera->setCameraFlag(CameraFlag::USER1);
this->addChild(camera);
TTFConfig config("fonts/tahoma.ttf",10);
_particleLab = Label::createWithTTF(config,"Particle Count: 0",TextHAlignment::LEFT);
_particleLab->setPosition(Vec2(0.0f, s.height / 6.0f));
_particleLab->setAnchorPoint(Vec2(0.0f, 0.0f));
this->addChild(_particleLab);
_quantityParticles = 1;
updateQuantityLabel();
createParticleSystem(_quantityParticles - 1);
schedule(CC_SCHEDULE_SELECTOR(Particle3DMainScene::step));
}
std::string Particle3DMainScene::title() const
{
return "No title";
}
void Particle3DMainScene::step(float dt)
{
unsigned int count = 0;
for (int i = 0; i < _quantityParticles; i++)
{
ParticleSystem3D *ps = static_cast<ParticleSystem3D *>(this->getChildByTag(kTagParticleSystem + i));
if (ps){
auto children = ps->getChildren();
for (auto iter : children){
ParticleSystem3D *child = dynamic_cast<ParticleSystem3D *>(iter);
if (child){
count += child->getAliveParticleCount();
}
}
char str[128];
sprintf(str, "Particle Count: %d", count);
_particleLab->setString(str);
}
}
}
void Particle3DMainScene::createParticleSystem(int idx)
{
auto ps = PUParticleSystem3D::create("Particle3D/scripts/example_004.pu", "Particle3D/materials/pu_example.material");
ps->setCameraMask((unsigned short)CameraFlag::USER1);
ps->setPosition(CCRANDOM_MINUS1_1() * 50.0f, CCRANDOM_MINUS1_1() * 20.0f);
ps->startParticleSystem();
addChild(ps, 0, kTagParticleSystem + idx);
}
void Particle3DMainScene::testNCallback(Ref* sender)
{
_subtestNumber = static_cast<Node*>(sender)->getTag();
auto menu = static_cast<Particle3DMenuLayer*>( getChildByTag(kTagMenuLayer) );
menu->restartCallback(sender);
}
void Particle3DMainScene::updateQuantityLabel()
{
if( _quantityParticles != _lastRenderedCount )
{
auto infoLabel = (Label *) getChildByTag(kTagInfoLayer);
char str[20] = {0};
sprintf(str, "%u Particle Systems", _quantityParticles);
infoLabel->setString(str);
_lastRenderedCount = _quantityParticles;
}
}
////////////////////////////////////////////////////////
//
// ParticlePerformTest1
//
////////////////////////////////////////////////////////
std::string Particle3DPerformTest::title() const
{
char str[20] = {0};
sprintf(str, "Particle3D Test"/*, subtestNumber*/);
std::string strRet = str;
return strRet;
}
void Particle3DPerformTest::doTest()
{
auto s = Director::getInstance()->getWinSize();
}
void runParticle3DTest()
{
auto scene = new (std::nothrow) Particle3DPerformTest;
scene->initWithSubTest(1, kNodesIncrease);
Director::getInstance()->replaceScene(scene);
scene->release();
}

View File

@ -0,0 +1,43 @@
#ifndef __PERFORMANCE_PARTICLE_3D_TEST_H__
#define __PERFORMANCE_PARTICLE_3D_TEST_H__
#include "PerformanceTest.h"
class Particle3DMenuLayer : public PerformBasicLayer
{
public:
Particle3DMenuLayer(bool isControlMenuVisible, int maxCases = 0, int curCase = 0);
virtual void showCurrentTest();
};
class Particle3DMainScene : public Scene
{
public:
virtual void initWithSubTest(int subtest, int particles);
virtual std::string title() const;
void step(float dt);
void createParticleSystem(int idx);
void testNCallback(Ref* sender);
void updateQuantityLabel();
int getSubTestNum() { return _subtestNumber; }
int getParticlesNum() { return _quantityParticles; }
virtual void doTest() = 0;
protected:
int _lastRenderedCount;
int _quantityParticles;
int _subtestNumber;
cocos2d::Label *_particleLab;
};
class Particle3DPerformTest : public Particle3DMainScene
{
public:
virtual std::string title() const override;
virtual void doTest();
};
void runParticle3DTest();
#endif

View File

@ -2,6 +2,7 @@
#include "../testResource.h"
#include "PerformanceNodeChildrenTest.h"
#include "PerformanceParticleTest.h"
#include "PerformanceParticle3DTest.h"
#include "PerformanceSpriteTest.h"
#include "PerformanceTextureTest.h"
#include "PerformanceTouchesTest.h"
@ -28,6 +29,7 @@ struct {
{ "Alloc Test", [](Ref*sender){runAllocPerformanceTest(); } },
{ "NodeChildren Test", [](Ref*sender){runNodeChildrenTest();} },
{ "Particle Test",[](Ref*sender){runParticleTest();} },
{ "Particle3D Perf Test",[](Ref*sender){runParticle3DTest();} },
{ "Sprite Perf Test",[](Ref*sender){runSpriteTest();} },
{ "Texture Perf Test",[](Ref*sender){runTextureTest();} },
{ "Touches Perf Test",[](Ref*sender){runTouchesTest();} },

View File

@ -368,6 +368,17 @@ Sprite3DUVAnimationTest::Sprite3DUVAnimationTest()
glProgram->initWithFilenames("Sprite3DTest/cylinder.vert", "Sprite3DTest/cylinder.frag");
glProgram->link();
glProgram->updateUniforms();
auto shining_texture = Director::getInstance()->getTextureCache()->addImage("Sprite3DTest/caustics.png");
Texture2D::TexParams tRepeatParams;//set texture parameters
tRepeatParams.magFilter = GL_NEAREST;
tRepeatParams.minFilter = GL_NEAREST;
tRepeatParams.wrapS = GL_REPEAT;
tRepeatParams.wrapT = GL_REPEAT;
shining_texture->setTexParameters(tRepeatParams);
//pass the texture sampler to our custom shader
_state->setUniformTexture("caustics",shining_texture);
_state->setUniformFloat("offset",_cylinder_texture_offset);
_state->setUniformFloat("duration",_shining_duraion);
}
);
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);

View File

@ -0,0 +1,32 @@
system example_004
{
category Examples_1_10
technique
{
visual_particle_quota 100
material ParticleUniverse/Star
default_particle_width 0.6
default_particle_height 0.6
renderer Billboard
{
}
emitter SphereSurface
{
emission_rate 60
time_to_live 1.8
velocity 0
direction 0 0 0
radius 3
}
affector Colour
{
time_colour 0 1 1 0 1
time_colour 1 1 0 0 0
}
affector Gravity
{
mass_affector 0.03
gravity 150
}
}
}

View File

@ -158,6 +158,7 @@ LOCAL_SRC_FILES := main.cpp \
../../Classes/PerformanceTest/PerformanceAllocTest.cpp \
../../Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp \
../../Classes/PerformanceTest/PerformanceParticleTest.cpp \
../../Classes/PerformanceTest/PerformanceParticle3DTest.cpp \
../../Classes/PerformanceTest/PerformanceSpriteTest.cpp \
../../Classes/PerformanceTest/PerformanceTest.cpp \
../../Classes/PerformanceTest/PerformanceTextureTest.cpp \

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -189,12 +189,13 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
<ClCompile Include="..\Classes\NewEventDispatcherTest\NewEventDispatcherTest.cpp" />
<ClCompile Include="..\Classes\NewRendererTest\NewRendererTest.cpp" />
<ClCompile Include="..\Classes\Particle3DTest\Particle3DTest.cpp" />
<ClCompile Include="..\Classes\CocosStudio3DTest\CocosStudio3DTest.cpp" />
<ClCompile Include="..\Classes\CocosStudio3DTest\CocosStudio3DTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceAllocTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceContainerTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceEventDispatcherTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceLabelTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceMathTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceParticle3DTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceRendererTest.cpp" />
<ClCompile Include="..\Classes\PerformanceTest\PerformanceScenarioTest.cpp" />
<ClCompile Include="..\Classes\PhysicsTest\PhysicsTest.cpp" />
@ -388,12 +389,13 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
<ClInclude Include="..\Classes\NewEventDispatcherTest\NewEventDispatcherTest.h" />
<ClInclude Include="..\Classes\NewRendererTest\NewRendererTest.h" />
<ClInclude Include="..\Classes\Particle3DTest\Particle3DTest.h" />
<ClInclude Include="..\Classes\CocosStudio3DTest\CocosStudio3DTest.h" />
<ClInclude Include="..\Classes\CocosStudio3DTest\CocosStudio3DTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceAllocTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceContainerTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceEventDispatcherTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceLabelTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceMathTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceParticle3DTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceRendererTest.h" />
<ClInclude Include="..\Classes\PerformanceTest\PerformanceScenarioTest.h" />
<ClInclude Include="..\Classes\PhysicsTest\PhysicsTest.h" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="win32">
@ -345,7 +345,7 @@
</Filter>
<Filter Include="Classes\CocosStudio3DTest">
<UniqueIdentifier>{e4104916-24d0-49b8-a864-d273ea13a248}</UniqueIdentifier>
</Filter>
</Filter>
<Filter Include="Classes\UITest\CocostudioGUISceneTest\CustomTest\CustomWidgetCallbackBindTest">
<UniqueIdentifier>{65be3b70-58d6-47f4-bc67-fac9ee134c42}</UniqueIdentifier>
</Filter>
@ -905,7 +905,7 @@
</ClCompile>
<ClCompile Include="..\Classes\CocosStudio3DTest\CocosStudio3DTest.cpp">
<Filter>Classes\CocosStudio3DTest</Filter>
</ClCompile>
</ClCompile>
<ClCompile Include="..\Classes\PerformanceTest\PerformanceMathTest.cpp">
<Filter>Classes\PerformanceTest</Filter>
</ClCompile>
@ -921,6 +921,9 @@
<ClCompile Include="..\Classes\AllocatorTest\AllocatorTest.cpp">
<Filter>Classes\AllocatorTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\PerformanceTest\PerformanceParticle3DTest.cpp">
<Filter>Classes\PerformanceTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
@ -1672,7 +1675,7 @@
</ClInclude>
<ClInclude Include="..\Classes\CocosStudio3DTest\CocosStudio3DTest.h">
<Filter>Classes\CocosStudio3DTest</Filter>
</ClInclude>
</ClInclude>
<ClInclude Include="..\Classes\PerformanceTest\PerformanceMathTest.h">
<Filter>Classes\PerformanceTest</Filter>
</ClInclude>
@ -1688,5 +1691,8 @@
<ClInclude Include="..\Classes\AllocatorTest\AllocatorTest.h">
<Filter>Classes\AllocatorTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\PerformanceTest\PerformanceParticle3DTest.h">
<Filter>Classes\PerformanceTest</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -115,7 +115,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\OpenURLTest\OpenURLTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\ParallaxTest\ParallaxTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\Particle3DTest\Particle3DTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\CocosStudio3DTest\CocosStudio3DTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\CocosStudio3DTest\CocosStudio3DTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\ParticleTest\ParticleTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceAllocTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceCallbackTest.cpp" />
@ -124,6 +124,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceLabelTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceMathTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceNodeChildrenTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceParticle3DTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceParticleTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceRendererTest.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceScenarioTest.cpp" />
@ -375,7 +376,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\OpenURLTest\OpenURLTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\ParallaxTest\ParallaxTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\Particle3DTest\Particle3DTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\CocosStudio3DTest\CocosStudio3DTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\CocosStudio3DTest\CocosStudio3DTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\ParticleTest\ParticleTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceAllocTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceCallbackTest.h" />
@ -384,6 +385,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceLabelTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceMathTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceNodeChildrenTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceParticle3DTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceParticleTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceRendererTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceScenarioTest.h" />

View File

@ -771,7 +771,10 @@
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\CocosStudio3DTest\CocosStudio3DTest.cpp">
<Filter>Classes\CocosStudio3DTest</Filter>
</ClCompile>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceParticle3DTest.cpp">
<Filter>Classes\PerformanceTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\ActionManagerTest\ActionManagerTest.cpp">
@ -1673,7 +1676,7 @@
</Filter>
<Filter Include="Classes\CocosStudio3DTest">
<UniqueIdentifier>{65d0104d-321a-41f7-99af-de609183f206}</UniqueIdentifier>
</Filter>
</Filter>
</ItemGroup>
<ItemGroup>
<Page Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml" />
@ -1700,6 +1703,9 @@
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\CocosStudio3DTest\CocosStudio3DTest.h">
<Filter>Classes\CocosStudio3DTest</Filter>
</ClInclude>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Classes\PerformanceTest\PerformanceParticle3DTest.h">
<Filter>Classes\PerformanceTest</Filter>
</ClInclude>
</ItemGroup>
</Project>