Actually oops meant t add multiply/divide to here

This commit is contained in:
2025-11-15 11:35:01 -05:00
parent b9f195ab89
commit 9846a514ad
4 changed files with 41 additions and 10 deletions

View File

@@ -77,8 +77,10 @@ namespace anm2ed::anm2
enum ChangeType
{
ADJUST,
ADD,
SUBTRACT,
ADJUST
MULTIPLY,
DIVIDE
};
}

View File

@@ -7,10 +7,6 @@
#include "anm2_type.h"
#include "types.h"
#if defined(TRANSPARENT)
#undef TRANSPARENT
#endif
namespace anm2ed::anm2
{
constexpr auto FRAME_DURATION_MIN = 1;

View File

@@ -176,6 +176,31 @@ namespace anm2ed::anm2
if (change.colorOffset) frame.colorOffset = glm::clamp(frame.colorOffset - *change.colorOffset, 0.0f, 1.0f);
if (change.tint) frame.tint = glm::clamp(frame.tint - *change.tint, 0.0f, 1.0f);
break;
case MULTIPLY:
if (change.rotation) frame.rotation *= *change.rotation;
if (change.duration) frame.duration = std::max(FRAME_DURATION_MIN, frame.duration * *change.duration);
if (change.crop) frame.crop *= *change.crop;
if (change.pivot) frame.pivot *= *change.pivot;
if (change.position) frame.position *= *change.position;
if (change.size) frame.size *= *change.size;
if (change.scale) frame.scale *= *change.scale;
if (change.colorOffset) frame.colorOffset = glm::clamp(frame.colorOffset * *change.colorOffset, 0.0f, 1.0f);
if (change.tint) frame.tint = glm::clamp(frame.tint * *change.tint, 0.0f, 1.0f);
break;
case DIVIDE:
if (change.rotation && *change.rotation != 0.0f) frame.rotation /= *change.rotation;
if (change.duration && *change.duration != 0)
frame.duration = std::max(FRAME_DURATION_MIN, frame.duration / *change.duration);
if (change.crop) frame.crop /= *change.crop;
if (change.pivot) frame.pivot /= *change.pivot;
if (change.position) frame.position /= *change.position;
if (change.size) frame.size /= *change.size;
if (change.scale) frame.scale /= *change.scale;
if (change.colorOffset) frame.colorOffset = glm::clamp(frame.colorOffset / *change.colorOffset, 0.0f, 1.0f);
if (change.tint) frame.tint = glm::clamp(frame.tint / *change.tint, 0.0f, 1.0f);
break;
}
}
}