Commit e56041a5 authored by Johannes Braun's avatar Johannes Braun
Browse files

Attempt to fix addProp<T> not being called properly on gcc

parent e9396fae
......@@ -15,7 +15,7 @@ function(make_executable name)
target_link_libraries(${name} PUBLIC dino::dino)
if(MINGW)
set_target_properties(${name} PROPERTIES LINK_FLAGS "-static-libstdc++ -static-libgcc")# -static")
target_link_libraries(${name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/res/dino.res)
#target_link_libraries(${name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/res/dino.res)
elseif(MSVC)
target_sources(${name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/res/dino.rc)
endif()
......
......@@ -16,6 +16,7 @@ namespace dino
{
class DistanceField;
class Operator;
using std::nullptr_t;
/** @brief A Function is the base class for Primitives, Operators and Modifiers and supplies a
* constant name, a code block to insert into the later build function, as well as basic
......@@ -169,7 +170,6 @@ public:
/** @brief Calls overrideParameter on the parent Function. */
void replace(const std::shared_ptr<ParamOperator>& parameter);
private:
/**
@brief Private constructor, because it should only be constructed with
Function::addProp<T>(...).
......@@ -179,15 +179,16 @@ public:
*/
Prop(const std::string& name, T&& value, Function* base);
private:
std::string m_name;
Function* m_base;
};
template <typename T>
Prop<T> addProp(const std::string& name, T&& value)
{
return Prop<T>(name, std::forward<T&&>(value), this);
}
template <typename T>
Prop<T> addProp(const std::string& name, T&& value)
{
return Prop<T>(name, std::forward<T&&>(value), this);
}
protected:
friend class DistanceField;
......@@ -270,7 +271,15 @@ protected:
* @tparam Self The deriving class itself (Curiously recurring template pattern).
*/
template<typename Base, typename Self>
using FunctionClass = Registering<Base, Self, Function, FunctionFactory>;
class FunctionClass : public Registering<Base, Self, Function, FunctionFactory>
{
public:
template <typename T>
Function::Prop<T> addProp(const std::string& name, T&& value)
{
return Function::Prop<T>(name, std::forward<T&&>(value), this);
}
};
} // namespace dino
......
......@@ -11,6 +11,7 @@
namespace dino
{
using std::nullptr_t;
struct ParamOperatorOutput;
class ParamOperator : public std::enable_shared_from_this<ParamOperator>
{
......
......@@ -4,7 +4,7 @@ namespace dino
{
/**************************************** Constant ****************************************/
PrConstant::PrConstant(float value) { this->value = value; }
PrConstant::PrConstant(float value) : value(addProp<float>("value", 0.1f)) { this->value = value; }
Bounds PrConstant::computeBounds()
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment