mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' into v3-wp8-fix
This commit is contained in:
commit
e93fe1b13b
|
@ -131,17 +131,26 @@ void Animate3D::startWithTarget(Node *target)
|
||||||
auto action = (*runningAction).second;
|
auto action = (*runningAction).second;
|
||||||
if (action != this)
|
if (action != this)
|
||||||
{
|
{
|
||||||
s_fadeOutAnimates[sprite] = action;
|
if (_transTime < 0.001f)
|
||||||
action->_state = Animate3D::Animate3DState::FadeOut;
|
{
|
||||||
action->_accTransTime = 0.0f;
|
s_runningAnimates[sprite] = this;
|
||||||
action->_weight = 1.0f;
|
_state = Animate3D::Animate3DState::Running;
|
||||||
action->_lastTime = 0.f;
|
_weight = 1.0f;
|
||||||
|
}
|
||||||
s_fadeInAnimates[sprite] = this;
|
else
|
||||||
_accTransTime = 0.0f;
|
{
|
||||||
_state = Animate3D::Animate3DState::FadeIn;
|
s_fadeOutAnimates[sprite] = action;
|
||||||
_weight = 0.f;
|
action->_state = Animate3D::Animate3DState::FadeOut;
|
||||||
_lastTime = 0.f;
|
action->_accTransTime = 0.0f;
|
||||||
|
action->_weight = 1.0f;
|
||||||
|
action->_lastTime = 0.f;
|
||||||
|
|
||||||
|
s_fadeInAnimates[sprite] = this;
|
||||||
|
_accTransTime = 0.0f;
|
||||||
|
_state = Animate3D::Animate3DState::FadeIn;
|
||||||
|
_weight = 0.f;
|
||||||
|
_lastTime = 0.f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -89,9 +89,12 @@ public:
|
||||||
void setOriginInterval(float interval);
|
void setOriginInterval(float interval);
|
||||||
float getOriginInterval() const {return _originInterval; }
|
float getOriginInterval() const {return _originInterval; }
|
||||||
|
|
||||||
/** animate transition time */
|
/** get animate transition time between 3d animations */
|
||||||
static float getTransitionTime() { return _transTime; }
|
static float getTransitionTime() { return _transTime; }
|
||||||
|
|
||||||
|
/** set animate transition time between 3d animations */
|
||||||
|
static void setTransitionTime(float transTime) { if (transTime >= 0.f) _transTime = transTime; }
|
||||||
|
|
||||||
/**get & set play reverse, these are deprecated, use set negative speed instead*/
|
/**get & set play reverse, these are deprecated, use set negative speed instead*/
|
||||||
CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
|
CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
|
||||||
CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; }
|
CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; }
|
||||||
|
|
|
@ -723,15 +723,11 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
GLuint textureID = mesh->getTexture() ? mesh->getTexture()->getName() : 0;
|
GLuint textureID = mesh->getTexture() ? mesh->getTexture()->getName() : 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float globalZ = _globalZOrder;
|
|
||||||
bool isTransparent = (mesh->_isTransparent || color.a < 1.f);
|
bool isTransparent = (mesh->_isTransparent || color.a < 1.f);
|
||||||
if (isTransparent && Camera::getVisitingCamera())
|
float globalZ = isTransparent ? 0 : _globalZOrder;
|
||||||
{
|
if (isTransparent)
|
||||||
// use the view matrix for Applying to recalculating transparent mesh's Z-Order
|
flags |= Node::FLAGS_RENDER_AS_3D;
|
||||||
const auto& viewMat = Camera::getVisitingCamera()->getViewMatrix();
|
|
||||||
//fetch the Z from the result matrix
|
|
||||||
globalZ = -(viewMat.m[2] * transform.m[12] + viewMat.m[6] * transform.m[13] + viewMat.m[10] * transform.m[14] + viewMat.m[14]);
|
|
||||||
}
|
|
||||||
meshCommand.init(globalZ, textureID, programstate, _blend, mesh->getVertexBuffer(), mesh->getIndexBuffer(), mesh->getPrimitiveType(), mesh->getIndexFormat(), mesh->getIndexCount(), transform, flags);
|
meshCommand.init(globalZ, textureID, programstate, _blend, mesh->getVertexBuffer(), mesh->getIndexBuffer(), mesh->getPrimitiveType(), mesh->getIndexFormat(), mesh->getIndexCount(), transform, flags);
|
||||||
|
|
||||||
meshCommand.setLightMask(_lightMask);
|
meshCommand.setLightMask(_lightMask);
|
||||||
|
|
|
@ -111,6 +111,8 @@ void MeshCommand::init(float globalZOrder,
|
||||||
{
|
{
|
||||||
CCASSERT(glProgramState, "GLProgramState cannot be nill");
|
CCASSERT(glProgramState, "GLProgramState cannot be nill");
|
||||||
|
|
||||||
|
RenderCommand::init(globalZOrder, mv, flags);
|
||||||
|
|
||||||
_globalOrder = globalZOrder;
|
_globalOrder = globalZOrder;
|
||||||
_textureID = textureID;
|
_textureID = textureID;
|
||||||
_blendType = blendType;
|
_blendType = blendType;
|
||||||
|
|
|
@ -48,7 +48,9 @@ void RenderCommand::init(float globalZOrder, const cocos2d::Mat4 &transform, uin
|
||||||
_globalOrder = globalZOrder;
|
_globalOrder = globalZOrder;
|
||||||
if (flags & Node::FLAGS_RENDER_AS_3D)
|
if (flags & Node::FLAGS_RENDER_AS_3D)
|
||||||
{
|
{
|
||||||
_depth = Camera::getVisitingCamera()->getDepthInView(transform);
|
if (Camera::getVisitingCamera())
|
||||||
|
_depth = Camera::getVisitingCamera()->getDepthInView(transform);
|
||||||
|
|
||||||
set3D(true);
|
set3D(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
-- @return Animate3D#Animate3D ret (return value: cc.Animate3D)
|
-- @return Animate3D#Animate3D ret (return value: cc.Animate3D)
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- animate transition time
|
-- get animate transition time between 3d animations
|
||||||
-- @function [parent=#Animate3D] getTransitionTime
|
-- @function [parent=#Animate3D] getTransitionTime
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @return float#float ret (return value: float)
|
-- @return float#float ret (return value: float)
|
||||||
|
@ -74,6 +74,13 @@
|
||||||
-- @param #float frameRate
|
-- @param #float frameRate
|
||||||
-- @return Animate3D#Animate3D ret (return value: cc.Animate3D)
|
-- @return Animate3D#Animate3D ret (return value: cc.Animate3D)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- set animate transition time between 3d animations
|
||||||
|
-- @function [parent=#Animate3D] setTransitionTime
|
||||||
|
-- @param self
|
||||||
|
-- @param #float transTime
|
||||||
|
-- @return Animate3D#Animate3D self (return value: cc.Animate3D)
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--
|
--
|
||||||
-- @function [parent=#Animate3D] startWithTarget
|
-- @function [parent=#Animate3D] startWithTarget
|
||||||
|
|
|
@ -2565,6 +2565,42 @@ int lua_cocos2dx_3d_Animate3D_createWithFrames(lua_State* tolua_S)
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_3d_Animate3D_setTransitionTime(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertable(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S) - 1;
|
||||||
|
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
double arg0;
|
||||||
|
ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Animate3D:setTransitionTime");
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Animate3D_setTransitionTime'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cocos2d::Animate3D::setTransitionTime(arg0);
|
||||||
|
lua_settop(tolua_S, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Animate3D:setTransitionTime",argc, 1);
|
||||||
|
return 0;
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Animate3D_setTransitionTime'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
static int lua_cocos2dx_3d_Animate3D_finalize(lua_State* tolua_S)
|
static int lua_cocos2dx_3d_Animate3D_finalize(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
printf("luabindings: finalizing LUA object (Animate3D)");
|
printf("luabindings: finalizing LUA object (Animate3D)");
|
||||||
|
@ -2586,6 +2622,7 @@ int lua_register_cocos2dx_3d_Animate3D(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"create", lua_cocos2dx_3d_Animate3D_create);
|
tolua_function(tolua_S,"create", lua_cocos2dx_3d_Animate3D_create);
|
||||||
tolua_function(tolua_S,"getTransitionTime", lua_cocos2dx_3d_Animate3D_getTransitionTime);
|
tolua_function(tolua_S,"getTransitionTime", lua_cocos2dx_3d_Animate3D_getTransitionTime);
|
||||||
tolua_function(tolua_S,"createWithFrames", lua_cocos2dx_3d_Animate3D_createWithFrames);
|
tolua_function(tolua_S,"createWithFrames", lua_cocos2dx_3d_Animate3D_createWithFrames);
|
||||||
|
tolua_function(tolua_S,"setTransitionTime", lua_cocos2dx_3d_Animate3D_setTransitionTime);
|
||||||
tolua_endmodule(tolua_S);
|
tolua_endmodule(tolua_S);
|
||||||
std::string typeName = typeid(cocos2d::Animate3D).name();
|
std::string typeName = typeid(cocos2d::Animate3D).name();
|
||||||
g_luaType[typeName] = "cc.Animate3D";
|
g_luaType[typeName] = "cc.Animate3D";
|
||||||
|
|
|
@ -74,6 +74,7 @@ int register_all_cocos2dx_3d(lua_State* tolua_S);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __cocos2dx_3d_h__
|
#endif // __cocos2dx_3d_h__
|
||||||
|
|
|
@ -216,8 +216,9 @@ void PUParticle3DQuadRender::render(Renderer* renderer, const Mat4 &transform, P
|
||||||
_indexBuffer->updateIndices(&_indexData[0], index/* * sizeof(unsigned short)*/, 0);
|
_indexBuffer->updateIndices(&_indexData[0], index/* * sizeof(unsigned short)*/, 0);
|
||||||
|
|
||||||
GLuint texId = (_texture ? _texture->getName() : 0);
|
GLuint texId = (_texture ? _texture->getName() : 0);
|
||||||
float depthZ = -(viewMat.m[2] * transform.m[12] + viewMat.m[6] * transform.m[13] + viewMat.m[10] * transform.m[14] + viewMat.m[14]);
|
// float depthZ = -(viewMat.m[2] * transform.m[12] + viewMat.m[6] * transform.m[13] + viewMat.m[10] * transform.m[14] + viewMat.m[14]);
|
||||||
_meshCommand->init(depthZ, texId, _glProgramState, particleSystem->getBlendFunc(), _vertexBuffer->getVBO(), _indexBuffer->getVBO(), GL_TRIANGLES, GL_UNSIGNED_SHORT, index, transform, 0);
|
_meshCommand->init(0, texId, _glProgramState, particleSystem->getBlendFunc(), _vertexBuffer->getVBO(), _indexBuffer->getVBO(), GL_TRIANGLES, GL_UNSIGNED_SHORT, index, transform, Node::FLAGS_RENDER_AS_3D);
|
||||||
|
_meshCommand->setTransparent(true);
|
||||||
renderer->addCommand(_meshCommand);
|
renderer->addCommand(_meshCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ static std::function<Layer*()> createFunctions[] =
|
||||||
CL(Particle3DUVAnimDemo),
|
CL(Particle3DUVAnimDemo),
|
||||||
CL(Particle3DFirePlaceDemo),
|
CL(Particle3DFirePlaceDemo),
|
||||||
CL(Particle3DElectricBeamSystemDemo),
|
CL(Particle3DElectricBeamSystemDemo),
|
||||||
CL(Particle3DExplosionBlueDemo),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||||
|
@ -242,7 +241,7 @@ bool Particle3DBlackHoleDemo::init()
|
||||||
if (!Particle3DTestDemo::init())
|
if (!Particle3DTestDemo::init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto rootps = PUParticleSystem3D::create("blackHole.pu", "pu_mediapack_01.material");
|
auto rootps = PUParticleSystem3D::create("blackHole.pu", "pu_example.material");
|
||||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
rootps->setPosition(-25.0f, 0.0f);
|
rootps->setPosition(-25.0f, 0.0f);
|
||||||
auto moveby = MoveBy::create(2.0f, Vec2(50.0f, 0.0f));
|
auto moveby = MoveBy::create(2.0f, Vec2(50.0f, 0.0f));
|
||||||
|
@ -269,7 +268,7 @@ bool Particle3DHypnoDemo::init()
|
||||||
if (!Particle3DTestDemo::init())
|
if (!Particle3DTestDemo::init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto rootps = PUParticleSystem3D::create("hypno.pu", "pu_mediapack_01.material");
|
auto rootps = PUParticleSystem3D::create("hypno.pu", "pu_example.material");
|
||||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
// auto scale = ScaleBy::create(1.0f, 2.0f, 2.0f, 2.0f);
|
// auto scale = ScaleBy::create(1.0f, 2.0f, 2.0f, 2.0f);
|
||||||
// auto rotate = RotateBy::create(1.0f, Vec3(0.0, 100.0f, 0.0f));
|
// auto rotate = RotateBy::create(1.0f, Vec3(0.0, 100.0f, 0.0f));
|
||||||
|
@ -292,7 +291,7 @@ bool Particle3DTimeShiftDemo::init()
|
||||||
if (!Particle3DTestDemo::init())
|
if (!Particle3DTestDemo::init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto rootps = PUParticleSystem3D::create("timeShift.pu", "pu_mediapack_01.material");
|
auto rootps = PUParticleSystem3D::create("timeShift.pu", "pu_example.material");
|
||||||
rootps->setScale(2.0f);
|
rootps->setScale(2.0f);
|
||||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
rootps->startParticleSystem();
|
rootps->startParticleSystem();
|
||||||
|
@ -312,7 +311,7 @@ bool Particle3DUVAnimDemo::init()
|
||||||
if (!Particle3DTestDemo::init())
|
if (!Particle3DTestDemo::init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto rootps = PUParticleSystem3D::create("UVAnimation.pu", "pu_mediapack_01.material");
|
auto rootps = PUParticleSystem3D::create("UVAnimation.pu", "pu_example.material");
|
||||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
rootps->startParticleSystem();
|
rootps->startParticleSystem();
|
||||||
|
|
||||||
|
@ -331,7 +330,7 @@ bool Particle3DFirePlaceDemo::init()
|
||||||
if (!Particle3DTestDemo::init())
|
if (!Particle3DTestDemo::init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto rootps = PUParticleSystem3D::create("mp_torch.pu", "pu_mediapack_01.material");
|
auto rootps = PUParticleSystem3D::create("mp_torch.pu", "pu_example.material");
|
||||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
rootps->setScale(5.0f);
|
rootps->setScale(5.0f);
|
||||||
rootps->startParticleSystem();
|
rootps->startParticleSystem();
|
||||||
|
@ -352,7 +351,7 @@ bool Particle3DLineStreakDemo::init()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
auto rootps = PUParticleSystem3D::create("lineStreak.pu", "pu_mediapack_01.material");
|
auto rootps = PUParticleSystem3D::create("lineStreak.pu", "pu_example.material");
|
||||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||||
rootps->setScale(5.0f);
|
rootps->setScale(5.0f);
|
||||||
//rootps->runAction(RepeatForever::create(Sequence::create(rotate, nullptr)));
|
//rootps->runAction(RepeatForever::create(Sequence::create(rotate, nullptr)));
|
||||||
|
@ -385,23 +384,3 @@ bool Particle3DElectricBeamSystemDemo::init()
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Particle3DExplosionBlueDemo::subtitle() const
|
|
||||||
{
|
|
||||||
return "ExplosionBlue";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Particle3DExplosionBlueDemo::init()
|
|
||||||
{
|
|
||||||
if (!Particle3DTestDemo::init())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
|
|
||||||
auto rootps = PUParticleSystem3D::create("mp_explosion_04_blue.pu");
|
|
||||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
|
||||||
rootps->setScale(0.25f);
|
|
||||||
rootps->startParticleSystem();
|
|
||||||
this->addChild(rootps, 0, PARTICLE_SYSTEM_TAG);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -162,19 +162,6 @@ public:
|
||||||
virtual bool init() override;
|
virtual bool init() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Particle3DExplosionBlueDemo : public Particle3DTestDemo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
CREATE_FUNC(Particle3DExplosionBlueDemo);
|
|
||||||
Particle3DExplosionBlueDemo(){};
|
|
||||||
virtual ~Particle3DExplosionBlueDemo(){};
|
|
||||||
|
|
||||||
virtual std::string subtitle() const override;
|
|
||||||
|
|
||||||
virtual bool init() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Particle3DTestScene : public TestScene
|
class Particle3DTestScene : public TestScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -539,3 +539,123 @@ material ParticleUniverse/Beam_2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
material PUMediaPack/Pentagram_02
|
||||||
|
{
|
||||||
|
technique
|
||||||
|
{
|
||||||
|
pass
|
||||||
|
{
|
||||||
|
lighting off
|
||||||
|
scene_blend add
|
||||||
|
depth_write off
|
||||||
|
|
||||||
|
texture_unit
|
||||||
|
{
|
||||||
|
texture pump_pentagram_02.png
|
||||||
|
tex_address_mode clamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
material PUMediaPack/Flare_04
|
||||||
|
{
|
||||||
|
technique
|
||||||
|
{
|
||||||
|
pass
|
||||||
|
{
|
||||||
|
lighting off
|
||||||
|
scene_blend add
|
||||||
|
depth_write off
|
||||||
|
|
||||||
|
texture_unit
|
||||||
|
{
|
||||||
|
texture pump_flare_04.png
|
||||||
|
tex_address_mode clamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
material PUMediaPack/Streak_03
|
||||||
|
{
|
||||||
|
technique
|
||||||
|
{
|
||||||
|
pass
|
||||||
|
{
|
||||||
|
lighting off
|
||||||
|
scene_blend add
|
||||||
|
depth_write off
|
||||||
|
|
||||||
|
texture_unit
|
||||||
|
{
|
||||||
|
texture pump_streak_03.png
|
||||||
|
tex_address_mode clamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
|
material ParticleUniverse/Swirl_02
|
||||||
|
{
|
||||||
|
technique
|
||||||
|
{
|
||||||
|
pass
|
||||||
|
{
|
||||||
|
lighting off
|
||||||
|
scene_blend add
|
||||||
|
depth_write off
|
||||||
|
|
||||||
|
texture_unit
|
||||||
|
{
|
||||||
|
texture pump_swirl_02.png
|
||||||
|
tex_address_mode clamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
material PUMediaPack/Watch
|
||||||
|
{
|
||||||
|
technique
|
||||||
|
{
|
||||||
|
pass
|
||||||
|
{
|
||||||
|
lighting off
|
||||||
|
depth_write off
|
||||||
|
scene_blend add
|
||||||
|
|
||||||
|
texture_unit
|
||||||
|
{
|
||||||
|
texture pump_watch.png
|
||||||
|
tex_address_mode clamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
material PUMediaPack/Hourglass
|
||||||
|
{
|
||||||
|
technique
|
||||||
|
{
|
||||||
|
pass
|
||||||
|
{
|
||||||
|
lighting off
|
||||||
|
depth_write off
|
||||||
|
scene_blend add
|
||||||
|
|
||||||
|
texture_unit
|
||||||
|
{
|
||||||
|
texture pump_hourglass.png
|
||||||
|
tex_address_mode clamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,380 +0,0 @@
|
||||||
//-----------------------------------------------------------------------------------------------------------------------
|
|
||||||
// This script is part of the Particle Universe Media Pack 1 product.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2010 Henry van Merode
|
|
||||||
//
|
|
||||||
// Usage of this program is licensed under the terms of the Particle Universe Commercial License Media Pack 1.
|
|
||||||
// You can find a copy of the Commercial License in the Media Pack 1 package.
|
|
||||||
//-----------------------------------------------------------------------------------------------------------------------
|
|
||||||
system Explosion/mp_explosion_04_blue
|
|
||||||
{
|
|
||||||
technique
|
|
||||||
{
|
|
||||||
visual_particle_quota 12
|
|
||||||
material mp_explosion_04
|
|
||||||
renderer Billboard
|
|
||||||
{
|
|
||||||
texture_coords_rows 2
|
|
||||||
texture_coords_columns 2
|
|
||||||
billboard_rotation_type vertex
|
|
||||||
}
|
|
||||||
emitter Point
|
|
||||||
{
|
|
||||||
emission_rate 100
|
|
||||||
angle 360
|
|
||||||
time_to_live dyn_random
|
|
||||||
{
|
|
||||||
min 0.4
|
|
||||||
max 1.2
|
|
||||||
}
|
|
||||||
velocity dyn_random
|
|
||||||
{
|
|
||||||
min 100
|
|
||||||
max 500
|
|
||||||
}
|
|
||||||
duration 0.1
|
|
||||||
all_particle_dimensions dyn_random
|
|
||||||
{
|
|
||||||
min 1
|
|
||||||
max 50
|
|
||||||
}
|
|
||||||
colour 0.670588 0.8 0.996078 1
|
|
||||||
}
|
|
||||||
affector ScaleVelocity
|
|
||||||
{
|
|
||||||
velocity_scale dyn_curved_linear
|
|
||||||
{
|
|
||||||
control_point 0 -1500
|
|
||||||
control_point 1 -200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
affector Scale
|
|
||||||
{
|
|
||||||
xyz_scale 500
|
|
||||||
}
|
|
||||||
affector Colour
|
|
||||||
{
|
|
||||||
time_colour 0 0 0.333333 0.701961 1
|
|
||||||
time_colour 1 0 0 0 1
|
|
||||||
}
|
|
||||||
affector TextureRotator
|
|
||||||
{
|
|
||||||
rotation dyn_random
|
|
||||||
{
|
|
||||||
min -3
|
|
||||||
max 3
|
|
||||||
}
|
|
||||||
rotation_speed 0
|
|
||||||
}
|
|
||||||
observer OnTime
|
|
||||||
{
|
|
||||||
observe_until_event true
|
|
||||||
handler DoStopSystem
|
|
||||||
{
|
|
||||||
}
|
|
||||||
since_start_system true
|
|
||||||
on_time greater_than 2
|
|
||||||
}
|
|
||||||
observer OnEmission
|
|
||||||
{
|
|
||||||
handler DoPlacementParticle
|
|
||||||
{
|
|
||||||
force_emitter BlackSmokeEmitter
|
|
||||||
inherit_direction true
|
|
||||||
inherit_time_to_live true
|
|
||||||
inherit_width true
|
|
||||||
inherit_height true
|
|
||||||
inherit_depth true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
technique
|
|
||||||
{
|
|
||||||
visual_particle_quota 12
|
|
||||||
material mp_explosion_smoke_01
|
|
||||||
renderer Billboard
|
|
||||||
{
|
|
||||||
billboard_rotation_type vertex
|
|
||||||
}
|
|
||||||
emitter Point BlackSmokeEmitter
|
|
||||||
{
|
|
||||||
emission_rate 100
|
|
||||||
angle 360
|
|
||||||
time_to_live dyn_random
|
|
||||||
{
|
|
||||||
min 0.8
|
|
||||||
max 1.2
|
|
||||||
}
|
|
||||||
velocity dyn_random
|
|
||||||
{
|
|
||||||
min 100
|
|
||||||
max 500
|
|
||||||
}
|
|
||||||
duration 0.1
|
|
||||||
all_particle_dimensions dyn_random
|
|
||||||
{
|
|
||||||
min 1
|
|
||||||
max 50
|
|
||||||
}
|
|
||||||
colour 0 0 0 1
|
|
||||||
}
|
|
||||||
affector ScaleVelocity
|
|
||||||
{
|
|
||||||
velocity_scale dyn_curved_linear
|
|
||||||
{
|
|
||||||
control_point 0 -1500
|
|
||||||
control_point 1 -200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
affector Scale
|
|
||||||
{
|
|
||||||
xyz_scale 400
|
|
||||||
}
|
|
||||||
affector Colour
|
|
||||||
{
|
|
||||||
time_colour 0 0.294118 0.294118 0.294118 0
|
|
||||||
time_colour 0.5 0.172549 0.172549 0.172549 0.3
|
|
||||||
time_colour 0.6 0.137255 0.137255 0.137255 0.5
|
|
||||||
time_colour 1 0 0 0 0
|
|
||||||
}
|
|
||||||
affector TextureRotator
|
|
||||||
{
|
|
||||||
rotation dyn_random
|
|
||||||
{
|
|
||||||
min -3
|
|
||||||
max 3
|
|
||||||
}
|
|
||||||
rotation_speed 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
technique
|
|
||||||
{
|
|
||||||
visual_particle_quota 50
|
|
||||||
material mp_explosion_04
|
|
||||||
renderer Billboard
|
|
||||||
{
|
|
||||||
texture_coords_rows 2
|
|
||||||
texture_coords_columns 2
|
|
||||||
billboard_type oriented_self
|
|
||||||
billboard_origin bottom_center
|
|
||||||
billboard_rotation_type vertex
|
|
||||||
}
|
|
||||||
emitter Point
|
|
||||||
{
|
|
||||||
emission_rate 1000
|
|
||||||
angle 360
|
|
||||||
time_to_live dyn_random
|
|
||||||
{
|
|
||||||
min 0.2
|
|
||||||
max 0.4
|
|
||||||
}
|
|
||||||
velocity dyn_random
|
|
||||||
{
|
|
||||||
min 200
|
|
||||||
max 300
|
|
||||||
}
|
|
||||||
duration 0.2
|
|
||||||
particle_width dyn_random
|
|
||||||
{
|
|
||||||
min 10
|
|
||||||
max 30
|
|
||||||
}
|
|
||||||
particle_height dyn_random
|
|
||||||
{
|
|
||||||
min 1
|
|
||||||
max 10
|
|
||||||
}
|
|
||||||
texture_coords 2
|
|
||||||
colour 0.670588 0.815686 0.996078 1
|
|
||||||
}
|
|
||||||
affector Scale
|
|
||||||
{
|
|
||||||
y_scale dyn_random
|
|
||||||
{
|
|
||||||
min 100
|
|
||||||
max 300
|
|
||||||
}
|
|
||||||
}
|
|
||||||
affector Colour
|
|
||||||
{
|
|
||||||
time_colour 0 0 0.384314 0.807843 1
|
|
||||||
time_colour 0.6 1 1 1 1
|
|
||||||
time_colour 1 0 0 0 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
technique
|
|
||||||
{
|
|
||||||
visual_particle_quota 50
|
|
||||||
material mp_explosion_04
|
|
||||||
renderer Billboard
|
|
||||||
{
|
|
||||||
texture_coords_rows 2
|
|
||||||
texture_coords_columns 2
|
|
||||||
billboard_type oriented_self
|
|
||||||
billboard_origin bottom_center
|
|
||||||
billboard_rotation_type vertex
|
|
||||||
}
|
|
||||||
emitter Point
|
|
||||||
{
|
|
||||||
emission_rate 1000
|
|
||||||
angle 360
|
|
||||||
time_to_live dyn_random
|
|
||||||
{
|
|
||||||
min 0.2
|
|
||||||
max 0.4
|
|
||||||
}
|
|
||||||
velocity dyn_random
|
|
||||||
{
|
|
||||||
min 100
|
|
||||||
max 200
|
|
||||||
}
|
|
||||||
duration 0.2
|
|
||||||
particle_width dyn_random
|
|
||||||
{
|
|
||||||
min 10
|
|
||||||
max 30
|
|
||||||
}
|
|
||||||
particle_height dyn_random
|
|
||||||
{
|
|
||||||
min 1
|
|
||||||
max 10
|
|
||||||
}
|
|
||||||
texture_coords 3
|
|
||||||
colour 0.984314 0.992157 0.67451 1
|
|
||||||
}
|
|
||||||
affector Scale
|
|
||||||
{
|
|
||||||
x_scale dyn_random
|
|
||||||
{
|
|
||||||
min 60
|
|
||||||
max 90
|
|
||||||
}
|
|
||||||
y_scale dyn_random
|
|
||||||
{
|
|
||||||
min 200
|
|
||||||
max 300
|
|
||||||
}
|
|
||||||
}
|
|
||||||
affector Colour
|
|
||||||
{
|
|
||||||
time_colour 0 0 0.396078 0.835294 1
|
|
||||||
time_colour 0.2 1 1 1 1
|
|
||||||
time_colour 1 0 0 0 1
|
|
||||||
colour_operation multiply
|
|
||||||
}
|
|
||||||
}
|
|
||||||
technique
|
|
||||||
{
|
|
||||||
visual_particle_quota 12
|
|
||||||
material mp_explosion_04
|
|
||||||
renderer Billboard
|
|
||||||
{
|
|
||||||
texture_coords_rows 2
|
|
||||||
texture_coords_columns 2
|
|
||||||
billboard_type oriented_self
|
|
||||||
billboard_rotation_type vertex
|
|
||||||
}
|
|
||||||
emitter Box
|
|
||||||
{
|
|
||||||
emission_rate 30
|
|
||||||
angle 360
|
|
||||||
time_to_live dyn_random
|
|
||||||
{
|
|
||||||
min 0.3
|
|
||||||
max 0.5
|
|
||||||
}
|
|
||||||
velocity dyn_random
|
|
||||||
{
|
|
||||||
min 5
|
|
||||||
max 10
|
|
||||||
}
|
|
||||||
duration 0.15
|
|
||||||
all_particle_dimensions dyn_random
|
|
||||||
{
|
|
||||||
min 1
|
|
||||||
max 50
|
|
||||||
}
|
|
||||||
texture_coords 1
|
|
||||||
colour 0.984314 0.992157 0.67451 1
|
|
||||||
box_width 20
|
|
||||||
box_height 20
|
|
||||||
box_depth 20
|
|
||||||
}
|
|
||||||
affector Scale
|
|
||||||
{
|
|
||||||
xyz_scale dyn_random
|
|
||||||
{
|
|
||||||
min 700
|
|
||||||
max 1000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
affector Colour
|
|
||||||
{
|
|
||||||
time_colour 0 1 1 1 1
|
|
||||||
time_colour 1 0 0 0 1
|
|
||||||
}
|
|
||||||
affector TextureRotator
|
|
||||||
{
|
|
||||||
rotation dyn_random
|
|
||||||
{
|
|
||||||
min -3
|
|
||||||
max 3
|
|
||||||
}
|
|
||||||
rotation_speed 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
technique
|
|
||||||
{
|
|
||||||
visual_particle_quota 20
|
|
||||||
material mp_explosion_debris
|
|
||||||
renderer Billboard
|
|
||||||
{
|
|
||||||
billboard_type oriented_self
|
|
||||||
billboard_rotation_type vertex
|
|
||||||
}
|
|
||||||
emitter Point
|
|
||||||
{
|
|
||||||
emission_rate 200
|
|
||||||
angle 360
|
|
||||||
time_to_live dyn_random
|
|
||||||
{
|
|
||||||
min 0.5
|
|
||||||
max 1
|
|
||||||
}
|
|
||||||
velocity dyn_random
|
|
||||||
{
|
|
||||||
min 200
|
|
||||||
max 350
|
|
||||||
}
|
|
||||||
duration 0.1
|
|
||||||
colour 0 0 0 1
|
|
||||||
}
|
|
||||||
affector ScaleVelocity
|
|
||||||
{
|
|
||||||
velocity_scale dyn_curved_linear
|
|
||||||
{
|
|
||||||
control_point 0 -1500
|
|
||||||
control_point 0.2 -200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
affector Scale
|
|
||||||
{
|
|
||||||
xyz_scale 300
|
|
||||||
}
|
|
||||||
affector Colour
|
|
||||||
{
|
|
||||||
time_colour 0 0.65098 0.815686 1 1
|
|
||||||
time_colour 0.5 0.0901961 0.52549 1 1
|
|
||||||
time_colour 1 0 0 0 1
|
|
||||||
}
|
|
||||||
affector TextureRotator
|
|
||||||
{
|
|
||||||
rotation dyn_random
|
|
||||||
{
|
|
||||||
min -3
|
|
||||||
max 3
|
|
||||||
}
|
|
||||||
rotation_speed 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -106,7 +106,7 @@ function Particle3DLineStreakDemo:subtitle()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle3DLineStreakDemo:onEnter()
|
function Particle3DLineStreakDemo:onEnter()
|
||||||
local rootps = cc.PUParticleSystem3D:create("lineStreak.pu", "pu_mediapack_01.material")
|
local rootps = cc.PUParticleSystem3D:create("lineStreak.pu", "pu_example.material")
|
||||||
rootps:setCameraMask(cc.CameraFlag.USER1)
|
rootps:setCameraMask(cc.CameraFlag.USER1)
|
||||||
rootps:setScale(5.0)
|
rootps:setScale(5.0)
|
||||||
rootps:startParticleSystem()
|
rootps:startParticleSystem()
|
||||||
|
@ -143,7 +143,7 @@ function Particle3DBlackHoleDemo:subtitle()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle3DBlackHoleDemo:onEnter()
|
function Particle3DBlackHoleDemo:onEnter()
|
||||||
local rootps = cc.PUParticleSystem3D:create("blackHole.pu", "pu_mediapack_01.material")
|
local rootps = cc.PUParticleSystem3D:create("blackHole.pu", "pu_example.material")
|
||||||
rootps:setCameraMask(cc.CameraFlag.USER1)
|
rootps:setCameraMask(cc.CameraFlag.USER1)
|
||||||
rootps:setPosition(-25.0, 0.0)
|
rootps:setPosition(-25.0, 0.0)
|
||||||
local moveby = cc.MoveBy:create(2.0, cc.p(50.0, 0.0))
|
local moveby = cc.MoveBy:create(2.0, cc.p(50.0, 0.0))
|
||||||
|
@ -182,7 +182,7 @@ function Particle3DHypnoDemo:subtitle()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle3DHypnoDemo:onEnter()
|
function Particle3DHypnoDemo:onEnter()
|
||||||
local rootps = cc.PUParticleSystem3D:create("hypno.pu", "pu_mediapack_01.material")
|
local rootps = cc.PUParticleSystem3D:create("hypno.pu", "pu_example.material")
|
||||||
rootps:setCameraMask(cc.CameraFlag.USER1)
|
rootps:setCameraMask(cc.CameraFlag.USER1)
|
||||||
rootps:startParticleSystem()
|
rootps:startParticleSystem()
|
||||||
self:addChild(rootps, 0, PARTICLE_SYSTEM_TAG)
|
self:addChild(rootps, 0, PARTICLE_SYSTEM_TAG)
|
||||||
|
@ -258,7 +258,7 @@ function Particle3DTimeShiftDemo:subtitle()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle3DTimeShiftDemo:onEnter()
|
function Particle3DTimeShiftDemo:onEnter()
|
||||||
local rootps = cc.PUParticleSystem3D:create("timeShift.pu", "pu_mediapack_01.material")
|
local rootps = cc.PUParticleSystem3D:create("timeShift.pu", "pu_example.material")
|
||||||
rootps:setScale(2.0)
|
rootps:setScale(2.0)
|
||||||
rootps:setCameraMask(cc.CameraFlag.USER1)
|
rootps:setCameraMask(cc.CameraFlag.USER1)
|
||||||
rootps:startParticleSystem()
|
rootps:startParticleSystem()
|
||||||
|
@ -295,7 +295,7 @@ function Particle3DUVAnimDemo:subtitle()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle3DUVAnimDemo:onEnter()
|
function Particle3DUVAnimDemo:onEnter()
|
||||||
local rootps = cc.PUParticleSystem3D:create("UVAnimation.pu", "pu_mediapack_01.material")
|
local rootps = cc.PUParticleSystem3D:create("UVAnimation.pu", "pu_example.material")
|
||||||
rootps:setCameraMask(cc.CameraFlag.USER1)
|
rootps:setCameraMask(cc.CameraFlag.USER1)
|
||||||
rootps:startParticleSystem()
|
rootps:startParticleSystem()
|
||||||
self:addChild(rootps, 0, PARTICLE_SYSTEM_TAG)
|
self:addChild(rootps, 0, PARTICLE_SYSTEM_TAG)
|
||||||
|
@ -330,7 +330,7 @@ function Particle3DFirePlaceDemo:subtitle()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle3DFirePlaceDemo:onEnter()
|
function Particle3DFirePlaceDemo:onEnter()
|
||||||
local rootps = cc.PUParticleSystem3D:create("mp_torch.pu", "pu_mediapack_01.material")
|
local rootps = cc.PUParticleSystem3D:create("mp_torch.pu", "pu_example.material")
|
||||||
rootps:setCameraMask(cc.CameraFlag.USER1)
|
rootps:setCameraMask(cc.CameraFlag.USER1)
|
||||||
rootps:setScale(5.0)
|
rootps:setScale(5.0)
|
||||||
rootps:startParticleSystem()
|
rootps:startParticleSystem()
|
||||||
|
@ -376,43 +376,6 @@ function Particle3DElectricBeamSystemDemo:onExit()
|
||||||
self:unscheduleUpdate()
|
self:unscheduleUpdate()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Particle3DExplosionBlueDemo
|
|
||||||
local Particle3DExplosionBlueDemo = class("Particle3DExplosionBlueDemo", function ()
|
|
||||||
local layer = cc.Layer:create()
|
|
||||||
Helper.initWithLayer(layer)
|
|
||||||
return layer
|
|
||||||
end)
|
|
||||||
|
|
||||||
function Particle3DExplosionBlueDemo:ctor()
|
|
||||||
-- body
|
|
||||||
self:init()
|
|
||||||
end
|
|
||||||
|
|
||||||
function Particle3DExplosionBlueDemo:init()
|
|
||||||
baseInit(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Particle3DExplosionBlueDemo:title()
|
|
||||||
return "Particle3D Test"
|
|
||||||
end
|
|
||||||
|
|
||||||
function Particle3DExplosionBlueDemo:subtitle()
|
|
||||||
return "ExplosionBlue"
|
|
||||||
end
|
|
||||||
|
|
||||||
function Particle3DExplosionBlueDemo:onEnter()
|
|
||||||
local rootps = cc.PUParticleSystem3D:create("mp_explosion_04_blue.pu")
|
|
||||||
rootps:setCameraMask(cc.CameraFlag.USER1)
|
|
||||||
rootps:setScale(0.25)
|
|
||||||
rootps:startParticleSystem()
|
|
||||||
self:addChild(rootps, 0, PARTICLE_SYSTEM_TAG)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Particle3DExplosionBlueDemo:onExit()
|
|
||||||
self:unscheduleUpdate()
|
|
||||||
end
|
|
||||||
|
|
||||||
function Particle3DTest()
|
function Particle3DTest()
|
||||||
local scene = cc.Scene:create()
|
local scene = cc.Scene:create()
|
||||||
|
|
||||||
|
@ -425,8 +388,7 @@ function Particle3DTest()
|
||||||
Particle3DTimeShiftDemo.create,
|
Particle3DTimeShiftDemo.create,
|
||||||
Particle3DUVAnimDemo.create,
|
Particle3DUVAnimDemo.create,
|
||||||
Particle3DFirePlaceDemo.create,
|
Particle3DFirePlaceDemo.create,
|
||||||
Particle3DElectricBeamSystemDemo.create,
|
Particle3DElectricBeamSystemDemo.create
|
||||||
Particle3DExplosionBlueDemo.create,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scene:addChild(Particle3DLineStreakDemo.create())
|
scene:addChild(Particle3DLineStreakDemo.create())
|
||||||
|
|
|
@ -113,7 +113,7 @@ local _allTests = {
|
||||||
{ isSupported = true, name = "OpenGLTest" , create_func= OpenGLTestMain },
|
{ isSupported = true, name = "OpenGLTest" , create_func= OpenGLTestMain },
|
||||||
{ isSupported = true, name = "ParallaxTest" , create_func = ParallaxTestMain },
|
{ isSupported = true, name = "ParallaxTest" , create_func = ParallaxTestMain },
|
||||||
{ isSupported = true, name = "ParticleTest" , create_func = ParticleTest },
|
{ isSupported = true, name = "ParticleTest" , create_func = ParticleTest },
|
||||||
{ isSupported = true, name = "Particle3DTest" , create_func = Particle3DTest },
|
{ isSupported = true, name = "Particle3D (PU)" , create_func = Particle3DTest },
|
||||||
{ isSupported = true, name = "PerformanceTest" , create_func= PerformanceTestMain },
|
{ isSupported = true, name = "PerformanceTest" , create_func= PerformanceTestMain },
|
||||||
{ isSupported = true, name = "PhysicsTest" , create_func = PhysicsTest },
|
{ isSupported = true, name = "PhysicsTest" , create_func = PhysicsTest },
|
||||||
{ isSupported = true, name = "RenderTextureTest" , create_func = RenderTextureTestMain },
|
{ isSupported = true, name = "RenderTextureTest" , create_func = RenderTextureTestMain },
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#put xctool.sh into your PATH
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
COCOS2DX_ROOT="$DIR"/../..
|
||||||
|
cd ${COCOS2DX_ROOT}
|
||||||
|
mkdir linux-build
|
||||||
|
cd linux-build
|
||||||
|
cmake ..
|
||||||
|
make -j4
|
|
@ -0,0 +1,8 @@
|
||||||
|
#put xctool.sh into your PATH
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
COCOS2DX_ROOT="$DIR"/../..
|
||||||
|
cd ${COCOS2DX_ROOT}
|
||||||
|
mkdir mac-build
|
||||||
|
cd mac-build
|
||||||
|
cmake ..
|
||||||
|
make -j4
|
|
@ -23,7 +23,7 @@ def set_description(desc, url):
|
||||||
req = urllib2.Request(url + 'submitDescription', req_data)
|
req = urllib2.Request(url + 'submitDescription', req_data)
|
||||||
#print(os.environ['BUILD_URL'])
|
#print(os.environ['BUILD_URL'])
|
||||||
req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
base64string = base64.encodestring(os.environ['JENKINS_ADMIN']+ ":" + os.environ['JENKINS_ADMIN_PW']).replace('\n', '')
|
base64string = base64.encodestring(os.environ['JENKINS_ADMIN'] + ":" + os.environ['JENKINS_ADMIN_PW']).replace('\n', '')
|
||||||
req.add_header("Authorization", "Basic " + base64string)
|
req.add_header("Authorization", "Basic " + base64string)
|
||||||
try:
|
try:
|
||||||
urllib2.urlopen(req)
|
urllib2.urlopen(req)
|
||||||
|
@ -35,11 +35,8 @@ def check_current_3rd_libs(branch):
|
||||||
#get current_libs config
|
#get current_libs config
|
||||||
backup_files = range(2)
|
backup_files = range(2)
|
||||||
current_files = range(2)
|
current_files = range(2)
|
||||||
config_file_paths = ['external/config.json','templates/lua-template-runtime/runtime/config.json']
|
config_file_paths = ['external/config.json', 'templates/lua-template-runtime/runtime/config.json']
|
||||||
if (branch == 'v2'):
|
|
||||||
config_file_paths = ['external/config.json']
|
|
||||||
backup_files = range(1)
|
|
||||||
current_files = range(1)
|
|
||||||
for i, config_file_path in enumerate(config_file_paths):
|
for i, config_file_path in enumerate(config_file_paths):
|
||||||
if not os.path.isfile(config_file_path):
|
if not os.path.isfile(config_file_path):
|
||||||
raise Exception("Could not find 'external/config.json'")
|
raise Exception("Could not find 'external/config.json'")
|
||||||
|
@ -55,7 +52,7 @@ def check_current_3rd_libs(branch):
|
||||||
current_file = filename
|
current_file = filename
|
||||||
current_files[i] = current_file
|
current_files[i] = current_file
|
||||||
if os.path.isfile(backup_file):
|
if os.path.isfile(backup_file):
|
||||||
copy(backup_file, current_file)
|
copy(backup_file, current_file)
|
||||||
#run download-deps.py
|
#run download-deps.py
|
||||||
print("prepare to downloading ...")
|
print("prepare to downloading ...")
|
||||||
os.system('python download-deps.py -r no')
|
os.system('python download-deps.py -r no')
|
||||||
|
@ -68,7 +65,7 @@ def connect_db():
|
||||||
db_host = os.environ['db_host']
|
db_host = os.environ['db_host']
|
||||||
db_user = os.environ['db_user']
|
db_user = os.environ['db_user']
|
||||||
db_pw = os.environ['db_pw']
|
db_pw = os.environ['db_pw']
|
||||||
db_name=os.environ['db_name']
|
db_name = os.environ['db_name']
|
||||||
try:
|
try:
|
||||||
db = MySQLdb.connect(db_host, db_user, db_pw, db_name)
|
db = MySQLdb.connect(db_host, db_user, db_pw, db_name)
|
||||||
except:
|
except:
|
||||||
|
@ -95,26 +92,27 @@ def scan_all_libs(db, pr_num):
|
||||||
stats = {}
|
stats = {}
|
||||||
lib_path = './tests/cpp-tests/proj.android/obj/local/armeabi'
|
lib_path = './tests/cpp-tests/proj.android/obj/local/armeabi'
|
||||||
for root, dirs, files in os.walk(lib_path):
|
for root, dirs, files in os.walk(lib_path):
|
||||||
for _file in files:
|
for _file in files:
|
||||||
if not _file.endswith(".a"):
|
if not _file.endswith(".a"):
|
||||||
continue
|
continue
|
||||||
print _file
|
print _file
|
||||||
libfile = lib_path + '/' + _file
|
libfile = lib_path + '/' + _file
|
||||||
_filename = _file.split('.')[0]
|
_filename = _file.split('.')[0]
|
||||||
filesize = os.path.getsize(libfile)/1024
|
filesize = os.path.getsize(libfile) / 1024
|
||||||
stats[_filename]=filesize
|
stats[_filename] = filesize
|
||||||
save_build_stats(db, pr_num, _filename, filesize)
|
save_build_stats(db, pr_num, _filename, filesize)
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
http_proxy = ''
|
http_proxy = ''
|
||||||
if(os.environ.has_key('HTTP_PROXY')):
|
|
||||||
|
if('HTTP_PROXY' in os.environ):
|
||||||
http_proxy = os.environ['HTTP_PROXY']
|
http_proxy = os.environ['HTTP_PROXY']
|
||||||
proxyDict = {'http':http_proxy,'https':http_proxy}
|
proxyDict = {'http': http_proxy, 'https': http_proxy}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#get payload from os env
|
#get payload from os env
|
||||||
payload_str = os.environ['payload']
|
payload_str = os.environ['payload']
|
||||||
payload_str = payload_str.decode('utf-8','ignore')
|
payload_str = payload_str.decode('utf-8', 'ignore')
|
||||||
#parse to json obj
|
#parse to json obj
|
||||||
payload = json.loads(payload_str)
|
payload = json.loads(payload_str)
|
||||||
|
|
||||||
|
@ -130,9 +128,7 @@ def main():
|
||||||
|
|
||||||
url = payload['html_url']
|
url = payload['html_url']
|
||||||
print "url:" + url
|
print "url:" + url
|
||||||
pr_desc = '<h3><a href='+ url + '> pr#' + str(pr_num) + ' is '+ action +'</a></h3>'
|
pr_desc = '<h3><a href=' + url + '> pr#' + str(pr_num) + ' is ' + action + '</a></h3>'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#get statuses url
|
#get statuses url
|
||||||
statuses_url = payload['statuses_url']
|
statuses_url = payload['statuses_url']
|
||||||
|
@ -149,21 +145,20 @@ def main():
|
||||||
|
|
||||||
set_description(pr_desc, target_url)
|
set_description(pr_desc, target_url)
|
||||||
|
|
||||||
|
data = {"state": "pending", "target_url": target_url, "context": "Jenkins CI", "description": "Build started..."}
|
||||||
data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Build started..."}
|
|
||||||
access_token = os.environ['GITHUB_ACCESS_TOKEN']
|
access_token = os.environ['GITHUB_ACCESS_TOKEN']
|
||||||
Headers = {"Authorization":"token " + access_token}
|
Headers = {"Authorization": "token " + access_token}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
|
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies=proxyDict)
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
#reset path to workspace root
|
#reset path to workspace root
|
||||||
os.system("cd " + os.environ['WORKSPACE']);
|
os.system("cd " + os.environ['WORKSPACE'])
|
||||||
#pull latest code
|
#pull latest code
|
||||||
os.system("git pull origin v3")
|
os.system("git pull origin " + branch)
|
||||||
os.system("git checkout v3")
|
os.system("git checkout " + branch)
|
||||||
os.system("git branch -D pull" + str(pr_num))
|
os.system("git branch -D pull" + str(pr_num))
|
||||||
#clean workspace
|
#clean workspace
|
||||||
print "Before checkout: git clean -xdf -f"
|
print "Before checkout: git clean -xdf -f"
|
||||||
|
@ -174,7 +169,7 @@ def main():
|
||||||
if(ret != 0):
|
if(ret != 0):
|
||||||
return(2)
|
return(2)
|
||||||
|
|
||||||
#checkout a new branch from v3
|
#checkout a new branch from v3 or v4-develop
|
||||||
git_checkout = "git checkout -b " + "pull" + str(pr_num)
|
git_checkout = "git checkout -b " + "pull" + str(pr_num)
|
||||||
os.system(git_checkout)
|
os.system(git_checkout)
|
||||||
#merge pull reqeust head
|
#merge pull reqeust head
|
||||||
|
@ -199,119 +194,91 @@ def main():
|
||||||
check_current_3rd_libs(branch)
|
check_current_3rd_libs(branch)
|
||||||
|
|
||||||
# Generate binding glue codes
|
# Generate binding glue codes
|
||||||
if(branch == 'v3'):
|
if(branch == 'v3' or branch == 'v4-develop'):
|
||||||
ret = os.system("python tools/jenkins-scripts/gen_jsb.py")
|
ret = os.system("python tools/jenkins-scripts/gen_jsb.py")
|
||||||
elif(branch == 'v2'):
|
|
||||||
os.chdir('tools/tojs')
|
|
||||||
if(platform.system() == 'Windows'):
|
|
||||||
os.environ['NDK_ROOT'] = os.environ['NDK_ROOT_R8E']
|
|
||||||
ret = os.system("genbindings-win32.bat")
|
|
||||||
os.environ['NDK_ROOT'] = os.environ['NDK_ROOT_R9B']
|
|
||||||
else:
|
|
||||||
ret = os.system("./genbindings.sh")
|
|
||||||
os.chdir('../..')
|
|
||||||
if(ret != 0):
|
if(ret != 0):
|
||||||
return(1)
|
return(1)
|
||||||
|
|
||||||
#make temp dir
|
#make temp dir
|
||||||
print "current dir is: " + os.environ['WORKSPACE']
|
print "current dir is: " + os.environ['WORKSPACE']
|
||||||
os.system("cd " + os.environ['WORKSPACE']);
|
os.system("cd " + os.environ['WORKSPACE'])
|
||||||
os.mkdir("android_build_objs")
|
os.mkdir("android_build_objs")
|
||||||
#add symbol link
|
#add symbol link
|
||||||
PROJECTS=["cpp-empty-test", "cpp-tests"]
|
PROJECTS = ["cpp-empty-test", "cpp-tests"]
|
||||||
|
|
||||||
print platform.system()
|
print platform.system()
|
||||||
if(platform.system() == 'Darwin'):
|
if(platform.system() == 'Darwin'):
|
||||||
for item in PROJECTS:
|
for item in PROJECTS:
|
||||||
cmd = "ln -s " + os.environ['WORKSPACE']+"/android_build_objs/ " + os.environ['WORKSPACE']+"/tests/"+item+"/proj.android/obj"
|
cmd = "ln -s " + os.environ['WORKSPACE'] + "/android_build_objs/ " + os.environ['WORKSPACE'] + "/tests/" + item + "/proj.android/obj"
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
elif(platform.system() == 'Windows'):
|
elif(platform.system() == 'Windows'):
|
||||||
for item in PROJECTS:
|
for item in PROJECTS:
|
||||||
p = item.replace("/", os.sep)
|
p = item.replace("/", os.sep)
|
||||||
cmd = "mklink /J "+os.environ['WORKSPACE']+os.sep+"tests"+os.sep +p+os.sep+"proj.android"+os.sep+"obj " + os.environ['WORKSPACE']+os.sep+"android_build_objs"
|
cmd = "mklink /J " + os.environ['WORKSPACE'] + os.sep + "tests" + os.sep + p + os.sep + "proj.android" + os.sep + "obj " + os.environ['WORKSPACE'] + os.sep + "android_build_objs"
|
||||||
print cmd
|
print cmd
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
#build
|
#build
|
||||||
#TODO: add android-linux build
|
# TODO: add wp8.1 universal build
|
||||||
#TODO: add mac build
|
#TODO: add mac build
|
||||||
node_name = os.environ['NODE_NAME']
|
node_name = os.environ['NODE_NAME']
|
||||||
if(branch == 'v3'):
|
jenkins_script_path = 'tools/jenkins-scripts/'
|
||||||
if(node_name == 'android_mac') or (node_name == 'android_win7'):
|
if(branch == 'v3' or branch == 'v4-develop'):
|
||||||
#modify tests/cpp-empty-test/Classes/AppDelegate.cpp to support Console
|
if(node_name == 'android') or (node_name == 'android_bak'):
|
||||||
modify_file = 'tests/cpp-empty-test/Classes/AppDelegate.cpp'
|
#modify tests/cpp-empty-test/Classes/AppDelegate.cpp to support Console
|
||||||
data = codecs.open(modify_file, encoding='UTF-8').read()
|
# FIXME: We should use patch instead
|
||||||
data = re.sub("director->setDisplayStats\(true\);", "director->setDisplayStats(true); director->getConsole()->listenOnTCP(5678);", data)
|
modify_file = 'tests/cpp-empty-test/Classes/AppDelegate.cpp'
|
||||||
codecs.open(modify_file, 'wb', encoding='UTF-8').write(data)
|
data = codecs.open(modify_file, encoding='UTF-8').read()
|
||||||
#modify tests/cpp-empty-test/proj.android/AndroidManifest.xml to support Console
|
data = re.sub("director->setDisplayStats\(true\);", "director->setDisplayStats(true); director->getConsole()->listenOnTCP(5678);", data)
|
||||||
modify_file = 'tests/cpp-empty-test/proj.android/AndroidManifest.xml'
|
codecs.open(modify_file, 'wb', encoding='UTF-8').write(data)
|
||||||
data = codecs.open(modify_file, encoding='UTF-8').read()
|
|
||||||
data = re.sub('<uses-feature android:glEsVersion="0x00020000" />', '<uses-feature android:glEsVersion="0x00020000" /> <uses-permission android:name="android.permission.INTERNET"/>', data)
|
#modify tests/cpp-empty-test/proj.android/AndroidManifest.xml to support Console
|
||||||
codecs.open(modify_file, 'wb', encoding='UTF-8').write(data)
|
modify_file = 'tests/cpp-empty-test/proj.android/AndroidManifest.xml'
|
||||||
print "Start build android..."
|
data = codecs.open(modify_file, encoding='UTF-8').read()
|
||||||
ret = os.system("python build/android-build.py -p 10 all")
|
data = re.sub('<uses-feature android:glEsVersion="0x00020000" />', '<uses-feature android:glEsVersion="0x00020000" /> <uses-permission android:name="android.permission.INTERNET"/>', data)
|
||||||
# create and save apk
|
codecs.open(modify_file, 'wb', encoding='UTF-8').write(data)
|
||||||
if(ret == 0):
|
print "Start build android..."
|
||||||
sample_dir = 'tests/cpp-tests/proj.android/'
|
ret = os.system("python build/android-build.py -p 10 all")
|
||||||
local_apk = sample_dir + 'bin/CppTests-debug.apk'
|
|
||||||
backup_apk = os.environ['BACKUP_PATH'] + 'CppTests_' + str(pr_num) + '.apk'
|
# create and save apk
|
||||||
os.system('cp ' + local_apk + ' ' + backup_apk)
|
if(ret == 0):
|
||||||
db = connect_db()
|
sample_dir = 'tests/cpp-tests/proj.android/'
|
||||||
scan_all_libs(db, pr_num)
|
local_apk = sample_dir + 'bin/CppTests-debug.apk'
|
||||||
ret = os.system("python build/android-build.py -p 10 -b release cpp-empty-test")
|
backup_apk = os.environ['BACKUP_PATH'] + 'CppTests_' + str(pr_num) + '.apk'
|
||||||
if(ret == 0):
|
os.system('cp ' + local_apk + ' ' + backup_apk)
|
||||||
_path = 'tests/cpp-empty-test/proj.android/libs/armeabi/libcpp_empty_test.so'
|
db = connect_db()
|
||||||
filesize = os.path.getsize(_path)
|
scan_all_libs(db, pr_num)
|
||||||
pr_desc = pr_desc + '<h3>size of libcpp_empty_test.so is:' + str(filesize/1024) + 'kb</h3>'
|
ret = os.system("python build/android-build.py -p 10 -b release cpp-empty-test")
|
||||||
set_description(pr_desc, target_url)
|
if(ret == 0):
|
||||||
save_build_stats(db, pr_num, 'libcpp_empty_test', filesize/1024)
|
_path = 'tests/cpp-empty-test/proj.android/libs/armeabi/libcpp_empty_test.so'
|
||||||
ret = os.system("python build/android-build.py -p 10 -b release lua-empty-test")
|
filesize = os.path.getsize(_path)
|
||||||
if(ret == 0):
|
pr_desc = pr_desc + '<h3>size of libcpp_empty_test.so is:' + str(filesize / 1024) + 'kb</h3>'
|
||||||
_path = 'tests/lua-empty-test/project/proj.android/libs/armeabi/liblua_empty_test.so'
|
set_description(pr_desc, target_url)
|
||||||
filesize = os.path.getsize(_path)
|
save_build_stats(db, pr_num, 'libcpp_empty_test', filesize / 1024)
|
||||||
pr_desc = pr_desc + '<h3>size of liblua_empty_test.so is:' + str(filesize/1024) + 'kb</h3>'
|
|
||||||
set_description(pr_desc, target_url)
|
ret = os.system("python build/android-build.py -p 10 -b release lua-empty-test")
|
||||||
save_build_stats(db, pr_num, 'liblua_empty_test', filesize/1024)
|
if(ret == 0):
|
||||||
close_db(db)
|
_path = 'tests/lua-empty-test/project/proj.android/libs/armeabi/liblua_empty_test.so'
|
||||||
elif(node_name == 'win32_win7'):
|
filesize = os.path.getsize(_path)
|
||||||
ret = subprocess.call('"%VS110COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win32.vc2012.sln" /Build "Debug|Win32"', shell=True)
|
pr_desc = pr_desc + '<h3>size of liblua_empty_test.so is:' + str(filesize / 1024) + 'kb</h3>'
|
||||||
elif(node_name == 'ios_mac'):
|
set_description(pr_desc, target_url)
|
||||||
ret = os.system("tools/jenkins-scripts/ios-build.sh")
|
save_build_stats(db, pr_num, 'liblua_empty_test', filesize / 1024)
|
||||||
elif(node_name == 'linux_centos'):
|
|
||||||
os.chdir("build/")
|
close_db(db)
|
||||||
ret = os.system("cmake ../")
|
elif(node_name == 'win32' or node_name == 'win32_win7' or node_name == 'win32_bak'):
|
||||||
ret = os.system("make -j10")
|
build_vs_project_name = 'cocos2d-win32.vc2013.sln'
|
||||||
os.chdir("../")
|
if(branch == 'v3'):
|
||||||
elif(branch == 'v2'):
|
build_vs_project_name = 'cocos2d-win32.vc2012.sln'
|
||||||
SAMPLES_DIRS = ['Cpp/HelloCpp', 'Cpp/SimpleGame', 'Cpp/TestCpp', 'Javascript/TestJavascript', 'Lua/HelloLua', 'Lua/TestLua']
|
ret = subprocess.call('"%VS120COMNTOOLS%..\IDE\devenv.com" "build\"' + build_vs_project_name + ' /Build "Debug|Win32"', shell=True)
|
||||||
SAMPLES_NAMES = ['HelloCpp', 'SimpleGame', 'TestCpp', 'TestJavascript', 'HelloLua', 'TestLua']
|
elif(node_name == 'windows-universal' or node_name == 'windows-universal_bak'):
|
||||||
if(node_name == 'android_mac'):
|
ret = subprocess.call('"%VS120COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win8.1-universal.sln" /Build "Debug|Win32"', shell=True)
|
||||||
for item in SAMPLES_DIRS:
|
elif(node_name == 'ios_mac' or node_name == 'ios' or node_name == 'ios_bak'):
|
||||||
proj_dir = "samples/" + item + "/proj.android"
|
ret = os.system(jenkins_script_path + "ios-build.sh")
|
||||||
os.system('ln -s ../../../../android_build_objs obj')
|
elif(node_name == 'mac' or node_name == 'mac_bak'):
|
||||||
os.system(proj_dir + "/build_native.sh")
|
ret = os.system(jenkins_script_path + "mac-build.sh")
|
||||||
if (ret != 0):
|
elif(node_name == 'linux_centos' or node_name == 'linux' or node_name == 'linux_bak'):
|
||||||
break
|
ret = os.system(jenkins_script_path + "linux-build.sh")
|
||||||
elif(node_name == 'win32_win7'):
|
|
||||||
ret = subprocess.call('"%VS110COMNTOOLS%..\IDE\devenv.com" "cocos2d-win32.vc2012.sln" /Build "Debug|Win32"', shell=True)
|
|
||||||
elif(node_name == 'ios_mac'):
|
|
||||||
for i, item in enumerate(SAMPLES_DIRS):
|
|
||||||
cmd = "xcodebuild -project samples/" + item + "/proj.ios/" + SAMPLES_NAMES[i] + ".xcodeproj -scheme " + SAMPLES_NAMES[i] + ' -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)"'
|
|
||||||
cmd_clean = cmd + ' clean'
|
|
||||||
cmd_build = cmd + ' build'
|
|
||||||
ret = os.system(cmd_clean)
|
|
||||||
if(ret != 0):
|
|
||||||
break
|
|
||||||
ret = os.system(cmd_build)
|
|
||||||
if(ret != 0):
|
|
||||||
break
|
|
||||||
elif(node_name == 'linux_centos'):
|
|
||||||
data = codecs.open('cocos2dx/proj.linux/cocos2dx.mk', encoding='UTF-8').read()
|
|
||||||
data = re.sub('-lglfw','-L$(GLFW_279_LIB) -lglfw', data)
|
|
||||||
codecs.open('cocos2dx/proj.linux/cocos2dx.mk', 'wb', encoding='UTF-8').write(data)
|
|
||||||
ret = os.system('make -j10')
|
|
||||||
else:
|
|
||||||
ret = 0
|
|
||||||
|
|
||||||
#get build result
|
#get build result
|
||||||
print "build finished and return " + str(ret)
|
print "build finished and return " + str(ret)
|
||||||
|
@ -326,7 +293,7 @@ def main():
|
||||||
os.system("cd " + os.environ['WORKSPACE'])
|
os.system("cd " + os.environ['WORKSPACE'])
|
||||||
os.system("git reset --hard")
|
os.system("git reset --hard")
|
||||||
os.system("git clean -xdf -f")
|
os.system("git clean -xdf -f")
|
||||||
os.system("git checkout v3")
|
os.system("git checkout " + branch)
|
||||||
os.system("git branch -D pull" + str(pr_num))
|
os.system("git branch -D pull" + str(pr_num))
|
||||||
|
|
||||||
return(exit_code)
|
return(exit_code)
|
||||||
|
|
Loading…
Reference in New Issue