Merge pull request #13639 from WenhaiLin/v3.9-beta0

Sync v3.8 to v3
This commit is contained in:
pandamicro 2015-09-01 09:49:43 +08:00
commit 3be083680a
19 changed files with 263 additions and 162 deletions

View File

@ -1157,7 +1157,10 @@ Developers:
perminovVS
Optimize Vec3 and Vec2
Added `UserDefault::setDelegate()`
FileUtils: Added FileUtils::getSuitableFOpen() for convert utf8 to locale, for specific platform
platform: Correct all usage of unicode version winapi in FileUtils for win32
FileUtils: Added FileUtils::getFileExtension for getting file's extension name
utils: Made utils::captureScreen saving file in another thread to improve the performance
qiutaoleo
Added a feature to check case characters for filename on windows

View File

@ -1,4 +1,4 @@
cocos2d-x-3.8 rc0 ??
cocos2d-x-3.8 rc0 August.26 2015
cocos2d-x-3.8 beta0 August.14 2015
[HIGHLIGHT] 3D: Added 3d physics collider

View File

@ -308,6 +308,9 @@ void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera)
glEnable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(true);
glDepthMask(GL_TRUE);
RenderState::StateBlock::_defaultState->setDepthWrite(true);
glDepthFunc(GL_ALWAYS);
RenderState::StateBlock::_defaultState->setDepthFunction(RenderState::DEPTH_ALWAYS);

View File

@ -359,6 +359,7 @@ void Mesh::draw(Renderer* renderer, float globalZOrder, const Mat4& transform, u
_meshCommand.setSkipBatching(isTransparent);
_meshCommand.setTransparent(isTransparent);
_meshCommand.set3D(!_force2DQueue);
_material->getStateBlock()->setBlend(_force2DQueue || isTransparent);
// set default uniforms for Mesh
// 'u_color' and others

View File

@ -130,19 +130,15 @@ void Timer::update(float dt)
trigger(interval);
_elapsed -= interval;
_timesExecuted += 1;
if (_elapsed <= 0.f)
if (!_runForever && _timesExecuted > _repeat)
{
cancel();
break;
}
if (_runForever)
if (_elapsed <= 0.f)
{
continue;
}
if (_timesExecuted > _repeat)
{ //unschedule timer
cancel();
break;
}
}

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x-3.8-github";
return "cocos2d-x-3.8";
}
NS_CC_END

View File

@ -588,6 +588,12 @@ bool BoneNode::isPointOnRack(const cocos2d::Vec2& bonePoint)
void BoneNode::batchBoneDrawToSkeleton(BoneNode* bone) const
{
bool visibleByCamera = bone->isVisitableByVisitingCamera();
if (!visibleByCamera)
{
return;
}
cocos2d::Vec3 vpos[4];
for (int i = 0; i < 4; i++)
{

View File

@ -43,6 +43,7 @@ struct EventFrame;
struct IntFrame;
struct BoolFrame;
struct InnerActionFrame;
struct EasingData;
struct RotationSkew;
struct Position;
struct Scale;
@ -51,7 +52,9 @@ struct Color;
struct ColorVector;
struct FlatSize;
struct CapInsets;
struct BlendFunc;
struct ResourceData;
struct BlendFrame;
} // namespace flatbuffers
namespace flatbuffers {
@ -60,6 +63,7 @@ struct Node3DOption;
struct Sprite3DOptions;
struct Particle3DOptions;
struct UserCameraOptions;
struct GameNode3DOption;
struct Vector2;
struct Vector3;
@ -93,92 +97,6 @@ MANUALLY_ALIGNED_STRUCT(4) Vector3 {
};
STRUCT_END(Vector3, 12);
struct GameNode3DOption : private flatbuffers::Table {
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(4); }
int32_t skyBoxMask() const { return GetField<int32_t>(6, 0); }
uint8_t skyBoxEnabled() const { return GetField<uint8_t>(8, 0); }
const ResourceData *leftFileData() const { return GetPointer<const ResourceData *>(10); }
const ResourceData *rightFileData() const { return GetPointer<const ResourceData *>(12); }
const ResourceData *upFileData() const { return GetPointer<const ResourceData *>(14); }
const ResourceData *downFileData() const { return GetPointer<const ResourceData *>(16); }
const ResourceData *forwardFileData() const { return GetPointer<const ResourceData *>(18); }
const ResourceData *backFileData() const { return GetPointer<const ResourceData *>(20); }
const flatbuffers::String *frameEvent() const { return GetPointer<const flatbuffers::String *>(22); }
const flatbuffers::String *customProperty() const { return GetPointer<const flatbuffers::String *>(24); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* nodeOptions */) &&
verifier.Verify(name()) &&
VerifyField<int32_t>(verifier, 6 /* skyBoxMask */) &&
VerifyField<uint8_t>(verifier, 8 /* skyBoxEnabled */) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* leftFileData */) &&
verifier.VerifyTable(leftFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* rightFileData */) &&
verifier.VerifyTable(rightFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* upFileData */) &&
verifier.VerifyTable(upFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 16 /* downFileData */) &&
verifier.VerifyTable(downFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 18 /* forwardFileData */) &&
verifier.VerifyTable(forwardFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 20 /* backFileData */) &&
verifier.VerifyTable(backFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 22 /* frameEvent */) &&
verifier.Verify(frameEvent()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 24 /* customProperty */) &&
verifier.Verify(customProperty()) &&
verifier.EndTable();
}
};
struct GameNode3DOptionBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(4, name); }
void add_skyBoxMask(int32_t skyBoxMask) { fbb_.AddElement<int32_t>(6, skyBoxMask, 0); }
void add_skyboxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement<uint8_t>(8, skyBoxEnabled, 0); }
void add_leftFileData(flatbuffers::Offset<ResourceData> leftFileData) { fbb_.AddOffset(10, leftFileData); }
void add_rightFileData(flatbuffers::Offset<ResourceData> rightFileData) { fbb_.AddOffset(12, rightFileData); }
void add_upFileData(flatbuffers::Offset<ResourceData> upFileData) { fbb_.AddOffset(14, upFileData); }
void add_downFileData(flatbuffers::Offset<ResourceData> downFileData) { fbb_.AddOffset(16, downFileData); }
void add_forwardFileData(flatbuffers::Offset<ResourceData> forwardFileData) { fbb_.AddOffset(18, forwardFileData); }
void add_backFileData(flatbuffers::Offset<ResourceData> backFileData) { fbb_.AddOffset(20, backFileData); }
void add_frameEvent(flatbuffers::Offset<flatbuffers::String> frameEvent) { fbb_.AddOffset(22, frameEvent); }
void add_customProperty(flatbuffers::Offset<flatbuffers::String> customProperty) { fbb_.AddOffset(24, customProperty); }
GameNode3DOptionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
flatbuffers::Offset<GameNode3DOption> Finish() {
auto o = flatbuffers::Offset<GameNode3DOption>(fbb_.EndTable(start_, 11));
return o;
}
};
inline flatbuffers::Offset<GameNode3DOption> CreateGameNode3DOption(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
int32_t skyBoxMask = 0,
uint8_t skyBoxEnabled = 0,
flatbuffers::Offset<ResourceData> leftFileData = 0,
flatbuffers::Offset<ResourceData> rightFileData = 0,
flatbuffers::Offset<ResourceData> upFileData = 0,
flatbuffers::Offset<ResourceData> downFileData = 0,
flatbuffers::Offset<ResourceData> forwardFileData = 0,
flatbuffers::Offset<ResourceData> backFileData = 0,
flatbuffers::Offset<flatbuffers::String> frameEvent = 0,
flatbuffers::Offset<flatbuffers::String> customProperty = 0) {
GameNode3DOptionBuilder builder_(_fbb);
builder_.add_customProperty(customProperty);
builder_.add_frameEvent(frameEvent);
builder_.add_backFileData(backFileData);
builder_.add_forwardFileData(forwardFileData);
builder_.add_downFileData(downFileData);
builder_.add_upFileData(upFileData);
builder_.add_rightFileData(rightFileData);
builder_.add_leftFileData(leftFileData);
builder_.add_skyboxEnabled(skyBoxEnabled);
builder_.add_skyBoxMask(skyBoxMask);
builder_.add_name(name);
return builder_.Finish();
}
struct Node3DOption : private flatbuffers::Table {
const flatbuffers::WidgetOptions *nodeOptions() const { return GetPointer<const flatbuffers::WidgetOptions *>(4); }
const Vector3 *position3D() const { return GetStruct<const Vector3 *>(6); }
@ -232,6 +150,7 @@ struct Sprite3DOptions : private flatbuffers::Table {
const Node3DOption *node3DOption() const { return GetPointer<const Node3DOption *>(4); }
const flatbuffers::ResourceData *fileData() const { return GetPointer<const flatbuffers::ResourceData *>(6); }
uint8_t runAction() const { return GetField<uint8_t>(8, 0); }
uint8_t isFlipped() const { return GetField<uint8_t>(10, 0); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* node3DOption */) &&
@ -239,6 +158,7 @@ struct Sprite3DOptions : private flatbuffers::Table {
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* fileData */) &&
verifier.VerifyTable(fileData()) &&
VerifyField<uint8_t>(verifier, 8 /* runAction */) &&
VerifyField<uint8_t>(verifier, 10 /* isFlipped */) &&
verifier.EndTable();
}
};
@ -249,10 +169,11 @@ struct Sprite3DOptionsBuilder {
void add_node3DOption(flatbuffers::Offset<Node3DOption> node3DOption) { fbb_.AddOffset(4, node3DOption); }
void add_fileData(flatbuffers::Offset<flatbuffers::ResourceData> fileData) { fbb_.AddOffset(6, fileData); }
void add_runAction(uint8_t runAction) { fbb_.AddElement<uint8_t>(8, runAction, 0); }
void add_isFlipped(uint8_t isFlipped) { fbb_.AddElement<uint8_t>(10, isFlipped, 0); }
Sprite3DOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
Sprite3DOptionsBuilder &operator=(const Sprite3DOptionsBuilder &);
flatbuffers::Offset<Sprite3DOptions> Finish() {
auto o = flatbuffers::Offset<Sprite3DOptions>(fbb_.EndTable(start_, 3));
auto o = flatbuffers::Offset<Sprite3DOptions>(fbb_.EndTable(start_, 4));
return o;
}
};
@ -260,10 +181,12 @@ struct Sprite3DOptionsBuilder {
inline flatbuffers::Offset<Sprite3DOptions> CreateSprite3DOptions(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<Node3DOption> node3DOption = 0,
flatbuffers::Offset<flatbuffers::ResourceData> fileData = 0,
uint8_t runAction = 0) {
uint8_t runAction = 0,
uint8_t isFlipped = 0) {
Sprite3DOptionsBuilder builder_(_fbb);
builder_.add_fileData(fileData);
builder_.add_node3DOption(node3DOption);
builder_.add_isFlipped(isFlipped);
builder_.add_runAction(runAction);
return builder_.Finish();
}
@ -310,12 +233,12 @@ struct UserCameraOptions : private flatbuffers::Table {
float farClip() const { return GetField<float>(10, 1000); }
int32_t cameraFlag() const { return GetField<int32_t>(12, 0); }
uint8_t skyBoxEnabled() const { return GetField<uint8_t>(14, 0); }
const ResourceData *leftFileData() const { return GetPointer<const ResourceData *>(16); }
const ResourceData *rightFileData() const { return GetPointer<const ResourceData *>(18); }
const ResourceData *upFileData() const { return GetPointer<const ResourceData *>(20); }
const ResourceData *downFileData() const { return GetPointer<const ResourceData *>(22); }
const ResourceData *forwardFileData() const { return GetPointer<const ResourceData *>(24); }
const ResourceData *backFileData() const { return GetPointer<const ResourceData *>(26); }
const flatbuffers::ResourceData *leftFileData() const { return GetPointer<const flatbuffers::ResourceData *>(16); }
const flatbuffers::ResourceData *rightFileData() const { return GetPointer<const flatbuffers::ResourceData *>(18); }
const flatbuffers::ResourceData *upFileData() const { return GetPointer<const flatbuffers::ResourceData *>(20); }
const flatbuffers::ResourceData *downFileData() const { return GetPointer<const flatbuffers::ResourceData *>(22); }
const flatbuffers::ResourceData *forwardFileData() const { return GetPointer<const flatbuffers::ResourceData *>(24); }
const flatbuffers::ResourceData *backFileData() const { return GetPointer<const flatbuffers::ResourceData *>(26); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* node3DOption */) &&
@ -349,13 +272,13 @@ struct UserCameraOptionsBuilder {
void add_nearClip(float nearClip) { fbb_.AddElement<float>(8, nearClip, 1); }
void add_farClip(float farClip) { fbb_.AddElement<float>(10, farClip, 1000); }
void add_cameraFlag(int32_t cameraFlag) { fbb_.AddElement<int32_t>(12, cameraFlag, 0); }
void add_skyboxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement<uint8_t>(14, skyBoxEnabled, 0); }
void add_leftFileData(flatbuffers::Offset<ResourceData> leftFileData) { fbb_.AddOffset(16, leftFileData); }
void add_rightFileData(flatbuffers::Offset<ResourceData> rightFileData) { fbb_.AddOffset(18, rightFileData); }
void add_upFileData(flatbuffers::Offset<ResourceData> upFileData) { fbb_.AddOffset(20, upFileData); }
void add_downFileData(flatbuffers::Offset<ResourceData> downFileData) { fbb_.AddOffset(22, downFileData); }
void add_forwardFileData(flatbuffers::Offset<ResourceData> forwardFileData) { fbb_.AddOffset(24, forwardFileData); }
void add_backFileData(flatbuffers::Offset<ResourceData> backFileData) { fbb_.AddOffset(26, backFileData); }
void add_skyBoxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement<uint8_t>(14, skyBoxEnabled, 0); }
void add_leftFileData(flatbuffers::Offset<flatbuffers::ResourceData> leftFileData) { fbb_.AddOffset(16, leftFileData); }
void add_rightFileData(flatbuffers::Offset<flatbuffers::ResourceData> rightFileData) { fbb_.AddOffset(18, rightFileData); }
void add_upFileData(flatbuffers::Offset<flatbuffers::ResourceData> upFileData) { fbb_.AddOffset(20, upFileData); }
void add_downFileData(flatbuffers::Offset<flatbuffers::ResourceData> downFileData) { fbb_.AddOffset(22, downFileData); }
void add_forwardFileData(flatbuffers::Offset<flatbuffers::ResourceData> forwardFileData) { fbb_.AddOffset(24, forwardFileData); }
void add_backFileData(flatbuffers::Offset<flatbuffers::ResourceData> backFileData) { fbb_.AddOffset(26, backFileData); }
UserCameraOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
UserCameraOptionsBuilder &operator=(const UserCameraOptionsBuilder &);
flatbuffers::Offset<UserCameraOptions> Finish() {
@ -371,12 +294,12 @@ inline flatbuffers::Offset<UserCameraOptions> CreateUserCameraOptions(flatbuffer
float farClip = 1000,
int32_t cameraFlag = 0,
uint8_t skyBoxEnabled = 0,
flatbuffers::Offset<ResourceData> leftFileData = 0,
flatbuffers::Offset<ResourceData> rightFileData = 0,
flatbuffers::Offset<ResourceData> upFileData = 0,
flatbuffers::Offset<ResourceData> downFileData = 0,
flatbuffers::Offset<ResourceData> forwardFileData = 0,
flatbuffers::Offset<ResourceData> backFileData = 0) {
flatbuffers::Offset<flatbuffers::ResourceData> leftFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> rightFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> upFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> downFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> forwardFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> backFileData = 0) {
UserCameraOptionsBuilder builder_(_fbb);
builder_.add_backFileData(backFileData);
builder_.add_forwardFileData(forwardFileData);
@ -384,12 +307,99 @@ inline flatbuffers::Offset<UserCameraOptions> CreateUserCameraOptions(flatbuffer
builder_.add_upFileData(upFileData);
builder_.add_rightFileData(rightFileData);
builder_.add_leftFileData(leftFileData);
builder_.add_skyboxEnabled(skyBoxEnabled);
builder_.add_cameraFlag(cameraFlag);
builder_.add_farClip(farClip);
builder_.add_nearClip(nearClip);
builder_.add_fov(fov);
builder_.add_node3DOption(node3DOption);
builder_.add_skyBoxEnabled(skyBoxEnabled);
return builder_.Finish();
}
struct GameNode3DOption : private flatbuffers::Table {
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(4); }
int32_t skyBoxMask() const { return GetField<int32_t>(6, 0); }
uint8_t skyBoxEnabled() const { return GetField<uint8_t>(8, 0); }
const flatbuffers::ResourceData *leftFileData() const { return GetPointer<const flatbuffers::ResourceData *>(10); }
const flatbuffers::ResourceData *rightFileData() const { return GetPointer<const flatbuffers::ResourceData *>(12); }
const flatbuffers::ResourceData *upFileData() const { return GetPointer<const flatbuffers::ResourceData *>(14); }
const flatbuffers::ResourceData *downFileData() const { return GetPointer<const flatbuffers::ResourceData *>(16); }
const flatbuffers::ResourceData *forwardFileData() const { return GetPointer<const flatbuffers::ResourceData *>(18); }
const flatbuffers::ResourceData *backFileData() const { return GetPointer<const flatbuffers::ResourceData *>(20); }
const flatbuffers::String *frameEvent() const { return GetPointer<const flatbuffers::String *>(22); }
const flatbuffers::String *customProperty() const { return GetPointer<const flatbuffers::String *>(24); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* name */) &&
verifier.Verify(name()) &&
VerifyField<int32_t>(verifier, 6 /* skyBoxMask */) &&
VerifyField<uint8_t>(verifier, 8 /* skyBoxEnabled */) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* leftFileData */) &&
verifier.VerifyTable(leftFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* rightFileData */) &&
verifier.VerifyTable(rightFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* upFileData */) &&
verifier.VerifyTable(upFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 16 /* downFileData */) &&
verifier.VerifyTable(downFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 18 /* forwardFileData */) &&
verifier.VerifyTable(forwardFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 20 /* backFileData */) &&
verifier.VerifyTable(backFileData()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 22 /* frameEvent */) &&
verifier.Verify(frameEvent()) &&
VerifyField<flatbuffers::uoffset_t>(verifier, 24 /* customProperty */) &&
verifier.Verify(customProperty()) &&
verifier.EndTable();
}
};
struct GameNode3DOptionBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(4, name); }
void add_skyBoxMask(int32_t skyBoxMask) { fbb_.AddElement<int32_t>(6, skyBoxMask, 0); }
void add_skyBoxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement<uint8_t>(8, skyBoxEnabled, 0); }
void add_leftFileData(flatbuffers::Offset<flatbuffers::ResourceData> leftFileData) { fbb_.AddOffset(10, leftFileData); }
void add_rightFileData(flatbuffers::Offset<flatbuffers::ResourceData> rightFileData) { fbb_.AddOffset(12, rightFileData); }
void add_upFileData(flatbuffers::Offset<flatbuffers::ResourceData> upFileData) { fbb_.AddOffset(14, upFileData); }
void add_downFileData(flatbuffers::Offset<flatbuffers::ResourceData> downFileData) { fbb_.AddOffset(16, downFileData); }
void add_forwardFileData(flatbuffers::Offset<flatbuffers::ResourceData> forwardFileData) { fbb_.AddOffset(18, forwardFileData); }
void add_backFileData(flatbuffers::Offset<flatbuffers::ResourceData> backFileData) { fbb_.AddOffset(20, backFileData); }
void add_frameEvent(flatbuffers::Offset<flatbuffers::String> frameEvent) { fbb_.AddOffset(22, frameEvent); }
void add_customProperty(flatbuffers::Offset<flatbuffers::String> customProperty) { fbb_.AddOffset(24, customProperty); }
GameNode3DOptionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
GameNode3DOptionBuilder &operator=(const GameNode3DOptionBuilder &);
flatbuffers::Offset<GameNode3DOption> Finish() {
auto o = flatbuffers::Offset<GameNode3DOption>(fbb_.EndTable(start_, 11));
return o;
}
};
inline flatbuffers::Offset<GameNode3DOption> CreateGameNode3DOption(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<flatbuffers::String> name = 0,
int32_t skyBoxMask = 0,
uint8_t skyBoxEnabled = 0,
flatbuffers::Offset<flatbuffers::ResourceData> leftFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> rightFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> upFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> downFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> forwardFileData = 0,
flatbuffers::Offset<flatbuffers::ResourceData> backFileData = 0,
flatbuffers::Offset<flatbuffers::String> frameEvent = 0,
flatbuffers::Offset<flatbuffers::String> customProperty = 0) {
GameNode3DOptionBuilder builder_(_fbb);
builder_.add_customProperty(customProperty);
builder_.add_frameEvent(frameEvent);
builder_.add_backFileData(backFileData);
builder_.add_forwardFileData(forwardFileData);
builder_.add_downFileData(downFileData);
builder_.add_upFileData(upFileData);
builder_.add_rightFileData(rightFileData);
builder_.add_leftFileData(leftFileData);
builder_.add_skyBoxMask(skyBoxMask);
builder_.add_name(name);
builder_.add_skyBoxEnabled(skyBoxEnabled);
return builder_.Finish();
}

View File

@ -109,6 +109,7 @@ namespace cocostudio
bool runAction = false;
std::string path;
int resourceType = 0;
bool isFlipped = false;
std::string attriname;
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
@ -120,7 +121,10 @@ namespace cocostudio
if(attriname == "RunAction3D")
{
runAction = value == "True" ? true : false;
break;
}
else if (attriname == "IsFlipped")
{
isFlipped = value == "True" ? true : false;
}
attribute = attribute->Next();
@ -170,7 +174,8 @@ namespace cocostudio
builder->CreateString(path),
builder->CreateString(""),
resourceType),
runAction
runAction,
isFlipped
);
return *(Offset<Table>*)(&options);
@ -184,6 +189,7 @@ namespace cocostudio
auto options = (Sprite3DOptions*)sprite3DOptions;
bool runAction = options->runAction() != 0;
bool isFlipped = options->isFlipped() != 0;
auto fileData = options->fileData();
std::string path = fileData->path()->c_str();
@ -213,6 +219,11 @@ namespace cocostudio
{
sprite3D->setColor(Color3B(red, green, blue));
}
if (isFlipped)
{
sprite3D->setCullFaceEnabled(true);
sprite3D->setCullFace(GL_FRONT);
}
auto node3DReader = Node3DReader::getInstance();
node3DReader->setPropsWithFlatBuffers(sprite3D, (Table*)(options->node3DOption()));
@ -230,7 +241,7 @@ namespace cocostudio
{
ret->initWithFile(path);
}
setPropsWithFlatBuffers(ret, sprite3DOptions);
return ret;

View File

@ -108,6 +108,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
private Cocos2dxVideoHelper mVideoHelper = null;
private Cocos2dxWebViewHelper mWebViewHelper = null;
private Cocos2dxEditBoxHelper mEditBoxHelper = null;
private boolean hasFocus = false;
public Cocos2dxGLSurfaceView getGLSurfaceView(){
return mGLSurfaceView;
@ -338,21 +339,30 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
@Override
protected void onResume() {
Log.d(TAG, "onResume()");
super.onResume();
resumeIfHasFocus();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
Log.d(TAG, "onWindowFocusChanged() hasFocus=" + hasFocus);
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
Cocos2dxHelper.onResume();
mGLSurfaceView.onResume();
this.hasFocus = hasFocus;
resumeIfHasFocus();
}
private void resumeIfHasFocus() {
if(hasFocus) {
Cocos2dxHelper.onResume();
mGLSurfaceView.onResume();
}
}
@Override
protected void onPause() {
Log.d(TAG, "onPause()");
super.onPause();
Cocos2dxHelper.onPause();
mGLSurfaceView.onPause();

View File

@ -543,15 +543,19 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glEnable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(true);
RenderState::StateBlock::_defaultState->setDepthWrite(true);
RenderState::StateBlock::_defaultState->setBlend(true);
}
else
{
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glEnable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(false);
RenderState::StateBlock::_defaultState->setDepthWrite(false);
RenderState::StateBlock::_defaultState->setBlend(true);
}
for (auto it = zNegQueue.cbegin(); it != zNegQueue.cend(); ++it)
{
@ -569,8 +573,10 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
//Clear depth to achieve layered rendering
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glDisable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(true);
RenderState::StateBlock::_defaultState->setDepthWrite(true);
RenderState::StateBlock::_defaultState->setBlend(false);
for (auto it = opaqueQueue.cbegin(); it != opaqueQueue.cend(); ++it)
@ -588,9 +594,11 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(false);
glEnable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(true);
RenderState::StateBlock::_defaultState->setDepthWrite(false);
RenderState::StateBlock::_defaultState->setBlend(true);
for (auto it = transQueue.cbegin(); it != transQueue.cend(); ++it)
@ -610,18 +618,22 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glEnable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(true);
RenderState::StateBlock::_defaultState->setDepthWrite(true);
RenderState::StateBlock::_defaultState->setBlend(true);
}
else
{
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glEnable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(false);
RenderState::StateBlock::_defaultState->setDepthWrite(false);
RenderState::StateBlock::_defaultState->setBlend(true);
}
for (auto it = zZeroQueue.cbegin(); it != zZeroQueue.cend(); ++it)
@ -637,6 +649,29 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
const auto& zPosQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_POS);
if (zPosQueue.size() > 0)
{
if(_isDepthTestFor2D)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glEnable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(true);
RenderState::StateBlock::_defaultState->setDepthWrite(true);
RenderState::StateBlock::_defaultState->setBlend(true);
}
else
{
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glEnable(GL_BLEND);
RenderState::StateBlock::_defaultState->setDepthTest(false);
RenderState::StateBlock::_defaultState->setDepthWrite(false);
RenderState::StateBlock::_defaultState->setBlend(true);
}
for (auto it = zPosQueue.cbegin(); it != zPosQueue.cend(); ++it)
{
processRenderCommand(*it);

View File

@ -39,7 +39,7 @@
#include <assert.h>
#include <memory>
#define ENGINE_VERSION "Cocos2d-JS v3.8 RC0"
#define ENGINE_VERSION "Cocos2d-JS v3.8"
void js_log(const char *format, ...);

View File

@ -26,7 +26,7 @@
// CCConfig.js
//
cc.ENGINE_VERSION = "Cocos2d-JS v3.8 RC0";
cc.ENGINE_VERSION = "Cocos2d-JS v3.8";
cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0;
cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0};

View File

@ -381,6 +381,7 @@ gl.INVERT = 0x150a;
gl.KEEP = 0x1e00;
gl.KHR_debug = 0x1;
gl.KHR_texture_compression_astc_ldr = 0x1;
gl.LEFT = 0x0406;
gl.LEQUAL = 0x203;
gl.LESS = 0x201;
gl.LINEAR = 0x2601;
@ -620,6 +621,7 @@ gl.RGBA4_OES = 0x8056;
gl.RGBA8_OES = 0x8058;
gl.RGB_422_APPLE = 0x8a1f;
gl.RG_EXT = 0x8227;
gl.RIGHT = 0x0407;
gl.SAMPLER = 0x82e6;
gl.SAMPLER_2D = 0x8b5e;
gl.SAMPLER_2D_ARRAY_SHADOW_NV = 0x8dc4;

View File

@ -160,6 +160,7 @@
}
};
var skyBoxBrushInstance = null;
var getSkyboxRes = function(json, key) {
if(json.hasOwnProperty(key) && json[key].hasOwnProperty("Path")) {
return json[key]["Path"];
@ -172,7 +173,7 @@
* @param json
* @returns {cc.Node}
*/
parser.initSingleNode = function(json){
parser.initSingleNode = function(json, resourcePath){
var node = new cc.Node();
this.generalAttributes(node, json);
@ -180,23 +181,25 @@
if(color != null)
node.setColor(getColor(color));
if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"])
if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"]&&
json.hasOwnProperty("SkyBoxValid") && true == json["SkyBoxValid"])
{
var leftFileData = getSkyboxRes(json, "LeftImage");
var rightFileData = getSkyboxRes(json, "RightImage");
var upFileData = getSkyboxRes(json, "UpImage");
var downFileData = getSkyboxRes(json, "DownImage");
var forwardFileData = getSkyboxRes(json, "ForwardImage");
var backFileData = getSkyboxRes(json, "BackImage");
var cameraFlag = json["SkyBoxMask"];
if(undefined === cameraFlag || isNaN(cameraFlag)) {
cameraFlag = 1024;
var leftFileData = resourcePath + getSkyboxRes(json, "LeftImage");
var rightFileData = resourcePath + getSkyboxRes(json, "RightImage");
var upFileData = resourcePath + getSkyboxRes(json, "UpImage");
var downFileData = resourcePath + getSkyboxRes(json, "DownImage");
var forwardFileData = resourcePath + getSkyboxRes(json, "ForwardImage");
var backFileData = resourcePath + getSkyboxRes(json, "BackImage");
var fileUtil = jsb.fileUtils;
if(fileUtil.isFileExist(leftFileData)&&
fileUtil.isFileExist(rightFileData)&&
fileUtil.isFileExist(upFileData)&&
fileUtil.isFileExist(downFileData)&&
fileUtil.isFileExist(forwardFileData)&&
fileUtil.isFileExist(backFileData))
{
skyBoxBrushInstance = cc.CameraBackgroundSkyBoxBrush.create(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData);
}
var skyBox = new jsb.Skybox();
skyBox.init(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData);
skyBox.setCameraMask(cameraFlag, false);
node.addChild(skyBox);
}
return node;
@ -1439,7 +1442,7 @@
* @param json
* @returns {*}
*/
parser.initCamera = function(json){
parser.initCamera = function(json,resourcePath){
var s = cc.winSize;
var fov = json["Fov"] ? json["Fov"] : 60;
@ -1500,21 +1503,34 @@
node.setCameraFlag(cameraFlag);
}
if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"])
if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"] &&
json.hasOwnProperty("SkyBoxValid") && true == json["SkyBoxValid"])
{
var leftFileData = getSkyboxRes(json, "LeftImage");
var rightFileData = getSkyboxRes(json, "RightImage");
var upFileData = getSkyboxRes(json, "UpImage");
var downFileData = getSkyboxRes(json, "DownImage");
var forwardFileData = getSkyboxRes(json, "ForwardImage");
var backFileData = getSkyboxRes(json, "BackImage");
var leftFileData = resourcePath + getSkyboxRes(json, "LeftImage");
var rightFileData = resourcePath + getSkyboxRes(json, "RightImage");
var upFileData = resourcePath + getSkyboxRes(json, "UpImage");
var downFileData = resourcePath + getSkyboxRes(json, "DownImage");
var forwardFileData = resourcePath + getSkyboxRes(json, "ForwardImage");
var backFileData = resourcePath + getSkyboxRes(json, "BackImage");
var skyBox = new jsb.Skybox();
skyBox.init(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData);
skyBox.setCameraMask(cameraFlag);
node.addChild(skyBox);
var fileUtil = jsb.fileUtils;
if(fileUtil.isFileExist(leftFileData)&&
fileUtil.isFileExist(rightFileData)&&
fileUtil.isFileExist(upFileData)&&
fileUtil.isFileExist(downFileData)&&
fileUtil.isFileExist(forwardFileData)&&
fileUtil.isFileExist(backFileData))
{
var innerBrush = cc.CameraBackgroundSkyBoxBrush.create(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData);
node.setBackgroundBrush(innerBrush);
}
else
node.setBackgroundBrush(skyBoxBrushInstance);
}
else if(skyBoxBrushInstance != null)
{
node.setBackgroundBrush(skyBoxBrushInstance);
}
return node;
};
@ -1546,6 +1562,11 @@
node.setColor(col);
}
if(json.hasOwnProperty("IsFlipped") && true == json["IsFlipped"]) {
node.setCullFaceEnabled(true);
node.setCullFace(gl.FRONT);
}
var autoAction = getParam(json["RunAction3D"], false);
if(autoAction && resFile){
var animation = jsb.Animation3D.create(resFile, "");

View File

@ -98,8 +98,8 @@ Slider* Slider::create(const std::string& barTextureName,
Slider* widget = new (std::nothrow) Slider();
if (widget && widget->init())
{
widget->loadBarTexture(barTextureName);
widget->loadSlidBallTextureNormal(normalBallTextureName);
widget->loadBarTexture(barTextureName, resType);
widget->loadSlidBallTextureNormal(normalBallTextureName, resType);
widget->autorelease();
return widget;
}

View File

@ -181,7 +181,7 @@ Here is some highlighted improvments and API changes:
## Download
[Cocos2d-x v3.8 rc0](http://www.cocos2d-x.org/filedown/cocos2d-x-3.8-rc0.zip) including : C++, Lua & JS
[Cocos2d-x v3.8](http://www.cocos2d-x.org/filedown/cocos2d-x-3.8.zip) including : C++, Lua & JS
## The main features in detail:
@ -270,9 +270,12 @@ Here is some highlighted improvments and API changes:
1. Reimplemented EditBox
The usage of EditBox is the same as before. It is more likely a iOS version EditBox remake plus a few improvments.
The usage of EditBox is the same as before, but we have reimplemented it for Android platform. The use experience is highly improved, important improvements are:
Besides, it supports multi-line input now, you should set InputMode to `ANY` to enable multi-line input.
- Display cursor in EditBox
- Support copy, cut, paste and select actions in EditBox
- Support multi-line input, you should set InputMode to `ANY` to enable multi-line input
- EditBox won't be masked by the keyboard UI anymore
2. ScrollViewBar

View File

@ -193,7 +193,7 @@ var SocketIOTestLayer = cc.Layer.extend({
onMenuSIOEndpointClicked: function(sender) {
//repeat the same connection steps for the namespace "testpoint"
var sioendpoint = SocketIO.connect("ws://tools.itharbors.com:4000/testpoint");
var sioendpoint = SocketIO.connect("ws://tools.itharbors.com:4000/testpoint", {"force new connection" : true});
//a tag to differentiate in shared callbacks
sioendpoint.tag = "Test Endpoint";

2
web

@ -1 +1 @@
Subproject commit 3aac6645cf36f40077d642daf8876913361fc930
Subproject commit 31263de3f661cdf42760884f162c56af0824ed0d