Skip to content

Commit

Permalink
Update OBJExporter.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Fexcraft committed Sep 8, 2020
1 parent 5425778 commit 7057c44
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/net/fexcraft/app/fmt/porters/OBJExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public OBJExporter(){
settings.add(new Setting("only_visible_groups", true));
settings.add(new Setting("groups_as_objects", false));
settings.add(new Setting("include_normals", false));
settings.add(new Setting("invert_normals", true));
}

@Override
Expand All @@ -60,6 +61,7 @@ public String exportModel(GroupCompound compound, File file, Map<String, Setting
boolean bool = settings.get("rotate_model").getBooleanValue();
boolean nog = settings.get("groups_as_objects").getBooleanValue();
boolean nor = settings.get("include_normals").getBooleanValue();
boolean inn = settings.get("invert_normals").getBooleanValue();
buffer.append("# FMT-Marker OBJ-2\n#\n");
float scale = settings.get("scale").getFloatValue();
String mtlname = null;
Expand Down Expand Up @@ -139,6 +141,11 @@ public String exportModel(GroupCompound compound, File file, Map<String, Setting
Vec3f vec0 = new Vec3f(poly.getVertices()[1].vector.subtract(poly.getVertices()[0].vector));
Vec3f vec1 = new Vec3f(poly.getVertices()[1].vector.subtract(poly.getVertices()[2].vector));
Vec3f vec2 = vec1.crossProduct(vec0).normalize();
if(inn){
vec2.xCoord *= -1;
vec2.yCoord *= -1;
vec2.zCoord *= -1;
}
buffer.append("vn " + vec2.xCoord + " " + vec2.yCoord + " " + vec2.zCoord + "\n");
norid++;
}
Expand Down

0 comments on commit 7057c44

Please sign in to comment.