Merge pull request #2561 from pandamicro/fix

Enable dynamic atlas
This commit is contained in:
pandamicro
2018-04-19 10:34:31 +08:00
committed by GitHub
7 changed files with 22 additions and 16 deletions
@@ -33,9 +33,10 @@ module.exports = {
updateRenderData (sprite) {
let frame = sprite.spriteFrame;
// 避免用户使用自定义 material 的情况下覆盖用户设置,不过这里还应该加一个 TODO,未来设计 material 的序列化和用户接口时,应该会有改动
// TODO: Material API design and export from editor could affect the material activation process
// need to update the logic here
if (!sprite._material && frame) {
// 尽可能避免函数调用的开销
// Avoid as much function call as possible
if (!frame._original) {
dynamicAtlasManager.insertSpriteFrame(frame);
}
@@ -35,9 +35,10 @@ const dynamicAtlasManager = require('../../utils/dynamic-atlas/manager');
updateRenderData (sprite) {
let frame = sprite.spriteFrame;
// 避免用户使用自定义 material 的情况下覆盖用户设置,不过这里还应该加一个 TODO,未来设计 material 的序列化和用户接口时,应该会有改动
// TODO: Material API design and export from editor could affect the material activation process
// need to update the logic here
if (!sprite._material && frame) {
// 尽可能避免函数调用的开销
// Avoid as much function call as possible
if (!frame._original) {
dynamicAtlasManager.insertSpriteFrame(frame);
}
@@ -45,9 +45,10 @@ module.exports = {
updateRenderData (sprite) {
let frame = sprite.spriteFrame;
// 避免用户使用自定义 material 的情况下覆盖用户设置,不过这里还应该加一个 TODO,未来设计 material 的序列化和用户接口时,应该会有改动
// TODO: Material API design and export from editor could affect the material activation process
// need to update the logic here
if (!sprite._material && frame) {
// 尽可能避免函数调用的开销
// Avoid as much function call as possible
if (!frame._original) {
dynamicAtlasManager.insertSpriteFrame(frame);
}
@@ -30,11 +30,12 @@ module.exports = {
useModel: false,
updateRenderData (sprite) {
let frame = sprite.spriteFrame;
let frame = sprite._spriteFrame;
// 避免用户使用自定义 material 的情况下覆盖用户设置,不过这里还应该加一个 TODO,未来设计 material 的序列化和用户接口时,应该会有改动
// TODO: Material API design and export from editor could affect the material activation process
// need to update the logic here
if (!sprite._material && frame) {
// 尽可能避免函数调用的开销
// Avoid as much function call as possible
if (!frame._original) {
dynamicAtlasManager.insertSpriteFrame(frame);
}
@@ -44,9 +44,10 @@ module.exports = {
updateRenderData (sprite, batchData) {
let frame = sprite.spriteFrame;
// 避免用户使用自定义 material 的情况下覆盖用户设置,不过这里还应该加一个 TODO,未来设计 material 的序列化和用户接口时,应该会有改动
// TODO: Material API design and export from editor could affect the material activation process
// need to update the logic here
if (!sprite._material && frame) {
// 尽可能避免函数调用的开销
// Avoid as much function call as possible
if (!frame._original) {
dynamicAtlasManager.insertSpriteFrame(frame);
}
@@ -35,9 +35,10 @@ module.exports = {
updateRenderData (sprite) {
let frame = sprite.spriteFrame;
// 避免用户使用自定义 material 的情况下覆盖用户设置,不过这里还应该加一个 TODO,未来设计 material 的序列化和用户接口时,应该会有改动
// TODO: Material API design and export from editor could affect the material activation process
// need to update the logic here
if (!sprite._material && frame) {
// 尽可能避免函数调用的开销
// Avoid as much function call as possible
if (!frame._original) {
dynamicAtlasManager.insertSpriteFrame(frame);
}
@@ -5,9 +5,9 @@ let _atlasIndex = -1;
let _maxAtlasCount = 5;
let _textureSize = 2048;
let _maxFrameSize = 256;
let _maxFrameSize = 512;
let _enabled = false;
let _enabled = true;
let _debugNode = null;
@@ -91,7 +91,7 @@ let dynamicAtlasManager = {
*/
insertSpriteFrame (spriteFrame) {
if (CC_EDITOR) return;
if (!this.enabled || _atlasIndex === _maxAtlasCount ||
if (!_enabled || _atlasIndex === _maxAtlasCount ||
!spriteFrame || spriteFrame._original) return;
let texture = spriteFrame._texture;