|
@ -828,6 +828,10 @@
|
|||
182C5CD71A98F30500C30D34 /* Sprite3DReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 182C5CD41A98F30500C30D34 /* Sprite3DReader.cpp */; };
|
||||
182C5CD81A98F30500C30D34 /* Sprite3DReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 182C5CD51A98F30500C30D34 /* Sprite3DReader.h */; };
|
||||
182C5CD91A98F30500C30D34 /* Sprite3DReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 182C5CD51A98F30500C30D34 /* Sprite3DReader.h */; };
|
||||
182C5CE51A9D725400C30D34 /* UserCameraReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 182C5CE31A9D725400C30D34 /* UserCameraReader.cpp */; };
|
||||
182C5CE61A9D725400C30D34 /* UserCameraReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 182C5CE31A9D725400C30D34 /* UserCameraReader.cpp */; };
|
||||
182C5CE71A9D725400C30D34 /* UserCameraReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 182C5CE41A9D725400C30D34 /* UserCameraReader.h */; };
|
||||
182C5CE81A9D725400C30D34 /* UserCameraReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 182C5CE41A9D725400C30D34 /* UserCameraReader.h */; };
|
||||
1A01C68418F57BE800EFE3A6 /* CCArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A01C67618F57BE800EFE3A6 /* CCArray.cpp */; };
|
||||
1A01C68518F57BE800EFE3A6 /* CCArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A01C67618F57BE800EFE3A6 /* CCArray.cpp */; };
|
||||
1A01C68618F57BE800EFE3A6 /* CCArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A01C67718F57BE800EFE3A6 /* CCArray.h */; };
|
||||
|
@ -2451,6 +2455,8 @@
|
|||
182C5CB11A95964700C30D34 /* Node3DReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Node3DReader.h; path = Node3DReader/Node3DReader.h; sourceTree = "<group>"; };
|
||||
182C5CD41A98F30500C30D34 /* Sprite3DReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite3DReader.cpp; path = Sprite3DReader/Sprite3DReader.cpp; sourceTree = "<group>"; };
|
||||
182C5CD51A98F30500C30D34 /* Sprite3DReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sprite3DReader.h; path = Sprite3DReader/Sprite3DReader.h; sourceTree = "<group>"; };
|
||||
182C5CE31A9D725400C30D34 /* UserCameraReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UserCameraReader.cpp; path = UserCameraReader/UserCameraReader.cpp; sourceTree = "<group>"; };
|
||||
182C5CE41A9D725400C30D34 /* UserCameraReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserCameraReader.h; path = UserCameraReader/UserCameraReader.h; sourceTree = "<group>"; };
|
||||
1A01C67618F57BE800EFE3A6 /* CCArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCArray.cpp; sourceTree = "<group>"; };
|
||||
1A01C67718F57BE800EFE3A6 /* CCArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCArray.h; sourceTree = "<group>"; };
|
||||
1A01C67818F57BE800EFE3A6 /* CCBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBool.h; sourceTree = "<group>"; };
|
||||
|
@ -3804,6 +3810,15 @@
|
|||
name = Sprite3DReader;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
182C5CE21A9D70C000C30D34 /* UserCameraReader */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
182C5CE31A9D725400C30D34 /* UserCameraReader.cpp */,
|
||||
182C5CE41A9D725400C30D34 /* UserCameraReader.h */,
|
||||
);
|
||||
name = UserCameraReader;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1A01C67518F57BE800EFE3A6 /* deprecated */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -5647,6 +5662,7 @@
|
|||
50FCEB6818C72017004AD434 /* WidgetReader */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
182C5CE21A9D70C000C30D34 /* UserCameraReader */,
|
||||
182C5CD31A98F2F400C30D34 /* Sprite3DReader */,
|
||||
182C5CAF1A95961E00C30D34 /* Node3DReader */,
|
||||
38F5263A1A48363B000DB7F7 /* ArmatureNodeReader */,
|
||||
|
@ -6369,6 +6385,7 @@
|
|||
1A570204180BCBD40088DEC7 /* CCClippingNode.h in Headers */,
|
||||
15AE1A7B19AAD40300C27E9E /* b2PolygonContact.h in Headers */,
|
||||
15AE1A2919AAD3D500C27E9E /* b2Collision.h in Headers */,
|
||||
182C5CE71A9D725400C30D34 /* UserCameraReader.h in Headers */,
|
||||
38B8E2D719E66581002D7CE7 /* CSLoader.h in Headers */,
|
||||
50643BE419BFCF1800EF68ED /* CCPlatformMacros.h in Headers */,
|
||||
15AE184219AAD2F700C27E9E /* CCSprite3D.h in Headers */,
|
||||
|
@ -6941,6 +6958,7 @@
|
|||
15AE1C0219AAE01E00C27E9E /* CCScrollView.h in Headers */,
|
||||
B6877AA11A8CA8A700643ABF /* CCPUParticle3DColorAffectorTranslator.h in Headers */,
|
||||
1A5701A8180BCB590088DEC7 /* CCFontAtlasCache.h in Headers */,
|
||||
182C5CE81A9D725400C30D34 /* UserCameraReader.h in Headers */,
|
||||
15AE1A4C19AAD3D500C27E9E /* b2EdgeShape.h in Headers */,
|
||||
1A5701B4180BCB590088DEC7 /* CCFontFNT.h in Headers */,
|
||||
B6877ABD1A8CA8A700643ABF /* CCPUParticle3DGravityAffector.h in Headers */,
|
||||
|
@ -7664,6 +7682,7 @@
|
|||
B6877ACA1A8CA8A700643ABF /* CCPUParticle3DJetAffector.cpp in Sources */,
|
||||
B6877A7A1A8CA8A700643ABF /* CCPUParticle3DBaseCollider.cpp in Sources */,
|
||||
B63990CC1A490AFE00B07923 /* CCAsyncTaskPool.cpp in Sources */,
|
||||
182C5CE51A9D725400C30D34 /* UserCameraReader.cpp in Sources */,
|
||||
1A5701EA180BCB8C0088DEC7 /* CCTransitionPageTurn.cpp in Sources */,
|
||||
15AE186B19AAD31D00C27E9E /* SimpleAudioEngine.mm in Sources */,
|
||||
50ABBDAD1925AB4100A911A9 /* CCRenderer.cpp in Sources */,
|
||||
|
@ -8020,6 +8039,7 @@
|
|||
B68779371A8CA84900643ABF /* CCPUParticle3DForceField.cpp in Sources */,
|
||||
B29A7E1C19EE1B7700872B35 /* SkeletonJson.c in Sources */,
|
||||
B2CC507C19776DD10041958E /* CCPhysicsJoint.cpp in Sources */,
|
||||
182C5CE61A9D725400C30D34 /* UserCameraReader.cpp in Sources */,
|
||||
38B8E2E219E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */,
|
||||
B2165EEA19921124000BE3E6 /* CCPrimitiveCommand.cpp in Sources */,
|
||||
15AE185C19AAD31200C27E9E /* CDOpenALSupport.m in Sources */,
|
||||
|
|
|
@ -489,7 +489,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\TextFieldReader\TextFieldReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\TextReader\TextReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\Node3DReader\Node3DReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\WidgetReader.cpp" />
|
||||
<ClCompile Include="..\math\CCAffineTransform.cpp" />
|
||||
<ClCompile Include="..\math\CCGeometry.cpp" />
|
||||
|
@ -993,7 +994,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\TextFieldReader\TextFieldReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\TextReader\TextReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Node3DReader\Node3DReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\WidgetReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\WidgetReaderProtocol.h" />
|
||||
<ClInclude Include="..\math\CCAffineTransform.h" />
|
||||
|
|
|
@ -160,6 +160,9 @@
|
|||
<Filter Include="cocostudio\reader\WidgetReader\Node3DReader">
|
||||
<UniqueIdentifier>{9421ece2-69f8-4cee-8e59-51043ba06f15}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="cocostudio\reader\WidgetReader\UserCameraReader">
|
||||
<UniqueIdentifier>{9421e104-69f8-4cee-8e59-51043ba06f15}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="cocostudio\reader\WidgetReader\Sprite3DReader">
|
||||
<UniqueIdentifier>{94210432-69f8-4cee-8e59-51043ba06f15}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -988,6 +991,9 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\Sprite3DReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\UserCameraReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClCompile>
|
||||
|
@ -2452,6 +2458,9 @@
|
|||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Node3DReader\Node3DReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\Node3DReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\UserCameraReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\Sprite3DReader</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -516,6 +516,7 @@
|
|||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\TextReader\TextReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Node3DReader\Node3DReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\WidgetReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\WidgetReaderProtocol.h" />
|
||||
<ClInclude Include="..\math\CCAffineTransform.h" />
|
||||
|
@ -1097,6 +1098,7 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\TextReader\TextReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\Node3DReader\Node3DReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\WidgetReader.cpp" />
|
||||
<ClCompile Include="..\math\CCAffineTransform.cpp" />
|
||||
<ClCompile Include="..\math\CCGeometry.cpp" />
|
||||
|
|
|
@ -128,6 +128,9 @@
|
|||
<Filter Include="cocostudio\reader\WidgetReader\Node3DReader">
|
||||
<UniqueIdentifier>{89da718e-f2fa-4437-83e8-40104f6fc3a2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="cocostudio\reader\WidgetReader\UserCameraReader">
|
||||
<UniqueIdentifier>{89da718e-f2fa-1043-83e8-40104f6fc3a2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="cocostudio\reader\WidgetReader\Sprite3DReader">
|
||||
<UniqueIdentifier>{8910718e-f2fa-4437-83e8-40104f6fc3a2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -1031,6 +1034,9 @@
|
|||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\Sprite3DReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\UserCameraReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClCompile>
|
||||
|
@ -2530,7 +2536,10 @@
|
|||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\Sprite3DReader\Sprite3DReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\Sprite3DReader</Filter>
|
||||
</ClInclude>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\WidgetReader\UserCameraReader\UserCameraReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\UserCameraReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\CocoLoader.h">
|
||||
<Filter>cocostudio\json</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.h"
|
||||
#include "cocostudio/WidgetReader/Node3DReader/Node3DReader.h"
|
||||
#include "cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h"
|
||||
#include "cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h"
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "flatbuffers/util.h"
|
||||
|
@ -208,6 +209,7 @@ CSLoader::CSLoader()
|
|||
CREATE_CLASS_NODE_READER_INFO(ArmatureNodeReader);
|
||||
CREATE_CLASS_NODE_READER_INFO(Node3DReader);
|
||||
CREATE_CLASS_NODE_READER_INFO(Sprite3DReader);
|
||||
CREATE_CLASS_NODE_READER_INFO(UserCameraReader);
|
||||
}
|
||||
|
||||
void CSLoader::purge()
|
||||
|
|
|
@ -63,6 +63,7 @@ WidgetReader/TextFieldReader/TextFieldReader.cpp \
|
|||
WidgetReader/TextReader/TextReader.cpp \
|
||||
WidgetReader/Node3DReader/Node3DReader.cpp \
|
||||
WidgetReader/Sprite3DReader/Sprite3DReader.cpp \
|
||||
WidgetReader/UserCameraReader/UserCameraReader.cpp \
|
||||
ActionTimeline/CCNodeReader.cpp \
|
||||
ActionTimeline/CCActionTimelineCache.cpp \
|
||||
ActionTimeline/CCFrame.cpp \
|
||||
|
|
|
@ -60,6 +60,7 @@ set(COCOS_CS_SRC
|
|||
editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp
|
||||
editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp
|
||||
editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp
|
||||
editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp
|
||||
editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp
|
||||
editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp
|
||||
editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp
|
||||
|
|
|
@ -220,16 +220,16 @@ inline flatbuffers::Offset<Particle3DOptions> CreateParticle3DOptions(flatbuffer
|
|||
struct UserCameraOptions : private flatbuffers::Table {
|
||||
const Node3DOption *node3DOption() const { return GetPointer<const Node3DOption *>(4); }
|
||||
float fov() const { return GetField<float>(6, 60); }
|
||||
float near() const { return GetField<float>(8, 1); }
|
||||
float far() const { return GetField<float>(10, 1000); }
|
||||
float nearClip() const { return GetField<float>(8, 1); }
|
||||
float farClip() const { return GetField<float>(10, 1000); }
|
||||
int32_t cameraFlag() const { return GetField<int32_t>(12, 0); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* node3DOption */) &&
|
||||
verifier.VerifyTable(node3DOption()) &&
|
||||
VerifyField<float>(verifier, 6 /* fov */) &&
|
||||
VerifyField<float>(verifier, 8 /* near */) &&
|
||||
VerifyField<float>(verifier, 10 /* far */) &&
|
||||
VerifyField<float>(verifier, 8 /* nearClip */) &&
|
||||
VerifyField<float>(verifier, 10 /* farClip */) &&
|
||||
VerifyField<int32_t>(verifier, 12 /* cameraFlag */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
|
@ -240,8 +240,8 @@ struct UserCameraOptionsBuilder {
|
|||
flatbuffers::uoffset_t start_;
|
||||
void add_node3DOption(flatbuffers::Offset<Node3DOption> node3DOption) { fbb_.AddOffset(4, node3DOption); }
|
||||
void add_fov(float fov) { fbb_.AddElement<float>(6, fov, 60); }
|
||||
void add_near(float near) { fbb_.AddElement<float>(8, near, 1); }
|
||||
void add_far(float far) { fbb_.AddElement<float>(10, far, 1000); }
|
||||
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); }
|
||||
UserCameraOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
UserCameraOptionsBuilder &operator=(const UserCameraOptionsBuilder &);
|
||||
|
@ -254,13 +254,13 @@ struct UserCameraOptionsBuilder {
|
|||
inline flatbuffers::Offset<UserCameraOptions> CreateUserCameraOptions(flatbuffers::FlatBufferBuilder &_fbb,
|
||||
flatbuffers::Offset<Node3DOption> node3DOption = 0,
|
||||
float fov = 60,
|
||||
float near = 1,
|
||||
float far = 1000,
|
||||
float nearClip = 1,
|
||||
float farClip = 1000,
|
||||
int32_t cameraFlag = 0) {
|
||||
UserCameraOptionsBuilder builder_(_fbb);
|
||||
builder_.add_cameraFlag(cameraFlag);
|
||||
builder_.add_far(far);
|
||||
builder_.add_near(near);
|
||||
builder_.add_farClip(farClip);
|
||||
builder_.add_nearClip(nearClip);
|
||||
builder_.add_fov(fov);
|
||||
builder_.add_node3DOption(node3DOption);
|
||||
return builder_.Finish();
|
||||
|
|
|
@ -59,4 +59,4 @@ namespace cocostudio
|
|||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__cocos2d_libs__SpriteReader__) */
|
||||
#endif /* defined(__cocos2d_libs__Node3DReader__) */
|
||||
|
|
|
@ -59,4 +59,4 @@ namespace cocostudio
|
|||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__cocos2d_libs__SpriteReader__) */
|
||||
#endif /* defined(__cocos2d_libs__Sprite3DReader__) */
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "UserCameraReader.h"
|
||||
|
||||
#include "cocostudio/CSParseBinary_generated.h"
|
||||
#include "cocostudio/CSParse3DBinary_generated.h"
|
||||
#include "cocostudio/FlatBuffersSerialize.h"
|
||||
#include "cocostudio/WidgetReader/Node3DReader/Node3DReader.h"
|
||||
|
||||
#include "tinyxml2.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace flatbuffers;
|
||||
|
||||
namespace cocostudio
|
||||
{
|
||||
IMPLEMENT_CLASS_NODE_READER_INFO(UserCameraReader)
|
||||
|
||||
UserCameraReader::UserCameraReader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UserCameraReader::~UserCameraReader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static UserCameraReader* _instanceUserCameraReader = nullptr;
|
||||
|
||||
UserCameraReader* UserCameraReader::getInstance()
|
||||
{
|
||||
if (!_instanceUserCameraReader)
|
||||
{
|
||||
_instanceUserCameraReader = new UserCameraReader();
|
||||
}
|
||||
|
||||
return _instanceUserCameraReader;
|
||||
}
|
||||
|
||||
void UserCameraReader::purge()
|
||||
{
|
||||
CC_SAFE_DELETE(_instanceUserCameraReader);
|
||||
}
|
||||
|
||||
Vec2 UserCameraReader::getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const
|
||||
{
|
||||
if(!attribute)
|
||||
return Vec2::ZERO;
|
||||
|
||||
Vec2 ret(Vec2::ZERO);
|
||||
std::string attriname;
|
||||
|
||||
while (attribute)
|
||||
{
|
||||
attriname = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
|
||||
if (attriname == "ValueX")
|
||||
{
|
||||
ret.x = atof(value.c_str());
|
||||
}
|
||||
else if (attriname == "ValueY")
|
||||
{
|
||||
ret.y = atof(value.c_str());
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Offset<Table> UserCameraReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
|
||||
flatbuffers::FlatBufferBuilder *builder)
|
||||
{
|
||||
auto temp = Node3DReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
|
||||
auto node3DOptions = *(Offset<Node3DOption>*)(&temp);
|
||||
|
||||
float fov = 60.f;
|
||||
unsigned int cameraFlag = 0;
|
||||
|
||||
std::string attriname;
|
||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||
while(attribute)
|
||||
{
|
||||
attriname = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
|
||||
if(attriname == "Fov")
|
||||
{
|
||||
fov = atof(value.c_str());
|
||||
}
|
||||
else if(attriname == "UserCameraFlagMode")
|
||||
{
|
||||
if(value == "DEFAULT") cameraFlag = 1;
|
||||
else if(value == "USER1") cameraFlag = 1 << 1;
|
||||
else if(value == "USER2") cameraFlag = 1 << 2;
|
||||
else if(value == "USER3") cameraFlag = 1 << 3;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
|
||||
Vec2 clipPlane(1, 1000);
|
||||
|
||||
// FileData
|
||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||
while (child)
|
||||
{
|
||||
std::string name = child->Name();
|
||||
|
||||
if (name == "ClipPlane")
|
||||
{
|
||||
attribute = child->FirstAttribute();
|
||||
clipPlane = getVec2Attribute(attribute);
|
||||
break;
|
||||
}
|
||||
|
||||
child = child->NextSiblingElement();
|
||||
}
|
||||
|
||||
auto options = CreateUserCameraOptions(*builder,
|
||||
node3DOptions,
|
||||
fov,
|
||||
clipPlane.x,
|
||||
clipPlane.y,
|
||||
cameraFlag
|
||||
);
|
||||
|
||||
return *(Offset<Table>*)(&options);
|
||||
}
|
||||
|
||||
void UserCameraReader::setPropsWithFlatBuffers(cocos2d::Node *node,
|
||||
const flatbuffers::Table* userCameraDOptions)
|
||||
{
|
||||
auto options = (UserCameraOptions*)userCameraDOptions;
|
||||
|
||||
Camera* camera = static_cast<Camera*>(node);
|
||||
int cameraFlag = options->cameraFlag();
|
||||
camera->setCameraFlag((CameraFlag)cameraFlag);
|
||||
|
||||
auto node3DReader = Node3DReader::getInstance();
|
||||
node3DReader->setPropsWithFlatBuffers(node, (Table*)(options->node3DOption()));
|
||||
}
|
||||
|
||||
Node* UserCameraReader::createNodeWithFlatBuffers(const flatbuffers::Table *userCameraDOptions)
|
||||
{
|
||||
auto options = (UserCameraOptions*)userCameraDOptions;
|
||||
|
||||
float fov = options->fov();
|
||||
float nearClip = options->nearClip();
|
||||
float farClip = options->farClip();
|
||||
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
Camera* camera = Camera::createPerspective(fov, size.width / size.height, nearClip, farClip);
|
||||
|
||||
setPropsWithFlatBuffers(camera, userCameraDOptions);
|
||||
|
||||
return camera;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __cocos2d_libs__UserCameraReader__
|
||||
#define __cocos2d_libs__UserCameraReader__
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "cocostudio/CocosStudioExport.h"
|
||||
#include "cocostudio/WidgetReader/NodeReaderProtocol.h"
|
||||
#include "cocostudio/WidgetReader/NodeReaderDefine.h"
|
||||
|
||||
namespace tinyxml2
|
||||
{
|
||||
class XMLAttribute;
|
||||
}
|
||||
|
||||
namespace cocostudio
|
||||
{
|
||||
class CC_STUDIO_DLL UserCameraReader : public cocos2d::Ref, public NodeReaderProtocol
|
||||
{
|
||||
DECLARE_CLASS_NODE_READER_INFO
|
||||
|
||||
public:
|
||||
UserCameraReader();
|
||||
~UserCameraReader();
|
||||
|
||||
static UserCameraReader* getInstance();
|
||||
static void purge();
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
|
||||
flatbuffers::FlatBufferBuilder* builder);
|
||||
void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* userCameraOptions);
|
||||
cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* userCameraOptions);
|
||||
|
||||
protected:
|
||||
|
||||
cocos2d::Vec2 getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* defined(__cocos2d_libs__UserCameraReader__) */
|
|
@ -39,7 +39,8 @@ static int sceneIdx = -1;
|
|||
static std::function<Layer*()> createFunctions[] =
|
||||
{
|
||||
CL(CSNode3DTest),
|
||||
CL(CSSprite3DTest)
|
||||
CL(CSSprite3DTest),
|
||||
CL(CSUserCameraTest)
|
||||
};
|
||||
|
||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||
|
@ -176,6 +177,33 @@ std::string CSSprite3DTest::subtitle() const
|
|||
return "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// CSUserCameraTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
CSUserCameraTest::CSUserCameraTest()
|
||||
{
|
||||
auto node = CSLoader::createNode("CocosStudio3DTest/UserCamera.csb");
|
||||
|
||||
auto sprite3D = Sprite3D::create("CocosStudio3DTest/dragon/dragon.c3b");
|
||||
sprite3D->setPosition3D(Vec3(100, 95, 80));
|
||||
sprite3D->setCameraMask((unsigned int)CameraFlag::USER1);
|
||||
|
||||
addChild(node);
|
||||
addChild(sprite3D);
|
||||
}
|
||||
|
||||
std::string CSUserCameraTest::title() const
|
||||
{
|
||||
return "UserCameraReader Test";
|
||||
}
|
||||
|
||||
std::string CSUserCameraTest::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -65,7 +65,15 @@ public:
|
|||
CSSprite3DTest();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class CSUserCameraTest : public CocosStudio3DTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(CSUserCameraTest);
|
||||
CSUserCameraTest();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class CS3DTestScene : public TestScene
|
||||
|
|
Before Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 143 KiB |
|
@ -8,12 +8,12 @@ CSNode3DTest.__index = CSNode3DTest
|
|||
function CSNode3DTest.create()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
Helper.titleLabel:setString("Testing Node3D")
|
||||
Helper.titleLabel:setString("Node3DReader Test")
|
||||
|
||||
local node = cc.CSLoader:createNode("CocosStudio3DTest/Node3D.csb");
|
||||
layer:addChild(node);
|
||||
|
||||
return layer
|
||||
return layer;
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
|
@ -26,20 +26,44 @@ CSSprite3DTest.__index = CSSprite3DTest
|
|||
function CSSprite3DTest.create()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
Helper.titleLabel:setString("Testing Node3D")
|
||||
Helper.titleLabel:setString("Sprite3DReader Test")
|
||||
|
||||
local node = cc.CSLoader:createNode("CocosStudio3DTest/Sprite3D.csb");
|
||||
local node = cc.CSLoader:createNode("CocosStudio3DTest/Sprite3D.csb")
|
||||
|
||||
local sprite3D = node:getChildByTag(8);
|
||||
local size = cc.Director:getInstance():getWinSize();
|
||||
local sprite3D = node:getChildByTag(8)
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
|
||||
sprite3D:setPosition(size.width / 2, size.height / 2 - 50);
|
||||
sprite3D:setColor(cc.c3b(255, 255, 255));
|
||||
sprite3D:setOpacity(255);
|
||||
sprite3D:setPosition(size.width / 2, size.height / 2 - 50)
|
||||
sprite3D:setColor(cc.c3b(255, 255, 255))
|
||||
sprite3D:setOpacity(255)
|
||||
|
||||
layer:addChild(node);
|
||||
layer:addChild(node)
|
||||
|
||||
return layer
|
||||
return layer
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
----CSUserCameraTest
|
||||
----------------------------------------
|
||||
|
||||
local CSUserCameraTest = {}
|
||||
CSUserCameraTest.__index = CSUserCameraTest
|
||||
|
||||
function CSUserCameraTest.create()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
Helper.titleLabel:setString("UserCameraReader Test")
|
||||
|
||||
local node = cc.CSLoader:createNode("CocosStudio3DTest/UserCamera.csb")
|
||||
|
||||
local sprite3D = cc.Sprite3D:create("CocosStudio3DTest/dragon/dragon.c3b")
|
||||
sprite3D:setPosition3D(cc.vec3(100, 95, 80))
|
||||
sprite3D:setCameraMask(cc.CameraFlag.USER1)
|
||||
|
||||
layer:addChild(node)
|
||||
layer:addChild(sprite3D)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
function CocosStudio3DTest()
|
||||
|
@ -48,7 +72,8 @@ function CocosStudio3DTest()
|
|||
Helper.createFunctionTable =
|
||||
{
|
||||
CSNode3DTest.create,
|
||||
CSSprite3DTest.create
|
||||
CSSprite3DTest.create,
|
||||
CSUserCameraTest.create
|
||||
}
|
||||
|
||||
scene:addChild(CSNode3DTest.create())
|
||||
|
|