2019-11-23 20:27:39 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2014 cocos2d-x.org
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2022-02-24 18:51:36 +08:00
|
|
|
https://adxeproject.github.io/
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
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:
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-10-21 10:12:00 +08:00
|
|
|
#include "WidgetReader/GameNode3DReader/GameNode3DReader.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
#include "platform/CCFileUtils.h"
|
|
|
|
|
2020-10-21 10:12:00 +08:00
|
|
|
#include "CCComExtensionData.h"
|
|
|
|
#include "CSParseBinary_generated.h"
|
|
|
|
#include "CSParse3DBinary_generated.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2020-10-21 10:12:00 +08:00
|
|
|
#include "FlatBuffersSerialize.h"
|
|
|
|
#include "WidgetReader/NodeReader/NodeReader.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
#include "flatbuffers/flatbuffers.h"
|
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
using namespace flatbuffers;
|
|
|
|
|
|
|
|
namespace cocostudio
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
IMPLEMENT_CLASS_NODE_READER_INFO(GameNode3DReader)
|
|
|
|
|
|
|
|
GameNode3DReader::GameNode3DReader() {}
|
|
|
|
|
|
|
|
GameNode3DReader::~GameNode3DReader() {}
|
|
|
|
|
|
|
|
static GameNode3DReader* _instanceNode3DReader = nullptr;
|
|
|
|
|
|
|
|
GameNode3DReader* GameNode3DReader::getInstance()
|
|
|
|
{
|
|
|
|
if (!_instanceNode3DReader)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
_instanceNode3DReader = new GameNode3DReader();
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
return _instanceNode3DReader;
|
|
|
|
}
|
|
|
|
static CameraBackgroundBrush* _sceneBrushInstance = nullptr;
|
|
|
|
CameraBackgroundBrush* GameNode3DReader::getSceneBrushInstance()
|
|
|
|
{
|
|
|
|
return _sceneBrushInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameNode3DReader::purge()
|
|
|
|
{
|
|
|
|
CC_SAFE_DELETE(_instanceNode3DReader);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameNode3DReader::destroyInstance()
|
|
|
|
{
|
|
|
|
CC_SAFE_DELETE(_instanceNode3DReader);
|
|
|
|
}
|
|
|
|
|
|
|
|
Offset<Table> GameNode3DReader::createOptionsWithFlatBuffers(pugi::xml_node objectData,
|
|
|
|
flatbuffers::FlatBufferBuilder* builder)
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
bool useDefaultLight = false;
|
|
|
|
int skyBoxMask = 1;
|
|
|
|
bool skyBoxEnabled = false;
|
|
|
|
bool skyBoxValid = true;
|
|
|
|
|
|
|
|
std::string leftPath;
|
|
|
|
std::string leftPlistFile;
|
|
|
|
int leftResourceType = 0;
|
|
|
|
|
|
|
|
std::string rightPath;
|
|
|
|
std::string rightPlistFile;
|
|
|
|
int rightResourceType = 0;
|
|
|
|
|
|
|
|
std::string upPath;
|
|
|
|
std::string upPlistFile;
|
|
|
|
int upResourceType = 0;
|
|
|
|
|
|
|
|
std::string downPath;
|
|
|
|
std::string downPlistFile;
|
|
|
|
int downResourceType = 0;
|
|
|
|
|
|
|
|
std::string forwardPath;
|
|
|
|
std::string forwardPlistFile;
|
|
|
|
int forwardResourceType = 0;
|
|
|
|
|
|
|
|
std::string backPath;
|
|
|
|
std::string backPlistFile;
|
|
|
|
int backResourceType = 0;
|
|
|
|
|
|
|
|
std::string frameEvent;
|
|
|
|
std::string customProperty;
|
|
|
|
|
|
|
|
// attributes
|
|
|
|
auto attribute = objectData.first_attribute();
|
|
|
|
while (attribute)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view attriname = attribute.name();
|
|
|
|
std::string_view value = attribute.value();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (attriname == "Name")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
name = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attriname == "UseDefaultLight")
|
|
|
|
{
|
|
|
|
useDefaultLight = (value == "True") ? true : false;
|
|
|
|
}
|
|
|
|
else if (attriname == "SkyBoxEnabled")
|
|
|
|
{
|
|
|
|
skyBoxEnabled = (value == "True") ? true : false;
|
|
|
|
}
|
|
|
|
else if (attriname == "SkyBoxValid")
|
|
|
|
{
|
|
|
|
skyBoxValid = (value == "True") ? true : false;
|
|
|
|
}
|
|
|
|
else if (attriname == "skyBoxMask")
|
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
skyBoxMask = atoi(value.data());
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (attriname == "UserData")
|
|
|
|
{
|
|
|
|
customProperty = value;
|
|
|
|
}
|
|
|
|
else if (attriname == "FrameEvent")
|
|
|
|
{
|
|
|
|
frameEvent = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
attribute = attribute.next_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (!skyBoxValid)
|
|
|
|
skyBoxEnabled = false;
|
|
|
|
|
|
|
|
auto child = objectData.first_child();
|
|
|
|
while (child)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view childName = child.name();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (childName == "LeftImage")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
attribute = child.first_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
while (attribute)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view attributeName = attribute.name();
|
|
|
|
std::string_view value = attribute.value();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (attributeName == "Path")
|
|
|
|
{
|
|
|
|
leftPath = value;
|
|
|
|
}
|
|
|
|
else if (attributeName == "Type")
|
|
|
|
{
|
|
|
|
leftResourceType = getResourceType(value);
|
|
|
|
}
|
|
|
|
else if (attributeName == "Plist")
|
|
|
|
{
|
|
|
|
leftPlistFile = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
attribute = attribute.next_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (leftResourceType == 1)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
|
|
|
fbs->_textures.push_back(builder->CreateString(leftPlistFile));
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (childName == "RightImage")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
attribute = child.first_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
while (attribute)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view attributeName = attribute.name();
|
|
|
|
std::string_view value = attribute.value();
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (attributeName == "Path")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
rightPath = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attributeName == "Type")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
rightResourceType = getResourceType(value);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attributeName == "Plist")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
rightPlistFile = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
attribute = attribute.next_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (rightResourceType == 1)
|
|
|
|
{
|
|
|
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
|
|
|
fbs->_textures.push_back(builder->CreateString(rightPlistFile));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (childName == "UpImage")
|
|
|
|
{
|
|
|
|
attribute = child.first_attribute();
|
|
|
|
|
|
|
|
while (attribute)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view attributeName = attribute.name();
|
|
|
|
std::string_view value = attribute.value();
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (attributeName == "Path")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
upPath = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attributeName == "Type")
|
|
|
|
{
|
|
|
|
upResourceType = getResourceType(value);
|
|
|
|
}
|
|
|
|
else if (attributeName == "Plist")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
upPlistFile = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
attribute = attribute.next_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (upResourceType == 1)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
|
|
|
fbs->_textures.push_back(builder->CreateString(upPlistFile));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (childName == "DownImage")
|
|
|
|
{
|
|
|
|
attribute = child.first_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
while (attribute)
|
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view attributeName = attribute.name();
|
|
|
|
std::string_view value = attribute.value();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (attributeName == "Path")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
downPath = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attributeName == "Type")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
downResourceType = getResourceType(value);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attributeName == "Plist")
|
|
|
|
{
|
|
|
|
downPlistFile = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
attribute = attribute.next_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (downResourceType == 1)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
|
|
|
fbs->_textures.push_back(builder->CreateString(downPlistFile));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (childName == "ForwardImage")
|
|
|
|
{
|
|
|
|
attribute = child.first_attribute();
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
while (attribute)
|
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view attributeName = attribute.name();
|
|
|
|
std::string_view value = attribute.value();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
if (attributeName == "Path")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
forwardPath = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attributeName == "Type")
|
|
|
|
{
|
|
|
|
forwardResourceType = getResourceType(value);
|
|
|
|
}
|
|
|
|
else if (attributeName == "Plist")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
forwardPlistFile = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
attribute = attribute.next_attribute();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (forwardResourceType == 1)
|
|
|
|
{
|
|
|
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
|
|
|
fbs->_textures.push_back(builder->CreateString(forwardPlistFile));
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (childName == "BackImage")
|
|
|
|
{
|
|
|
|
attribute = child.first_attribute();
|
|
|
|
|
|
|
|
while (attribute)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-31 15:49:45 +08:00
|
|
|
std::string_view attributeName = attribute.name();
|
|
|
|
std::string_view value = attribute.value();
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (attributeName == "Path")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
backPath = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (attributeName == "Type")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
backResourceType = getResourceType(value);
|
|
|
|
}
|
|
|
|
else if (attributeName == "Plist")
|
|
|
|
{
|
|
|
|
backPlistFile = value;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
attribute = attribute.next_attribute();
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (backResourceType == 1)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
|
|
|
fbs->_textures.push_back(builder->CreateString(backPlistFile));
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
child = child.next_sibling();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto options = CreateGameNode3DOption(
|
|
|
|
*builder, builder->CreateString(name), skyBoxMask, skyBoxEnabled,
|
|
|
|
CreateResourceData(*builder, builder->CreateString(leftPath), builder->CreateString(leftPlistFile),
|
|
|
|
leftResourceType),
|
|
|
|
CreateResourceData(*builder, builder->CreateString(rightPath), builder->CreateString(rightPlistFile),
|
|
|
|
rightResourceType),
|
|
|
|
CreateResourceData(*builder, builder->CreateString(upPath), builder->CreateString(upPlistFile), upResourceType),
|
|
|
|
CreateResourceData(*builder, builder->CreateString(downPath), builder->CreateString(downPlistFile),
|
|
|
|
downResourceType),
|
|
|
|
CreateResourceData(*builder, builder->CreateString(forwardPath), builder->CreateString(forwardPlistFile),
|
|
|
|
forwardResourceType),
|
|
|
|
CreateResourceData(*builder, builder->CreateString(backPath), builder->CreateString(backPlistFile),
|
|
|
|
backResourceType),
|
|
|
|
builder->CreateString(frameEvent), builder->CreateString(customProperty), useDefaultLight);
|
|
|
|
|
|
|
|
return *(Offset<Table>*)(&options);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameNode3DReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* node3DOptions)
|
|
|
|
{
|
|
|
|
auto options = (GameNode3DOption*)node3DOptions;
|
|
|
|
|
|
|
|
std::string name = options->name()->c_str();
|
|
|
|
node->setName(name);
|
|
|
|
|
|
|
|
_sceneBrushInstance = nullptr;
|
|
|
|
bool skyBoxEnabled = options->skyBoxEnabled() != 0;
|
|
|
|
if (skyBoxEnabled)
|
|
|
|
{
|
|
|
|
std::string leftFileData = options->leftFileData()->path()->c_str();
|
|
|
|
std::string rightFileData = options->rightFileData()->path()->c_str();
|
|
|
|
std::string upFileData = options->upFileData()->path()->c_str();
|
|
|
|
std::string downFileData = options->downFileData()->path()->c_str();
|
|
|
|
std::string forwardFileData = options->forwardFileData()->path()->c_str();
|
|
|
|
std::string backFileData = options->backFileData()->path()->c_str();
|
|
|
|
FileUtils* fileUtils = FileUtils::getInstance();
|
|
|
|
|
|
|
|
if (fileUtils->isFileExist(leftFileData) && fileUtils->isFileExist(rightFileData) &&
|
|
|
|
fileUtils->isFileExist(upFileData) && fileUtils->isFileExist(downFileData) &&
|
|
|
|
fileUtils->isFileExist(forwardFileData) && fileUtils->isFileExist(backFileData))
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
_sceneBrushInstance = CameraBackgroundSkyBoxBrush::create(leftFileData, rightFileData, upFileData,
|
|
|
|
downFileData, forwardFileData, backFileData);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
std::string customProperty = options->customProperty()->c_str();
|
|
|
|
ComExtensionData* extensionData = ComExtensionData::create();
|
|
|
|
extensionData->setCustomProperty(customProperty);
|
|
|
|
if (node->getComponent(ComExtensionData::COMPONENT_NAME))
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
node->removeComponent(ComExtensionData::COMPONENT_NAME);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
node->addComponent(extensionData);
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
Node* GameNode3DReader::createNodeWithFlatBuffers(const flatbuffers::Table* node3DOptions)
|
|
|
|
{
|
|
|
|
Node* node = Node::create();
|
|
|
|
|
|
|
|
setPropsWithFlatBuffers(node, (Table*)node3DOptions);
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2021-12-31 15:49:45 +08:00
|
|
|
int GameNode3DReader::getResourceType(std::string_view key)
|
2021-12-25 10:04:45 +08:00
|
|
|
{
|
|
|
|
if (key == "Normal" || key == "Default")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance();
|
|
|
|
if (fbs->_isSimulator)
|
|
|
|
{
|
|
|
|
if (key == "MarkedSubImage")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
return 0;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
return 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} // namespace cocostudio
|