feat: add xyz parameter type
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
#include "Engine/Parameter/Parameter.h"
|
||||
#include "Engine/Types.h"
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
enzo::prm::Parameter::Parameter(Template prmTemplate)
|
||||
: template_{prmTemplate}
|
||||
{
|
||||
floatValue_ = prmTemplate.getDefault();
|
||||
floatValues_ = std::vector<bt::floatT>(prmTemplate.getSize(), prmTemplate.getDefault());
|
||||
std::cout << "created new parameter: " << prmTemplate.getName() << "\n";
|
||||
}
|
||||
|
||||
@@ -13,13 +16,28 @@ std::string enzo::prm::Parameter::getName() const
|
||||
return template_.getName();
|
||||
}
|
||||
|
||||
enzo::bt::floatT enzo::prm::Parameter::evalFloat() const
|
||||
enzo::bt::floatT enzo::prm::Parameter::evalFloat(unsigned int index) const
|
||||
{
|
||||
return floatValue_;
|
||||
if(index >= floatValues_.size())
|
||||
throw std::out_of_range("Cannot access index: " + std::to_string(index) + " for parameter: " + getName());
|
||||
return floatValues_[index];
|
||||
}
|
||||
void enzo::prm::Parameter::setFloat(bt::floatT value)
|
||||
|
||||
enzo::prm::Type enzo::prm::Parameter::getType() const
|
||||
{
|
||||
floatValue_ = value;
|
||||
return template_.getType();
|
||||
}
|
||||
|
||||
enzo::bt::String enzo::prm::Parameter::evalString() const
|
||||
{
|
||||
return stringValue_;
|
||||
}
|
||||
|
||||
void enzo::prm::Parameter::setFloat(bt::floatT value, unsigned int index)
|
||||
{
|
||||
std::cout << "accessing at: " << index << "\n";
|
||||
std::cout << "size: " << floatValues_.size() << "\n";
|
||||
floatValues_[index] = value;
|
||||
valueChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user