Skip to content
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
16 changes: 9 additions & 7 deletions Dev/Cpp/renderer/EffekseerRendererImplemented.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,7 @@ void ModelRenderer::EndRendering(const efkModelNodeParam& parameter, void* userD
state.TextureWrapTypes[i] = collector_.TextureWrapTypes[i];
}

if (textureCount > 0)
{
renderer_->SetTextures(nullptr, textures.data(), textureCount);
}
renderer_->SetTextures(nullptr, textures.data(), textureCount);

if (parameter.BasicParameterPtr->MaterialType == Effekseer::RendererMaterialType::File)
{
Expand Down Expand Up @@ -1014,6 +1011,10 @@ void RendererImplemented::DrawModel(Effekseer::ModelRef model,
modelParameter.VColor[2] = colors[i].B / 255.0f;
modelParameter.VColor[3] = colors[i].A / 255.0f;
modelParameter.Time = times[i] % model_->GetFrameCount();
if (modelParameter.Time < 0)
{
modelParameter.Time += model_->GetFrameCount();
}
AddInfoBuffer(&modelParameter, sizeof(UnityModelParameter1));
}

Expand Down Expand Up @@ -1097,10 +1098,11 @@ void RendererImplemented::SetPixelBufferToShader(const void* data, int32_t size,

void RendererImplemented::SetTextures(Shader* shader, Effekseer::Backend::TextureRef* textures, int32_t count)
{
textures_.resize(count);
if (count > 0)
const auto textureCount = count < static_cast<int32_t>(Effekseer::TextureSlotMax) ? count : static_cast<int32_t>(Effekseer::TextureSlotMax);
textures_.resize(textureCount);
if (textureCount > 0)
{
for (int i = 0; i < count; i++)
for (int i = 0; i < textureCount; i++)
{
if (textures[i] != nullptr)
{
Expand Down
24 changes: 12 additions & 12 deletions Dev/Cpp/renderer/EffekseerRendererImplemented.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ extern "C"

struct EdgeParameters
{
std::array<float, 4> Color;
std::array<float, 4> Color{};
float Threshold = 0;
float ColorScaling = 1;
};

struct FalloffParameter
{
int32_t ColorBlendType = 0;
std::array<float, 4> BeginColor;
std::array<float, 4> EndColor;
std::array<float, 4> BeginColor{};
std::array<float, 4> EndColor{};
float Pow = 1.0f;
};

Expand Down Expand Up @@ -87,12 +87,12 @@ extern "C"
float EmissiveScaling = 1;
EdgeParameters EdgeParams;

std::array<float, 4> SoftParticleParam;
std::array<float, 4> ReconstrcutionParam1;
std::array<float, 4> ReconstrcutionParam2;
std::array<float, 4> SoftParticleParam{};
std::array<float, 4> ReconstrcutionParam1{};
std::array<float, 4> ReconstrcutionParam2{};

//! For a material
std::array<float, 4> PredefinedUniform;
std::array<float, 4> PredefinedUniform{};

int ZTest = 0;

Expand All @@ -108,11 +108,11 @@ extern "C"
int IsRefraction = 0;

//! Texture ptr
std::array<void*, Effekseer::TextureSlotMax> TexturePtrs;
std::array<void*, Effekseer::TextureSlotMax> TexturePtrs{};

std::array<int, Effekseer::TextureSlotMax> TextureFilterTypes;
std::array<int, Effekseer::TextureSlotMax> TextureFilterTypes{};

std::array<int, Effekseer::TextureSlotMax> TextureWrapTypes;
std::array<int, Effekseer::TextureSlotMax> TextureWrapTypes{};

int32_t TextureCount = 0;

Expand All @@ -124,7 +124,7 @@ extern "C"
};

UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API GetUnityRenderParameter(UnityRenderParameter* dst, int index);
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetUnityRenderCount();
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetUnityRenderParameterCount();
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetUnityVertexBuffer();
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetUnityInfoBuffer();

Expand Down Expand Up @@ -294,7 +294,7 @@ class RendererImplemented : public ::EffekseerRenderer::Renderer, public ::Effek
dst.UVDistortionUV = EffekseerRenderer::GetVertexUVDistortionUV(v);
dst.BlendUV = EffekseerRenderer::GetVertexBlendUV(v);
dst.BlendAlphaUV = EffekseerRenderer::GetVertexBlendAlphaUV(v);
dst.BlendUVDistortionUV = EffekseerRenderer::GetVertexUVDistortionUV(v);
dst.BlendUVDistortionUV = EffekseerRenderer::GetVertexBlendUVDistortionUV(v);
dst.FlipbookIndexAndNextRate = EffekseerRenderer::GetVertexFlipbookIndexAndNextRate(v);
dst.AlphaThreshold = EffekseerRenderer::GetVertexAlphaThreshold(v);
strideBuffer.PushBuffer(&dst, sizeof(AdvancedVertexParameter));
Expand Down
8 changes: 4 additions & 4 deletions Dev/Cpp/renderer/EffekseerRendererMaterialLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ Effekseer::MaterialRef MaterialLoader::Load(const EFK_CHAR* path)

materialData->IsSimpleVertex = material->GetIsSimpleVertex();
materialData->IsRefractionRequired = material->GetHasRefraction();
materialData->CustomData1 = material->GetCustomData1Count();
materialData->CustomData2 = material->GetCustomData2Count();
materialData->CustomData1 = std::min(std::max(material->GetCustomData1Count(), 0), 4);
materialData->CustomData2 = std::min(std::max(material->GetCustomData2Count(), 0), 4);
materialData->TextureCount = std::min(material->GetTextureCount(), Effekseer::UserTextureSlotMax);
materialData->UniformCount = material->GetUniformCount();
materialData->UniformCount = std::min(material->GetUniformCount(), Effekseer::UserUniformSlotMax);
materialData->ShadingModel = material->GetShadingModel();

for (int32_t i = 0; i < materialData->TextureCount; i++)
Expand Down Expand Up @@ -131,4 +131,4 @@ void MaterialLoader::Unload(Effekseer::MaterialRef data)
}
}

} // namespace EffekseerRendererUnity
} // namespace EffekseerRendererUnity
2 changes: 1 addition & 1 deletion Dev/Effekseer
Submodule Effekseer updated 228 files
Loading
Loading