update for reader

1.update for sprite3d cullface
2.sync js code
This commit is contained in:
Liam 2015-08-27 18:23:13 +08:00
parent 30d6c82da6
commit ed49250b9b
4 changed files with 187 additions and 140 deletions

View File

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

View File

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

View File

@ -826,6 +826,11 @@ gl.WRITEONLY_RENDERING_QCOM = 0x8823;
gl.WRITE_ONLY_OES = 0x88b9; gl.WRITE_ONLY_OES = 0x88b9;
gl.Z400_BINARY_AMD = 0x8740; gl.Z400_BINARY_AMD = 0x8740;
gl.ZERO = 0x0; gl.ZERO = 0x0;
gl.FRONT = 0x0404;
gl.BACK = 0x0405;
gl.LEFT = 0x0406;
gl.RIGHT = 0x0407;
gl.FRONT_AND_BACK = 0x0408;
//------------Shader Name--------------- //------------Shader Name---------------
/** /**

View File

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