From 8e54ac90fd983f2a9f00a454afeb5a5ea1b6f9d5 Mon Sep 17 00:00:00 2001 From: Daan Vanden Bosch Date: Sat, 1 Feb 2020 19:46:57 +0100 Subject: [PATCH] Fixed issue with NJ meshes. --- src/core/rendering/GfxRenderer.ts | 4 ++-- .../rendering/conversion/ninja_geometry.ts | 2 +- src/core/rendering/webgl/WebglRenderer.ts | 1 - src/viewer/stores/ModelStore.ts | 18 ------------------ 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/core/rendering/GfxRenderer.ts b/src/core/rendering/GfxRenderer.ts index e830fbbd..09481cf8 100644 --- a/src/core/rendering/GfxRenderer.ts +++ b/src/core/rendering/GfxRenderer.ts @@ -111,9 +111,9 @@ export abstract class GfxRenderer implements Renderer { case Projection.Perspective: if (evt.deltaY < 0) { - this.camera.pan(0, 0, -5); + this.camera.pan(0, 0, -2); } else { - this.camera.pan(0, 0, 5); + this.camera.pan(0, 0, 2); } break; } diff --git a/src/core/rendering/conversion/ninja_geometry.ts b/src/core/rendering/conversion/ninja_geometry.ts index 453c076f..94a6ccf7 100644 --- a/src/core/rendering/conversion/ninja_geometry.ts +++ b/src/core/rendering/conversion/ninja_geometry.ts @@ -149,7 +149,7 @@ class MeshCreator { this.builder.vertex(vertex.position, normal); - if (index >= 2) { + if (i >= 2) { if (i % 2 === (mesh.clockwise_winding ? 1 : 0)) { this.builder.triangle(index - 2, index - 1, index); } else { diff --git a/src/core/rendering/webgl/WebglRenderer.ts b/src/core/rendering/webgl/WebglRenderer.ts index 684a0cbb..c6830938 100644 --- a/src/core/rendering/webgl/WebglRenderer.ts +++ b/src/core/rendering/webgl/WebglRenderer.ts @@ -29,7 +29,6 @@ export class WebglRenderer extends GfxRenderer { this.gfx = new WebglGfx(gl); gl.enable(gl.DEPTH_TEST); - // gl.enable(gl.CULL_FACE); gl.clearColor(0.1, 0.1, 0.1, 1); this.shader_programs = []; diff --git a/src/viewer/stores/ModelStore.ts b/src/viewer/stores/ModelStore.ts index 1be8be10..c6d1f546 100644 --- a/src/viewer/stores/ModelStore.ts +++ b/src/viewer/stores/ModelStore.ts @@ -246,24 +246,6 @@ export class ModelStore extends Store { body, ); - // nj_object.children[0].children[0].children[0].clear_children(); - // nj_object.children[0].children[0].children[1].clear_children(); - // nj_object.children[0].children[0].children[2].clear_children(); - // nj_object.children[0].children[0].children[3].clear_children(); - // nj_object.children[0].children[0].children[4].clear_children(); - // nj_object.children[0].children[0].children[5].children[0].children[0].clear_children(); - // nj_object.children[0].children[0].children[5].children[0].children[1].clear_children(); - // nj_object.children[0].children[0].children[5].children[0].children[2].clear_children(); - // nj_object.children[0].children[0].children[5].children[0].children[3].children[0].clear_children(); - // const model = nj_object.children[0].children[0].children[5].children[0].children[3] - // .children[0].model!; - // model.meshes.splice(0, 1); - // model.meshes.splice(1); - // console.log( - // nj_object.children[0].children[0].children[5].children[0].children[3].children[0] - // .model, - // ); - this._current_nj_object.val = nj_object; } catch (e) { logger.error(`Couldn't load model for ${character_class.name}.`);