Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add empty effekseer producer #242

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions auto/examples.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"),
Expand Down
5 changes: 5 additions & 0 deletions auto/producers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
99 changes: 99 additions & 0 deletions auto/producers/effekseer_producer.lua
Original file line number Diff line number Diff line change
@@ -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..."
10 changes: 6 additions & 4 deletions auto/producers/fbx_producer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions auto/thirdparty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ end
DefineSDKConfig("FBX_SDK_DIR")
DefineSDKConfig("PHYSX_SDK_DIR")
DefineSDKConfig("SPEEDTREE_SDK_DIR")
DefineSDKConfig("EFFEKSEER_SDK_DIR")
--------------------------------------------------------------

-- Define ThirdParty projects
Expand Down
33 changes: 33 additions & 0 deletions examples/Prototype/Effekseer/EffekseerToCD/Main.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
26 changes: 26 additions & 0 deletions private/Producers/EffekseerProducer/EffekseerProducer.cpp
Original file line number Diff line number Diff line change
@@ -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);
}

}
37 changes: 37 additions & 0 deletions private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "EffekseerProducerImpl.h"

#include <Effekseer.h>
#include <Effekseer.Modules.h>

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();
}

}
26 changes: 26 additions & 0 deletions private/Producers/EffekseerProducer/EffekseerProducerImpl.h
Original file line number Diff line number Diff line change
@@ -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;
};

}
27 changes: 27 additions & 0 deletions public/Producers/EffekseerProducer/EffekseerProducer.h
Original file line number Diff line number Diff line change
@@ -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;
};

}
Loading