New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vim-format

Package Overview
Dependencies
Maintainers
5
Versions
341
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vim-format - npm Package Compare versions

Comparing version 1.0.2-dev.20 to 1.0.2-dev.21

8

dist/remoteG3d.d.ts

@@ -63,9 +63,9 @@ import { BFast } from "./bfast";

filter(instances: number[]): Promise<G3d>;
private filterMaterials;
private filterVertices;
private filterIndices;
private filterSubmeshes;
private filterInstances;
private filterMesh;
private filterSubmeshes;
private filterIndices;
private filterPositions;
private filterMaterials;
}
export {};

@@ -266,13 +266,14 @@ "use strict";

let submeshes;
let materials;
const A = () => __awaiter(this, void 0, void 0, function* () {
submeshes = yield this.filterSubmeshes(meshes, submeshCount);
materials = yield this.filterMaterials(submeshes.materials);
});
let vertices;
yield Promise.all([
this.filterSubmeshes(meshes, submeshCount).then(v => submeshes = v),
this.filterIndices(meshes, indiceCount).then(v => vertices = v)
]);
let positions;
let materials;
yield Promise.all([
this.filterVertices(vertices, meshes).then(v => positions = v),
this.filterMaterials(submeshes.materials).then(v => materials = v)
]);
const B = () => __awaiter(this, void 0, void 0, function* () {
vertices = yield this.filterIndices(meshes, indiceCount);
positions = yield this.filterPositions(vertices, meshes);
});
yield Promise.all([A(), B()]);
submeshes.remapMaterials(materials.map);

@@ -282,37 +283,67 @@ return new g3d_1.G3d(instanceData.meshes, instanceData.flags, instanceData.transforms, instanceData.nodes, meshes.submeshes, submeshes.indexOffsets, submeshes.materials, vertices.indices, positions, materials.colors);

}
filterMaterials(submeshMaterials) {
filterInstances(instances) {
return __awaiter(this, void 0, void 0, function* () {
// Material Colors
const materialCount = yield this.materialColors.getCount();
let color_i = 0;
const materials = new MaterialData(submeshMaterials);
const instanceSet = new Set(instances);
const attributes = new InstanceData(instanceSet.size);
let instance_i = 0;
const instanceCount = yield this.instanceMeshes.getCount();
const promises = [];
for (let i = 0; i < materialCount; i++) {
if (materials.set.has(i)) {
materials.map.set(i, color_i);
const current = color_i;
promises.push(this.materialColors.getValue(i)
.then(c => materials.colors.set(c, current * 4)));
color_i++;
}
for (let i = 0; i < instanceCount; i++) {
if (!instanceSet.has(i))
continue;
const current = instance_i;
promises.push(this.instanceFlags.getNumber(i).then(v => attributes.flags[current] = v));
promises.push(this.instanceMeshes.getNumber(i).then(v => attributes.meshes[current] = v));
promises.push(this.instanceTransforms.getValue(i).then(v => attributes.transforms.set(v, current * 16)));
attributes.nodes[current] = i;
instance_i++;
}
yield Promise.all(promises);
return materials;
return attributes;
});
}
filterVertices(indices, meshData) {
filterMesh(instanceMeshes) {
return __awaiter(this, void 0, void 0, function* () {
let positions_i = 0;
const _positions = new Float32Array(indices.positionCount * 3);
for (let mesh = 0; mesh < meshData.count; mesh++) {
if (!meshData.set.has(mesh))
const meshes = new MeshData(instanceMeshes);
if (meshes.hasMeshes) {
meshes.count = yield this.meshSubmeshes.getCount();
let last = -1;
let mesh_i = 0;
for (let i = 0; i < meshes.count; i++) {
if (!meshes.set.has(i))
continue;
const offset = mesh_i > 0 ? meshes.submeshes[mesh_i - 1] : 0;
const lastCount = last < 0 ? 0 : yield this.getMeshSubmeshCount(last);
meshes.submeshes[mesh_i] = lastCount + offset;
meshes.map.set(i, mesh_i);
last = i;
mesh_i++;
}
}
return meshes;
});
}
filterSubmeshes(meshes, submeshCount) {
return __awaiter(this, void 0, void 0, function* () {
let submesh_i = 0;
let submeshOffset = 0;
const submeshes = new SubmeshData(submeshCount);
for (let mesh = 0; mesh < meshes.count; mesh++) {
if (!meshes.set.has(mesh))
continue;
// vertices
const vertexStart = indices.meshVertexStart[mesh];
const vertexEnd = indices.meshVertexStart[mesh + 1];
const vertices = yield this.positions.getValues(vertexStart, vertexEnd - vertexStart);
_positions.set(vertices, positions_i);
positions_i += vertices.length;
const subStart = yield this.getMeshSubmeshStart(mesh);
const subEnd = yield this.getMeshSubmeshEnd(mesh);
const promises = [];
for (let j = subStart; j < subEnd; j++) {
const current = submesh_i;
promises.push(this.submeshIndexOffsets.getNumber(subStart)
.then(start => this.submeshIndexOffsets.getNumber(j)
.then(v => submeshes.indexOffsets[current] = v - start + submeshOffset)));
promises.push(this.submeshMaterials.getNumber(j).then(v => submeshes.materials[current] = v));
submesh_i++;
}
yield Promise.all(promises);
submeshOffset += yield this.getMeshIndexCount(mesh);
}
return _positions;
return submeshes;
});

@@ -352,96 +383,58 @@ }

}
filterSubmeshes(meshes, submeshCount) {
filterPositions(indices, meshData) {
return __awaiter(this, void 0, void 0, function* () {
let submesh_i = 0;
let submeshOffset = 0;
const submeshes = new SubmeshData(submeshCount);
for (let mesh = 0; mesh < meshes.count; mesh++) {
if (!meshes.set.has(mesh))
let positions_i = 0;
const _positions = new Float32Array(indices.positionCount * 3);
for (let mesh = 0; mesh < meshData.count; mesh++) {
if (!meshData.set.has(mesh))
continue;
const subStart = yield this.getMeshSubmeshStart(mesh);
const subEnd = yield this.getMeshSubmeshEnd(mesh);
const promises = [];
for (let j = subStart; j < subEnd; j++) {
const current = submesh_i;
promises.push(this.submeshIndexOffsets.getNumber(subStart)
.then(start => this.submeshIndexOffsets.getNumber(j)
.then(v => submeshes.indexOffsets[current] = v - start + submeshOffset)));
promises.push(this.submeshMaterials.getNumber(j).then(v => submeshes.materials[current] = v));
submesh_i++;
}
yield Promise.all(promises);
submeshOffset += yield this.getMeshIndexCount(mesh);
// vertices
const vertexStart = indices.meshVertexStart[mesh];
const vertexEnd = indices.meshVertexStart[mesh + 1];
const vertices = yield this.positions.getValues(vertexStart, vertexEnd - vertexStart);
_positions.set(vertices, positions_i);
positions_i += vertices.length;
}
return submeshes;
return _positions;
});
}
filterInstances(instances) {
filterMaterials(submeshMaterials) {
return __awaiter(this, void 0, void 0, function* () {
const instanceSet = new Set(instances);
const attributes = new G3dInstanceAttributes(instanceSet.size);
let instance_i = 0;
const instanceCount = yield this.instanceMeshes.getCount();
// Material Colors
const materialCount = yield this.materialColors.getCount();
let color_i = 0;
const materials = new MaterialData(submeshMaterials);
const promises = [];
for (let i = 0; i < instanceCount; i++) {
if (!instanceSet.has(i))
continue;
const current = instance_i;
promises.push(this.instanceFlags.getNumber(i).then(v => attributes.flags[current] = v));
promises.push(this.instanceMeshes.getNumber(i).then(v => attributes.meshes[current] = v));
promises.push(this.instanceTransforms.getValue(i).then(v => attributes.transforms.set(v, current * 16)));
attributes.nodes[current] = i;
instance_i++;
for (let i = 0; i < materialCount; i++) {
if (materials.set.has(i)) {
materials.map.set(i, color_i);
const current = color_i;
promises.push(this.materialColors.getValue(i)
.then(c => materials.colors.set(c, current * 4)));
color_i++;
}
}
yield Promise.all(promises);
return attributes;
return materials;
});
}
filterMesh(instanceMeshes) {
return __awaiter(this, void 0, void 0, function* () {
const meshes = new MeshData(instanceMeshes);
if (meshes.hasMeshes) {
meshes.count = yield this.meshSubmeshes.getCount();
let last = -1;
let mesh_i = 0;
for (let i = 0; i < meshes.count; i++) {
if (!meshes.set.has(i))
continue;
const offset = mesh_i > 0 ? meshes.submeshes[mesh_i - 1] : 0;
const lastCount = last < 0 ? 0 : yield this.getMeshSubmeshCount(last);
meshes.submeshes[mesh_i] = lastCount + offset;
meshes.map.set(i, mesh_i);
last = i;
mesh_i++;
}
}
return meshes;
});
}
}
exports.RemoteG3d = RemoteG3d;
class SubmeshData {
class InstanceData {
constructor(count) {
this.indexOffsets = new Int32Array(count);
this.materials = new Int32Array(count);
this.meshes = new Int32Array(count);
this.flags = new Uint16Array(count);
this.transforms = new Float32Array(count * 16);
this.nodes = new Int32Array(count);
}
remapMaterials(map) {
for (let i = 0; i < this.materials.length; i++) {
this.materials[i] = this.materials[i] < 0 ? -1 : map.get(this.materials[i]);
remapMeshes(map) {
var _a;
for (let i = 0; i < this.meshes.length; i++) {
this.meshes[i] = (_a = map.get(this.meshes[i])) !== null && _a !== void 0 ? _a : -1;
}
}
}
class MaterialData {
constructor(submeshMaterials) {
this.set = new Set(submeshMaterials);
this.map = new Map();
this.colors = new Float32Array(this.set.size * 4);
toG3d() {
return new g3d_1.G3d(this.meshes, this.flags, this.transforms, this.nodes, new Int32Array(), new Int32Array(), new Int32Array(), new Uint32Array(), new Float32Array(), new Float32Array());
}
}
class VertexData {
constructor(meshCount, indicesCount) {
this.positionCount = 0;
this.indices = new Uint32Array(indicesCount);
this.meshVertexStart = new Int32Array(meshCount + 1);
}
}
class MeshData {

@@ -471,18 +464,26 @@ constructor(instanceMeshes) {

}
class G3dInstanceAttributes {
class SubmeshData {
constructor(count) {
this.meshes = new Int32Array(count);
this.flags = new Uint16Array(count);
this.transforms = new Float32Array(count * 16);
this.nodes = new Int32Array(count);
this.indexOffsets = new Int32Array(count);
this.materials = new Int32Array(count);
}
remapMeshes(map) {
var _a;
for (let i = 0; i < this.meshes.length; i++) {
this.meshes[i] = (_a = map.get(this.meshes[i])) !== null && _a !== void 0 ? _a : -1;
remapMaterials(map) {
for (let i = 0; i < this.materials.length; i++) {
this.materials[i] = this.materials[i] < 0 ? -1 : map.get(this.materials[i]);
}
}
toG3d() {
return new g3d_1.G3d(this.meshes, this.flags, this.transforms, this.nodes, new Int32Array(), new Int32Array(), new Int32Array(), new Uint32Array(), new Float32Array(), new Float32Array());
}
class VertexData {
constructor(meshCount, indicesCount) {
this.positionCount = 0;
this.indices = new Uint32Array(indicesCount);
this.meshVertexStart = new Int32Array(meshCount + 1);
}
}
class MaterialData {
constructor(submeshMaterials) {
this.set = new Set(submeshMaterials);
this.map = new Map();
this.colors = new Float32Array(this.set.size * 4);
}
}

@@ -63,9 +63,9 @@ import { BFast } from "./bfast";

filter(instances: number[]): Promise<G3d>;
private filterMaterials;
private filterVertices;
private filterIndices;
private filterSubmeshes;
private filterInstances;
private filterMesh;
private filterSubmeshes;
private filterIndices;
private filterPositions;
private filterMaterials;
}
export {};
{
"name": "vim-format",
"version": "1.0.2-dev.20",
"version": "1.0.2-dev.21",
"description": "The VIM format is a modern and efficient open 3D data interchange format designed for BIM and manufacturing data optimized for efficient loading and rendering on low-power devices.",

@@ -5,0 +5,0 @@ "directories": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc