-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added MDL importer/exporter for Kuro1
- Loading branch information
Showing
12 changed files
with
1,917 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// GenerateParametersLayout.cpp : Ce fichier contient la fonction 'main'. L'exécution du programme commence et se termine à cet endroit. | ||
// | ||
|
||
#include <iostream> | ||
#include <fstream> | ||
#include <vector> | ||
#include <MDLFile.h> | ||
#include <model.h> | ||
#include <filesystem> | ||
#include "AssetConfig.h" | ||
#include <cstring> | ||
#include <JsonGenerator.h> | ||
|
||
namespace fs = std::filesystem; | ||
int main(int argc, char** argv) | ||
{ | ||
|
||
if (argc > 1) { | ||
std::error_code ec; | ||
std::string filepath = std::string(argv[1]); | ||
AssetConfig conf("asset_config.json"); | ||
if (fs::is_directory(filepath, ec)) | ||
{ | ||
std::vector<model> ani_mdls = {}; | ||
model base_model; | ||
for (const auto& file : fs::directory_iterator(filepath)) { | ||
filepath = file.path().string(); | ||
JsonGenerator gen(filepath, conf); | ||
|
||
} | ||
|
||
} | ||
else { | ||
|
||
std::string base_filename = filepath.substr(filepath.find_last_of("/\\") + 1); | ||
try { | ||
JsonGenerator gen(filepath, conf); | ||
|
||
|
||
} | ||
catch (std::exception e) { | ||
std::string msg = e.what(); | ||
std::transform(msg.begin(), msg.end(), msg.begin(), ::toupper); | ||
std::cout << msg << " " << base_filename << std::endl; | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "JsonGenerator.h" | ||
#include <CLEDecrypt.h> | ||
#include <MDLFile.h> | ||
bool JsonGenerator::MDLToJson(std::string filepath, AssetConfig conf) { | ||
std::string base_filename = filepath.substr(filepath.find_last_of("/\\") + 1); | ||
std::string::size_type const p(base_filename.find_last_of('.')); | ||
std::string scene_name = base_filename.substr(0, p); | ||
decrypt(filepath); | ||
std::ifstream input(filepath, std::ios::binary); | ||
std::vector<unsigned char> buffer(std::istreambuf_iterator<char>(input), {}); | ||
MDLFile mdl(scene_name, buffer); | ||
mdl.write_to_json(conf); | ||
|
||
|
||
return true; } | ||
bool JsonGenerator::FBXToJson(std::string filepath) { | ||
|
||
model m = model(filepath); | ||
m.to_json(); | ||
return true; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
#include <string> | ||
#include <iostream> | ||
#include "AssetConfig.h" | ||
class JsonGenerator | ||
{ | ||
public: | ||
JsonGenerator(std::string filepath, AssetConfig conf) { | ||
std::string base_filename = filepath.substr(filepath.find_last_of("/\\") + 1); | ||
std::string::size_type const p(base_filename.find_last_of('.')); | ||
std::string scene_name = base_filename.substr(0, p); | ||
std::string extension = base_filename.substr(p+1, base_filename.length()); | ||
|
||
if (extension.compare("mdl") == 0) | ||
MDLToJson(filepath, conf); | ||
else if (extension.compare("fbx") == 0) | ||
FBXToJson(filepath); | ||
else | ||
std::cout << "no idea" << std::endl; | ||
/*decrypt(filepath); | ||
std::ifstream input(filepath, std::ios::binary); | ||
std::vector<unsigned char> buffer(std::istreambuf_iterator<char>(input), {}); | ||
MDLFile mdl(scene_name, buffer);*/ | ||
} | ||
|
||
bool MDLToJson(std::string filepath, AssetConfig conf); | ||
bool FBXToJson(std::string filepath); | ||
|
||
}; | ||
|
Oops, something went wrong.