fix: Issues with various float nodes
This commit is contained in:
parent
7685a22c5f
commit
1bb0a72bed
@ -99,6 +99,9 @@ namespace hex::dp {
|
|||||||
if (attribute.getIOType() != Attribute::IOType::Out)
|
if (attribute.getIOType() != Attribute::IOType::Out)
|
||||||
throwNodeError("Tried to set output data of an input attribute!");
|
throwNodeError("Tried to set output data of an input attribute!");
|
||||||
|
|
||||||
|
if (attribute.getType() != Attribute::Type::Buffer)
|
||||||
|
throwNodeError("Tried to set buffer on non-buffer attribute!");
|
||||||
|
|
||||||
attribute.getOutputData() = { data.begin(), data.end() };
|
attribute.getOutputData() = { data.begin(), data.end() };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +114,9 @@ namespace hex::dp {
|
|||||||
if (attribute.getIOType() != Attribute::IOType::Out)
|
if (attribute.getIOType() != Attribute::IOType::Out)
|
||||||
throwNodeError("Tried to set output data of an input attribute!");
|
throwNodeError("Tried to set output data of an input attribute!");
|
||||||
|
|
||||||
|
if (attribute.getType() != Attribute::Type::Integer)
|
||||||
|
throwNodeError("Tried to set integer on non-integer attribute!");
|
||||||
|
|
||||||
std::vector<u8> buffer(sizeof(integer), 0);
|
std::vector<u8> buffer(sizeof(integer), 0);
|
||||||
std::memcpy(buffer.data(), &integer, sizeof(integer));
|
std::memcpy(buffer.data(), &integer, sizeof(integer));
|
||||||
|
|
||||||
@ -126,6 +132,9 @@ namespace hex::dp {
|
|||||||
if (attribute.getIOType() != Attribute::IOType::Out)
|
if (attribute.getIOType() != Attribute::IOType::Out)
|
||||||
throwNodeError("Tried to set output data of an input attribute!");
|
throwNodeError("Tried to set output data of an input attribute!");
|
||||||
|
|
||||||
|
if (attribute.getType() != Attribute::Type::Float)
|
||||||
|
throwNodeError("Tried to set float on non-float attribute!");
|
||||||
|
|
||||||
std::vector<u8> buffer(sizeof(floatingPoint), 0);
|
std::vector<u8> buffer(sizeof(floatingPoint), 0);
|
||||||
std::memcpy(buffer.data(), &floatingPoint, sizeof(floatingPoint));
|
std::memcpy(buffer.data(), &floatingPoint, sizeof(floatingPoint));
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
i128 output = 0;
|
i128 output = 0;
|
||||||
if (input.empty() || input.size() > sizeof(output))
|
if (input.empty() || input.size() > sizeof(output))
|
||||||
throwNodeError("Buffer is empty or bigger than 64 bits");
|
throwNodeError("Buffer is empty or bigger than 128 bits");
|
||||||
|
|
||||||
std::memcpy(&output, input.data(), input.size());
|
std::memcpy(&output, input.data(), input.size());
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ namespace hex::plugin::builtin {
|
|||||||
void process() override {
|
void process() override {
|
||||||
const auto &input = this->getFloatOnInput(0);
|
const auto &input = this->getFloatOnInput(0);
|
||||||
|
|
||||||
this->setIntegerOnOutput(1, std::ceil(input));
|
this->setFloatOnOutput(1, std::ceil(input));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ namespace hex::plugin::builtin {
|
|||||||
void process() override {
|
void process() override {
|
||||||
const auto &input = this->getFloatOnInput(0);
|
const auto &input = this->getFloatOnInput(0);
|
||||||
|
|
||||||
this->setIntegerOnOutput(1, std::floor(input));
|
this->setFloatOnOutput(1, std::floor(input));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -713,7 +713,7 @@ namespace hex::plugin::builtin {
|
|||||||
void process() override {
|
void process() override {
|
||||||
const auto &input = this->getFloatOnInput(0);
|
const auto &input = this->getFloatOnInput(0);
|
||||||
|
|
||||||
this->setIntegerOnOutput(1, std::round(input));
|
this->setFloatOnOutput(1, std::round(input));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user