void texDraw() { if (readPhase_i == 3) { ts = 12; textSize(ts); for (int i = 0; i < 5; i ++) { if (i == 3) { ts = 20; textSize(ts); } buttons[i].update(); buttons[i].display(); } } ts = 14; textSize(ts); buttons[5].update(); buttons[5].display(); textAlign(CENTER); ts = 15; textSize(ts); text(loadText_s[0][readPhase_i], width/2, 1*ts); ts = 12; textSize(ts); text(loadText_s[2][readPhase_i], width/2, 3*ts); ts = 20; textSize(ts); text(loadText_s[1][readPhase_i], width/2, 3*ts); } void getImage(DropEvent theDropEvent) { if (readPhase_i != 3 && !loadSMD) { texture_pi[readPhase_i] = theDropEvent.loadImage(); while (texture_pi[readPhase_i].width < 10) { loading_b = true; println("loading.."); } if (filePath == null) filePath = theDropEvent.file().getParent(); fileName = theDropEvent.file().getName(); nameStamm = fileName.substring(0, fileName.lastIndexOf('.')); textureWidth = texture_pi[readPhase_i].width; textureHeight = texture_pi[readPhase_i].height; loading_b = false; //image loaded if (textureWidth != 0) { println("old: " + textureWidth + " new: " + texture_pi[readPhase_i].width); if (texture_pi[readPhase_i].width != textureWidth || texture_pi[readPhase_i].height != textureWidth) { error_s = "Images don't match in size"; error_b = true; } } if (!error_b) { // if (readPhase_i > 3) { if (readPhase_i != 3) { sa.loadNewTex(); saveImage(); imgCount++; } // } else { // readPhase_i++; // } } } } boolean foldersCreated; void saveImage() { println(filePath); launch("mkdir " + filePath + "\\models"); launch("mkdir " + filePath + "\\models\\pbr"); launch("mkdir " + filePath + "\\models\\pbr\\" + inputName); launch("mkdir " + filePath + "\\materials"); launch("mkdir " + filePath + "\\materials\\pbr"); launch("mkdir " + filePath + "\\materials\\pbr\\" + inputName); foldersCreated = true; nameOut = dataPath("") + "\\mgaoa_map.tga"; if (readPhase_i == 0) { nameOut = dataPath("") + "\\metallic.tga"; } else if (readPhase_i == 1) { nameOut = dataPath("") + "\\roughness.tga"; } else if (readPhase_i == 2) { nameOut = dataPath("") + "\\ambientocclusion.tga"; } else if (readPhase_i == 4) { nameOut = dataPath("") + "\\albedo.tga"; } else if (readPhase_i == 5) { nameOut = dataPath("") + "\\normal.tga"; } else if (readPhase_i == 6) { nameOut = dataPath("") + "\\height.tga"; } render.save(nameOut); exporttimer = 3; waitForExport = true; } void exportVMT() { loading_b = true; exportinc++; if (exportinc >= exporttimer * frameRate) { println("launching vtfcmd"); exportinc = 0; String vtfcmdpath = dataPath("") + "\\VTFCmd\\VTFCmd.exe"; println(vtfcmdpath + " -file \"" + nameOut + "\" -output \"" + filePath + "\\materials\\pbr\\" + inputName + "\" -format \"dxt5\""); launch(vtfcmdpath + " -file \"" + nameOut + "\" -output \"" + filePath + "\\materials\\pbr\\" + inputName + "\" -format \"dxt5\""); String[] vmt = { "VertexLitPBR", "{", " \"$AlbedoMap\" \"pbr\\" + inputName + "\\albedo\"", "", " \"$NormalMap\" \"pbr\\" + inputName + "\\normal\"", " \"$MetalRoughnessAmbientOccAniMaskMap\" \"pbr\\" + inputName + "\\mgaoa_map\"", " \"$HeightMap\" \"pbr\\" + inputName + "\\height\"", "", " \"$ParallaxHeightRatio\" \"0.1\"", " \"$MinParallaxSteps\" \"9\"", " \"$MaxParallaxSteps\" \"64\"", " \"$ParallaxViewStepBias\" \"1\"", "", " \"$PreintegratedFG\" \"pbr\\PreintegratedFG\"", "", "}" }; println(filePath + "\\" + inputName + ".vmt"); saveStrings(filePath + "\\materials\\pbr\\" + inputName + "\\" + inputName + ".vmt", vmt); loading_b = false; waitForExport = false; nextPhase(); } }