mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-26 17:16:20 +00:00
Move pipeline utilities into new pipeline library
This commit is contained in:
parent
ab7512cfc0
commit
9815393c27
12 changed files with 59 additions and 30 deletions
|
@ -28,6 +28,8 @@ typedef NLMISC::CSString TPathString;
|
||||||
typedef std::string TPathString;
|
typedef std::string TPathString;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace NLPIPELINE {
|
||||||
|
|
||||||
/// Asset database configuration
|
/// Asset database configuration
|
||||||
class CDatabaseConfig
|
class CDatabaseConfig
|
||||||
{
|
{
|
||||||
|
@ -55,4 +57,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} /* namespace NLPIPELINE */
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
|
@ -27,8 +27,8 @@
|
||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NLMISC_TOOL_LOGGER_H
|
#ifndef NLPIPELINE_TOOL_LOGGER_H
|
||||||
#define NLMISC_TOOL_LOGGER_H
|
#define NLPIPELINE_TOOL_LOGGER_H
|
||||||
#include <nel/misc/types_nl.h>
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
// STL includes
|
// STL includes
|
||||||
|
@ -47,16 +47,16 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NL_DEBUG_H
|
#ifdef NL_DEBUG_H
|
||||||
#define tlerror(toolLogger, path, error, ...) nlwarning(error, ## __VA_ARGS__), toolLogger.writeError(NLMISC::ERROR, path, error, ## __VA_ARGS__)
|
#define tlerror(toolLogger, path, error, ...) nlwarning(error, ## __VA_ARGS__), toolLogger.writeError(NLPIPELINE::ERROR, path, error, ## __VA_ARGS__)
|
||||||
#define tlwarning(toolLogger, path, error, ...) nlwarning(error, ## __VA_ARGS__), toolLogger.writeError(NLMISC::WARNING, path, error, ## __VA_ARGS__)
|
#define tlwarning(toolLogger, path, error, ...) nlwarning(error, ## __VA_ARGS__), toolLogger.writeError(NLPIPELINE::WARNING, path, error, ## __VA_ARGS__)
|
||||||
#define tlmessage(toolLogger, path, error, ...) nlinfo(error, ## __VA_ARGS__), toolLogger.writeError(NLMISC::MESSAGE, path, error, ## __VA_ARGS__)
|
#define tlmessage(toolLogger, path, error, ...) nlinfo(error, ## __VA_ARGS__), toolLogger.writeError(NLPIPELINE::MESSAGE, path, error, ## __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define tlerror(toolLogger, path, error, ...) toolLogger.writeError(NLMISC::ERROR, path, error, ## __VA_ARGS__)
|
#define tlerror(toolLogger, path, error, ...) toolLogger.writeError(NLPIPELINE::ERROR, path, error, ## __VA_ARGS__)
|
||||||
#define tlwarning(toolLogger, path, error, ...) toolLogger.writeError(NLMISC::WARNING, path, error, ## __VA_ARGS__)
|
#define tlwarning(toolLogger, path, error, ...) toolLogger.writeError(NLPIPELINE::WARNING, path, error, ## __VA_ARGS__)
|
||||||
#define tlmessage(toolLogger, path, error, ...) toolLogger.writeError(NLMISC::MESSAGE, path, error, ## __VA_ARGS__)
|
#define tlmessage(toolLogger, path, error, ...) toolLogger.writeError(NLPIPELINE::MESSAGE, path, error, ## __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace NLMISC {
|
namespace NLPIPELINE {
|
||||||
|
|
||||||
enum TError
|
enum TError
|
||||||
{
|
{
|
||||||
|
@ -203,8 +203,8 @@ public:
|
||||||
}
|
}
|
||||||
}; /* class CToolLogger */
|
}; /* class CToolLogger */
|
||||||
|
|
||||||
} /* namespace NLMISC */
|
} /* namespace NLPIPELINE */
|
||||||
|
|
||||||
#endif /* #ifndef NLMISC_TOOL_LOGGER_H */
|
#endif /* #ifndef NLPIPELINE_TOOL_LOGGER_H */
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
|
@ -35,3 +35,7 @@ ENDIF(WITH_NEL_CEGUI)
|
||||||
IF(WITH_PACS)
|
IF(WITH_PACS)
|
||||||
ADD_SUBDIRECTORY(pacs)
|
ADD_SUBDIRECTORY(pacs)
|
||||||
ENDIF(WITH_PACS)
|
ENDIF(WITH_PACS)
|
||||||
|
|
||||||
|
IF(WITH_NEL_TOOLS)
|
||||||
|
ADD_SUBDIRECTORY(pipeline)
|
||||||
|
ENDIF(WITH_NEL_TOOLS)
|
||||||
|
|
18
code/nel/src/pipeline/CMakeLists.txt
Normal file
18
code/nel/src/pipeline/CMakeLists.txt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
FILE(GLOB SRC *.cpp *.h)
|
||||||
|
FILE(GLOB HEADERS ../../include/nel/pipeline/*.h)
|
||||||
|
|
||||||
|
SOURCE_GROUP("" FILES ${HEADERS} ${SRC})
|
||||||
|
|
||||||
|
NL_TARGET_LIB(nelpipeline ${HEADERS} ${SRC})
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(nelpipeline nelmisc)
|
||||||
|
NL_DEFAULT_PROPS(nelpipeline "NeL, Library: NeL Pipeline")
|
||||||
|
NL_ADD_RUNTIME_FLAGS(nelpipeline)
|
||||||
|
|
||||||
|
NL_ADD_LIB_SUFFIX(nelpipeline)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
INSTALL(TARGETS nelpipeline LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
|
@ -16,7 +16,7 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <nel/misc/types_nl.h>
|
#include <nel/misc/types_nl.h>
|
||||||
#include "database_config.h"
|
#include "nel/pipeline/database_config.h"
|
||||||
|
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
#include <nel/misc/path.h>
|
#include <nel/misc/path.h>
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace NLPIPELINE {
|
||||||
|
|
||||||
TPathString CDatabaseConfig::s_RootPath;
|
TPathString CDatabaseConfig::s_RootPath;
|
||||||
NLMISC::CConfigFile *CDatabaseConfig::s_ConfigFile = NULL;
|
NLMISC::CConfigFile *CDatabaseConfig::s_ConfigFile = NULL;
|
||||||
CDatabaseConfig CDatabaseConfig::s_Instance;
|
CDatabaseConfig CDatabaseConfig::s_Instance;
|
||||||
|
@ -104,4 +106,6 @@ void CDatabaseConfig::release()
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} /* namespace NLPIPELINE */
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
|
@ -25,8 +25,7 @@
|
||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdmisc.h"
|
#include "nel/pipeline/tool_logger.h"
|
||||||
#include "nel/misc/tool_logger.h"
|
|
||||||
|
|
||||||
// STL includes
|
// STL includes
|
||||||
|
|
||||||
|
@ -35,11 +34,11 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLMISC {
|
namespace NLPIPELINE {
|
||||||
|
|
||||||
// Tool logger is fully implemented in header so small tools do not need to link to this library unnecessarily.
|
// Tool logger is fully implemented in header so small tools do not need to link to this library unnecessarily.
|
||||||
void dummy_tool_logger_cpp() { }
|
void dummy_tool_logger_cpp() { }
|
||||||
|
|
||||||
} /* namespace NLMISC */
|
} /* namespace NLPIPELINE */
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
|
@ -7,7 +7,7 @@ INCLUDE_DIRECTORIES(${assimp_INCLUDE_DIRS})
|
||||||
|
|
||||||
NL_TARGET_LIB(mesh_utils ${SRCS} ${HDRS})
|
NL_TARGET_LIB(mesh_utils ${SRCS} ${HDRS})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(mesh_utils ${assimp_LIBRARIES} nelmisc nel3d)
|
TARGET_LINK_LIBRARIES(mesh_utils ${assimp_LIBRARIES} nelmisc nelpipeline nel3d)
|
||||||
NL_DEFAULT_PROPS(mesh_utils "NeL, Tools, 3D: Mesh Utils")
|
NL_DEFAULT_PROPS(mesh_utils "NeL, Tools, 3D: Mesh Utils")
|
||||||
NL_ADD_RUNTIME_FLAGS(mesh_utils)
|
NL_ADD_RUNTIME_FLAGS(mesh_utils)
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
#include <nel/misc/path.h>
|
#include <nel/misc/path.h>
|
||||||
#include <nel/misc/tool_logger.h>
|
#include <nel/pipeline/tool_logger.h>
|
||||||
|
|
||||||
#include <nel/3d/mesh.h>
|
#include <nel/3d/mesh.h>
|
||||||
#include <nel/3d/texture_file.h>
|
#include <nel/3d/texture_file.h>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
#include <nel/misc/path.h>
|
#include <nel/misc/path.h>
|
||||||
#include <nel/misc/tool_logger.h>
|
#include <nel/pipeline/tool_logger.h>
|
||||||
|
|
||||||
#include <nel/3d/mesh.h>
|
#include <nel/3d/mesh.h>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
#include "mesh_utils.h"
|
#include "mesh_utils.h"
|
||||||
|
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
#include <nel/misc/tool_logger.h>
|
#include <nel/pipeline/tool_logger.h>
|
||||||
|
#include <nel/pipeline/database_config.h>
|
||||||
#include <nel/misc/sstring.h>
|
#include <nel/misc/sstring.h>
|
||||||
#include <nel/misc/file.h>
|
#include <nel/misc/file.h>
|
||||||
#include <nel/misc/path.h>
|
#include <nel/misc/path.h>
|
||||||
|
@ -28,7 +29,6 @@
|
||||||
#include <nel/3d/mesh.h>
|
#include <nel/3d/mesh.h>
|
||||||
#include <nel/3d/texture_file.h>
|
#include <nel/3d/texture_file.h>
|
||||||
|
|
||||||
#include "database_config.h"
|
|
||||||
#include "scene_meta.h"
|
#include "scene_meta.h"
|
||||||
|
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
|
@ -231,7 +231,7 @@ void exportShapes(CMeshUtilsContext &context)
|
||||||
if (nodeContext.Shape)
|
if (nodeContext.Shape)
|
||||||
{
|
{
|
||||||
std::string shapePath = NLMISC::CPath::standardizePath(context.Settings.DestinationDirectoryPath, true) + it->first + ".shape";
|
std::string shapePath = NLMISC::CPath::standardizePath(context.Settings.DestinationDirectoryPath, true) + it->first + ".shape";
|
||||||
context.ToolLogger.writeDepend(NLMISC::BUILD, shapePath.c_str(), "*");
|
context.ToolLogger.writeDepend(NLPIPELINE::BUILD, shapePath.c_str(), "*");
|
||||||
NLMISC::COFile f;
|
NLMISC::COFile f;
|
||||||
if (f.open(shapePath, false, false, true))
|
if (f.open(shapePath, false, false, true))
|
||||||
{
|
{
|
||||||
|
@ -262,7 +262,7 @@ void exportShapes(CMeshUtilsContext &context)
|
||||||
std::string knownPath = NLMISC::CPath::lookup(fileName, false, false, false);
|
std::string knownPath = NLMISC::CPath::lookup(fileName, false, false, false);
|
||||||
if (!knownPath.empty())
|
if (!knownPath.empty())
|
||||||
{
|
{
|
||||||
context.ToolLogger.writeDepend(NLMISC::RUNTIME, shapePath.c_str(), knownPath.c_str());
|
context.ToolLogger.writeDepend(NLPIPELINE::RUNTIME, shapePath.c_str(), knownPath.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -289,16 +289,16 @@ int exportScene(const CMeshUtilsSettings &settings)
|
||||||
context.ToolLogger.initDepend(settings.ToolDependLog);
|
context.ToolLogger.initDepend(settings.ToolDependLog);
|
||||||
if (!settings.ToolErrorLog.empty())
|
if (!settings.ToolErrorLog.empty())
|
||||||
context.ToolLogger.initError(settings.ToolErrorLog);
|
context.ToolLogger.initError(settings.ToolErrorLog);
|
||||||
context.ToolLogger.writeDepend(NLMISC::BUILD, "*", NLMISC::CPath::standardizePath(context.Settings.SourceFilePath, false).c_str()); // Base input file
|
context.ToolLogger.writeDepend(NLPIPELINE::BUILD, "*", NLMISC::CPath::standardizePath(context.Settings.SourceFilePath, false).c_str()); // Base input file
|
||||||
|
|
||||||
// Apply database configuration
|
// Apply database configuration
|
||||||
if (!CDatabaseConfig::init(settings.SourceFilePath))
|
if (!NLPIPELINE::CDatabaseConfig::init(settings.SourceFilePath))
|
||||||
{
|
{
|
||||||
tlerror(context.ToolLogger, context.Settings.SourceFilePath.c_str(), "Unable to find database.cfg in input path or any of its parents.");
|
tlerror(context.ToolLogger, context.Settings.SourceFilePath.c_str(), "Unable to find database.cfg in input path or any of its parents.");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDatabaseConfig::initTextureSearchDirectories();
|
NLPIPELINE::CDatabaseConfig::initTextureSearchDirectories();
|
||||||
|
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(settings.SourceFilePath, 0
|
const aiScene *scene = importer.ReadFile(settings.SourceFilePath, 0
|
||||||
|
@ -321,7 +321,7 @@ int exportScene(const CMeshUtilsSettings &settings)
|
||||||
|
|
||||||
context.InternalScene = scene;
|
context.InternalScene = scene;
|
||||||
if (context.SceneMeta.load(context.Settings.SourceFilePath))
|
if (context.SceneMeta.load(context.Settings.SourceFilePath))
|
||||||
context.ToolLogger.writeDepend(NLMISC::BUILD, "*", context.SceneMeta.metaFilePath().c_str()); // Meta input file
|
context.ToolLogger.writeDepend(NLPIPELINE::BUILD, "*", context.SceneMeta.metaFilePath().c_str()); // Meta input file
|
||||||
|
|
||||||
validateInternalNodeNames(context, context.InternalScene->mRootNode);
|
validateInternalNodeNames(context, context.InternalScene->mRootNode);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
#include <nel/misc/path.h>
|
#include <nel/misc/path.h>
|
||||||
#include <nel/misc/tool_logger.h>
|
#include <nel/pipeline/tool_logger.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "scene_meta.h"
|
#include "scene_meta.h"
|
||||||
|
|
||||||
#include <nel/misc/sstring.h>
|
#include <nel/misc/sstring.h>
|
||||||
#include <nel/misc/tool_logger.h>
|
#include <nel/pipeline/tool_logger.h>
|
||||||
#include <nel/misc/smart_ptr.h>
|
#include <nel/misc/smart_ptr.h>
|
||||||
#include <nel/misc/matrix.h>
|
#include <nel/misc/matrix.h>
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ struct CMeshUtilsContext
|
||||||
|
|
||||||
const CMeshUtilsSettings &Settings;
|
const CMeshUtilsSettings &Settings;
|
||||||
|
|
||||||
NLMISC::CToolLogger ToolLogger;
|
NLPIPELINE::CToolLogger ToolLogger;
|
||||||
|
|
||||||
const NL_SCENE_INTERNAL_TYPE *InternalScene;
|
const NL_SCENE_INTERNAL_TYPE *InternalScene;
|
||||||
CSceneMeta SceneMeta;
|
CSceneMeta SceneMeta;
|
||||||
|
|
Loading…
Reference in a new issue