u0u0 发布的文章

查看节点信息。

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

分别在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);
}

注意微信上必须是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);
});

参考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

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