How to use the @gltf-transform/core.LoggerVerbosity.INFO function in @gltf-transform/core

To help you get started, we’ve selected a few @gltf-transform/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github donmccurdy / glTF-Transform / packages / split / src / split.ts View on Github external
const split = function (container: GLTFContainer, meshes: Array): GLTFContainer {

  const json = container.json;
  const logger = GLTFUtil.createLogger('@gltf-transform/split', LoggerVerbosity.INFO);

  const bufferViewMap = {};
  const removedBufferViews = [];

  // Group bufferviews by mesh.
  json.meshes.forEach((mesh) => {
    if (meshes.indexOf(mesh.name) === -1) return;
    mesh.primitives.forEach((prim) => {
      if (prim.indices) markAccessor(json.accessors[prim.indices]);
      Object.keys(prim.attributes).forEach((attrName) => {
        markAccessor(json.accessors[prim.attributes[attrName]]);
      });

      function markAccessor(accessor) {
        if (bufferViewMap[accessor.bufferView] === undefined) {
          bufferViewMap[accessor.bufferView] = mesh.name;
github donmccurdy / glTF-Transform / packages / prune / src / prune.ts View on Github external
const prune = function (container: GLTFContainer): GLTFContainer {
  const json = container.json;
  const logger = GLTFUtil.createLogger('@gltf-transform/prune', LoggerVerbosity.INFO);

  // Find all accessors used for mesh data.
  let meshAccessorIndices = [];
  json.meshes.forEach((mesh) => {
    mesh.primitives.forEach((primitive) => {
      for (const semantic in primitive.attributes) {
        meshAccessorIndices.push(primitive.attributes[semantic]);
      }
      if (primitive.indices) {
        meshAccessorIndices.push(primitive.indices);
      }
    })
  });

  meshAccessorIndices = Array.from(new Set(meshAccessorIndices)); // dedupe
  meshAccessorIndices.sort((a, b) => a > b ? 1 : -1); // sort ascending
github donmccurdy / glTF-Transform / packages / colorspace / src / colorspace.ts View on Github external
import { GLTFContainer, GLTFUtil, LoggerVerbosity, AccessorTypeData } from '@gltf-transform/core';

const logger = GLTFUtil.createLogger('@gltf-transform/colorspace', LoggerVerbosity.INFO);

interface IColorspaceOptions {
    inputEncoding: string;
}

function colorspace (container: GLTFContainer, options: IColorspaceOptions): GLTFContainer {

    if (options.inputEncoding === 'linear') {
        logger.info(`Vertex colors already linear. Skipping conversion.`);
        return container;
    }

    if (options.inputEncoding !== 'sRGB') {
        logger.error(`Unknown input encoding "${options.inputEncoding}" – should be "sRGB" or "linear". Skipping conversion.`);
        return container;
    }
github donmccurdy / glTF-Transform / packages / ao / src / ao.ts View on Github external
import { GLTFContainer, GLTFUtil, LoggerVerbosity, AccessorComponentType, BufferViewTarget } from '@gltf-transform/core';
import * as geoaoNamespace from 'geo-ambient-occlusion';
import * as reglNamespace from 'regl';

const REGL = reglNamespace['default'] as Function;
const geoao = geoaoNamespace['default'] as Function;
const logger = GLTFUtil.createLogger('@gltf-transform/ao', LoggerVerbosity.INFO);

interface GLFactory {
    (w: number, h: number): WebGLRenderingContext;
}

interface IOcclusionOptions {
    gl?: GLFactory;
    resolution: number;
    samples: number;
}

const DEFAULT_OPTIONS: IOcclusionOptions = {
    resolution: 512,
    samples: 500,
};