Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylancyclone committed Jun 28, 2020
2 parents f4726a0 + e2d83a1 commit 770c29f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ Watch a demonstration video:

From the root directory, run:

`mvn package;java -jar ./target/VMF2OBJ-1.0.0-jar-with-dependencies.jar [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS]`
`mvn package;java -jar ./target/VMF2OBJ-1.1.0-jar-with-dependencies.jar [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS]`

```
usage: vmf2obj [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS] [args...]
-e,--externalPath <arg> Folder for external custom content (such as
materials or models)
-e,--externalPath <arg> Semi-colon separated list of folders for
external custom content (such as materials or
models)
-h,--help Show this message
-q,--quiet Suppress warnings
-t,--tools Ignore tool brushes
Expand All @@ -24,7 +25,7 @@ usage: vmf2obj [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS] [args...]
Example:

```
java -jar .\vmf2obj.jar .\input.vmf .\output "C:\Program Files (x86)\Steam\steamapps\common\Half-Life 2\hl2\pak01_dir.vpk" -e "C:\path\to\custom\content" -t
java -jar .\vmf2obj.jar .\input.vmf .\output "D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\hl2_misc_dir.vpk;D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\hl2_textures_dir.vpk" -e "C:\path\to\custom\content\;C:\path\to\more\custom\content\" -t
```

## Packaged Dependencies
Expand Down Expand Up @@ -60,3 +61,7 @@ These are features that I don't have any plans to implement, either because I do
- infodecal entities don't store any data about where the decal is displayed, meaning it is projected from it's origin to the brush and clipped/sized accordingly. I personally don't know enough about how this process is done, and I don't feel comfortable trying to brute force it. I looked around for the source code associated with it, but I could not find anything to reverse engineer. I know it's a pretty important feature, but I don't know how to make it work _correctly_.
- [ ] info_overlay
- info_overlay is basically nextgen infodecal. Instead of just projecting to one side, an info_overlay can be projected to multiple faces, including different orientations and brushes so that the decal can "wrap" around. Again, I honestly don't really know how to approach this without brute forcing every face to create a seperate object with it's own UV wrapping. And that doesn't even include the fact that info_overlays can be distorted before being placed.

## Other Notes

Depending on where you import the converted result to, you might run into a problem where all the geometry looks very dark. This is due to the Source engine using additional normal data that might cause side effects in other software. In Blender, this can be solved with [this quick script](https://gist.github.com/Dylancyclone/d9bd1b53dbdd02702814661d8d82be5d). Simply select all the objects, and run this script in a new text editor. See [this](https://youtu.be/3CgoCSRIGqI?t=334) for more information.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.lathrum.VMF2OBJ</groupId>
<artifactId>VMF2OBJ</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<packaging>jar</packaging>

<name>VMF2OBJ</name>
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/lathrum/VMF2OBJ/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public static void main(String args[]) throws Exception {
CommandLineParser parser = new DefaultParser();
Options options = new Options();
options.addOption("h", "help", false, "Show this message");
options.addOption("e", "externalPath", true, "Folder for external custom content (such as materials or models)");
options.addOption("e", "externalPath", true, "Semi-colon separated list of folders for external custom content (such as materials or models)");
options.addOption("q", "quiet", false, "Suppress warnings");
options.addOption("t", "tools", false, "Ignore tool brushes");

Expand All @@ -303,7 +303,10 @@ public static void main(String args[]) throws Exception {
System.exit(0);
}
if (cmd.hasOption("e")) {
vpkEntries.addAll(addExtraFiles(formatPath(cmd.getOptionValue("e")), new File(cmd.getOptionValue("e"))));
String[] externalFolders = cmd.getOptionValue("e").split(";");
for (String path : externalFolders) {
vpkEntries.addAll(addExtraFiles(path, new File(path)));
}
}
if (cmd.hasOption("q")) {
quietMode = true;
Expand Down Expand Up @@ -906,6 +909,7 @@ public static void main(String args[]) throws Exception {
radAngles[0] = Double.parseDouble(angles[0]) * Math.PI / 180;
radAngles[1] = (Double.parseDouble(angles[1]) + 90) * Math.PI / 180;
radAngles[2] = Double.parseDouble(angles[2]) * Math.PI / 180;
double scale = entity.uniformscale != null ? Double.parseDouble(entity.uniformscale) : 1.0;
String[] origin = entity.origin.split(" ");
Vector3 transform = new Vector3(Double.parseDouble(origin[0]), Double.parseDouble(origin[1]),
Double.parseDouble(origin[2]));
Expand All @@ -919,6 +923,7 @@ public static void main(String args[]) throws Exception {
// Or what would normally be read as XZY
temp.points[j].position = temp.points[j].position.rotate3D(radAngles[0], radAngles[2], radAngles[1]);

temp.points[j].position = temp.points[j].position.multiply(scale);
temp.points[j].position = temp.points[j].position.add(transform);
verticies.add(temp.points[j].position);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public class Entity {
public String classname;
public String angles;
public String origin;
public String uniformscale;

public String model;
public String skin;
Expand Down

0 comments on commit 770c29f

Please sign in to comment.