Commit ddfa21e1 authored by CAMP C++ Builder's avatar CAMP C++ Builder

some improvements to the core api

* AbstractPipeline offers getter for the canvas to execute jobs in the pipeline's OpenGL context
* PropertyCollectionWidget adds a spacer element at the end to prevent element stretching when there is too much free space
* job.h offers new CallFunctionObjectJob to create jobs on the fly using lambda functions (the respective makeJob and makeJobOnHeap are inlined to prevent linker errors)
parent 3a6c7c04
......@@ -64,6 +64,7 @@ namespace campvis {
propertyCollection->s_propertyAdded.connect(this, &PropertyCollectionWidget::onPropCollectionPropAdded);
propertyCollection->s_propertyRemoved.connect(this, &PropertyCollectionWidget::onPropCollectionPropRemoved);
}
_layout->addStretch(1);
}
void PropertyCollectionWidget::setupWidget() {
......
......@@ -169,6 +169,12 @@ namespace campvis {
*/
const std::string& getRenderTargetID() const;
/**
* returns the currently set canvas for the pipeline
*/
tgt::GLCanvas * getCanvas() {
return _canvas;
}
/// Signal emitted when the pipeline's render target has changed
sigslot::signal0 s_renderTargetChanged;
......
......@@ -29,6 +29,8 @@
#include "core/coreapi.h"
#include <functional>
namespace campvis {
/**
......@@ -258,6 +260,27 @@ namespace campvis {
A2 _arg2; ///< Second Argument to pass to \a callee
};
/**
* specific job that evaluates a function object
*/
class CAMPVIS_CORE_API CallFunctionObjectJob : public AbstractJob{
public:
CallFunctionObjectJob(std::function<void(void)> fn)
: _fn(fn)
{
}
~CallFunctionObjectJob() {};
virtual void execute() {
_fn();
};
protected:
std::function<void(void)> _fn;
};
// = Helper functions for easier creation of jobs =================================================
/**
......@@ -383,6 +406,24 @@ namespace campvis {
CallFunc2ArgJob<A1, A2> makeJob(void (*callee)(A1, A2), A1 arg1, A2 arg2) {
return CallFunc2ArgJob<A1, A2>(callee, arg1, arg2);
}
/**
* Creates a new CallFunctionObjectJob
* \NOTE when the compiler decides not to inline this function, there will be linking errors
* in that case, try removing this function (it is only scarcely used)
*/
inline CallFunctionObjectJob makeJob(std::function<void(void)> fn) {
return CallFunctionObjectJob(fn);
}
/**
* creates a new CallFunctionObjectJob on the Heap
* \NOTE when the compiler decides not to inline this function, there will be linking errors
* in that case, try removing this function (it is only scarcely used)
*/
inline CallFunctionObjectJob * makeJobOnHeap(std::function<void(void)> fn) {
return new CallFunctionObjectJob(fn);
}
}
#endif // JOB_H__
\ No newline at end of file
Markdown is supported
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