From 13e3afa72f0a3a5a4ded7f06e368a642ba483ac8 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 16 Feb 2016 17:42:27 -1000 Subject: [PATCH] D3D CElementGen rendering --- CMakeLists.txt | 2 +- Editor/Space.cpp | 8 +- Editor/main.cpp | 6 +- Runtime/CFactoryMgr.hpp | 2 +- Runtime/CGraphics.cpp | 3 + Runtime/Particle/CElementGenShadersHLSL.cpp | 359 ++++++++++++++++++++ Runtime/Particle/CParticleDataFactory.cpp | 8 +- Runtime/Particle/CParticleDataFactory.hpp | 12 + Runtime/Particle/CParticleElectric.cpp | 18 + Runtime/Particle/CParticleSwoosh.cpp | 18 + Runtime/Particle/CWeaponDescription.hpp | 3 + Runtime/RetroTypes.hpp | 2 + hecl | 2 +- libSpecter | 2 +- 14 files changed, 429 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d4fe69b9..6682e6622 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ add_definitions(-DZE_ATHENA_TYPES=1) set(MATHLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libSpecter/MathLib/include) include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR} ${NODLIB_INCLUDE_DIR} ${MATHLIB_INCLUDE_DIR} ${BOO_INCLUDE_DIR} - ${SPECTER_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + ${SPECTER_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(DataSpec) add_subdirectory(Editor) add_subdirectory(Runtime) diff --git a/Editor/Space.cpp b/Editor/Space.cpp index 074785aad..2ac88c8a4 100644 --- a/Editor/Space.cpp +++ b/Editor/Space.cpp @@ -43,10 +43,10 @@ Specter::View* Space::buildSpaceView(Specter::ViewResources& res) std::vector Space::SpaceMenuNode::s_subNodeDats = { - {Class::ResourceBrowser, "resource_browser", "Resource Browser", GetIcon(SpaceIcon::ResourceBrowser), {0.0,1.0,0.0,1.0}}, - {Class::EffectEditor, "effect_editor", "Effect Editor", GetIcon(SpaceIcon::ParticleEditor), {1.0,0.5,0.0,1.0}}, - {Class::ModelViewer, "model_viewer", "Model Viewer", GetIcon(SpaceIcon::ModelViewer), {0.95, 0.95, 0.95, 1.0}}, - {Class::InformationCenter, "information_center", "Information Center", GetIcon(SpaceIcon::InformationCenter), {0.0, 1.0, 1.0, 1.0}} + {Class::ResourceBrowser, "resource_browser", "Resource Browser", GetIcon(SpaceIcon::ResourceBrowser), {0.0f, 1.0f, 0.0f, 1.0f}}, + {Class::EffectEditor, "effect_editor", "Effect Editor", GetIcon(SpaceIcon::ParticleEditor), {1.0f, 0.5f, 0.0f, 1.0f}}, + {Class::ModelViewer, "model_viewer", "Model Viewer", GetIcon(SpaceIcon::ModelViewer), {0.95f, 0.95f, 0.95f, 1.0f}}, + {Class::InformationCenter, "information_center", "Information Center", GetIcon(SpaceIcon::InformationCenter), {0.0f, 1.0f, 1.0f, 1.0f}} }; std::string Space::SpaceMenuNode::s_text = "Space Types"; diff --git a/Editor/main.cpp b/Editor/main.cpp index 4d8e09d43..4255ba21a 100644 --- a/Editor/main.cpp +++ b/Editor/main.cpp @@ -51,10 +51,8 @@ struct Application : boo::IApplicationCallback Zeus::detectCPU(); const Zeus::CPUInfo& cpuInf = Zeus::cpuFeatures(); - HECL::SystemString cpuName{reinterpret_cast(cpuInf.cpuBrand)}; - HECL::SystemString cpuVendor{reinterpret_cast(cpuInf.cpuVendor)}; - Log.report(LogVisor::Info, _S("CPU Name: %s"), cpuName.c_str()); - Log.report(LogVisor::Info, _S("CPU Vendor: %s"), cpuVendor.c_str()); + Log.report(LogVisor::Info, "CPU Name: %s", cpuInf.cpuBrand); + Log.report(LogVisor::Info, "CPU Vendor: %s", cpuInf.cpuVendor); HECL::SystemString features; if (cpuInf.AESNI) features += _S("AES-NI"); diff --git a/Runtime/CFactoryMgr.hpp b/Runtime/CFactoryMgr.hpp index 458d9692e..0112dc253 100644 --- a/Runtime/CFactoryMgr.hpp +++ b/Runtime/CFactoryMgr.hpp @@ -7,7 +7,7 @@ namespace pshag { -class SObjectTag; +struct SObjectTag; class CVParamTransfer; class IObj; diff --git a/Runtime/CGraphics.cpp b/Runtime/CGraphics.cpp index aceec8425..cbee58cd5 100644 --- a/Runtime/CGraphics.cpp +++ b/Runtime/CGraphics.cpp @@ -1,6 +1,9 @@ #include "CGraphics.hpp" #include +#undef near +#undef far + namespace pshag { diff --git a/Runtime/Particle/CElementGenShadersHLSL.cpp b/Runtime/Particle/CElementGenShadersHLSL.cpp index e69de29bb..7143fa023 100644 --- a/Runtime/Particle/CElementGenShadersHLSL.cpp +++ b/Runtime/Particle/CElementGenShadersHLSL.cpp @@ -0,0 +1,359 @@ +#include "CElementGenShaders.hpp" +#include "CElementGen.hpp" +#include "CGenDescription.hpp" + +namespace pshag +{ + +static const char* VS_HLSL_TEX = +"struct VertData\n" +"{\n" +" float4 posIn[4] : POSITION;\n" +" float4 colorIn : COLOR;\n" +" float4 uvsIn[4] : UV;\n" +"};\n" +"\n" +"cbuffer ParticleUniform : register(b0)\n" +"{\n" +" float4x4 mvp;\n" +" float4 moduColor;\n" +"};\n" +"\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +" float2 uv : UV;\n" +"};\n" +"\n" +"VertToFrag main(in VertData v, in uint vertId : SV_VertexID)\n" +"{\n" +" VertToFrag vtf;\n" +" vtf.color = v.colorIn * moduColor;\n" +" vtf.uv = v.uvsIn[vertId].xy;\n" +" vtf.position = mul(mvp, v.posIn[vertId]);\n" +" return vtf;\n" +"}\n"; + +static const char* FS_HLSL_TEX = +"SamplerState samp : register(s0);\n" +"Texture2D tex0 : register(t0);\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +" float2 uv : UV;\n" +"};\n" +"\n" +"float4 main(in VertToFrag vtf) : SV_Target0\n" +"{\n" +" return vtf.color * tex0.Sample(samp, vtf.uv);\n" +"}\n"; + +static const char* FS_HLSL_TEX_REDTOALPHA = +"SamplerState samp : register(s0);\n" +"Texture2D tex0 : register(t0);\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +" float2 uv : UV;\n" +"};\n" +"\n" +"float4 main(in VertToFrag vtf) : SV_Target0\n" +"{\n" +" float4 colr = vtf.color * tex0.Sample(samp, vtf.uv);\n" +" return float4(colr.rgb, colr.r);" +"}\n"; + +static const char* VS_HLSL_INDTEX = +"struct VertData\n" +"{\n" +" float4 posIn[4] : POSITION;\n" +" float4 colorIn : COLOR;\n" +" float4 uvsInTexrTind[4] : UV0;\n" +" float4 uvsInScene[4] : UV4;\n" +"};\n" +"\n" +"cbuffer ParticleUniform : register(b0)\n" +"{\n" +" float4x4 mvp;\n" +" float4 moduColor;\n" +"};\n" +"\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +" float2 uvTexr : UV0;\n" +" float2 uvScene : UV1;\n" +" float2 uvTind : UV2;\n" +"};\n" +"\n" +"VertToFrag main(in VertData v, in uint vertId : SV_VertexID)\n" +"{\n" +" VertToFrag vtf;\n" +" vtf.color = v.colorIn * moduColor;\n" +" vtf.uvTexr = v.uvsInTexrTind[vertId].xy;\n" +" vtf.uvScene = v.uvsInScene[vertId].xy;\n" +" vtf.uvTind = v.uvsInTexrTind[vertId].zw;\n" +" vtf.position = mul(mvp, v.posIn[vertId]);\n" +" return vtf;\n" +"}\n"; + +static const char* FS_HLSL_INDTEX = +"SamplerState samp : register(s0);\n" +"Texture2D tex0 : register(t0);\n" +"Texture2D tex1 : register(t1);\n" +"Texture2D tex2 : register(t2);\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +" float2 uvTexr : UV0;\n" +" float2 uvScene : UV1;\n" +" float2 uvTind : UV2;\n" +"};\n" +"\n" +"float4 main(in VertToFrag vtf) : SV_Target0\n" +"{\n" +" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ba;\n" +" float4 sceneTexel = tex1.Sample(samp, vtf.uvScene + tindTexel);\n" +" float4 texrTexel = tex0.Sample(samp, vtf.uvTexr);\n" +" float4 colr = vtf.color * sceneTexel + texrTexel;\n" +" return float4(colr.rgb, vtf.color.a * texrTexel.a);" +"}\n"; + +static const char* FS_METAL_CINDTEX = +"SamplerState samp : register(s0);\n" +"Texture2D tex0 : register(t0);\n" +"Texture2D tex1 : register(t1);\n" +"Texture2D tex2 : register(t2);\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +" float2 uvTexr : UV0;\n" +" float2 uvScene : UV1;\n" +" float2 uvTind : UV2;\n" +"};\n" +"\n" +"float4 main(in VertToFrag vtf) : SV_Target0\n" +"{\n" +" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ba;\n" +" float4 sceneTexel = tex1.Sample(samp, vtf.uvScene + tindTexel);\n" +" return vtf.color * sceneTexel * tex0.Sample(samp, vtf.uvTexr);\n" +"}\n"; + +static const char* VS_HLSL_NOTEX = +"struct VertData\n" +"{\n" +" float4 posIn[4] : POSITION;\n" +" float4 colorIn : COLOR;\n" +"};\n" +"\n" +"cbuffer ParticleUniform : register(b0)\n" +"{\n" +" float4x4 mvp;\n" +" float4 moduColor;\n" +"};\n" +"\n" +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +"};\n" +"\n" +"VertToFrag main(in VertData v, in uint vertId : SV_VertexID)\n" +"{\n" +" VertToFrag vtf;\n" +" vtf.color = v.colorIn * moduColor;\n" +" vtf.position = mul(mvp, v.posIn[vertId]);\n" +" return vtf;\n" +"}\n"; + +static const char* FS_HLSL_NOTEX = +"struct VertToFrag\n" +"{\n" +" float4 position : SV_Position;\n" +" float4 color : COLOR;\n" +"};\n" +"\n" +"float4 main(in VertToFrag vtf) : SV_Target0\n" +"{\n" +" return vtf.color;\n" +"}\n"; + +struct D3DDataBindingFactory : CElementGenShaders::IDataBindingFactory +{ + void BuildShaderDataBinding(CElementGen& gen, + boo::IShaderPipeline* regPipeline, + boo::IShaderPipeline* redToAlphaPipeline) + { + CGenDescription* desc = gen.GetDesc(); + + CUVElement* texr = desc->x54_TEXR.get(); + CUVElement* tind = desc->x58_TIND.get(); + int texCount = 0; + boo::ITexture* textures[3]; + + if (texr) + { + textures[0] = texr->GetValueTexture(0).GetObj()->GetBooTexture(); + texCount = 1; + if (tind) + { + textures[1] = CGraphics::g_SpareTexture; + textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture(); + texCount = 3; + } + } + + boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf}; + + if (regPipeline) + gen.m_normalDataBind = CGraphics::g_BooFactory->newShaderDataBinding(regPipeline, nullptr, nullptr, + gen.m_instBuf, nullptr, 1, uniforms, + texCount, textures); + if (redToAlphaPipeline) + gen.m_redToAlphaDataBind = CGraphics::g_BooFactory->newShaderDataBinding(redToAlphaPipeline, nullptr, nullptr, + gen.m_instBuf, nullptr, 1, uniforms, + texCount, textures); + } +}; + +CElementGenShaders::IDataBindingFactory* CElementGenShaders::Initialize(boo::ID3DDataFactory& factory) +{ + static const boo::VertexElementDescriptor TexFmtTex[] = + { + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3}, + {nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3} + }; + m_vtxFormatTex = factory.newVertexFormat(9, TexFmtTex); + + static const boo::VertexElementDescriptor TexFmtIndTex[] = + { + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3}, + {nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 4}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 5}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 6}, + {nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 7} + }; + m_vtxFormatIndTex = CGraphics::g_BooFactory->newVertexFormat(13, TexFmtIndTex); + + static const boo::VertexElementDescriptor TexFmtNoTex[] = + { + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2}, + {nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3}, + {nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced} + }; + m_vtxFormatNoTex = CGraphics::g_BooFactory->newVertexFormat(5, TexFmtNoTex); + + m_texZTestZWrite = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, true, false); + m_texNoZTestZWrite = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + false, true, false); + m_texZTestNoZWrite = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, false, false); + m_texNoZTestNoZWrite = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + false, false, false); + + m_texAdditiveZTest = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + true, false, false); + m_texAdditiveNoZTest = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + false, false, false); + + m_texRedToAlphaZTest = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX_REDTOALPHA, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, false, false); + m_texRedToAlphaNoZTest = factory.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX_REDTOALPHA, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + false, false, false); + + m_indTexZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatIndTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, true, false); + m_indTexNoZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatIndTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, false, false); + m_indTexAdditive = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_HLSL_INDTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatIndTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + true, true, false); + + m_cindTexZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_METAL_CINDTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatIndTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, true, false); + m_cindTexNoZWrite = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_METAL_CINDTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatIndTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, false, false); + m_cindTexAdditive = factory.newShaderPipeline(VS_HLSL_INDTEX, FS_METAL_CINDTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatIndTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + true, true, false); + + m_noTexZTestZWrite = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatNoTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, true, false); + m_noTexNoZTestZWrite = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatNoTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + false, true, false); + m_noTexZTestNoZWrite = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatNoTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + true, false, false); + m_noTexNoZTestNoZWrite = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatNoTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, + false, false, false); + + m_noTexAdditiveZTest = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatNoTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + true, false, false); + m_noTexAdditiveNoZTest = factory.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, ComPtr(), ComPtr(), + ComPtr(), m_vtxFormatNoTex, + boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, + false, false, false); + + return new struct D3DDataBindingFactory; +} + +} diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index 0835f12b7..fb4ada0f6 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -41,13 +41,13 @@ SParticleModel CParticleDataFactory::GetModel(CInputStream& in, CSimplePool* res TResId id = in.readUint32Big(); if (!id) return {}; - return {resPool->GetObj({FOURCC('CMDL'), id}), true}; + return {std::move(resPool->GetObj({FOURCC('CMDL'), id})), true}; } SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(TResId res, CSimplePool* resPool, const std::vector& tracker) { if (std::count(tracker.cbegin(), tracker.cend(), res) == 0) - return {resPool->GetObj({FOURCC('PART'), res}), true}; + return {std::move(resPool->GetObj({FOURCC('PART'), res})), true}; return {}; } @@ -70,7 +70,7 @@ SSwooshGeneratorDesc CParticleDataFactory::GetSwooshGeneratorDesc(CInputStream& TResId id = in.readUint32Big(); if (!id) return {}; - return {resPool->GetObj({FOURCC('SWHC'), id}), true}; + return {std::move(resPool->GetObj({FOURCC('SWHC'), id})), true}; } SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool) @@ -81,7 +81,7 @@ SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStre TResId id = in.readUint32Big(); if (!id) return {}; - return {resPool->GetObj({FOURCC('ELSC'), id}), true}; + return {std::move(resPool->GetObj({FOURCC('ELSC'), id})), true}; } CUVElement* CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePool* resPool) diff --git a/Runtime/Particle/CParticleDataFactory.hpp b/Runtime/Particle/CParticleDataFactory.hpp index 787c0cba9..aaecd7880 100644 --- a/Runtime/Particle/CParticleDataFactory.hpp +++ b/Runtime/Particle/CParticleDataFactory.hpp @@ -27,6 +27,9 @@ struct SParticleModel TLockedToken m_token; bool m_found = false; CModel* m_model = nullptr; + SParticleModel() = default; + SParticleModel(CToken&& tok, bool found) + : m_token(std::move(tok)), m_found(found) {} }; struct SChildGeneratorDesc @@ -34,6 +37,9 @@ struct SChildGeneratorDesc TLockedToken m_token; bool m_found = false; CGenDescription* m_gen = nullptr; + SChildGeneratorDesc() = default; + SChildGeneratorDesc(CToken&& tok, bool found) + : m_token(std::move(tok)), m_found(found) {} }; struct SSwooshGeneratorDesc @@ -41,6 +47,9 @@ struct SSwooshGeneratorDesc TLockedToken m_token; bool m_found = false; CSwooshDescription* m_swoosh = nullptr; + SSwooshGeneratorDesc() = default; + SSwooshGeneratorDesc(CToken&& tok, bool found) + : m_token(std::move(tok)), m_found(found) {} }; struct SElectricGeneratorDesc @@ -48,6 +57,9 @@ struct SElectricGeneratorDesc TLockedToken m_token; bool m_found = false; CElectricDescription* m_electric = nullptr; + SElectricGeneratorDesc() = default; + SElectricGeneratorDesc(CToken&& tok, bool found) + : m_token(std::move(tok)), m_found(found) {} }; class CParticleDataFactory diff --git a/Runtime/Particle/CParticleElectric.cpp b/Runtime/Particle/CParticleElectric.cpp index 71d953a69..a6fc308ea 100644 --- a/Runtime/Particle/CParticleElectric.cpp +++ b/Runtime/Particle/CParticleElectric.cpp @@ -49,50 +49,68 @@ void CParticleElectric::SetModulationColor(const Zeus::CColor&) const Zeus::CTransform& CParticleElectric::GetOrientation() const { + static Zeus::CTransform dummy; + return dummy; } const Zeus::CVector3f& CParticleElectric::GetTranslation() const { + static Zeus::CVector3f dummy; + return dummy; } const Zeus::CTransform& CParticleElectric::GetGlobalOrientation() const { + static Zeus::CTransform dummy; + return dummy; } const Zeus::CVector3f& CParticleElectric::GetGlobalTranslation() const { + static Zeus::CVector3f dummy; + return dummy; } const Zeus::CVector3f& CParticleElectric::GetGlobalScale() const { + static Zeus::CVector3f dummy; + return dummy; } const Zeus::CColor& CParticleElectric::GetModulationColor() const { + static Zeus::CColor dummy; + return dummy; } bool CParticleElectric::IsSystemDeletable() const { + return false; } std::pair CParticleElectric::GetBounds() const { + return std::make_pair(Zeus::CAABox(), false); } u32 CParticleElectric::GetParticleCount() const { + return 0; } bool CParticleElectric::SystemHasLight() const { + return false; } CLight CParticleElectric::GetLight() const { + return CLight(); } bool CParticleElectric::GetParticleEmission() const { + return false; } void CParticleElectric::DestroyParticles() diff --git a/Runtime/Particle/CParticleSwoosh.cpp b/Runtime/Particle/CParticleSwoosh.cpp index c828ba079..d07fdb2eb 100644 --- a/Runtime/Particle/CParticleSwoosh.cpp +++ b/Runtime/Particle/CParticleSwoosh.cpp @@ -49,50 +49,68 @@ void CParticleSwoosh::SetModulationColor(const Zeus::CColor&) const Zeus::CTransform& CParticleSwoosh::GetOrientation() const { + static Zeus::CTransform dummy; + return dummy; } const Zeus::CVector3f& CParticleSwoosh::GetTranslation() const { + static Zeus::CVector3f dummy; + return dummy; } const Zeus::CTransform& CParticleSwoosh::GetGlobalOrientation() const { + static Zeus::CTransform dummy; + return dummy; } const Zeus::CVector3f& CParticleSwoosh::GetGlobalTranslation() const { + static Zeus::CVector3f dummy; + return dummy; } const Zeus::CVector3f& CParticleSwoosh::GetGlobalScale() const { + static Zeus::CVector3f dummy; + return dummy; } const Zeus::CColor& CParticleSwoosh::GetModulationColor() const { + static Zeus::CColor dummy; + return dummy; } bool CParticleSwoosh::IsSystemDeletable() const { + return false; } std::pair CParticleSwoosh::GetBounds() const { + return std::make_pair(Zeus::CAABox(), false); } u32 CParticleSwoosh::GetParticleCount() const { + return 0; } bool CParticleSwoosh::SystemHasLight() const { + return false; } CLight CParticleSwoosh::GetLight() const { + return CLight(); } bool CParticleSwoosh::GetParticleEmission() const { + return false; } void CParticleSwoosh::DestroyParticles() diff --git a/Runtime/Particle/CWeaponDescription.hpp b/Runtime/Particle/CWeaponDescription.hpp index 47edcb3b2..5ebc948f4 100644 --- a/Runtime/Particle/CWeaponDescription.hpp +++ b/Runtime/Particle/CWeaponDescription.hpp @@ -16,6 +16,9 @@ struct SCollisionResponseData { TToken m_res; bool m_found = false; + SCollisionResponseData() = default; + SCollisionResponseData(CToken&& tok, bool found) + : m_res(std::move(tok)), m_found(found) {} }; class CWeaponDescription diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index e85c8f3c3..3e4b16683 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -20,6 +20,8 @@ struct SObjectTag TResId id = -1; bool operator!=(const SObjectTag& other) const {return id != other.id;} bool operator==(const SObjectTag& other) const {return id == other.id;} + SObjectTag() = default; + SObjectTag(FourCC tp, TResId rid) : type(tp), id(rid) {} }; /** diff --git a/hecl b/hecl index 82a0c26fd..92604d9ce 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 82a0c26fd7c1f2acda42c73f4bf4bafbf3281b59 +Subproject commit 92604d9ce5c32aa9a7c58603683b43f2064850b5 diff --git a/libSpecter b/libSpecter index 0d22ed8d6..a5d6f9f26 160000 --- a/libSpecter +++ b/libSpecter @@ -1 +1 @@ -Subproject commit 0d22ed8d625a58d8eac7a63d09c80c490d581db2 +Subproject commit a5d6f9f2624d86a92f1438dda89695f47789995c