Fixed linting errors

This commit is contained in:
Ben Coleman
2018-06-24 19:10:07 +01:00
parent 4b6657c2f3
commit 0e527870db
3 changed files with 30 additions and 30 deletions

View File

@@ -1,9 +1,8 @@
// Type definitions for obj-file-parser 0.5
// Project: https://github.com/WesUnwin/obj-file-parser#readme
// Definitions by: Ben Coleman https://github.com/benc-uk
// Project: https://github.com/wesunwin/obj-file-parser
// Definitions by: Ben Coleman <https://github.com/benc-uk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export default class Parser {
constructor(fileContents: any, defaultModelName?: any);
parse(): ObjFile;
@@ -16,17 +15,17 @@ export interface ObjFile {
export class ObjModel {
name: string;
vertices: {x: number, y: number, z: number}[];
textureCoords: {u: number, v: number, w: number}[];
vertexNormals: {x: number, y: number, z: number}[];
vertices: number[];
textureCoords: number[];
vertexNormals: number[];
faces: Face[];
}
}
export class Face {
material: any;
group: string;
smoothingGroup: number;
vertices: FaceVertex[]
vertices: FaceVertex[];
}
export class FaceVertex {

View File

@@ -1,11 +1,11 @@
import ObjFileParser, { ObjModel, ObjFile } from 'obj-file-parser'
import ObjFileParser, { ObjModel, ObjFile } from 'obj-file-parser';
let testObjFile = `
const testObjFile = `
# cube.obj
# Example object
g cube
v 0.0 0.0 0.0
v 0.0 0.0 1.0
v 0.0 1.0 0.0
@@ -21,31 +21,31 @@ vn 0.0 1.0 0.0
vn 0.0 -1.0 0.0
vn 1.0 0.0 0.0
vn -1.0 0.0 0.0
g cube-faces
f 1//2 7//2 5//2
f 1//2 3//2 7//2
f 1//6 4//6 3//6
f 1//6 2//6 4//6
f 3//3 8//3 7//3
f 3//3 4//3 8//3
f 5//5 7//5 8//5
f 5//5 8//5 6//5
f 1//4 5//4 6//4
f 1//4 6//4 2//4
f 2//1 6//1 8//1
f 2//1 8//1 4//1`
f 1//2 3//2 7//2
f 1//6 4//6 3//6
f 1//6 2//6 4//6
f 3//3 8//3 7//3
f 3//3 4//3 8//3
f 5//5 7//5 8//5
f 5//5 8//5 6//5
f 1//4 5//4 6//4
f 1//4 6//4 2//4
f 2//1 6//1 8//1
f 2//1 8//1 4//1`;
// Create parser and load test OBJ
let parser = new ObjFileParser(testObjFile, 'test');
let file = parser.parse();
let model = file.models[0];
const parser = new ObjFileParser(testObjFile, 'test');
const file = parser.parse();
const model = file.models[0];
let name = model.name; // Prints "test"
let face = model.faces[0] // Prints faces object
const name = model.name; // Prints "test"
const face = model.faces[0]; // Prints faces object
// gets { vertexIndex: 1, textureCoordsIndex: 0, vertexNormalIndex: 2 }
let vert = face.vertices[0];
const vert = face.vertices[0];
// gets { x: 0, y: 0, z: 1 }
let vertPoints = model.vertices[vert.vertexIndex];
const vertPoints = model.vertices[vert.vertexIndex];

View File

@@ -7,6 +7,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"