diff --git a/auto/examples.lua b/auto/examples.lua index b0a5b53d..d0b8ecde 100644 --- a/auto/examples.lua +++ b/auto/examples.lua @@ -21,6 +21,7 @@ local function MakeExample(exampleProjectPath) local doUseGenericConsumer = string.contains(exampleProject, "ToGeneric") local doUseTerrainProducer = string.contains(exampleProject, "TerrainTo") + local doUseEffekseerProducer = string.contains(exampleProject, "EffekseerTo") print("Making example : "..exampleProject) project(exampleProject) @@ -106,6 +107,14 @@ local function MakeExample(exampleProjectPath) print("Using TerrainProducer") end + if doUseEffekseerProducer then + table.insert(extraIncludeDirs, path.join(RootPath, "public/Producers/EffekseerProducer")) + table.insert(extraLinkDebugLibs, path.join(RootPath, "build/bin/Debug/EffekseerProducer")) + table.insert(extraLinkReleaseLibs, path.join(RootPath, "build/bin/Release/EffekseerProducer")) + dependson { "EffekseerProducer" } + print("Using EffekseerProducer") + end + includedirs { path.join(RootPath, "public"), path.join(RootPath, "misc"), diff --git a/auto/producers.lua b/auto/producers.lua index cdc93074..2ef0f4db 100644 --- a/auto/producers.lua +++ b/auto/producers.lua @@ -16,6 +16,11 @@ end if CheckSDKExists("FBX_SDK_DIR") and BUILD_FBX then dofile("producers/fbx_producer.lua") end + +if CheckSDKExists("EFFEKSEER_SDK_DIR") then + dofile("producers/effekseer_producer.lua") +end + if CheckSDKExists("PHYSX_SDK_DIR") then dofile("producers/physx_producer.lua") end diff --git a/auto/producers/effekseer_producer.lua b/auto/producers/effekseer_producer.lua new file mode 100644 index 00000000..5b91126f --- /dev/null +++ b/auto/producers/effekseer_producer.lua @@ -0,0 +1,99 @@ +-------------------------------------------------------------- +print("Building effekseer_producer") + +-- Define producer dll +project("EffekseerProducer") + kind("SharedLib") + language("C++") + Platform_SetCppDialect() + dependson { "AssetPipelineCore" } + + location(path.join(RootPath, "build")) + + filter { "configurations:Debug" } + objdir(path.join(RootPath, "build/obj/Debug")) + targetdir(path.join(RootPath, "build/bin/Debug")) + libdirs(path.join(RootPath, "build/bin/Release")) + links { + path.join(RootPath, "build/bin/Debug/AssetPipelineCore") + } + filter { "configurations:Release" } + objdir(path.join(RootPath, "build/obj/Release")) + targetdir(path.join(RootPath, "build/bin/Release")) + libdirs(path.join(RootPath, "build/bin/Release")) + links { + path.join(RootPath, "build/bin/Release/AssetPipelineCore") + } + filter {} + + defines { + "TOOL_BUILD_SHARED" + } + + files { + path.join(RootPath, "public/Producers/EffekseerProducer/**.*"), + path.join(RootPath, "private/Producers/EffekseerProducer/**.*"), + } + + vpaths { + ["Source/*"] = { + path.join(RootPath, "public/Producers/EffekseerProducer/**.*"), + path.join(RootPath, "private/Producers/EffekseerProducer/**.*"), + }, + } + + commercialSDKIncludeDirs = {} + commercialSDKLibDirs = {} + commercialSDKLibNames = {} + + local config = CommercialSDKConfigs["EFFEKSEER_SDK_DIR"] + if config then + table.insert(commercialSDKIncludeDirs, config.include) + table.insert(commercialSDKLibDirs, config.lib_dir) + for _, libName in pairs(config.lib_names) do + table.insert(commercialSDKLibNames, libName) + end + end + + includedirs { + path.join(RootPath, "public"), + path.join(RootPath, "private"), + table.unpack(commercialSDKIncludeDirs) + } + + libdirs { + table.unpack(commercialSDKLibDirs), + } + + links { + table.unpack(commercialSDKLibNames), + } + + -- Auto copy dlls + local commercialSDKPostCmds = {} + filter { "configurations:Debug" } + for _, config in pairs(CommercialSDKConfigs) do + for _, dllPath in pairs(config.dll_paths) do + local copyCommand = "{COPYDIR} "..dllPath.." ".."build\\bin\\Debug" + table.insert(commercialSDKPostCmds, copyCommand) + end + end + + postbuildcommands { + "cd "..RootPath, + table.unpack(commercialSDKPostCmds) + } + filter { "configurations:Release" } + for _, config in pairs(CommercialSDKConfigs) do + for _, dllPath in pairs(config.dll_paths) do + local copyCommand = "{COPYDIR} "..dllPath.." ".."build\\bin\\Release" + table.insert(commercialSDKPostCmds, copyCommand) + end + end + + postbuildcommands { + "cd "..RootPath, + table.unpack(commercialSDKPostCmds) + } + filter {} + postbuildmessage "Copying dependencies..." \ No newline at end of file diff --git a/auto/producers/fbx_producer.lua b/auto/producers/fbx_producer.lua index 54729411..e35c8d58 100644 --- a/auto/producers/fbx_producer.lua +++ b/auto/producers/fbx_producer.lua @@ -47,10 +47,12 @@ project("FbxProducer") commercialSDKLibNames = {} local config = CommercialSDKConfigs["FBX_SDK_DIR"] - table.insert(commercialSDKIncludeDirs, config.include) - table.insert(commercialSDKLibDirs, config.lib_dir) - for _, libName in pairs(config.lib_names) do - table.insert(commercialSDKLibNames, libName) + if config then + table.insert(commercialSDKIncludeDirs, config.include) + table.insert(commercialSDKLibDirs, config.lib_dir) + for _, libName in pairs(config.lib_names) do + table.insert(commercialSDKLibNames, libName) + end end includedirs { diff --git a/auto/thirdparty.lua b/auto/thirdparty.lua index 0ee12253..db370eb2 100644 --- a/auto/thirdparty.lua +++ b/auto/thirdparty.lua @@ -31,6 +31,7 @@ end DefineSDKConfig("FBX_SDK_DIR") DefineSDKConfig("PHYSX_SDK_DIR") DefineSDKConfig("SPEEDTREE_SDK_DIR") +DefineSDKConfig("EFFEKSEER_SDK_DIR") -------------------------------------------------------------- -- Define ThirdParty projects diff --git a/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp b/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp new file mode 100644 index 00000000..ddc43f5f --- /dev/null +++ b/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp @@ -0,0 +1,33 @@ +#include "CDConsumer.h" +#include "Framework/Processor.h" +#include "EffekseerProducer.h" +#include "Utilities/PerformanceProfiler.h" + +int main(int argc, char** argv) +{ + // argv[0] : exe name + // argv[1] : input file path + // argv[2] : output file path + if (argc != 3) + { + return 1; + } + + using namespace cdtools; + + PerformanceProfiler profiler("AssetPipeline"); + + // TODO : how to input char16_t string from argv? + const char16_t* pInputFilePath = u"S:/Effekseer/Examples/Resources/Laser01.efkefc"; + const char* pOutputFilePath = argv[2]; + EffekseerProducer producer(pInputFilePath); + CDConsumer consumer(pOutputFilePath); + consumer.SetExportMode(ExportMode::PureBinary); + + Processor processor(&producer, &consumer); + processor.SetDumpSceneDatabaseEnable(true); + processor.SetValidateSceneDatabaseEnable(true); + processor.Run(); + + return 0; +} \ No newline at end of file diff --git a/private/Producers/EffekseerProducer/EffekseerProducer.cpp b/private/Producers/EffekseerProducer/EffekseerProducer.cpp new file mode 100644 index 00000000..10e9be03 --- /dev/null +++ b/private/Producers/EffekseerProducer/EffekseerProducer.cpp @@ -0,0 +1,26 @@ +#include "Producers/EffekseerProducer/EffekseerProducer.h" +#include "EffekseerProducerImpl.h" + +namespace cdtools +{ + +EffekseerProducer::EffekseerProducer(const char16_t* pFilePath) +{ + m_pEffekseerProducerImpl = new EffekseerProducerImpl(pFilePath); +} + +EffekseerProducer::~EffekseerProducer() +{ + if (m_pEffekseerProducerImpl) + { + delete m_pEffekseerProducerImpl; + m_pEffekseerProducerImpl = nullptr; + } +} + +void EffekseerProducer::Execute(cd::SceneDatabase* pSceneDatabase) +{ + m_pEffekseerProducerImpl->Execute(pSceneDatabase); +} + +} \ No newline at end of file diff --git a/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp b/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp new file mode 100644 index 00000000..eaa20744 --- /dev/null +++ b/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp @@ -0,0 +1,37 @@ +#include "EffekseerProducerImpl.h" + +#include +#include + +namespace cdtools +{ + +EffekseerProducerImpl::EffekseerProducerImpl(const char16_t* pFilePath) : + m_pFilePath(pFilePath) +{ +} + +void EffekseerProducerImpl::Execute(cd::SceneDatabase* pSceneDatabase) +{ + auto efkManager = ::Effekseer::Manager::Create(8000); + auto effect = Effekseer::Effect::Create(efkManager, m_pFilePath); + auto* pEffectData = effect.Get(); + + // Mesh + pEffectData->GetProceduralModelCount(); + pEffectData->GetWaveCount(); + + // Materials and ParticleEmitter + pEffectData->GetMaterialCount(); + pEffectData->GetLoadingParameter(); + pEffectData->GetDefaultDynamicInputs(); + + // Texture + pEffectData->GetColorImageCount(); + pEffectData->GetDistortionImageCount(); + + // Track + pEffectData->GetCurveCount(); +} + +} \ No newline at end of file diff --git a/private/Producers/EffekseerProducer/EffekseerProducerImpl.h b/private/Producers/EffekseerProducer/EffekseerProducerImpl.h new file mode 100644 index 00000000..7bd220cb --- /dev/null +++ b/private/Producers/EffekseerProducer/EffekseerProducerImpl.h @@ -0,0 +1,26 @@ +#pragma once + +#include "Base/Template.h" +#include "Scene/SceneDatabase.h" + +namespace cdtools +{ + +class EffekseerProducerImpl final +{ +public: + EffekseerProducerImpl() = delete; + explicit EffekseerProducerImpl(const char16_t* pFilePath); + EffekseerProducerImpl(const EffekseerProducerImpl&) = delete; + EffekseerProducerImpl& operator=(const EffekseerProducerImpl&) = delete; + EffekseerProducerImpl(EffekseerProducerImpl&&) = delete; + EffekseerProducerImpl& operator=(EffekseerProducerImpl&&) = delete; + ~EffekseerProducerImpl() = default; + + void Execute(cd::SceneDatabase* pSceneDatabase); + +private: + const char16_t* m_pFilePath; +}; + +} \ No newline at end of file diff --git a/public/Producers/EffekseerProducer/EffekseerProducer.h b/public/Producers/EffekseerProducer/EffekseerProducer.h new file mode 100644 index 00000000..99b58a48 --- /dev/null +++ b/public/Producers/EffekseerProducer/EffekseerProducer.h @@ -0,0 +1,27 @@ +#pragma once + +#include "Framework/IProducer.h" + +namespace cdtools +{ + +class EffekseerProducerImpl; + +class TOOL_API EffekseerProducer final : public IProducer +{ +public: + EffekseerProducer() = delete; + explicit EffekseerProducer(const char16_t* pFilePath); + EffekseerProducer(const EffekseerProducer&) = delete; + EffekseerProducer& operator=(const EffekseerProducer&) = delete; + EffekseerProducer(EffekseerProducer&&) = delete; + EffekseerProducer& operator=(EffekseerProducer&&) = delete; + virtual ~EffekseerProducer(); + + virtual void Execute(cd::SceneDatabase* pSceneDatabase) override; + +private: + EffekseerProducerImpl* m_pEffekseerProducerImpl; +}; + +} \ No newline at end of file