Skip to content
Permalink
Browse files

feat(asset-bundle): add "generate sab" logic

  • Loading branch information...
yyc-git committed Apr 15, 2019
1 parent 11e51e6 commit 124e9bd1c0e0c7ed094d49a36e791b7b0301c96b
Showing with 32 additions and 0 deletions.
  1. +1 −0 .cz-config.js
  2. +31 −0 src/asset_bundle/sab/generate/GenerateSABSystem.re
@@ -20,6 +20,7 @@ module.exports = {
{ name: "api" },
{ name: "data-json" },
{ name: "texture" },
{ name: "asset-bundle" },
{ name: "asset" },
{ name: "shader" },
{ name: "glsl" },
@@ -0,0 +1,31 @@
open Js.Typed_array;

let _writeUint32DataToUint8Array = uint32Data =>
Uint8Array.fromBuffer(
Uint32Array.make([|uint32Data|]) |> Uint32Array.buffer,
);

let generate = (sceneGameObject, imageUint8ArrayMap, state) => {
let (gltf, imageResultUint8ArrayMap, binBuffer) =
GenerateGLBSystem.generateGLBData(
(sceneGameObject, imageUint8ArrayMap),
(
(
VerticesGeometryMainService.getVertices,
NormalsGeometryMainService.getNormals,
TexCoordsGeometryMainService.getTexCoords,
IndicesGeometryMainService.getIndices16,
IndicesGeometryMainService.getIndices32,
),
imageUint8Array =>
_writeUint32DataToUint8Array(imageUint8Array |> Uint8Array.length),
),
state,
);

(
state,
imageResultUint8ArrayMap,
ConvertGLBSystem.convertGLBData(gltf, binBuffer),
);
};

0 comments on commit 124e9bd

Please sign in to comment.
You can’t perform that action at this time.