mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3.6' of https://github.com/cocos2d/cocos2d-x into v3.6
This commit is contained in:
commit
2b245e0318
|
@ -1,6 +1,7 @@
|
||||||
cocos2d-x-3.6 ??
|
cocos2d-x-3.6 ??
|
||||||
[NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App
|
[NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App
|
||||||
[NEW] 3rd: update freetype to v 2.5.5 on Windows 8.1 Universal App
|
[NEW] 3rd: update freetype to v 2.5.5 on Windows 8.1 Universal App
|
||||||
|
[NEW] C++: Added SpritePolygon
|
||||||
[NEW] Label: added LabelEffect::ALL which can be used in disableEffect(LabelEffect) to disable all effects
|
[NEW] Label: added LabelEffect::ALL which can be used in disableEffect(LabelEffect) to disable all effects
|
||||||
[NEW] Lua-binding: binded ui:WebView and added corresponidng test case
|
[NEW] Lua-binding: binded ui:WebView and added corresponidng test case
|
||||||
[NEW] MathUtil: added `MathUtil::lerp()`
|
[NEW] MathUtil: added `MathUtil::lerp()`
|
||||||
|
|
|
@ -67,8 +67,8 @@ set(COCOS_2D_SRC
|
||||||
2d/CCSpriteFrameCache.cpp
|
2d/CCSpriteFrameCache.cpp
|
||||||
2d/CCSpriteFrame.cpp
|
2d/CCSpriteFrame.cpp
|
||||||
2d/MarchingSquare.cpp
|
2d/MarchingSquare.cpp
|
||||||
2d/PolySprite.cpp
|
2d/SpritePolygon.cpp
|
||||||
2d/PolySpriteCache.cpp
|
2d/SpritePolygonCache.cpp
|
||||||
2d/CCTextFieldTTF.cpp
|
2d/CCTextFieldTTF.cpp
|
||||||
2d/CCTileMapAtlas.cpp
|
2d/CCTileMapAtlas.cpp
|
||||||
2d/CCTMXLayer.cpp
|
2d/CCTMXLayer.cpp
|
||||||
|
|
|
@ -209,7 +209,8 @@ TrianglesCommand::Triangles SpritePolygon::triangulate(std::vector<cocos2d::Vec2
|
||||||
//vert does not exist yet, so we need to create a new one,
|
//vert does not exist yet, so we need to create a new one,
|
||||||
auto c4b = Color4B::WHITE;
|
auto c4b = Color4B::WHITE;
|
||||||
auto t2f = Tex2F(0,0); // don't worry about tex coords now, we calculate that later
|
auto t2f = Tex2F(0,0); // don't worry about tex coords now, we calculate that later
|
||||||
_verts->push_back(V3F_C4B_T2F{v3,c4b,t2f});
|
V3F_C4B_T2F vert = {v3,c4b,t2f};
|
||||||
|
_verts->push_back(vert);
|
||||||
_indices->push_back(idx);
|
_indices->push_back(idx);
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +221,9 @@ TrianglesCommand::Triangles SpritePolygon::triangulate(std::vector<cocos2d::Vec2
|
||||||
delete j;
|
delete j;
|
||||||
}
|
}
|
||||||
delete cdt;
|
delete cdt;
|
||||||
return TrianglesCommand::Triangles{&(*_verts)[0], &(*_indices)[0], (ssize_t)_verts->size(), (ssize_t)_indices->size()};
|
|
||||||
|
TrianglesCommand::Triangles triangles = {&(*_verts)[0], &(*_indices)[0], (ssize_t)_verts->size(), (ssize_t)_indices->size()};
|
||||||
|
return triangles;
|
||||||
}
|
}
|
||||||
bool SpritePolygon::initWithCache(const std::string &file, SpritePolygonInfo *info)
|
bool SpritePolygon::initWithCache(const std::string &file, SpritePolygonInfo *info)
|
||||||
{
|
{
|
||||||
|
@ -331,14 +334,15 @@ bool SpritePolygon::initWithVerts(const std::string& filename,std::vector<cocos2
|
||||||
setContentSize(_textureRect.size/Director::getInstance()->getContentScaleFactor());
|
setContentSize(_textureRect.size/Director::getInstance()->getContentScaleFactor());
|
||||||
setAnchorPoint(Vec2(0.5,0.5));
|
setAnchorPoint(Vec2(0.5,0.5));
|
||||||
_transformDirty = true;
|
_transformDirty = true;
|
||||||
auto _triangles = TrianglesCommand::Triangles{&verts[0], &indices[0], (ssize_t)verts.size(), (ssize_t)indices.size()};
|
TrianglesCommand::Triangles triangles = {&verts[0], &indices[0], (ssize_t)verts.size(), (ssize_t)indices.size()};
|
||||||
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(filename, _textureRect, _triangles);
|
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(filename, _textureRect, triangles);
|
||||||
|
|
||||||
#if CC_SPRITE_DEBUG_DRAW
|
#if CC_SPRITE_DEBUG_DRAW
|
||||||
debugDraw();
|
debugDraw();
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpritePolygon::initWithRect(const std::string& filename, std::vector<cocos2d::Vec2>& verts, std::vector<unsigned short>& indices, const cocos2d::Rect& rect)
|
bool SpritePolygon::initWithRect(const std::string& filename, std::vector<cocos2d::Vec2>& verts, std::vector<unsigned short>& indices, const cocos2d::Rect& rect)
|
||||||
{
|
{
|
||||||
CCASSERT(filename.size()>0, "Invalid filename for sprite");
|
CCASSERT(filename.size()>0, "Invalid filename for sprite");
|
||||||
|
@ -352,11 +356,12 @@ bool SpritePolygon::initWithRect(const std::string& filename, std::vector<cocos2
|
||||||
auto v3 = Vec3(it->x, it->y, 0);
|
auto v3 = Vec3(it->x, it->y, 0);
|
||||||
auto c4b = Color4B::WHITE;
|
auto c4b = Color4B::WHITE;
|
||||||
auto t2f = Tex2F(0,0);
|
auto t2f = Tex2F(0,0);
|
||||||
_verts.push_back(V3F_C4B_T2F{v3,c4b,t2f});
|
V3F_C4B_T2F vert = {v3,c4b,t2f};
|
||||||
|
_verts.push_back(vert);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto _triangles = TrianglesCommand::Triangles{&_verts[0], &indices[0], (ssize_t)_verts.size(), (ssize_t)indices.size()};
|
TrianglesCommand::Triangles triangles = {&_verts[0], &indices[0], (ssize_t)_verts.size(), (ssize_t)indices.size()};
|
||||||
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(filename, rect, _triangles);
|
_polygonInfo = SpritePolygonCache::getInstance()->addSpritePolygonCache(filename, rect, triangles);
|
||||||
calculateUVandContentSize();
|
calculateUVandContentSize();
|
||||||
setAnchorPoint(Vec2(0.5,0.5));
|
setAnchorPoint(Vec2(0.5,0.5));
|
||||||
#if CC_SPRITE_DEBUG_DRAW
|
#if CC_SPRITE_DEBUG_DRAW
|
||||||
|
@ -456,7 +461,7 @@ void SpritePolygon::debugDraw()
|
||||||
pos->x = v->vertices.x;
|
pos->x = v->vertices.x;
|
||||||
pos->y = v->vertices.y;
|
pos->y = v->vertices.y;
|
||||||
}
|
}
|
||||||
_debugDrawNode->drawPoints(positions, (unsigned int)_polygonInfo->_triangles.vertCount, 8, Color4F{0.0,1.0,1.0,1.0});
|
_debugDrawNode->drawPoints(positions, (unsigned int)_polygonInfo->_triangles.vertCount, 8, Color4F(0.0f, 1.0f, 1.0f, 1.0f));
|
||||||
//draw lines
|
//draw lines
|
||||||
auto last = _polygonInfo->_triangles.indexCount/3;
|
auto last = _polygonInfo->_triangles.indexCount/3;
|
||||||
auto _indices = _polygonInfo->_triangles.indices;
|
auto _indices = _polygonInfo->_triangles.indices;
|
||||||
|
|
|
@ -479,7 +479,8 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
|
||||||
{
|
{
|
||||||
if(it->bones.size() > 0 || singleSprite)
|
if(it->bones.size() > 0 || singleSprite)
|
||||||
{
|
{
|
||||||
this->setName(nodedata->id);
|
if(singleSprite)
|
||||||
|
root->setName(nodedata->id);
|
||||||
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(it->subMeshId));
|
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(it->subMeshId));
|
||||||
if(mesh)
|
if(mesh)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,8 +72,8 @@ cocos2d.cpp \
|
||||||
2d/CCSpriteFrame.cpp \
|
2d/CCSpriteFrame.cpp \
|
||||||
2d/CCSpriteFrameCache.cpp \
|
2d/CCSpriteFrameCache.cpp \
|
||||||
2d/MarchingSquare.cpp \
|
2d/MarchingSquare.cpp \
|
||||||
2d/PolySprite.cpp \
|
2d/SpritePolygon.cpp \
|
||||||
2d/PolySpriteCache.cpp \
|
2d/SpritePolygonCache.cpp \
|
||||||
2d/CCTMXLayer.cpp \
|
2d/CCTMXLayer.cpp \
|
||||||
2d/CCFastTMXLayer.cpp \
|
2d/CCFastTMXLayer.cpp \
|
||||||
2d/CCTMXObjectGroup.cpp \
|
2d/CCTMXObjectGroup.cpp \
|
||||||
|
|
|
@ -225,7 +225,7 @@ void RotationFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
|
|
||||||
void RotationFrame::onApply(float percent)
|
void RotationFrame::onApply(float percent)
|
||||||
{
|
{
|
||||||
if (_betwennRotation != 0)
|
if (nullptr != _node && _betwennRotation != 0)
|
||||||
{
|
{
|
||||||
float rotation = _rotation + percent * _betwennRotation;
|
float rotation = _rotation + percent * _betwennRotation;
|
||||||
_node->setRotation(rotation);
|
_node->setRotation(rotation);
|
||||||
|
@ -282,7 +282,7 @@ void SkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
|
|
||||||
void SkewFrame::onApply(float percent)
|
void SkewFrame::onApply(float percent)
|
||||||
{
|
{
|
||||||
if (_betweenSkewX != 0 || _betweenSkewY != 0)
|
if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
|
||||||
{
|
{
|
||||||
float skewx = _skewX + percent * _betweenSkewX;
|
float skewx = _skewX + percent * _betweenSkewX;
|
||||||
float skewy = _skewY + percent * _betweenSkewY;
|
float skewy = _skewY + percent * _betweenSkewY;
|
||||||
|
@ -342,7 +342,7 @@ void RotationSkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
|
|
||||||
void RotationSkewFrame::onApply(float percent)
|
void RotationSkewFrame::onApply(float percent)
|
||||||
{
|
{
|
||||||
if (_betweenSkewX != 0 || _betweenSkewY != 0)
|
if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
|
||||||
{
|
{
|
||||||
float skewx = _skewX + percent * _betweenSkewX;
|
float skewx = _skewX + percent * _betweenSkewX;
|
||||||
float skewy = _skewY + percent * _betweenSkewY;
|
float skewy = _skewY + percent * _betweenSkewY;
|
||||||
|
@ -400,7 +400,7 @@ void PositionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
|
|
||||||
void PositionFrame::onApply(float percent)
|
void PositionFrame::onApply(float percent)
|
||||||
{
|
{
|
||||||
if (_betweenX != 0 || _betweenY != 0)
|
if (nullptr != _node && _betweenX != 0 || _betweenY != 0)
|
||||||
{
|
{
|
||||||
Point p;
|
Point p;
|
||||||
p.x = _position.x + _betweenX * percent;
|
p.x = _position.x + _betweenX * percent;
|
||||||
|
@ -460,7 +460,7 @@ void ScaleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
|
|
||||||
void ScaleFrame::onApply(float percent)
|
void ScaleFrame::onApply(float percent)
|
||||||
{
|
{
|
||||||
if (_betweenScaleX != 0 || _betweenScaleY != 0)
|
if (nullptr != _node && _betweenScaleX != 0 || _betweenScaleY != 0)
|
||||||
{
|
{
|
||||||
float scaleX = _scaleX + _betweenScaleX * percent;
|
float scaleX = _scaleX + _betweenScaleX * percent;
|
||||||
float scaleY = _scaleY + _betweenScaleY * percent;
|
float scaleY = _scaleY + _betweenScaleY * percent;
|
||||||
|
@ -694,7 +694,7 @@ void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
|
|
||||||
void ColorFrame::onApply(float percent)
|
void ColorFrame::onApply(float percent)
|
||||||
{
|
{
|
||||||
if (_betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)
|
if (nullptr != _node && _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)
|
||||||
{
|
{
|
||||||
Color3B color;
|
Color3B color;
|
||||||
color.r = _color.r+ _betweenRed * percent;
|
color.r = _color.r+ _betweenRed * percent;
|
||||||
|
@ -749,10 +749,13 @@ void AlphaFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlphaFrame::onApply(float percent)
|
void AlphaFrame::onApply(float percent)
|
||||||
|
{
|
||||||
|
if (nullptr != _node)
|
||||||
{
|
{
|
||||||
GLubyte alpha = _alpha + _betweenAlpha * percent;
|
GLubyte alpha = _alpha + _betweenAlpha * percent;
|
||||||
_node->setOpacity(alpha);
|
_node->setOpacity(alpha);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Frame* AlphaFrame::clone()
|
Frame* AlphaFrame::clone()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1334,6 +1334,8 @@ void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, Data
|
||||||
{
|
{
|
||||||
std::string plistPath = filePath + ".plist";
|
std::string plistPath = filePath + ".plist";
|
||||||
std::string pngPath = filePath + ".png";
|
std::string pngPath = filePath + ".png";
|
||||||
|
if (FileUtils::getInstance()->isFileExist(dataInfo->baseFilePath + plistPath) && FileUtils::getInstance()->isFileExist(dataInfo->baseFilePath + pngPath))
|
||||||
|
{
|
||||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(dataInfo->baseFilePath + plistPath);
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(dataInfo->baseFilePath + plistPath);
|
||||||
if (dict.find("particleLifespan") != dict.end()) continue;
|
if (dict.find("particleLifespan") != dict.end()) continue;
|
||||||
|
|
||||||
|
@ -1342,6 +1344,7 @@ void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArmatureData *DataReaderHelper::decodeArmature(const rapidjson::Value& json, DataInfo *dataInfo)
|
ArmatureData *DataReaderHelper::decodeArmature(const rapidjson::Value& json, DataInfo *dataInfo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,3 +7,10 @@ cc.Terrain.CrackFixedType =
|
||||||
SKIRT = 0,
|
SKIRT = 0,
|
||||||
INCREASE_LOWER = 1,
|
INCREASE_LOWER = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc.Animate3DQuality =
|
||||||
|
{
|
||||||
|
QUALITY_NONE = 0,
|
||||||
|
QUALITY_LOW = 1,
|
||||||
|
QUALITY_HIGH = 2,
|
||||||
|
}
|
||||||
|
|
|
@ -176,6 +176,7 @@ set(TESTS_SRC
|
||||||
Classes/ShaderTest/ShaderTest.cpp
|
Classes/ShaderTest/ShaderTest.cpp
|
||||||
Classes/ShaderTest/ShaderTest2.cpp
|
Classes/ShaderTest/ShaderTest2.cpp
|
||||||
Classes/SpriteTest/SpriteTest.cpp
|
Classes/SpriteTest/SpriteTest.cpp
|
||||||
|
Classes/SpritePolygonTest/SpritePolygonTest.cpp
|
||||||
Classes/Sprite3DTest/Sprite3DTest.cpp
|
Classes/Sprite3DTest/Sprite3DTest.cpp
|
||||||
Classes/Sprite3DTest/DrawNode3D.cpp
|
Classes/Sprite3DTest/DrawNode3D.cpp
|
||||||
Classes/TerrainTest/TerrainTest.cpp
|
Classes/TerrainTest/TerrainTest.cpp
|
||||||
|
|
|
@ -305,7 +305,7 @@ void TestSuite::restartCurrTest()
|
||||||
testCase->setTestSuite(this);
|
testCase->setTestSuite(this);
|
||||||
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
|
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
|
||||||
|
|
||||||
Director::getInstance()->replaceScene(testCase);
|
Director::getInstance()->replaceScene(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestSuite::enterNextTest()
|
void TestSuite::enterNextTest()
|
||||||
|
@ -317,7 +317,7 @@ void TestSuite::enterNextTest()
|
||||||
testCase->setTestSuite(this);
|
testCase->setTestSuite(this);
|
||||||
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
|
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
|
||||||
|
|
||||||
Director::getInstance()->replaceScene(testCase);
|
Director::getInstance()->replaceScene(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestSuite::enterPreviousTest()
|
void TestSuite::enterPreviousTest()
|
||||||
|
@ -336,7 +336,7 @@ void TestSuite::enterPreviousTest()
|
||||||
testCase->setTestSuite(this);
|
testCase->setTestSuite(this);
|
||||||
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
|
testCase->setTestCaseName(_childTestNames[_currTestIndex]);
|
||||||
|
|
||||||
Director::getInstance()->replaceScene(testCase);
|
Director::getInstance()->replaceScene(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TestCase
|
//TestCase
|
||||||
|
|
|
@ -31,7 +31,7 @@ bool UISliderTest::init()
|
||||||
Size widgetSize = _widget->getContentSize();
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
// Add a label in which the slider alert will be displayed
|
// Add a label in which the slider alert will be displayed
|
||||||
_displayValueLabel = Text::create("Move the slider thumb","Move the slider thumb",32);
|
_displayValueLabel = TextBMFont::create("Move the slider thumb", "ccb/markerfelt24shadow.fnt");
|
||||||
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1));
|
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1));
|
||||||
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
_uiLayer->addChild(_displayValueLabel);
|
_uiLayer->addChild(_displayValueLabel);
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
|
void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cocos2d::ui::Text* _displayValueLabel;
|
cocos2d::ui::TextBMFont* _displayValueLabel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UISliderTest_Scale9 : public UIScene
|
class UISliderTest_Scale9 : public UIScene
|
||||||
|
|
|
@ -198,7 +198,8 @@ LOCAL_SRC_FILES := main.cpp \
|
||||||
../../Classes/UserDefaultTest/UserDefaultTest.cpp \
|
../../Classes/UserDefaultTest/UserDefaultTest.cpp \
|
||||||
../../Classes/OpenURLTest/OpenURLTest.cpp \
|
../../Classes/OpenURLTest/OpenURLTest.cpp \
|
||||||
../../Classes/ZwoptexTest/ZwoptexTest.cpp \
|
../../Classes/ZwoptexTest/ZwoptexTest.cpp \
|
||||||
../../Classes/TerrainTest/TerrainTest.cpp
|
../../Classes/TerrainTest/TerrainTest.cpp \
|
||||||
|
../../Classes/SpritePolygonTest/SpritePolygonTest.cpp
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
|
||||||
$(LOCAL_PATH)/../../../..
|
$(LOCAL_PATH)/../../../..
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require "cocos.3d.3dConstants"
|
||||||
|
|
||||||
local size = cc.Director:getInstance():getWinSize()
|
local size = cc.Director:getInstance():getWinSize()
|
||||||
local scheduler = cc.Director:getInstance():getScheduler()
|
local scheduler = cc.Director:getInstance():getScheduler()
|
||||||
local attributeNames =
|
local attributeNames =
|
||||||
|
@ -140,6 +142,8 @@ end
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
local Sprite3DWithSkinTest = {}
|
local Sprite3DWithSkinTest = {}
|
||||||
Sprite3DWithSkinTest.__index = Sprite3DWithSkinTest
|
Sprite3DWithSkinTest.__index = Sprite3DWithSkinTest
|
||||||
|
Sprite3DWithSkinTest._animateQuality = cc.Animate3DQuality.QUALITY_HIGH
|
||||||
|
Sprite3DWithSkinTest._sprites = {}
|
||||||
|
|
||||||
function Sprite3DWithSkinTest.onTouchesEnd(touches, event)
|
function Sprite3DWithSkinTest.onTouchesEnd(touches, event)
|
||||||
for i = 1,table.getn(touches) do
|
for i = 1,table.getn(touches) do
|
||||||
|
@ -154,6 +158,7 @@ function Sprite3DWithSkinTest.addNewSpriteWithCoords(parent,x,y)
|
||||||
sprite:setRotation3D({x = 0, y = 180, z = 0})
|
sprite:setRotation3D({x = 0, y = 180, z = 0})
|
||||||
sprite:setPosition(cc.p(x, y))
|
sprite:setPosition(cc.p(x, y))
|
||||||
parent:addChild(sprite)
|
parent:addChild(sprite)
|
||||||
|
table.insert(Sprite3DWithSkinTest._sprites, sprite)
|
||||||
|
|
||||||
local animation = cc.Animation3D:create("Sprite3DTest/orc.c3b")
|
local animation = cc.Animation3D:create("Sprite3DTest/orc.c3b")
|
||||||
if nil ~= animation then
|
if nil ~= animation then
|
||||||
|
@ -177,8 +182,11 @@ function Sprite3DWithSkinTest.addNewSpriteWithCoords(parent,x,y)
|
||||||
else
|
else
|
||||||
animate:setSpeed(speed)
|
animate:setSpeed(speed)
|
||||||
end
|
end
|
||||||
|
animate:setTag(110)
|
||||||
sprite:runAction(cc.RepeatForever:create(animate))
|
animate:setQuality(Sprite3DWithSkinTest._animateQuality)
|
||||||
|
local repeate = cc.RepeatForever:create(animate)
|
||||||
|
repeate:setTag(110)
|
||||||
|
sprite:runAction(repeate)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -193,8 +201,39 @@ function Sprite3DWithSkinTest.create()
|
||||||
|
|
||||||
local eventDispatcher = layer:getEventDispatcher()
|
local eventDispatcher = layer:getEventDispatcher()
|
||||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer)
|
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer)
|
||||||
|
Sprite3DWithSkinTest._sprites = {}
|
||||||
Sprite3DWithSkinTest.addNewSpriteWithCoords(layer, size.width / 2, size.height / 2)
|
Sprite3DWithSkinTest.addNewSpriteWithCoords(layer, size.width / 2, size.height / 2)
|
||||||
|
|
||||||
|
cc.MenuItemFont:setFontName("fonts/arial.ttf")
|
||||||
|
cc.MenuItemFont:setFontSize(15)
|
||||||
|
local menuItem = cc.MenuItemFont:create("High Quality")
|
||||||
|
Sprite3DWithSkinTest._animateQuality = cc.Animate3DQuality.QUALITY_HIGH
|
||||||
|
menuItem:registerScriptTapHandler(function(tag, sender)
|
||||||
|
Sprite3DWithSkinTest._animateQuality = Sprite3DWithSkinTest._animateQuality + 1
|
||||||
|
|
||||||
|
if Sprite3DWithSkinTest._animateQuality > cc.Animate3DQuality.QUALITY_HIGH then
|
||||||
|
Sprite3DWithSkinTest._animateQuality = cc.Animate3DQuality.QUALITY_NONE
|
||||||
|
end
|
||||||
|
|
||||||
|
if Sprite3DWithSkinTest._animateQuality == cc.Animate3DQuality.QUALITY_NONE then
|
||||||
|
menuItem:setString("None Quality")
|
||||||
|
elseif Sprite3DWithSkinTest._animateQuality == cc.Animate3DQuality.QUALITY_LOW then
|
||||||
|
menuItem:setString("Low Quality")
|
||||||
|
elseif Sprite3DWithSkinTest._animateQuality == cc.Animate3DQuality.QUALITY_HIGH then
|
||||||
|
menuItem:setString("High Quality")
|
||||||
|
end
|
||||||
|
|
||||||
|
for i,spriteIter in ipairs(Sprite3DWithSkinTest._sprites) do
|
||||||
|
local repAction = spriteIter:getActionByTag(110)
|
||||||
|
local animate3D = repAction:getInnerAction()
|
||||||
|
animate3D:setQuality(Sprite3DWithSkinTest._animateQuality)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
local menu = cc.Menu:create(menuItem)
|
||||||
|
menu:setPosition(cc.p(0.0, 0.0))
|
||||||
|
menuItem:setPosition(VisibleRect:left().x + 50, VisibleRect:top().y -70)
|
||||||
|
layer:addChild(menu, 1)
|
||||||
|
|
||||||
return layer
|
return layer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1078,7 +1117,8 @@ end
|
||||||
|
|
||||||
function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos)
|
function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos)
|
||||||
local visibleSize = cc.Director:getInstance():getVisibleSize()
|
local visibleSize = cc.Director:getInstance():getVisibleSize()
|
||||||
local camera = cc.Camera:createPerspective(60, visibleSize.width / visibleSize.height, 0.1, 200)
|
local camera = cc.Camera:createPerspective(60, visibleSize.width / visibleSize.height, 10, 1000)
|
||||||
|
camera:setPosition3D(cc.vec3(0.0, 0.0, 50.0))
|
||||||
camera:setCameraFlag(cc.CameraFlag.USER1)
|
camera:setCameraFlag(cc.CameraFlag.USER1)
|
||||||
--create a teapot
|
--create a teapot
|
||||||
self._teapot = cc.Sprite3D:create("Sprite3DTest/teapot.c3b")
|
self._teapot = cc.Sprite3D:create("Sprite3DTest/teapot.c3b")
|
||||||
|
@ -1091,14 +1131,14 @@ function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos)
|
||||||
"Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg")
|
"Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg")
|
||||||
|
|
||||||
--set texture parameters
|
--set texture parameters
|
||||||
local tRepeatParams = { magFilter=gl.NEAREST , minFilter=gl.NEAREST , wrapS=gl.MIRRORED_REPEAT , wrapT=gl.MIRRORED_REPEAT }
|
local tRepeatParams = { magFilter=gl.LINEAR , minFilter=gl.LINEAR , wrapS=gl.MIRRORED_REPEAT , wrapT=gl.MIRRORED_REPEAT }
|
||||||
self._textureCube:setTexParameters(tRepeatParams)
|
self._textureCube:setTexParameters(tRepeatParams)
|
||||||
|
|
||||||
--pass the texture sampler to our custom shader
|
--pass the texture sampler to our custom shader
|
||||||
state:setUniformTexture("u_cubeTex", self._textureCube)
|
state:setUniformTexture("u_cubeTex", self._textureCube)
|
||||||
|
|
||||||
self._teapot:setGLProgramState(state)
|
self._teapot:setGLProgramState(state)
|
||||||
self._teapot:setPosition3D(cc.vec3(0, -5, -20))
|
self._teapot:setPosition3D(cc.vec3(0, -5, 0))
|
||||||
self._teapot:setRotation3D(cc.vec3(-90, 180, 0))
|
self._teapot:setRotation3D(cc.vec3(-90, 180, 0))
|
||||||
|
|
||||||
local rotate_action = cc.RotateBy:create(1.5, cc.vec3(0, 30, 0))
|
local rotate_action = cc.RotateBy:create(1.5, cc.vec3(0, 30, 0))
|
||||||
|
@ -1133,15 +1173,16 @@ function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:addChild(self._teapot)
|
self:addChild(self._teapot)
|
||||||
self:addChild(camera)
|
|
||||||
|
|
||||||
self:setCameraMask(2)
|
|
||||||
|
|
||||||
--config skybox
|
--config skybox
|
||||||
self._skyBox = cc.Skybox:create()
|
self._skyBox = cc.Skybox:create()
|
||||||
|
|
||||||
self._skyBox:setTexture(self._textureCube)
|
self._skyBox:setTexture(self._textureCube)
|
||||||
self:addChild(self._skyBox)
|
self:addChild(self._skyBox)
|
||||||
|
self._skyBox:setScale(700)
|
||||||
|
|
||||||
|
self:addChild(camera)
|
||||||
|
self:setCameraMask(2)
|
||||||
|
|
||||||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||||
if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then
|
if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then
|
||||||
|
|
|
@ -106,7 +106,7 @@ local function VideoPlayerTest()
|
||||||
|
|
||||||
local function menuOnlineVideoCallback(tag, sender)
|
local function menuOnlineVideoCallback(tag, sender)
|
||||||
if nil ~= videoPlayer then
|
if nil ~= videoPlayer then
|
||||||
videoPlayer:setURL("http://video001.smgbb.cn/gslb/program/FDN/FDN1190949/HLSVodService.m3u8?_mdCode=6065719&_cdnCode=B2B_XL_TEST&_type=0&_rCode=TerOut_18865&_userId=020341000456068&_categoryCode=SMG_HUAYU&_categoryPath=SMG_1002,SMG_HUAYU,&_adPositionId=01001000&_adCategorySource=0&_flag=.m3u8&_enCode=m3u8&taskID=ysh_ps_002-ott_1397459105893_020341000456068&_client=103&_cms=ctv&_CDNToken=76C043FD4969501754DC19E54EC8DC2C")
|
videoPlayer:setURL("http://benchmark.cocos2d-x.org/cocosvideo.mp4")
|
||||||
videoPlayer:play()
|
videoPlayer:play()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -236,4 +236,8 @@ if __name__ == '__main__':
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
sys_ret = 1
|
sys_ret = 1
|
||||||
finally:
|
finally:
|
||||||
sys.exit(sys_ret)
|
print "return value is " + str(sys_ret)
|
||||||
|
if sys_ret > 0:
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
sys.exit(0)
|
||||||
|
|
|
@ -5,4 +5,8 @@ cd ${COCOS2DX_ROOT}
|
||||||
mkdir linux-build
|
mkdir linux-build
|
||||||
cd linux-build
|
cd linux-build
|
||||||
cmake ..
|
cmake ..
|
||||||
|
if [ ! $? = 0 ]; then
|
||||||
|
echo "cmake generate error"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
make -j4
|
make -j4
|
||||||
|
|
Loading…
Reference in New Issue