csb dump

查看节点信息。

local function dumpNode(node, deep)
    print("== deep:", deep)
    print("== parent:", node:getName(), tolua.type(node))
    print("== child ==")
    for _, child in ipairs(node:getChildren()) do
        print(child:getName(), tolua.type(child))
        dumpNode(child, deep + 1)
    end
    print("== child end ==")
end

闪白 shader

分别在r、b、g向量上叠加一个0~1之间的值。

#ifdef GL_ES
precision mediump float;
varying mediump vec2 v_texCoord;
#else
varying vec2 v_texCoord;
#endif

void main()
{
    vec4 c = texture2D(CC_Texture0, v_texCoord);
    if (c.a <= 0.0) {
        discard;
    }
    float param = 0.2;
    gl_FragColor = vec4(c.r + param, c.g + param, c.b + param, c.a);
}

cocos creator 加载二进制

注意微信上必须是bin后缀的,才能以二进制模式读取文件。

微信返回的是 ArrayBuffer, chrome返回的是Uint8Array。

var url = cc.url.raw("resources/bin/data.bin");
cc.loader.load({ url: url, type: "binary", }, function (err, data) {
    if (data instanceof ArrayBuffer){
        data = new Uint8Array(data);
    }
    console.log("err ===", err);
    console.log("data ===", data.length);
});

luajit 编译 windows, mac 下的64位程序

win

  1. 启动vs的64位编译

    xxx\vs2015\VC\vcvarsall.bat amd64
  2. 切换到luajit src目录,运行

    msvcbuild.bat gc64

mac

make clean
make CC="gcc -m64 -arch x86_64 -DLUAJIT_ENABLE_GC64"

加LUAJIT_ENABLE_GC64 决定了是否64位的bytecode

m4 在 mac 下 Abort trap: 6的解决

参考homebrew下的m4安装描述,https://github.com/Homebrew/homebrew-core/blob/master/Formula/m4.rb

 # Fix crash from usage of %n in dynamic format strings on High Sierra
  # Patch credit to Jeremy Huddleston Sequoia <jeremyhu@apple.com>
  if MacOS.version >= :high_sierra
    patch :p0 do
      url "https://raw.githubusercontent.com/macports/macports-ports/edf0ee1e2cf/devel/m4/files/secure_snprintf.patch"
      sha256 "57f972940a10d448efbd3d5ba46e65979ae4eea93681a85e1d998060b356e0d2"
    end
end

手动打上面的补丁,编译安装。