mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-26 03:38:29 +00:00
[cocos2d-x] 修复纹理插槽设为 null 时警告与性能问题
This commit is contained in:
parent
adb32f5c23
commit
7dbe1a4f72
@ -57,6 +57,8 @@ const size_t BaseRenderer::cc_matViewProj = std::hash<std::string>{}("cc_matView
|
|||||||
const size_t BaseRenderer::cc_cameraPos = std::hash<std::string>{}("cc_cameraPos");
|
const size_t BaseRenderer::cc_cameraPos = std::hash<std::string>{}("cc_cameraPos");
|
||||||
const size_t BaseRenderer::cc_time = std::hash<std::string>{}("cc_time");
|
const size_t BaseRenderer::cc_time = std::hash<std::string>{}("cc_time");
|
||||||
|
|
||||||
|
Effect::Property* BaseRenderer::defaultTextureProperty = nullptr;
|
||||||
|
|
||||||
const size_t BaseRenderer::cc_shadow_map[4] = {
|
const size_t BaseRenderer::cc_shadow_map[4] = {
|
||||||
std::hash<std::string>{}("cc_shadow_map_0"),
|
std::hash<std::string>{}("cc_shadow_map_0"),
|
||||||
std::hash<std::string>{}("cc_shadow_map_1"),
|
std::hash<std::string>{}("cc_shadow_map_1"),
|
||||||
@ -212,11 +214,14 @@ void BaseRenderer::setProperty (const Effect::Property* prop)
|
|||||||
|
|
||||||
if (nullptr == prop->getValue())
|
if (nullptr == prop->getValue())
|
||||||
{
|
{
|
||||||
Effect::Property tmp(propName, propType);
|
if (Effect::Property::Type::TEXTURE_2D == propType)
|
||||||
prop = &tmp;
|
|
||||||
if (Effect::Property::Type::TEXTURE_2D == propType)
|
|
||||||
{
|
{
|
||||||
tmp.setTexture(_defaultTexture);
|
if (defaultTextureProperty == nullptr)
|
||||||
|
{
|
||||||
|
defaultTextureProperty = new Effect::Property(propName, propType);
|
||||||
|
defaultTextureProperty->setTexture(_defaultTexture);
|
||||||
|
}
|
||||||
|
prop = defaultTextureProperty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,9 @@ protected:
|
|||||||
static const size_t cc_matViewProj;
|
static const size_t cc_matViewProj;
|
||||||
static const size_t cc_cameraPos;
|
static const size_t cc_cameraPos;
|
||||||
static const size_t cc_time;
|
static const size_t cc_time;
|
||||||
|
|
||||||
|
static Effect::Property* defaultTextureProperty;
|
||||||
|
|
||||||
static std::vector<const OrderedValueMap*> __tmp_defines__;
|
static std::vector<const OrderedValueMap*> __tmp_defines__;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user