From e36047725ce3217618d4e5807ac7c8769b9e3598 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 17 Jun 2019 19:45:55 -0400 Subject: [PATCH] Split pigment bump. --- Object3D.java | 76 +++++++++++++++++++++++++++++++++++--- 1 files changed, 70 insertions(+), 6 deletions(-) diff --git a/Object3D.java b/Object3D.java index 23e2d98..d6e0e59 100644 --- a/Object3D.java +++ b/Object3D.java @@ -4351,6 +4351,55 @@ } } + void RepairSOV() + { + if (blockloop) + return; + + String texname = this.GetPigmentTexture(); + + if (texname.startsWith("sov")) + { + String[] s = texname.split("/"); + + String[] sname = s[1].split("Color.pn"); + + texname = sname[0]; + + if (sname.length > 1) + { + texname += "Color.jpg"; + } + + this.SetPigmentTexture("sov/" + texname); + } + + texname = this.GetBumpTexture(); + + if (texname.startsWith("sov")) + { + String[] s = texname.split("/"); + + String[] sname = s[1].split("Bump.pn"); + + texname = sname[0]; + + if (sname.length > 1) + { + texname += "Bump.jpg"; + } + + this.SetBumpTexture("sov/" + texname); + } + + for (int i=0; i<Size(); i++) + { + blockloop = true; + get(i).RepairSOV(); + blockloop = false; + } + } + void RepairTexture() { if (this instanceof FileObject || blockloop) @@ -5846,16 +5895,27 @@ tex = GetTextures(); } - boolean failed = false; + boolean failedPigment = false; + boolean failedBump = false; try { - display.BindTextures(tex, texres); + display.BindPigmentTexture(tex, texres); } catch (Exception e) { System.err.println("FAILED: " + this); - failed = true; + failedPigment = true; + } + + try + { + display.BindBumpTexture(tex, texres); + } + catch (Exception e) + { + //System.err.println("FAILED: " + this); + failedBump = true; } if (!compiled) @@ -5878,8 +5938,11 @@ } } - if (!failed) - display.ReleaseTextures(tex); + if (!failedBump) + display.ReleaseBumpTexture(tex); + + if (!failedPigment) + display.ReleasePigmentTexture(tex); display.PopMaterial(this, selected); } @@ -7452,7 +7515,8 @@ } // vScale, 1); else { - LA.matScale(toParent, 1, totalScale, totalScale); + // EXCEPTION! + LA.matScale(toParent, totalScale, totalScale, totalScale); } // vScale, 1); break; -- Gitblit v1.6.2