style cleanup: compositor, pointer syntax, function brace placement, line length
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Model The data model of the compositor
|
||||
* @defgroup Memory The memory management stuff
|
||||
@@ -38,7 +37,8 @@
|
||||
* @mainpage Introduction of the Blender Compositor
|
||||
*
|
||||
* @section bcomp Blender compositor
|
||||
* This project redesigns the interals of Blender's compositor. The project has been executed in 2011 by At Mind. At Mind is a technology company located in Amsterdam, The Netherlands.
|
||||
* This project redesigns the interals of Blender's compositor. The project has been executed in 2011 by At Mind.
|
||||
* At Mind is a technology company located in Amsterdam, The Netherlands.
|
||||
* The project has been crowdfunded. This code has been released under GPL2 to be used in Blender.
|
||||
*
|
||||
* @section goals The goals of the project
|
||||
@@ -47,32 +47,41 @@
|
||||
* - Make the compositor work faster for you (workflow)
|
||||
*
|
||||
* @section speed Faster compositor
|
||||
* The speedup has been done by making better use of the hardware Blenders is working on. The previous compositor only used a single threaded model to calculate a node. The only exception to this is the Defocus node.
|
||||
* Only when it is possible to calculate two full nodes in parallel a second thread was used. Current workstations have 8-16 threads available, and most of the time these are idle.
|
||||
* The speedup has been done by making better use of the hardware Blenders is working on. The previous compositor only
|
||||
* used a single threaded model to calculate a node. The only exception to this is the Defocus node.
|
||||
* Only when it is possible to calculate two full nodes in parallel a second thread was used.
|
||||
* Current workstations have 8-16 threads available, and most of the time these are idle.
|
||||
*
|
||||
* In the new compositor we want to use as much of threads as possible. Even new OpenCL capable GPU-hardware can be used for calculation.
|
||||
* In the new compositor we want to use as much of threads as possible. Even new OpenCL capable GPU-hardware can be
|
||||
* used for calculation.
|
||||
*
|
||||
* @section workflow Work faster
|
||||
* The previous compositor only showed the final image. The compositor could wait a long time before seeing the result of his work. The new compositor will work in a way that it will focus on getting information back to the user.
|
||||
* The previous compositor only showed the final image. The compositor could wait a long time before seeing the result
|
||||
* of his work. The new compositor will work in a way that it will focus on getting information back to the user.
|
||||
* It will prioritise its work to get earlier user feedback.
|
||||
*
|
||||
* @page memory Memory model
|
||||
* The main issue is the type of memory model to use. Blender is used by consumers and professionals. Ranging from low-end machines to very high-end machines. The system should work on high-end machines and on low-end machines.
|
||||
* The main issue is the type of memory model to use. Blender is used by consumers and professionals.
|
||||
* Ranging from low-end machines to very high-end machines.
|
||||
* The system should work on high-end machines and on low-end machines.
|
||||
*
|
||||
*
|
||||
* @page executing Executing
|
||||
* @section prepare Prepare execution
|
||||
*
|
||||
* during the preparation of the execution All ReadBufferOperation will receive an offset. this offset is used during execution as an optimization trick
|
||||
* during the preparation of the execution All ReadBufferOperation will receive an offset.
|
||||
* This offset is used during execution as an optimization trick
|
||||
* Next all operations will be initialized for execution @see NodeOperation.initExecution
|
||||
* Next all ExecutionGroup's will be initialized for execution @see ExecutionGroup.initExecution
|
||||
* this all is controlled from @see ExecutionSystem.execute
|
||||
*
|
||||
* @section priority Render priority
|
||||
* Render priority is an priority of an output node. A user has a different need of Render priorities of output nodes than during editing.
|
||||
* Render priority is an priority of an output node. A user has a different need of Render priorities of output nodes
|
||||
* than during editing.
|
||||
* for example. the Active ViewerNode has top priority during editing, but during rendering a CompositeNode has.
|
||||
* All NodeOperation has a setting for their renderpriority, but only for output NodeOperation these have effect.
|
||||
* In ExecutionSystem.execute all priorities are checked. For every priority the ExecutionGroup's are check if the priority do match.
|
||||
* In ExecutionSystem.execute all priorities are checked. For every priority the ExecutionGroup's are check if the
|
||||
* priority do match.
|
||||
* When match the ExecutionGroup will be executed (this happens in serial)
|
||||
*
|
||||
* @see ExecutionSystem.execute control of the Render priority
|
||||
@@ -82,7 +91,8 @@
|
||||
* @section order Chunk order
|
||||
*
|
||||
* When a ExecutionGroup is executed, first the order of chunks are determined.
|
||||
* The settings are stored in the ViewerNode inside the ExecutionGroup. ExecutionGroups that have no viewernode, will use a default one.
|
||||
* The settings are stored in the ViewerNode inside the ExecutionGroup. ExecutionGroups that have no viewernode,
|
||||
* will use a default one.
|
||||
* There are several possible chunk orders
|
||||
* - [@ref OrderOfChunks.COM_TO_CENTER_OUT]: Start calculating from a configurable point and order by nearest chunk
|
||||
* - [@ref OrderOfChunks.COM_TO_RANDOM]: Randomize all chunks.
|
||||
@@ -100,7 +110,8 @@
|
||||
* @see OrderOfChunks
|
||||
*
|
||||
* @section interest Area of interest
|
||||
* An ExecutionGroup can have dependancies to other ExecutionGroup's. Data passing from one ExecutionGroup to another one are stored in 'chunks'.
|
||||
* An ExecutionGroup can have dependancies to other ExecutionGroup's. Data passing from one ExecutionGroup to another
|
||||
* one are stored in 'chunks'.
|
||||
* If not all input chunks are available the chunk execution will not be scheduled.
|
||||
* <pre>
|
||||
* +-------------------------------------+ +--------------------------------------+
|
||||
@@ -125,9 +136,12 @@
|
||||
* </pre>
|
||||
*
|
||||
* In the above example ExecutionGroup B has an outputoperation (ViewerOperation) and is being executed.
|
||||
* The first chunk is evaluated [@ref ExecutionGroup.scheduleChunkWhenPossible], but not all input chunks are available. The relevant ExecutionGroup (that can calculate the missing chunks; ExecutionGroup A) is
|
||||
* Asked to calculate the area ExecutionGroup B is missing. [@ref ExecutionGroup.scheduleAreaWhenPossible]
|
||||
* ExecutionGroup B checks what chunks the area spans, and tries to schedule these chunks. If all input data is available these chunks are scheduled [@ref ExecutionGroup.scheduleChunk]
|
||||
* The first chunk is evaluated [@ref ExecutionGroup.scheduleChunkWhenPossible],
|
||||
* but not all input chunks are available. The relevant ExecutionGroup (that can calculate the missing chunks;
|
||||
* ExecutionGroup A) is asked to calculate the area ExecutionGroup B is missing.
|
||||
* [@ref ExecutionGroup.scheduleAreaWhenPossible]
|
||||
* ExecutionGroup B checks what chunks the area spans, and tries to schedule these chunks.
|
||||
* If all input data is available these chunks are scheduled [@ref ExecutionGroup.scheduleChunk]
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
@@ -166,7 +180,8 @@
|
||||
*
|
||||
* This happens until all chunks of (ExecutionGroup B) are finished executing or the user break's the process.
|
||||
*
|
||||
* NodeOperation like the ScaleOperation can influence the area of interest by reimplementing the [@ref NodeOperation.determineAreaOfInterest] method
|
||||
* NodeOperation like the ScaleOperation can influence the area of interest by reimplementing the
|
||||
* [@ref NodeOperation.determineAreaOfInterest] method
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
@@ -188,8 +203,10 @@
|
||||
* </pre>
|
||||
*
|
||||
* @see ExecutionGroup.execute Execute a complete ExecutionGroup. Halts until finished or breaked by user
|
||||
* @see ExecutionGroup.scheduleChunkWhenPossible Tries to schedule a single chunk, checks if all input data is available. Can trigger dependant chunks to be calculated
|
||||
* @see ExecutionGroup.scheduleAreaWhenPossible Tries to schedule an area. This can be multiple chunks (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible])
|
||||
* @see ExecutionGroup.scheduleChunkWhenPossible Tries to schedule a single chunk,
|
||||
* checks if all input data is available. Can trigger dependant chunks to be calculated
|
||||
* @see ExecutionGroup.scheduleAreaWhenPossible Tries to schedule an area. This can be multiple chunks
|
||||
* (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible])
|
||||
* @see ExecutionGroup.scheduleChunk Schedule a chunk on the WorkScheduler
|
||||
* @see NodeOperation.determineDependingAreaOfInterest Influence the area of interest of a chunk.
|
||||
* @see WriteBufferOperation NodeOperation to write to a MemoryProxy/MemoryBuffer
|
||||
@@ -198,27 +215,34 @@
|
||||
* @see MemoryBuffer Allocated memory for a single chunk
|
||||
*
|
||||
* @section workscheduler WorkScheduler
|
||||
* the WorkScheduler is implemented as a static class. the responsibility of the WorkScheduler is to balance WorkPackages to the available and free devices.
|
||||
* the WorkScheduler is implemented as a static class. the responsibility of the WorkScheduler is to balance
|
||||
* WorkPackages to the available and free devices.
|
||||
* the workscheduler can work in 2 states. For witching these between the state you need to recompile blender
|
||||
*
|
||||
* @subsection multithread Multi threaded
|
||||
* Default the workscheduler will place all work as WorkPackage in a queue.
|
||||
* For every CPUcore a working thread is created. These working threads will ask the WorkScheduler if there is work for a specific Device.
|
||||
* For every CPUcore a working thread is created. These working threads will ask the WorkScheduler if there is work
|
||||
* for a specific Device.
|
||||
* the workscheduler will find work for the device and the device will be asked to execute the WorkPackage
|
||||
|
||||
* @subsection singlethread Single threaded
|
||||
* For debugging reasons the multi-threading can be disabled. This is done by changing the COM_CURRENT_THREADING_MODEL to COM_TM_NOTHREAD. When compiling the workscheduler
|
||||
* For debugging reasons the multi-threading can be disabled. This is done by changing the COM_CURRENT_THREADING_MODEL
|
||||
* to COM_TM_NOTHREAD. When compiling the workscheduler
|
||||
* will be changes to support no threading and run everything on the CPU.
|
||||
*
|
||||
* @section devices Devices
|
||||
* A Device within the compositor context is a Hardware component that can used to calculate chunks. This chunk is encapseled in a WorkPackage.
|
||||
* A Device within the compositor context is a Hardware component that can used to calculate chunks.
|
||||
* This chunk is encapseled in a WorkPackage.
|
||||
* the WorkScheduler controls the devices and selects the device where a WorkPackage will be calculated.
|
||||
*
|
||||
* @subsection WS_Devices Workscheduler
|
||||
* The WorkScheduler controls all Devices. When initializing the compositor the WorkScheduler selects all devices that will be used during compositor.
|
||||
* The WorkScheduler controls all Devices. When initializing the compositor the WorkScheduler selects
|
||||
* all devices that will be used during compositor.
|
||||
* There are two types of Devices, CPUDevice and OpenCLDevice.
|
||||
* When an ExecutionGroup schedules a Chunk the schedule method of the WorkScheduler
|
||||
* The Workscheduler determines if the chunk can be run on an OpenCLDevice (and that there are available OpenCLDevice). If this is the case the chunk will be added to the worklist for OpenCLDevice's
|
||||
* The Workscheduler determines if the chunk can be run on an OpenCLDevice
|
||||
* (and that there are available OpenCLDevice). If this is the case the chunk will be added to the worklist for
|
||||
* OpenCLDevice's
|
||||
* otherwise the chunk will be added to the worklist of CPUDevices.
|
||||
*
|
||||
* A thread will read the work-list and sends a workpackage to its device.
|
||||
@@ -227,7 +251,8 @@
|
||||
* @see Device.execute method called to execute a chunk
|
||||
*
|
||||
* @subsection CPUDevice CPUDevice
|
||||
* When a CPUDevice gets a WorkPackage the Device will get the inputbuffer that is needed to calculate the chunk. Allocation is already done by the ExecutionGroup.
|
||||
* When a CPUDevice gets a WorkPackage the Device will get the inputbuffer that is needed to calculate the chunk.
|
||||
* Allocation is already done by the ExecutionGroup.
|
||||
* The outputbuffer of the chunk is being created.
|
||||
* The OutputOperation of the ExecutionGroup is called to execute the area of the outputbuffer.
|
||||
*
|
||||
@@ -269,7 +294,8 @@
|
||||
* @see bNodeTree.edit_quality
|
||||
* @see bNodeTree.render_quality
|
||||
*
|
||||
* - output nodes can have different priorities in the WorkScheduler. This is implemented in the COM_execute function.
|
||||
* - output nodes can have different priorities in the WorkScheduler.
|
||||
* This is implemented in the COM_execute function.
|
||||
*/
|
||||
void COM_execute(bNodeTree *editingtree, int rendering);
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_CPUDevice.h"
|
||||
|
||||
void CPUDevice::execute(WorkPackage *work) {
|
||||
void CPUDevice::execute(WorkPackage *work)
|
||||
{
|
||||
const unsigned int chunkNumber = work->getChunkNumber();
|
||||
ExecutionGroup * executionGroup = work->getExecutionGroup();
|
||||
rcti rect;
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
/**
|
||||
* @brief create new ChannelInfo instance and sets the defaults.
|
||||
*/
|
||||
ChannelInfo::ChannelInfo() {
|
||||
ChannelInfo::ChannelInfo()
|
||||
{
|
||||
this->number = 0;
|
||||
this->premultiplied = true;
|
||||
this->type = COM_CT_UNUSED;
|
||||
|
||||
@@ -23,18 +23,20 @@
|
||||
#include "COM_ChunkOrder.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ChunkOrder::ChunkOrder() {
|
||||
ChunkOrder::ChunkOrder()
|
||||
{
|
||||
this->distance = 0.0;
|
||||
this->number = 0;
|
||||
this->x = 0;
|
||||
this->y = 0;
|
||||
}
|
||||
|
||||
void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots) {
|
||||
void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots)
|
||||
{
|
||||
unsigned int index;
|
||||
double distance = MAXFLOAT;
|
||||
for (index = 0 ; index < numberOfHotspots ; index ++) {
|
||||
ChunkOrderHotspot* hotspot = hotspots[index];
|
||||
ChunkOrderHotspot *hotspot = hotspots[index];
|
||||
double ndistance = hotspot->determineDistance(this->x, this->y);
|
||||
if (ndistance < distance) {
|
||||
distance = ndistance;
|
||||
@@ -43,6 +45,7 @@ void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int nu
|
||||
this->distance = distance;
|
||||
}
|
||||
|
||||
bool operator<(const ChunkOrder& a, const ChunkOrder& b) {
|
||||
bool operator<(const ChunkOrder& a, const ChunkOrder& b)
|
||||
{
|
||||
return a.distance < b.distance;
|
||||
}
|
||||
|
||||
@@ -23,13 +23,15 @@
|
||||
#include "COM_ChunkOrderHotspot.h"
|
||||
#include <math.h>
|
||||
|
||||
ChunkOrderHotspot::ChunkOrderHotspot(int x, int y, float addition) {
|
||||
ChunkOrderHotspot::ChunkOrderHotspot(int x, int y, float addition)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->addition = addition;
|
||||
}
|
||||
|
||||
double ChunkOrderHotspot::determineDistance(int x, int y) {
|
||||
double ChunkOrderHotspot::determineDistance(int x, int y)
|
||||
{
|
||||
int dx = x-this->x;
|
||||
int dy = y-this->y;
|
||||
double result = sqrt((double)(dx*dx+dy*dy));
|
||||
|
||||
@@ -24,13 +24,15 @@
|
||||
#include "COM_defines.h"
|
||||
#include <stdio.h>
|
||||
|
||||
CompositorContext::CompositorContext() {
|
||||
CompositorContext::CompositorContext()
|
||||
{
|
||||
this->scene = NULL;
|
||||
this->quality = COM_QUALITY_HIGH;
|
||||
this->hasActiveOpenCLDevices = false;
|
||||
}
|
||||
|
||||
const int CompositorContext::getFramenumber() const {
|
||||
const int CompositorContext::getFramenumber() const
|
||||
{
|
||||
if (this->scene) {
|
||||
return this->scene->r.cfra;
|
||||
}
|
||||
@@ -39,7 +41,8 @@ const int CompositorContext::getFramenumber() const {
|
||||
}
|
||||
}
|
||||
|
||||
const int CompositorContext::isColorManaged() const {
|
||||
const int CompositorContext::isColorManaged() const
|
||||
{
|
||||
if (this->scene) {
|
||||
return this->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
|
||||
}
|
||||
|
||||
@@ -55,14 +55,14 @@ private:
|
||||
* This field is initialized in ExecutionSystem and must only be read from that point on.
|
||||
* @see ExecutionSystem
|
||||
*/
|
||||
Scene* scene;
|
||||
Scene *scene;
|
||||
|
||||
/**
|
||||
* @brief reference to the bNodeTree
|
||||
* This field is initialized in ExecutionSystem and must only be read from that point on.
|
||||
* @see ExecutionSystem
|
||||
*/
|
||||
bNodeTree* bnodetree;
|
||||
bNodeTree *bnodetree;
|
||||
|
||||
/**
|
||||
* @brief does this system have active opencl devices?
|
||||
@@ -88,12 +88,12 @@ public:
|
||||
/**
|
||||
* @brief set the scene of the context
|
||||
*/
|
||||
void setScene(Scene* scene) {this->scene = scene;}
|
||||
void setScene(Scene *scene) {this->scene = scene;}
|
||||
|
||||
/**
|
||||
* @brief set the bnodetree of the context
|
||||
*/
|
||||
void setbNodeTree(bNodeTree* bnodetree) {this->bnodetree = bnodetree;}
|
||||
void setbNodeTree(bNodeTree *bnodetree) {this->bnodetree = bnodetree;}
|
||||
|
||||
/**
|
||||
* @brief get the bnodetree of the context
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
/**
|
||||
* @brief get the scene of the context
|
||||
*/
|
||||
const Scene* getScene() const {return this->scene;}
|
||||
const Scene *getScene() const {return this->scene;}
|
||||
|
||||
/**
|
||||
* @brief set the quality
|
||||
|
||||
@@ -112,7 +112,8 @@
|
||||
#include "COM_DoubleEdgeMaskNode.h"
|
||||
#include "COM_CropNode.h"
|
||||
|
||||
Node* Converter::convert(bNode *bNode) {
|
||||
Node *Converter::convert(bNode *bNode)
|
||||
{
|
||||
Node * node;
|
||||
|
||||
if (bNode->flag & NODE_MUTED) {
|
||||
@@ -353,9 +354,10 @@ case CMP_NODE_OUTPUT_FILE:
|
||||
}
|
||||
return node;
|
||||
}
|
||||
void Converter::convertDataType(SocketConnection* connection, ExecutionSystem *system) {
|
||||
OutputSocket* outputSocket = connection->getFromSocket();
|
||||
InputSocket* inputSocket = connection->getToSocket();
|
||||
void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *system)
|
||||
{
|
||||
OutputSocket *outputSocket = connection->getFromSocket();
|
||||
InputSocket *inputSocket = connection->getToSocket();
|
||||
DataType fromDatatype = outputSocket->getActualDataType();
|
||||
DataType toDatatype = inputSocket->getActualDataType();
|
||||
NodeOperation * converter = NULL;
|
||||
@@ -384,7 +386,8 @@ void Converter::convertDataType(SocketConnection* connection, ExecutionSystem *s
|
||||
}
|
||||
}
|
||||
|
||||
void Converter::convertResolution(SocketConnection *connection, ExecutionSystem *system) {
|
||||
void Converter::convertResolution(SocketConnection *connection, ExecutionSystem *system)
|
||||
{
|
||||
InputSocketResizeMode mode = connection->getToSocket()->getResizeMode();
|
||||
|
||||
NodeOperation * toOperation = (NodeOperation*)connection->getToNode();
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
* @see Node
|
||||
* @see MuteNode
|
||||
*/
|
||||
static Node* convert(bNode* bNode);
|
||||
static Node *convert(bNode *bNode);
|
||||
|
||||
/**
|
||||
* @brief This method will add a datetype conversion rule when the to-socket does not support the from-socket actual data type.
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
* @param system the ExecutionSystem to add the conversion to.
|
||||
* @see SocketConnection - a link between two sockets
|
||||
*/
|
||||
static void convertDataType(SocketConnection* connection, ExecutionSystem *system);
|
||||
static void convertDataType(SocketConnection *connection, ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief This method will add a resolution rule based on the settings of the InputSocket.
|
||||
@@ -65,6 +65,6 @@ public:
|
||||
* @param system the ExecutionSystem to add the conversion to.
|
||||
* @see SocketConnection - a link between two sockets
|
||||
*/
|
||||
static void convertResolution(SocketConnection* connection, ExecutionSystem *system);
|
||||
static void convertResolution(SocketConnection *connection, ExecutionSystem *system);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "COM_ExecutionSystemHelper.h"
|
||||
|
||||
ExecutionGroup::ExecutionGroup() {
|
||||
ExecutionGroup::ExecutionGroup()
|
||||
{
|
||||
this->isOutput = false;
|
||||
this->complex = false;
|
||||
this->chunkExecutionStates = NULL;
|
||||
@@ -57,13 +58,15 @@ ExecutionGroup::ExecutionGroup() {
|
||||
this->chunksFinished = 0;
|
||||
}
|
||||
|
||||
int ExecutionGroup::getRenderPriotrity() {
|
||||
int ExecutionGroup::getRenderPriotrity()
|
||||
{
|
||||
return this->getOutputNodeOperation()->getRenderPriority();
|
||||
}
|
||||
|
||||
bool ExecutionGroup::containsOperation(NodeOperation* operation) {
|
||||
bool ExecutionGroup::containsOperation(NodeOperation *operation)
|
||||
{
|
||||
for (vector<NodeOperation*>::const_iterator iterator = this->operations.begin() ; iterator != this->operations.end() ; ++iterator) {
|
||||
NodeOperation* inListOperation = *iterator;
|
||||
NodeOperation *inListOperation = *iterator;
|
||||
if (inListOperation == operation) {
|
||||
return true;
|
||||
}
|
||||
@@ -71,11 +74,13 @@ bool ExecutionGroup::containsOperation(NodeOperation* operation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool ExecutionGroup::isComplex() const {
|
||||
const bool ExecutionGroup::isComplex() const
|
||||
{
|
||||
return this->complex;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::canContainOperation(NodeOperation* operation) {
|
||||
bool ExecutionGroup::canContainOperation(NodeOperation *operation)
|
||||
{
|
||||
if (!this->initialized) {return true;}
|
||||
if (operation->isReadBufferOperation()) {return true;}
|
||||
if (operation->isWriteBufferOperation()) {return false;}
|
||||
@@ -89,7 +94,8 @@ bool ExecutionGroup::canContainOperation(NodeOperation* operation) {
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operation) {
|
||||
void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operation)
|
||||
{
|
||||
if (containsOperation(operation)) return;
|
||||
if (canContainOperation(operation)) {
|
||||
if (!operation->isBufferOperation()) {
|
||||
@@ -99,8 +105,8 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
}
|
||||
this->operations.push_back(operation);
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation* readOperation = (ReadBufferOperation*)operation;
|
||||
WriteBufferOperation* writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation();
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
|
||||
WriteBufferOperation *writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation();
|
||||
this->addOperation(system, writeOperation);
|
||||
}
|
||||
else {
|
||||
@@ -108,7 +114,7 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
for (index = 0 ; index < operation->getNumberOfInputSockets(); index ++) {
|
||||
InputSocket * inputSocket = operation->getInputSocket(index);
|
||||
if (inputSocket->isConnected()) {
|
||||
NodeOperation* node = (NodeOperation*)inputSocket->getConnection()->getFromNode();
|
||||
NodeOperation *node = (NodeOperation*)inputSocket->getConnection()->getFromNode();
|
||||
this->addOperation(system, node);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +124,7 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
WriteBufferOperation * writeoperation = (WriteBufferOperation*)operation;
|
||||
if (writeoperation->getMemoryProxy()->getExecutor() == NULL) {
|
||||
ExecutionGroup* newGroup = new ExecutionGroup();
|
||||
ExecutionGroup *newGroup = new ExecutionGroup();
|
||||
writeoperation->getMemoryProxy()->setExecutor(newGroup);
|
||||
newGroup->addOperation(system, operation);
|
||||
ExecutionSystemHelper::addExecutionGroup(system->getExecutionGroups(), newGroup);
|
||||
@@ -127,7 +133,8 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
}
|
||||
}
|
||||
|
||||
NodeOperation* ExecutionGroup::getOutputNodeOperation() const {
|
||||
NodeOperation *ExecutionGroup::getOutputNodeOperation() const
|
||||
{
|
||||
return this->operations[0]; // the first operation of the group is always the output operation.
|
||||
}
|
||||
|
||||
@@ -151,7 +158,7 @@ void ExecutionGroup::initExecution()
|
||||
unsigned int maxNumber = 0;
|
||||
|
||||
for (index = 0 ; index < this->operations.size(); index ++) {
|
||||
NodeOperation* operation = this->operations[index];
|
||||
NodeOperation *operation = this->operations[index];
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
|
||||
this->cachedReadOperations.push_back(readOperation);
|
||||
@@ -163,7 +170,8 @@ void ExecutionGroup::initExecution()
|
||||
|
||||
}
|
||||
|
||||
void ExecutionGroup::deinitExecution() {
|
||||
void ExecutionGroup::deinitExecution()
|
||||
{
|
||||
if (this->chunkExecutionStates != NULL) {
|
||||
delete[] this->chunkExecutionStates;
|
||||
this->chunkExecutionStates = NULL;
|
||||
@@ -174,8 +182,9 @@ void ExecutionGroup::deinitExecution() {
|
||||
this->cachedReadOperations.clear();
|
||||
this->bTree = NULL;
|
||||
}
|
||||
void ExecutionGroup::determineResolution(unsigned int resolution[]) {
|
||||
NodeOperation* operation = this->getOutputNodeOperation();
|
||||
void ExecutionGroup::determineResolution(unsigned int resolution[])
|
||||
{
|
||||
NodeOperation *operation = this->getOutputNodeOperation();
|
||||
unsigned int preferredResolution[2];
|
||||
preferredResolution[0] = 0;
|
||||
preferredResolution[1] = 0;
|
||||
@@ -184,7 +193,8 @@ void ExecutionGroup::determineResolution(unsigned int resolution[]) {
|
||||
this->setResolution(resolution);
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineNumberOfChunks() {
|
||||
void ExecutionGroup::determineNumberOfChunks()
|
||||
{
|
||||
const float chunkSizef = this->chunkSize;
|
||||
this->numberOfXChunks = ceil(this->width / chunkSizef);
|
||||
this->numberOfYChunks = ceil(this->height / chunkSizef);
|
||||
@@ -194,9 +204,10 @@ void ExecutionGroup::determineNumberOfChunks() {
|
||||
/**
|
||||
* this method is called for the top execution groups. containing the compositor node or the preview node or the viewer node)
|
||||
*/
|
||||
void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
{
|
||||
CompositorContext& context = graph->getContext();
|
||||
const bNodeTree* bTree = context.getbNodeTree();
|
||||
const bNodeTree *bTree = context.getbNodeTree();
|
||||
if (this->width == 0 || this->height == 0) {return;} /// @note: break out... no pixels to calculate.
|
||||
if (bTree->test_break && bTree->test_break(bTree->tbh)) {return;} /// @note: early break out for blur and preview nodes
|
||||
if (this->numberOfChunks == 0) {return;} /// @note: early break out
|
||||
@@ -216,7 +227,7 @@ void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
int chunkorder = COM_TO_CENTER_OUT;
|
||||
|
||||
if (operation->isViewerOperation()) {
|
||||
ViewerBaseOperation* viewer = (ViewerBaseOperation*)operation;
|
||||
ViewerBaseOperation *viewer = (ViewerBaseOperation*)operation;
|
||||
centerX = viewer->getCenterX();
|
||||
centerY = viewer->getCenterY();
|
||||
chunkorder = viewer->getChunkOrder();
|
||||
@@ -224,7 +235,7 @@ void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
|
||||
switch (chunkorder) {
|
||||
case COM_TO_RANDOM:
|
||||
for (index = 0 ; index < 2* numberOfChunks ; index ++) {
|
||||
for (index = 0 ; index < 2 * numberOfChunks ; index ++) {
|
||||
int index1 = rand()%numberOfChunks;
|
||||
int index2 = rand()%numberOfChunks;
|
||||
int s = chunkOrder[index1];
|
||||
@@ -351,7 +362,8 @@ void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
delete[] chunkOrder;
|
||||
}
|
||||
|
||||
MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber) {
|
||||
MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber)
|
||||
{
|
||||
rcti rect;
|
||||
vector<MemoryProxy*> memoryproxies;
|
||||
unsigned int index;
|
||||
@@ -359,7 +371,7 @@ MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber) {
|
||||
|
||||
this->determineDependingMemoryProxies(&memoryproxies);
|
||||
MemoryBuffer **memoryBuffers = new MemoryBuffer*[this->cachedMaxReadBufferOffset];
|
||||
for (index= 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
|
||||
for (index = 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
|
||||
memoryBuffers[index] = NULL;
|
||||
}
|
||||
rcti output;
|
||||
@@ -367,13 +379,14 @@ MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation*)this->cachedReadOperations[index];
|
||||
MemoryProxy * memoryProxy = readOperation->getMemoryProxy();
|
||||
this->determineDependingAreaOfInterest(&rect, readOperation, &output);
|
||||
MemoryBuffer* memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(memoryProxy, &output);
|
||||
MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(memoryProxy, &output);
|
||||
memoryBuffers[readOperation->getOffset()] = memoryBuffer;
|
||||
}
|
||||
return memoryBuffers;
|
||||
}
|
||||
|
||||
MemoryBuffer* ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect) {
|
||||
MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
|
||||
{
|
||||
// find all chunks inside the rect
|
||||
// determine minxchunk, minychunk, maxxchunk, maxychunk where x and y are chunknumbers
|
||||
float chunkSizef = this->chunkSize;
|
||||
@@ -415,7 +428,8 @@ MemoryBuffer* ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *mem
|
||||
return result;
|
||||
}
|
||||
|
||||
void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memoryBuffers) {
|
||||
void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memoryBuffers)
|
||||
{
|
||||
if (this->chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
|
||||
this->chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
|
||||
else
|
||||
@@ -442,31 +456,35 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memo
|
||||
}
|
||||
}
|
||||
|
||||
inline void ExecutionGroup::determineChunkRect(rcti* rect, const unsigned int xChunk, const unsigned int yChunk ) const {
|
||||
inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk ) const
|
||||
{
|
||||
const unsigned int minx = xChunk * chunkSize;
|
||||
const unsigned int miny = yChunk * chunkSize;
|
||||
BLI_init_rcti(rect, minx, min(minx + this->chunkSize, this->width), miny, min(miny + this->chunkSize, this->height));
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineChunkRect(rcti* rect, const unsigned int chunkNumber) const {
|
||||
void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumber) const
|
||||
{
|
||||
const unsigned int yChunk = chunkNumber / numberOfXChunks;
|
||||
const unsigned int xChunk = chunkNumber - (yChunk * numberOfXChunks);
|
||||
determineChunkRect(rect, xChunk, yChunk);
|
||||
}
|
||||
|
||||
MemoryBuffer* ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti* rect) {
|
||||
MemoryBuffer* outputBuffer = NULL;
|
||||
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
|
||||
{
|
||||
MemoryBuffer *outputBuffer = NULL;
|
||||
// output allocation is only valid when our outputoperation is a memorywriter
|
||||
NodeOperation * operation = this->getOutputNodeOperation();
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
WriteBufferOperation* writeOperation = (WriteBufferOperation*)operation;
|
||||
WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;
|
||||
outputBuffer = MemoryManager::allocateMemoryBuffer(writeOperation->getMemoryProxy(), chunkNumber, rect);
|
||||
}
|
||||
return outputBuffer;
|
||||
}
|
||||
|
||||
|
||||
bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *area) {
|
||||
bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *area)
|
||||
{
|
||||
// find all chunks inside the rect
|
||||
// determine minxchunk, minychunk, maxxchunk, maxychunk where x and y are chunknumbers
|
||||
|
||||
@@ -490,7 +508,8 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *are
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) {
|
||||
bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
|
||||
{
|
||||
if (this->chunkExecutionStates[chunkNumber] == COM_ES_NOT_SCHEDULED) {
|
||||
this->chunkExecutionStates[chunkNumber] = COM_ES_SCHEDULED;
|
||||
WorkScheduler::schedule(this, chunkNumber);
|
||||
@@ -499,7 +518,8 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChunk, int yChunk) {
|
||||
bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChunk, int yChunk)
|
||||
{
|
||||
if (xChunk < 0 || xChunk >= (int)this->numberOfXChunks) {
|
||||
return true;
|
||||
}
|
||||
@@ -551,11 +571,13 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
|
||||
return false;
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output) {
|
||||
void ExecutionGroup::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
this->getOutputNodeOperation()->determineDependingAreaOfInterest(input, readOperation, output);
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memoryProxies) {
|
||||
void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memoryProxies)
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->cachedReadOperations.size() ; index ++) {
|
||||
ReadBufferOperation * readOperation = (ReadBufferOperation*) this->cachedReadOperations[index];
|
||||
@@ -563,10 +585,12 @@ void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memor
|
||||
}
|
||||
}
|
||||
|
||||
bool ExecutionGroup::operator ==(const ExecutionGroup & executionGroup) const {
|
||||
bool ExecutionGroup::operator ==(const ExecutionGroup & executionGroup) const
|
||||
{
|
||||
return this->getOutputNodeOperation() == executionGroup.getOutputNodeOperation();
|
||||
}
|
||||
|
||||
bool ExecutionGroup::isOpenCL() {
|
||||
bool ExecutionGroup::isOpenCL()
|
||||
{
|
||||
return this->openCL;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ private:
|
||||
* @brief check whether parameter operation can be added to the execution group
|
||||
* @param operation the operation to be added
|
||||
*/
|
||||
bool canContainOperation(NodeOperation* operation);
|
||||
bool canContainOperation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief get the Render priority of this ExecutionGroup
|
||||
@@ -188,7 +188,7 @@ private:
|
||||
* @note Only gives usefull results ater the determination of the chunksize
|
||||
* @see determineChunkSize()
|
||||
*/
|
||||
void determineChunkRect(rcti* rect, const unsigned int xChunk, const unsigned int yChunk) const;
|
||||
void determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const;
|
||||
|
||||
/**
|
||||
* @brief determine the number of chunks, based on the chunkSize, width and height.
|
||||
@@ -233,7 +233,7 @@ private:
|
||||
* @param readOperation The ReadBufferOperation where the area needs to be evaluated
|
||||
* @param output the area needed of the ReadBufferOperation. Result
|
||||
*/
|
||||
void determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output);
|
||||
void determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
|
||||
public:
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
* @param operation the NodeOperation to check
|
||||
* @return [true,false]
|
||||
*/
|
||||
bool containsOperation(NodeOperation* operation);
|
||||
bool containsOperation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief add an operation to this ExecutionGroup
|
||||
@@ -266,7 +266,7 @@ public:
|
||||
* @param system
|
||||
* @param operation
|
||||
*/
|
||||
void addOperation(ExecutionSystem* system, NodeOperation *operation);
|
||||
void addOperation(ExecutionSystem *system, NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief is this ExecutionGroup an output ExecutionGroup
|
||||
@@ -312,15 +312,15 @@ public:
|
||||
|
||||
/**
|
||||
* @brief get the output operation of this ExecutionGroup
|
||||
* @return NodeOperation* output operation
|
||||
* @return NodeOperation *output operation
|
||||
*/
|
||||
NodeOperation* getOutputNodeOperation() const;
|
||||
NodeOperation *getOutputNodeOperation() const;
|
||||
|
||||
/**
|
||||
* @brief compose multiple chunks into a single chunk
|
||||
* @return Memorybuffer* consolidated chunk
|
||||
* @return Memorybuffer *consolidated chunk
|
||||
*/
|
||||
MemoryBuffer* constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *output);
|
||||
MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *output);
|
||||
|
||||
/**
|
||||
* @brief initExecution is called just before the execution of the whole graph will be done.
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
* @param rect the rect of that chunk
|
||||
* @see determineChunkRect
|
||||
*/
|
||||
MemoryBuffer* allocateOutputBuffer(int chunkNumber, rcti *rect);
|
||||
MemoryBuffer *allocateOutputBuffer(int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief after a chunk is executed the needed resources can be freed or unlocked.
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
* @see ViewerOperation
|
||||
* @param system
|
||||
*/
|
||||
void execute(ExecutionSystem* system);
|
||||
void execute(ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief this method determines the MemoryProxy's where this execution group depends on.
|
||||
@@ -387,7 +387,7 @@ public:
|
||||
* @note Only gives usefull results ater the determination of the chunksize
|
||||
* @see determineChunkSize()
|
||||
*/
|
||||
void determineChunkRect(rcti* rect, const unsigned int chunkNumber) const;
|
||||
void determineChunkRect(rcti *rect, const unsigned int chunkNumber) const;
|
||||
|
||||
|
||||
bool operator ==(const ExecutionGroup &executionGroup) const;
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
|
||||
#include "BKE_global.h"
|
||||
|
||||
ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
|
||||
{
|
||||
this->context.setbNodeTree(editingtree);
|
||||
|
||||
/* initialize the CompositorContext */
|
||||
@@ -53,7 +54,7 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
context.setRendering(rendering);
|
||||
context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
|
||||
|
||||
Node* mainOutputNode=NULL;
|
||||
Node *mainOutputNode=NULL;
|
||||
|
||||
mainOutputNode = ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree);
|
||||
|
||||
@@ -68,7 +69,7 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
for (index = 0 ; index < executionGroups.size(); index ++) {
|
||||
resolution[0]=0;
|
||||
resolution[1]=0;
|
||||
ExecutionGroup* executionGroup = executionGroups[index];
|
||||
ExecutionGroup *executionGroup = executionGroups[index];
|
||||
executionGroup->determineResolution(resolution);
|
||||
}
|
||||
}
|
||||
@@ -76,34 +77,36 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
if (G.f & G_DEBUG) ExecutionSystemHelper::debugDump(this);
|
||||
}
|
||||
|
||||
ExecutionSystem::~ExecutionSystem() {
|
||||
ExecutionSystem::~ExecutionSystem()
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0; index < this->connections.size(); index++) {
|
||||
SocketConnection* connection = this->connections[index];
|
||||
SocketConnection *connection = this->connections[index];
|
||||
delete connection;
|
||||
}
|
||||
this->connections.clear();
|
||||
for (index = 0; index < this->nodes.size(); index++) {
|
||||
Node* node = this->nodes[index];
|
||||
Node *node = this->nodes[index];
|
||||
delete node;
|
||||
}
|
||||
this->nodes.clear();
|
||||
for (index = 0; index < this->operations.size(); index++) {
|
||||
NodeOperation* operation = this->operations[index];
|
||||
NodeOperation *operation = this->operations[index];
|
||||
delete operation;
|
||||
}
|
||||
this->operations.clear();
|
||||
for (index = 0; index < this->groups.size(); index++) {
|
||||
ExecutionGroup* group = this->groups[index];
|
||||
ExecutionGroup *group = this->groups[index];
|
||||
delete group;
|
||||
}
|
||||
this->groups.clear();
|
||||
}
|
||||
|
||||
void ExecutionSystem::execute() {
|
||||
void ExecutionSystem::execute()
|
||||
{
|
||||
unsigned int order = 0;
|
||||
for ( vector<NodeOperation*>::iterator iter = this->operations.begin(); iter != operations.end(); ++iter ) {
|
||||
NodeBase* node = *iter;
|
||||
NodeBase *node = *iter;
|
||||
NodeOperation *operation = (NodeOperation*) node;
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation * readOperation = (ReadBufferOperation*)operation;
|
||||
@@ -134,8 +137,8 @@ void ExecutionSystem::execute() {
|
||||
/* start execution of the ExecutionGroups based on priority of their output node */
|
||||
for (int priority = 9 ; priority>=0 ; priority--) {
|
||||
for (index = 0 ; index < executionGroups.size(); index ++) {
|
||||
ExecutionGroup* group = executionGroups[index];
|
||||
NodeOperation* output = group->getOutputNodeOperation();
|
||||
ExecutionGroup *group = executionGroups[index];
|
||||
NodeOperation *output = group->getOutputNodeOperation();
|
||||
if (output->getRenderPriority() == priority) {
|
||||
group->execute(this);
|
||||
}
|
||||
@@ -156,19 +159,21 @@ void ExecutionSystem::execute() {
|
||||
MemoryManager::clear();
|
||||
}
|
||||
|
||||
void ExecutionSystem::addOperation(NodeOperation *operation) {
|
||||
void ExecutionSystem::addOperation(NodeOperation *operation)
|
||||
{
|
||||
ExecutionSystemHelper::addOperation(this->operations, operation);
|
||||
}
|
||||
|
||||
void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) {
|
||||
void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
|
||||
{
|
||||
// for every input add write and read operation if input is not a read operation
|
||||
// only add read operation to other links when they are attached to buffered operations.
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < operation->getNumberOfInputSockets();index++) {
|
||||
InputSocket* inputsocket = operation->getInputSocket(index);
|
||||
InputSocket *inputsocket = operation->getInputSocket(index);
|
||||
if (inputsocket->isConnected()) {
|
||||
SocketConnection *connection = inputsocket->getConnection();
|
||||
NodeOperation* otherEnd = (NodeOperation*)connection->getFromNode();
|
||||
NodeOperation *otherEnd = (NodeOperation*)connection->getFromNode();
|
||||
if (!otherEnd->isReadBufferOperation()) {
|
||||
// check of other end already has write operation
|
||||
OutputSocket *fromsocket = connection->getFromSocket();
|
||||
@@ -201,7 +206,7 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) {
|
||||
this->addOperation(writeOperation);
|
||||
for (index = 0 ; index < outputsocket->getNumberOfConnections();index ++) {
|
||||
SocketConnection * connection = outputsocket->getConnection(index);
|
||||
ReadBufferOperation* readoperation = new ReadBufferOperation();
|
||||
ReadBufferOperation *readoperation = new ReadBufferOperation();
|
||||
readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
|
||||
connection->setFromSocket(readoperation->getOutputSocket());
|
||||
readoperation->getOutputSocket()->addConnection(connection);
|
||||
@@ -211,12 +216,13 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) {
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionSystem::convertToOperations() {
|
||||
void ExecutionSystem::convertToOperations()
|
||||
{
|
||||
unsigned int index;
|
||||
// first determine data types of the nodes, this can be used by the node to convert to a different operation system
|
||||
this->determineActualSocketDataTypes((vector<NodeBase*>&)this->nodes);
|
||||
for (index = 0; index < this->nodes.size(); index++) {
|
||||
Node* node = (Node*)this->nodes[index];
|
||||
Node *node = (Node*)this->nodes[index];
|
||||
node->convertToOperations(this, &this->context);
|
||||
}
|
||||
|
||||
@@ -233,7 +239,7 @@ void ExecutionSystem::convertToOperations() {
|
||||
|
||||
// determine all resolutions of the operations (Width/Height)
|
||||
for (index = 0 ; index < this->operations.size(); index ++) {
|
||||
NodeOperation* operation= this->operations[index];
|
||||
NodeOperation *operation = this->operations[index];
|
||||
if (operation->isOutputOperation(context.isRendering())) {
|
||||
unsigned int resolution[2] = {0,0};
|
||||
unsigned int preferredResolution[2] = {0,0};
|
||||
@@ -254,7 +260,8 @@ void ExecutionSystem::convertToOperations() {
|
||||
|
||||
}
|
||||
|
||||
void ExecutionSystem::groupOperations() {
|
||||
void ExecutionSystem::groupOperations()
|
||||
{
|
||||
vector<NodeOperation*> outputOperations;
|
||||
NodeOperation * operation;
|
||||
unsigned int index;
|
||||
@@ -281,11 +288,12 @@ void ExecutionSystem::addSocketConnection(SocketConnection *connection)
|
||||
}
|
||||
|
||||
|
||||
void ExecutionSystem::determineActualSocketDataTypes(vector<NodeBase*> &nodes) {
|
||||
void ExecutionSystem::determineActualSocketDataTypes(vector<NodeBase*> &nodes)
|
||||
{
|
||||
unsigned int index;
|
||||
/* first do all input nodes */
|
||||
for (index = 0; index < nodes.size(); index++) {
|
||||
NodeBase* node = nodes[index];
|
||||
NodeBase *node = nodes[index];
|
||||
if (node->isInputNode()) {
|
||||
node->determineActualSocketDataTypes();
|
||||
}
|
||||
@@ -293,17 +301,18 @@ void ExecutionSystem::determineActualSocketDataTypes(vector<NodeBase*> &nodes) {
|
||||
|
||||
/* then all other nodes */
|
||||
for (index = 0; index < nodes.size(); index++) {
|
||||
NodeBase* node = nodes[index];
|
||||
NodeBase *node = nodes[index];
|
||||
if (!node->isInputNode()) {
|
||||
node->determineActualSocketDataTypes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result) const {
|
||||
void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result) const
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->groups.size() ; index ++) {
|
||||
ExecutionGroup* group = this->groups[index];
|
||||
ExecutionGroup *group = this->groups[index];
|
||||
if (group->isOutputExecutionGroup()) {
|
||||
result->push_back(group);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ private: //methods
|
||||
* @brief add ReadBufferOperation and WriteBufferOperation around an operation
|
||||
* @param operation the operation to add the bufferoperations around.
|
||||
*/
|
||||
void addReadWriteBufferOperations(NodeOperation* operation);
|
||||
void addReadWriteBufferOperations(NodeOperation *operation);
|
||||
|
||||
|
||||
/**
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
* @param editingtree [bNodeTree*]
|
||||
* @param rendering [true false]
|
||||
*/
|
||||
ExecutionSystem(bNodeTree* editingtree, bool rendering);
|
||||
ExecutionSystem(bNodeTree *editingtree, bool rendering);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@@ -172,14 +172,14 @@ public:
|
||||
*
|
||||
* @param operation the operation to add
|
||||
*/
|
||||
void addOperation(NodeOperation* operation);
|
||||
void addOperation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* Add an editor link to the system. convert it to an socketconnection (CPP-representative)
|
||||
* this converted socket is returned.
|
||||
*/
|
||||
SocketConnection* addNodeLink(bNodeLink* bNodeLink);
|
||||
void addSocketConnection(SocketConnection* connection);
|
||||
SocketConnection *addNodeLink(bNodeLink *bNodeLink);
|
||||
void addSocketConnection(SocketConnection *connection);
|
||||
|
||||
/**
|
||||
* @brief Convert all nodes to operations
|
||||
|
||||
@@ -37,14 +37,15 @@
|
||||
#include "COM_WriteBufferOperation.h"
|
||||
#include "COM_ReadBufferOperation.h"
|
||||
|
||||
Node* ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree) {
|
||||
Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree)
|
||||
{
|
||||
vector<Node*>& nodes = system.getNodes();
|
||||
vector<SocketConnection*>& links = system.getConnections();
|
||||
Node* mainnode = NULL;
|
||||
Node *mainnode = NULL;
|
||||
/* add all nodes of the tree to the node list */
|
||||
bNode* node = (bNode*)tree->nodes.first;
|
||||
bNode *node = (bNode*)tree->nodes.first;
|
||||
while (node != NULL) {
|
||||
Node* execnode = addNode(nodes, node);
|
||||
Node *execnode = addNode(nodes, node);
|
||||
if (node->type == CMP_NODE_COMPOSITE) {
|
||||
mainnode = execnode;
|
||||
}
|
||||
@@ -54,7 +55,7 @@ Node* ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
|
||||
NodeRange node_range(nodes.begin()+nodes_start, nodes.end());
|
||||
|
||||
/* add all nodelinks of the tree to the link list */
|
||||
bNodeLink* nodelink = (bNodeLink*)tree->links.first;
|
||||
bNodeLink *nodelink = (bNodeLink*)tree->links.first;
|
||||
while (nodelink != NULL) {
|
||||
addNodeLink(node_range, links, nodelink);
|
||||
nodelink = (bNodeLink*)nodelink->next;
|
||||
@@ -72,11 +73,13 @@ Node* ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
|
||||
return mainnode;
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::addNode(vector<Node*>& nodes, Node *node) {
|
||||
void ExecutionSystemHelper::addNode(vector<Node*>& nodes, Node *node)
|
||||
{
|
||||
nodes.push_back(node);
|
||||
}
|
||||
|
||||
Node* ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode) {
|
||||
Node *ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode)
|
||||
{
|
||||
Converter converter;
|
||||
Node * node;
|
||||
node = converter.convert(bNode);
|
||||
@@ -86,36 +89,40 @@ Node* ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void ExecutionSystemHelper::addOperation(vector<NodeOperation*>& operations, NodeOperation *operation) {
|
||||
void ExecutionSystemHelper::addOperation(vector<NodeOperation*>& operations, NodeOperation *operation)
|
||||
{
|
||||
operations.push_back(operation);
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup*>& executionGroups, ExecutionGroup *executionGroup) {
|
||||
void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup*>& executionGroups, ExecutionGroup *executionGroup)
|
||||
{
|
||||
executionGroups.push_back(executionGroup);
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* result, vector<NodeOperation*>& operations, bool rendering) {
|
||||
void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* result, vector<NodeOperation*>& operations, bool rendering)
|
||||
{
|
||||
unsigned int index;
|
||||
|
||||
for (index = 0 ; index < operations.size() ; index ++) {
|
||||
NodeOperation* operation = operations[index];
|
||||
NodeOperation *operation = operations[index];
|
||||
if (operation->isOutputOperation(rendering)) {
|
||||
result->push_back(operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static InputSocket* find_input(NodeRange &node_range, bNode *bnode, bNodeSocket* bsocket) {
|
||||
static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
|
||||
{
|
||||
if (bnode != NULL) {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->getbNode() == bnode)
|
||||
return node->findInputSocketBybNodeSocket(bsocket);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->isProxyNode()) {
|
||||
InputSocket *proxySocket = node->getInputSocket(0);
|
||||
if (proxySocket->getbNodeSocket()==bsocket)
|
||||
@@ -125,17 +132,18 @@ static InputSocket* find_input(NodeRange &node_range, bNode *bnode, bNodeSocket*
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static OutputSocket* find_output(NodeRange &node_range, bNode *bnode, bNodeSocket* bsocket) {
|
||||
static OutputSocket *find_output(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
|
||||
{
|
||||
if (bnode != NULL) {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->getbNode() == bnode)
|
||||
return node->findOutputSocketBybNodeSocket(bsocket);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->isProxyNode()) {
|
||||
OutputSocket *proxySocket = node->getOutputSocket(0);
|
||||
if (proxySocket->getbNodeSocket()==bsocket)
|
||||
@@ -145,7 +153,8 @@ static OutputSocket* find_output(NodeRange &node_range, bNode *bnode, bNodeSocke
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
SocketConnection* ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink) {
|
||||
SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink)
|
||||
{
|
||||
/// @note: cyclic lines will be ignored. This has been copied from node.c
|
||||
if (bNodeLink->tonode != 0 && bNodeLink->fromnode != 0) {
|
||||
if (!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level!=0xFFF)) { // only add non cyclic lines! so execution will procede
|
||||
@@ -161,11 +170,12 @@ SocketConnection* ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vect
|
||||
if (inputSocket->isConnected()) {
|
||||
return NULL;
|
||||
}
|
||||
SocketConnection* connection = addLink(links, outputSocket, inputSocket);
|
||||
SocketConnection *connection = addLink(links, outputSocket, inputSocket);
|
||||
return connection;
|
||||
}
|
||||
|
||||
SocketConnection* ExecutionSystemHelper::addLink(vector<SocketConnection*>& links, OutputSocket* fromSocket, InputSocket* toSocket) {
|
||||
SocketConnection *ExecutionSystemHelper::addLink(vector<SocketConnection*>& links, OutputSocket *fromSocket, InputSocket *toSocket)
|
||||
{
|
||||
SocketConnection * newconnection = new SocketConnection();
|
||||
newconnection->setFromSocket(fromSocket);
|
||||
newconnection->setToSocket(toSocket);
|
||||
@@ -175,11 +185,12 @@ SocketConnection* ExecutionSystemHelper::addLink(vector<SocketConnection*>& link
|
||||
return newconnection;
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::debugDump(ExecutionSystem* system) {
|
||||
Node* node;
|
||||
NodeOperation* operation;
|
||||
ExecutionGroup* group;
|
||||
SocketConnection* connection;
|
||||
void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
|
||||
{
|
||||
Node *node;
|
||||
NodeOperation *operation;
|
||||
ExecutionGroup *group;
|
||||
SocketConnection *connection;
|
||||
int tot, tot2;
|
||||
printf("-- BEGIN COMPOSITOR DUMP --\r\n");
|
||||
printf("digraph compositorexecution {\r\n");
|
||||
@@ -283,7 +294,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem* system) {
|
||||
operation = system->getOperations()[i];
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation * read = (ReadBufferOperation*)operation;
|
||||
WriteBufferOperation * write= read->getMemoryProxy()->getWriteBufferOperation();
|
||||
WriteBufferOperation * write = read->getMemoryProxy()->getWriteBufferOperation();
|
||||
printf("\t\"O_%p\" -> \"O_%p\" [style=dotted]\r\n", write, read);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
* @param tree bNodeTree to add
|
||||
* @return Node representing the "Compositor node" of the maintree. or NULL when a subtree is added
|
||||
*/
|
||||
static Node* addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree * tree);
|
||||
static Node *addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree * tree);
|
||||
|
||||
/**
|
||||
* @brief add an editor node to the system.
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
* @param bNode node to add
|
||||
* @return Node that represents the bNode or null when not able to convert.
|
||||
*/
|
||||
static Node* addNode(vector<Node*>& nodes, bNode* bNode);
|
||||
static Node *addNode(vector<Node*>& nodes, bNode *bNode);
|
||||
|
||||
/**
|
||||
* @brief Add a Node to a list
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
* @param nodes the list where the node needs to be added to
|
||||
* @param node the node to be added
|
||||
*/
|
||||
static void addNode(vector<Node*>& nodes, Node* node);
|
||||
static void addNode(vector<Node*>& nodes, Node *node);
|
||||
|
||||
/**
|
||||
* @brief Add an operation to the operation list
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
* @param operations the list where the operation need to be added to
|
||||
* @param operation the operation to add
|
||||
*/
|
||||
static void addOperation(vector<NodeOperation*> &operations, NodeOperation* operation);
|
||||
static void addOperation(vector<NodeOperation*> &operations, NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief Add an ExecutionGroup to a list
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
* @param bNodeLink the link to be added
|
||||
* @return the created SocketConnection or NULL
|
||||
*/
|
||||
static SocketConnection* addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink);
|
||||
static SocketConnection *addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink);
|
||||
|
||||
/**
|
||||
* @brief create a new SocketConnection and add to a vector of links
|
||||
@@ -116,12 +116,12 @@ public:
|
||||
* @param toSocket the endpoint of the connection
|
||||
* @return the new created SocketConnection
|
||||
*/
|
||||
static SocketConnection* addLink(vector<SocketConnection*>& links, OutputSocket* fromSocket, InputSocket* toSocket);
|
||||
static SocketConnection *addLink(vector<SocketConnection*>& links, OutputSocket *fromSocket, InputSocket *toSocket);
|
||||
|
||||
/**
|
||||
* @brief dumps the content of the execution system to standard out
|
||||
* @param system the execution system to dump
|
||||
*/
|
||||
static void debugDump(ExecutionSystem* system);
|
||||
static void debugDump(ExecutionSystem *system);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -25,16 +25,19 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
InputSocket::InputSocket(DataType datatype) :Socket(datatype) {
|
||||
InputSocket::InputSocket(DataType datatype) :Socket(datatype)
|
||||
{
|
||||
this->connection = NULL;
|
||||
this->resizeMode = COM_SC_CENTER;
|
||||
}
|
||||
InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) :Socket(datatype) {
|
||||
InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) :Socket(datatype)
|
||||
{
|
||||
this->connection = NULL;
|
||||
this->resizeMode = resizeMode;
|
||||
}
|
||||
|
||||
InputSocket::InputSocket(InputSocket* from) :Socket(from->getDataType()) {
|
||||
InputSocket::InputSocket(InputSocket *from) :Socket(from->getDataType())
|
||||
{
|
||||
this->connection = NULL;
|
||||
this->resizeMode = from->getResizeMode();
|
||||
}
|
||||
@@ -42,12 +45,17 @@ InputSocket::InputSocket(InputSocket* from) :Socket(from->getDataType()) {
|
||||
int InputSocket::isInputSocket() const { return true; }
|
||||
const int InputSocket::isConnected() const { return this->connection != NULL; }
|
||||
|
||||
void InputSocket::setConnection(SocketConnection *connection) {
|
||||
void InputSocket::setConnection(SocketConnection *connection)
|
||||
{
|
||||
this->connection = connection;
|
||||
}
|
||||
SocketConnection* InputSocket::getConnection() {return this->connection;}
|
||||
SocketConnection *InputSocket::getConnection()
|
||||
{
|
||||
return this->connection;
|
||||
}
|
||||
|
||||
void InputSocket::determineResolution(unsigned int resolution[],unsigned int preferredResolution[]) {
|
||||
void InputSocket::determineResolution(unsigned int resolution[],unsigned int preferredResolution[])
|
||||
{
|
||||
if (this->isConnected()) {
|
||||
this->connection->getFromSocket()->determineResolution(resolution, preferredResolution);
|
||||
}
|
||||
@@ -56,7 +64,8 @@ void InputSocket::determineResolution(unsigned int resolution[],unsigned int pre
|
||||
}
|
||||
}
|
||||
|
||||
DataType InputSocket::convertToSupportedDataType(DataType datatype) {
|
||||
DataType InputSocket::convertToSupportedDataType(DataType datatype)
|
||||
{
|
||||
int supportedDataTypes = getDataType();
|
||||
if (supportedDataTypes&datatype) {
|
||||
return datatype;
|
||||
@@ -92,7 +101,8 @@ DataType InputSocket::convertToSupportedDataType(DataType datatype) {
|
||||
return this->getDataType();
|
||||
}
|
||||
|
||||
void InputSocket::determineActualDataType() {
|
||||
void InputSocket::determineActualDataType()
|
||||
{
|
||||
/// @note: this method is only called for inputsocket that are not connected.
|
||||
/// @note: passes COM_DT_COLOR, the convertToSupportedDataType converts this to a capable DataType
|
||||
this->setActualDataType(this->convertToSupportedDataType(COM_DT_COLOR));
|
||||
@@ -105,26 +115,30 @@ void InputSocket::determineActualDataType() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void InputSocket::notifyActualInputType(DataType datatype) {
|
||||
void InputSocket::notifyActualInputType(DataType datatype)
|
||||
{
|
||||
DataType supportedDataType = convertToSupportedDataType(datatype);
|
||||
this->setActualDataType(supportedDataType);
|
||||
this->fireActualDataTypeSet();
|
||||
}
|
||||
|
||||
void InputSocket::fireActualDataTypeSet() {
|
||||
void InputSocket::fireActualDataTypeSet()
|
||||
{
|
||||
this->getNode()->notifyActualDataTypeSet(this, this->getActualDataType());
|
||||
}
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket) {
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket)
|
||||
{
|
||||
this->relinkConnections(relinkToSocket, false, -1, NULL);
|
||||
}
|
||||
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem* graph) {
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem *graph)
|
||||
{
|
||||
if (!duplicate) {
|
||||
this->relinkConnections(relinkToSocket, autoconnect, editorNodeInputSocketIndex, graph);
|
||||
}
|
||||
else {
|
||||
if (!this->isConnected() && autoconnect) {
|
||||
Node* node = (Node*)this->getNode();
|
||||
Node *node = (Node*)this->getNode();
|
||||
switch (this->getActualDataType()) {
|
||||
case COM_DT_UNKNOWN:
|
||||
case COM_DT_COLOR:
|
||||
@@ -149,10 +163,11 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnec
|
||||
}
|
||||
}
|
||||
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem* graph) {
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem *graph)
|
||||
{
|
||||
if (!isConnected()) {
|
||||
if (autoconnect) {
|
||||
Node* node = (Node*)this->getNode();
|
||||
Node *node = (Node*)this->getNode();
|
||||
switch (this->getActualDataType()) {
|
||||
case COM_DT_UNKNOWN:
|
||||
case COM_DT_COLOR:
|
||||
@@ -174,7 +189,8 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnec
|
||||
this->setConnection(NULL);
|
||||
}
|
||||
|
||||
const ChannelInfo* InputSocket::getChannelInfo(const int channelnumber) {
|
||||
const ChannelInfo *InputSocket::getChannelInfo(const int channelnumber)
|
||||
{
|
||||
if (this->isConnected() && this->connection->getFromSocket()) {
|
||||
return this->connection->getFromSocket()->getChannelInfo(channelnumber);
|
||||
}
|
||||
@@ -183,20 +199,23 @@ const ChannelInfo* InputSocket::getChannelInfo(const int channelnumber) {
|
||||
}
|
||||
}
|
||||
|
||||
bool InputSocket::isStatic() {
|
||||
bool InputSocket::isStatic()
|
||||
{
|
||||
if (isConnected()) {
|
||||
NodeBase* node = this->getConnection()->getFromNode();
|
||||
NodeBase *node = this->getConnection()->getFromNode();
|
||||
if (node) {
|
||||
return node->isStatic();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
SocketReader* InputSocket::getReader() {
|
||||
SocketReader *InputSocket::getReader()
|
||||
{
|
||||
return this->getOperation();
|
||||
}
|
||||
|
||||
NodeOperation* InputSocket::getOperation() const {
|
||||
NodeOperation *InputSocket::getOperation() const
|
||||
{
|
||||
if (isConnected()) {
|
||||
return (NodeOperation*)this->connection->getFromSocket()->getNode();
|
||||
}
|
||||
@@ -205,7 +224,8 @@ NodeOperation* InputSocket::getOperation() const {
|
||||
}
|
||||
}
|
||||
|
||||
float* InputSocket::getStaticValues() {
|
||||
float *InputSocket::getStaticValues()
|
||||
{
|
||||
/* XXX only works for socket types with actual float input values.
|
||||
* currently all compositor socket types (value, rgba, vector) support this.
|
||||
*/
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
* @brief connection connected to this InputSocket.
|
||||
* An input socket can only have a single connection
|
||||
*/
|
||||
SocketConnection* connection;
|
||||
SocketConnection *connection;
|
||||
|
||||
/**
|
||||
* @brief resize mode of this socket
|
||||
@@ -89,10 +89,10 @@ private:
|
||||
public:
|
||||
InputSocket(DataType datatype);
|
||||
InputSocket(DataType datatype, InputSocketResizeMode resizeMode);
|
||||
InputSocket(InputSocket* from);
|
||||
InputSocket(InputSocket *from);
|
||||
|
||||
void setConnection(SocketConnection* connection);
|
||||
SocketConnection* getConnection();
|
||||
void setConnection(SocketConnection *connection);
|
||||
SocketConnection *getConnection();
|
||||
|
||||
const int isConnected() const;
|
||||
int isInputSocket() const;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
* @param editorNodeInputSocketIndex index of the socket number of the bNode (used to retrieve the value for autoconnection)
|
||||
* @param system ExecutionSystem to update to
|
||||
*/
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem* system);
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief move all connections of this input socket to another socket
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
* @param duplicate instead of move do a copy of the connection.
|
||||
* @param system ExecutionSystem to update to
|
||||
*/
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem* system);
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief set the resize mode
|
||||
@@ -150,13 +150,13 @@ public:
|
||||
*/
|
||||
InputSocketResizeMode getResizeMode() const {return this->resizeMode;}
|
||||
|
||||
const ChannelInfo* getChannelInfo(const int channelnumber);
|
||||
const ChannelInfo *getChannelInfo(const int channelnumber);
|
||||
|
||||
bool isStatic();
|
||||
|
||||
float* getStaticValues();
|
||||
SocketReader* getReader();
|
||||
NodeOperation* getOperation() const;
|
||||
float *getStaticValues();
|
||||
SocketReader *getReader();
|
||||
NodeOperation *getOperation() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,18 +25,22 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
unsigned int MemoryBuffer::determineBufferSize() {
|
||||
unsigned int MemoryBuffer::determineBufferSize()
|
||||
{
|
||||
return getWidth() * getHeight();
|
||||
}
|
||||
|
||||
int MemoryBuffer::getWidth() const {
|
||||
int MemoryBuffer::getWidth() const
|
||||
{
|
||||
return this->rect.xmax-this->rect.xmin;
|
||||
}
|
||||
int MemoryBuffer::getHeight() const {
|
||||
int MemoryBuffer::getHeight() const
|
||||
{
|
||||
return this->rect.ymax-this->rect.ymin;
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber, rcti* rect) {
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber, rcti *rect)
|
||||
{
|
||||
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->memoryProxy = memoryProxy;
|
||||
this->chunkNumber = chunkNumber;
|
||||
@@ -46,7 +50,8 @@ MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber,
|
||||
this->chunkWidth = this->rect.xmax - this->rect.xmin;
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti* rect) {
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti *rect)
|
||||
{
|
||||
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->memoryProxy = memoryProxy;
|
||||
this->chunkNumber = -1;
|
||||
@@ -55,20 +60,23 @@ MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti* rect) {
|
||||
this->datatype = COM_DT_COLOR;
|
||||
this->chunkWidth = this->rect.xmax - this->rect.xmin;
|
||||
}
|
||||
MemoryBuffer* MemoryBuffer::duplicate() {
|
||||
MemoryBuffer *MemoryBuffer::duplicate()
|
||||
{
|
||||
MemoryBuffer *result = new MemoryBuffer(this->memoryProxy, &this->rect);
|
||||
memcpy(result->buffer, this->buffer, this->determineBufferSize()*4*sizeof(float));
|
||||
return result;
|
||||
}
|
||||
void MemoryBuffer::clear() {
|
||||
void MemoryBuffer::clear()
|
||||
{
|
||||
memset(this->buffer, 0, this->determineBufferSize()*4*sizeof(float));
|
||||
}
|
||||
|
||||
float* MemoryBuffer::convertToValueBuffer() {
|
||||
float *MemoryBuffer::convertToValueBuffer()
|
||||
{
|
||||
int size = this->determineBufferSize();
|
||||
int i;
|
||||
int offset4;
|
||||
float* result = new float[size];
|
||||
float *result = new float[size];
|
||||
for (i = 0, offset4 = 0 ; i < size ; i ++, offset4 +=4) {
|
||||
result[i] = this->buffer[offset4];
|
||||
}
|
||||
@@ -76,14 +84,16 @@ float* MemoryBuffer::convertToValueBuffer() {
|
||||
return result;
|
||||
}
|
||||
|
||||
MemoryBuffer::~MemoryBuffer() {
|
||||
MemoryBuffer::~MemoryBuffer()
|
||||
{
|
||||
if (this->buffer) {
|
||||
MEM_freeN(this->buffer);
|
||||
this->buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer) {
|
||||
void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer)
|
||||
{
|
||||
if (!otherBuffer) {
|
||||
return;
|
||||
}
|
||||
@@ -103,7 +113,8 @@ void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer) {
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::read(float* result, int x, int y) {
|
||||
void MemoryBuffer::read(float *result, int x, int y)
|
||||
{
|
||||
if (x>=this->rect.xmin && x < this->rect.xmax &&
|
||||
y>=this->rect.ymin && y < this->rect.ymax) {
|
||||
int dx = x-this->rect.xmin;
|
||||
@@ -121,7 +132,8 @@ void MemoryBuffer::read(float* result, int x, int y) {
|
||||
result[3] = 0.0f;
|
||||
}
|
||||
}
|
||||
void MemoryBuffer::writePixel(int x, int y, float color[4]) {
|
||||
void MemoryBuffer::writePixel(int x, int y, float color[4])
|
||||
{
|
||||
if (x>=this->rect.xmin && x < this->rect.xmax &&
|
||||
y>=this->rect.ymin && y < this->rect.ymax) {
|
||||
int offset = (this->chunkWidth*y+x)*4;
|
||||
@@ -132,7 +144,8 @@ void MemoryBuffer::writePixel(int x, int y, float color[4]) {
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::readCubic(float* result, float x, float y) {
|
||||
void MemoryBuffer::readCubic(float *result, float x, float y)
|
||||
{
|
||||
int x1 = floor(x);
|
||||
int x2 = x1 + 1;
|
||||
int y1 = floor(y);
|
||||
@@ -208,7 +221,7 @@ static float EWA_WTS[EWA_MAXIDX + 1] =
|
||||
0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
|
||||
};
|
||||
|
||||
static void radangle2imp(float a2, float b2, float th, float* A, float* B, float* C, float* F)
|
||||
static void radangle2imp(float a2, float b2, float th, float *A, float *B, float *C, float *F)
|
||||
{
|
||||
float ct2 = cosf(th);
|
||||
const float st2 = 1.f - ct2*ct2; // <- sin(th)^2
|
||||
@@ -220,7 +233,7 @@ static void radangle2imp(float a2, float b2, float th, float* A, float* B, float
|
||||
}
|
||||
|
||||
// all tests here are done to make sure possible overflows are hopefully minimized
|
||||
static void imp2radangle(float A, float B, float C, float F, float* a, float* b, float* th, float* ecc)
|
||||
static void imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc)
|
||||
{
|
||||
if (F <= 1e-5f) { // use arbitrary major radius, zero minor, infinite eccentricity
|
||||
*a = sqrtf(A > C ? A : C);
|
||||
@@ -247,12 +260,14 @@ static void imp2radangle(float A, float B, float C, float F, float* a, float* b,
|
||||
}
|
||||
}
|
||||
|
||||
float clipuv(float x, float limit) {
|
||||
float clipuv(float x, float limit)
|
||||
{
|
||||
x = (x < 0) ? 0 : ((x >= limit) ? (limit - 1) : x);
|
||||
return x;
|
||||
}
|
||||
|
||||
void MemoryBuffer::readEWA(float* result, float fx, float fy, float dx, float dy) {
|
||||
void MemoryBuffer::readEWA(float *result, float fx, float fy, float dx, float dy)
|
||||
{
|
||||
int width = this->getWidth(), height = this->getHeight();
|
||||
|
||||
// scaling dxt/dyt by full resolution can cause overflow because of huge A/B/C and esp. F values,
|
||||
|
||||
@@ -88,18 +88,18 @@ private:
|
||||
/**
|
||||
* @brief the actual float buffer/data
|
||||
*/
|
||||
float* buffer;
|
||||
float *buffer;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief construct new MemoryBuffer for a chunk
|
||||
*/
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti* rect);
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief construct new temporarily MemoryBuffer for an area
|
||||
*/
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, rcti* rect);
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief destructor
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
* @brief get the data of this MemoryBuffer
|
||||
* @note buffer should already be available in memory
|
||||
*/
|
||||
float* getBuffer() {return this->buffer;}
|
||||
float *getBuffer() {return this->buffer;}
|
||||
|
||||
/**
|
||||
* @brief after execution the state will be set to available by calling this method
|
||||
@@ -124,9 +124,9 @@ public:
|
||||
this->state = COM_MB_AVAILABLE;
|
||||
}
|
||||
|
||||
void read(float* result, int x, int y);
|
||||
void read(float *result, int x, int y);
|
||||
void writePixel(int x, int y, float color[4]);
|
||||
void readCubic(float* result, float x, float y);
|
||||
void readCubic(float *result, float x, float y);
|
||||
void readEWA(float *result, float fx, float fy, float dx, float dy);
|
||||
|
||||
/**
|
||||
@@ -138,12 +138,12 @@ public:
|
||||
* @brief add the content from otherBuffer to this MemoryBuffer
|
||||
* @param otherBuffer source buffer
|
||||
*/
|
||||
void copyContentFrom(MemoryBuffer* otherBuffer);
|
||||
void copyContentFrom(MemoryBuffer *otherBuffer);
|
||||
|
||||
/**
|
||||
* @brief get the rect of this MemoryBuffer
|
||||
*/
|
||||
rcti* getRect() {return &this->rect;}
|
||||
rcti *getRect() {return &this->rect;}
|
||||
|
||||
/**
|
||||
* @brief get the width of this MemoryBuffer
|
||||
@@ -160,9 +160,9 @@ public:
|
||||
*/
|
||||
void clear();
|
||||
|
||||
MemoryBuffer* duplicate();
|
||||
MemoryBuffer *duplicate();
|
||||
|
||||
float* convertToValueBuffer();
|
||||
float *convertToValueBuffer();
|
||||
private:
|
||||
unsigned int determineBufferSize();
|
||||
};
|
||||
|
||||
@@ -29,7 +29,8 @@ vector<MemoryBuffer*> buffers;
|
||||
|
||||
ThreadMutex mutex;
|
||||
|
||||
MemoryBuffer* MemoryManager::allocateMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber, rcti *rect) {
|
||||
MemoryBuffer *MemoryManager::allocateMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber, rcti *rect)
|
||||
{
|
||||
MemoryBuffer *result = new MemoryBuffer(id, chunkNumber, rect);
|
||||
MemoryManagerState * state = MemoryManager::getState(id);
|
||||
state->addMemoryBuffer(result);
|
||||
@@ -39,30 +40,35 @@ MemoryBuffer* MemoryManager::allocateMemoryBuffer(MemoryProxy *id, unsigned int
|
||||
return result;
|
||||
}
|
||||
|
||||
void MemoryManager::addMemoryProxy(MemoryProxy *memoryProxy) {
|
||||
void MemoryManager::addMemoryProxy(MemoryProxy *memoryProxy)
|
||||
{
|
||||
MemoryManagerState * state = MemoryManager::getState(memoryProxy);
|
||||
if (!state) {
|
||||
state = new MemoryManagerState(memoryProxy);
|
||||
memoryProxy->setState(state);
|
||||
}
|
||||
}
|
||||
MemoryBuffer* MemoryManager::getMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber) {
|
||||
MemoryBuffer *MemoryManager::getMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber)
|
||||
{
|
||||
MemoryManagerState * state = MemoryManager::getState(id);
|
||||
if (!state) {
|
||||
return NULL;
|
||||
}
|
||||
MemoryBuffer* buffer = state->getMemoryBuffer(chunkNumber);
|
||||
MemoryBuffer *buffer = state->getMemoryBuffer(chunkNumber);
|
||||
if (!buffer) return NULL;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
MemoryManagerState* MemoryManager::getState(MemoryProxy* memoryProxy) {
|
||||
MemoryManagerState *MemoryManager::getState(MemoryProxy *memoryProxy)
|
||||
{
|
||||
return memoryProxy->getState();
|
||||
}
|
||||
void MemoryManager::initialize() {
|
||||
void MemoryManager::initialize()
|
||||
{
|
||||
BLI_mutex_init(&mutex);
|
||||
}
|
||||
void MemoryManager::clear() {
|
||||
void MemoryManager::clear()
|
||||
{
|
||||
buffers.clear();
|
||||
BLI_mutex_end(&mutex);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
* @brief retrieve the state of a certain MemoryProxy;
|
||||
* @param memoryProxy the MemoryProxy to retrieve the state from
|
||||
*/
|
||||
static MemoryManagerState* getState(MemoryProxy* memoryProxy);
|
||||
static MemoryManagerState *getState(MemoryProxy *memoryProxy);
|
||||
public:
|
||||
/**
|
||||
* @brief allocate a memory buffer
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
* @param chunkNumber number of the chunk to receive
|
||||
* @param rect size + position of the chunk
|
||||
*/
|
||||
static MemoryBuffer* allocateMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti* rect);
|
||||
static MemoryBuffer *allocateMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief get a memory buffer
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
* @param chunkNumber number of the chunk to receive
|
||||
* @param addUser must we add a user to the chunk.
|
||||
*/
|
||||
static MemoryBuffer* getMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber);
|
||||
static MemoryBuffer *getMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber);
|
||||
|
||||
/**
|
||||
* @brief add a MemoryProxy to the scope of the memory manager
|
||||
|
||||
@@ -22,22 +22,25 @@
|
||||
|
||||
#include "COM_MemoryManagerState.h"
|
||||
|
||||
MemoryManagerState::MemoryManagerState(MemoryProxy *memoryProxy) {
|
||||
MemoryManagerState::MemoryManagerState(MemoryProxy *memoryProxy)
|
||||
{
|
||||
this->memoryProxy = memoryProxy;
|
||||
this->currentSize = 0;
|
||||
this->chunkBuffers = NULL;
|
||||
BLI_mutex_init(&this->mutex);
|
||||
}
|
||||
|
||||
MemoryProxy * MemoryManagerState::getMemoryProxy() {
|
||||
MemoryProxy * MemoryManagerState::getMemoryProxy()
|
||||
{
|
||||
return this->memoryProxy;
|
||||
}
|
||||
|
||||
MemoryManagerState::~MemoryManagerState() {
|
||||
MemoryManagerState::~MemoryManagerState()
|
||||
{
|
||||
this->memoryProxy = NULL;
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->currentSize; index ++) {
|
||||
MemoryBuffer* buffer = this->chunkBuffers[index];
|
||||
MemoryBuffer *buffer = this->chunkBuffers[index];
|
||||
if (buffer) {
|
||||
delete buffer;
|
||||
}
|
||||
@@ -46,7 +49,8 @@ MemoryManagerState::~MemoryManagerState() {
|
||||
BLI_mutex_end(&this->mutex);
|
||||
}
|
||||
|
||||
void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer) {
|
||||
void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer)
|
||||
{
|
||||
BLI_mutex_lock(&this->mutex);
|
||||
unsigned int chunkNumber = buffer->getChunkNumber();
|
||||
unsigned int index;
|
||||
@@ -76,8 +80,9 @@ void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer) {
|
||||
BLI_mutex_unlock(&this->mutex);
|
||||
}
|
||||
|
||||
MemoryBuffer* MemoryManagerState::getMemoryBuffer(unsigned int chunkNumber) {
|
||||
MemoryBuffer* result = NULL;
|
||||
MemoryBuffer *MemoryManagerState::getMemoryBuffer(unsigned int chunkNumber)
|
||||
{
|
||||
MemoryBuffer *result = NULL;
|
||||
if (chunkNumber< this->currentSize) {
|
||||
result = this->chunkBuffers[chunkNumber];
|
||||
if (result) {
|
||||
|
||||
@@ -75,13 +75,13 @@ public:
|
||||
/**
|
||||
* @brief add a new memorybuffer to the state
|
||||
*/
|
||||
void addMemoryBuffer(MemoryBuffer* buffer);
|
||||
void addMemoryBuffer(MemoryBuffer *buffer);
|
||||
|
||||
/**
|
||||
* @brief get the MemoryBuffer assiciated to a chunk.
|
||||
* @param chunkNumber the chunknumber
|
||||
*/
|
||||
MemoryBuffer* getMemoryBuffer(unsigned int chunkNumber);
|
||||
MemoryBuffer *getMemoryBuffer(unsigned int chunkNumber);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,13 +23,15 @@
|
||||
#include "COM_MemoryProxy.h"
|
||||
|
||||
|
||||
MemoryProxy::MemoryProxy() {
|
||||
MemoryProxy::MemoryProxy()
|
||||
{
|
||||
this->state = NULL;
|
||||
this->writeBufferOperation = NULL;
|
||||
this->executor = NULL;
|
||||
}
|
||||
|
||||
MemoryProxy::~MemoryProxy() {
|
||||
MemoryProxy::~MemoryProxy()
|
||||
{
|
||||
if (this->state) {
|
||||
delete this->state;
|
||||
this->state = NULL;
|
||||
|
||||
@@ -76,19 +76,19 @@ public:
|
||||
/**
|
||||
* @brief get the ExecutionGroup that can be scheduled to calculate a certain chunk.
|
||||
*/
|
||||
ExecutionGroup* getExecutor() {return this->executor;}
|
||||
ExecutionGroup *getExecutor() {return this->executor;}
|
||||
|
||||
/**
|
||||
* @brief set the WriteBufferOperation that is responsible for writing to this MemoryProxy
|
||||
* @param operation
|
||||
*/
|
||||
void setWriteBufferOperation(WriteBufferOperation* operation) {this->writeBufferOperation = operation;}
|
||||
void setWriteBufferOperation(WriteBufferOperation *operation) {this->writeBufferOperation = operation;}
|
||||
|
||||
/**
|
||||
* @brief get the WriteBufferOperation that is responsible for writing to this MemoryProxy
|
||||
* @return WriteBufferOperation
|
||||
*/
|
||||
WriteBufferOperation* getWriteBufferOperation() {return this->writeBufferOperation;}
|
||||
WriteBufferOperation *getWriteBufferOperation() {return this->writeBufferOperation;}
|
||||
|
||||
/**
|
||||
* @brief set the memorymanager state of this MemoryProxy, this is set from the MemoryManager
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
* @brief get the state of this MemoryProxy
|
||||
* @return MemoryManagerState reference to the state of this MemoryProxy.
|
||||
*/
|
||||
MemoryManagerState* getState() {return this->state;}
|
||||
MemoryManagerState *getState() {return this->state;}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
//#include "stdio.h"
|
||||
#include "COM_defines.h"
|
||||
|
||||
Node::Node(bNode* editorNode, bool create_sockets) {
|
||||
Node::Node(bNode *editorNode, bool create_sockets)
|
||||
{
|
||||
this->editorNode = editorNode;
|
||||
|
||||
if (create_sockets) {
|
||||
@@ -62,13 +63,18 @@ Node::Node(bNode* editorNode, bool create_sockets) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Node::Node() {
|
||||
Node::Node()
|
||||
{
|
||||
this->editorNode = NULL;
|
||||
}
|
||||
|
||||
bNode* Node::getbNode() {return this->editorNode;}
|
||||
bNode *Node::getbNode()
|
||||
{
|
||||
return this->editorNode;
|
||||
}
|
||||
|
||||
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex) {
|
||||
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
|
||||
SetValueOperation *operation = new SetValueOperation();
|
||||
bNodeSocketValueFloat *val = (bNodeSocketValueFloat*)bSock->default_value;
|
||||
@@ -77,7 +83,8 @@ void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket* inputsocket
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket, int priority) {
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket, int priority)
|
||||
{
|
||||
#ifdef COM_PREVIEW_ENABLED
|
||||
PreviewOperation *operation = new PreviewOperation();
|
||||
system->addOperation(operation);
|
||||
@@ -88,14 +95,16 @@ void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSock
|
||||
#endif
|
||||
}
|
||||
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority) {
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority)
|
||||
{
|
||||
if (inputSocket->isConnected()) {
|
||||
OutputSocket *outputsocket = inputSocket->getConnection()->getFromSocket();
|
||||
this->addPreviewOperation(system, outputsocket, priority);
|
||||
}
|
||||
}
|
||||
|
||||
SocketConnection* Node::addLink(ExecutionSystem *graph, OutputSocket* outputSocket, InputSocket* inputsocket) {
|
||||
SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSocket, InputSocket *inputsocket)
|
||||
{
|
||||
if (inputsocket->isConnected()) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -108,7 +117,8 @@ SocketConnection* Node::addLink(ExecutionSystem *graph, OutputSocket* outputSock
|
||||
return connection;
|
||||
}
|
||||
|
||||
void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex) {
|
||||
void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA*)bSock->default_value;
|
||||
@@ -120,7 +130,8 @@ void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket* inputsocket
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
||||
void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex) {
|
||||
void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
|
||||
bNodeSocketValueVector *val = (bNodeSocketValueVector*)bSock->default_value;
|
||||
SetVectorOperation *operation = new SetVectorOperation();
|
||||
@@ -132,7 +143,8 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket* inputsocke
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
||||
bNodeSocket* Node::getEditorInputSocket(int editorNodeInputSocketIndex) {
|
||||
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->inputs.first;
|
||||
int index = 0;
|
||||
while (bSock != NULL) {
|
||||
@@ -144,7 +156,8 @@ bNodeSocket* Node::getEditorInputSocket(int editorNodeInputSocketIndex) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
bNodeSocket* Node::getEditorOutputSocket(int editorNodeInputSocketIndex) {
|
||||
bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->outputs.first;
|
||||
int index = 0;
|
||||
while (bSock != NULL) {
|
||||
@@ -157,11 +170,12 @@ bNodeSocket* Node::getEditorOutputSocket(int editorNodeInputSocketIndex) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
InputSocket* Node::findInputSocketBybNodeSocket(bNodeSocket* socket) {
|
||||
InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket)
|
||||
{
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < inputsockets.size(); index ++) {
|
||||
InputSocket* input = inputsockets[index];
|
||||
InputSocket *input = inputsockets[index];
|
||||
if (input->getbNodeSocket() == socket) {
|
||||
return input;
|
||||
}
|
||||
@@ -169,11 +183,12 @@ InputSocket* Node::findInputSocketBybNodeSocket(bNodeSocket* socket) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OutputSocket* Node::findOutputSocketBybNodeSocket(bNodeSocket* socket) {
|
||||
OutputSocket *Node::findOutputSocketBybNodeSocket(bNodeSocket *socket)
|
||||
{
|
||||
vector<OutputSocket*> &outputsockets = this->getOutputSockets();
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < outputsockets.size(); index ++) {
|
||||
OutputSocket* output = outputsockets[index];
|
||||
OutputSocket *output = outputsockets[index];
|
||||
if (output->getbNodeSocket() == socket) {
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -50,15 +50,15 @@ private:
|
||||
/**
|
||||
* @brief stores the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode* editorNode;
|
||||
bNode *editorNode;
|
||||
|
||||
public:
|
||||
Node(bNode* editorNode, bool create_sockets=true);
|
||||
Node(bNode *editorNode, bool create_sockets=true);
|
||||
|
||||
/**
|
||||
* @brief get the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode* getbNode();
|
||||
bNode *getbNode();
|
||||
|
||||
/**
|
||||
* @brief convert node to operation
|
||||
@@ -68,31 +68,31 @@ public:
|
||||
* @param system the ExecutionSystem where the operations need to be added
|
||||
* @param context reference to the CompositorContext
|
||||
*/
|
||||
virtual void convertToOperations(ExecutionSystem* system, CompositorContext * context) =0;
|
||||
virtual void convertToOperations(ExecutionSystem *system, CompositorContext * context) =0;
|
||||
|
||||
/**
|
||||
* this method adds a SetValueOperation as input of the input socket.
|
||||
* This can only be used from the convertToOperation method. all other usages are not allowed
|
||||
*/
|
||||
void addSetValueOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex);
|
||||
void addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
||||
|
||||
/**
|
||||
* this method adds a SetColorOperation as input of the input socket.
|
||||
* This can only be used from the convertToOperation method. all other usages are not allowed
|
||||
*/
|
||||
void addSetColorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex);
|
||||
void addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
||||
|
||||
/**
|
||||
* this method adds a SetVectorOperation as input of the input socket.
|
||||
* This can only be used from the convertToOperation method. all other usages are not allowed
|
||||
*/
|
||||
void addSetVectorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex);
|
||||
void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
||||
|
||||
/**
|
||||
* Creates a new link between an outputSocket and inputSocket and registrates the link to the graph
|
||||
* @return the new created link
|
||||
*/
|
||||
SocketConnection* addLink(ExecutionSystem *graph, OutputSocket* outputSocket, InputSocket* inputsocket);
|
||||
SocketConnection *addLink(ExecutionSystem *graph, OutputSocket *outputSocket, InputSocket *inputsocket);
|
||||
|
||||
/**
|
||||
* is this node a group node.
|
||||
@@ -108,23 +108,23 @@ public:
|
||||
*
|
||||
* @param socket
|
||||
*/
|
||||
InputSocket* findInputSocketBybNodeSocket(bNodeSocket* socket);
|
||||
InputSocket *findInputSocketBybNodeSocket(bNodeSocket *socket);
|
||||
|
||||
/**
|
||||
* @brief find the OutputSocket by bNodeSocket
|
||||
*
|
||||
* @param socket
|
||||
*/
|
||||
OutputSocket* findOutputSocketBybNodeSocket(bNodeSocket* socket);
|
||||
OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket);
|
||||
protected:
|
||||
|
||||
Node();
|
||||
|
||||
void addPreviewOperation(ExecutionSystem *system, InputSocket* inputSocket, int priority);
|
||||
void addPreviewOperation(ExecutionSystem *system, OutputSocket* inputSocket, int priority);
|
||||
void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority);
|
||||
void addPreviewOperation(ExecutionSystem *system, OutputSocket *inputSocket, int priority);
|
||||
|
||||
bNodeSocket* getEditorInputSocket(int editorNodeInputSocketIndex);
|
||||
bNodeSocket* getEditorOutputSocket(int editorNodeOutputSocketIndex);
|
||||
bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
|
||||
bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -29,11 +29,13 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
NodeBase::NodeBase() {
|
||||
NodeBase::NodeBase()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NodeBase::~NodeBase() {
|
||||
NodeBase::~NodeBase()
|
||||
{
|
||||
while (!this->outputsockets.empty()) {
|
||||
delete (this->outputsockets.back());
|
||||
this->outputsockets.pop_back();
|
||||
@@ -44,60 +46,70 @@ NodeBase::~NodeBase() {
|
||||
}
|
||||
}
|
||||
|
||||
void NodeBase::addInputSocket(DataType datatype) {
|
||||
void NodeBase::addInputSocket(DataType datatype)
|
||||
{
|
||||
this->addInputSocket(datatype, COM_SC_CENTER, NULL);
|
||||
}
|
||||
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode) {
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode)
|
||||
{
|
||||
this->addInputSocket(datatype, resizeMode, NULL);
|
||||
}
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket* bSocket) {
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket *bSocket)
|
||||
{
|
||||
InputSocket *socket = new InputSocket(datatype, resizeMode);
|
||||
socket->setEditorSocket(bSocket);
|
||||
socket->setNode(this);
|
||||
this->inputsockets.push_back(socket);
|
||||
}
|
||||
|
||||
void NodeBase::addOutputSocket(DataType datatype) {
|
||||
void NodeBase::addOutputSocket(DataType datatype)
|
||||
{
|
||||
this->addOutputSocket(datatype, NULL);
|
||||
|
||||
}
|
||||
void NodeBase::addOutputSocket(DataType datatype, bNodeSocket* bSocket) {
|
||||
void NodeBase::addOutputSocket(DataType datatype, bNodeSocket *bSocket)
|
||||
{
|
||||
OutputSocket *socket = new OutputSocket(datatype);
|
||||
socket->setEditorSocket(bSocket);
|
||||
socket->setNode(this);
|
||||
this->outputsockets.push_back(socket);
|
||||
}
|
||||
const bool NodeBase::isInputNode() const {
|
||||
const bool NodeBase::isInputNode() const
|
||||
{
|
||||
return this->inputsockets.size() == 0;
|
||||
}
|
||||
|
||||
OutputSocket* NodeBase::getOutputSocket(int index) {
|
||||
OutputSocket *NodeBase::getOutputSocket(int index)
|
||||
{
|
||||
return this->outputsockets[index];
|
||||
}
|
||||
|
||||
InputSocket* NodeBase::getInputSocket(int index) {
|
||||
InputSocket *NodeBase::getInputSocket(int index)
|
||||
{
|
||||
return this->inputsockets[index];
|
||||
}
|
||||
|
||||
|
||||
void NodeBase::determineActualSocketDataTypes() {
|
||||
void NodeBase::determineActualSocketDataTypes()
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->outputsockets.size() ; index ++) {
|
||||
OutputSocket* socket = this->outputsockets[index];
|
||||
OutputSocket *socket = this->outputsockets[index];
|
||||
if (socket->getActualDataType() ==COM_DT_UNKNOWN && socket->isConnected()) {
|
||||
socket->determineActualDataType();
|
||||
}
|
||||
}
|
||||
for (index = 0 ; index < this->inputsockets.size() ; index ++) {
|
||||
InputSocket* socket = this->inputsockets[index];
|
||||
InputSocket *socket = this->inputsockets[index];
|
||||
if (socket->getActualDataType() ==COM_DT_UNKNOWN) {
|
||||
socket->determineActualDataType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DataType NodeBase::determineActualDataType(OutputSocket *outputsocket) {
|
||||
DataType NodeBase::determineActualDataType(OutputSocket *outputsocket)
|
||||
{
|
||||
const int inputIndex = outputsocket->getInputSocketDataTypeDeterminatorIndex();
|
||||
if (inputIndex != -1) {
|
||||
return this->getInputSocket(inputIndex)->getActualDataType();
|
||||
@@ -107,7 +119,8 @@ DataType NodeBase::determineActualDataType(OutputSocket *outputsocket) {
|
||||
}
|
||||
}
|
||||
|
||||
void NodeBase::notifyActualDataTypeSet(InputSocket *socket, DataType actualType) {
|
||||
void NodeBase::notifyActualDataTypeSet(InputSocket *socket, DataType actualType)
|
||||
{
|
||||
unsigned int index;
|
||||
int socketIndex = -1;
|
||||
for (index = 0 ; index < this->inputsockets.size() ; index ++) {
|
||||
@@ -119,9 +132,10 @@ void NodeBase::notifyActualDataTypeSet(InputSocket *socket, DataType actualType)
|
||||
if (socketIndex == -1) return;
|
||||
|
||||
for (index = 0 ; index < this->outputsockets.size() ; index ++) {
|
||||
OutputSocket* socket = this->outputsockets[index];
|
||||
OutputSocket *socket = this->outputsockets[index];
|
||||
if (socket->isActualDataTypeDeterminedByInputSocket() &&
|
||||
socket->getInputSocketDataTypeDeterminatorIndex() == socketIndex) {
|
||||
socket->getInputSocketDataTypeDeterminatorIndex() == socketIndex)
|
||||
{
|
||||
socket->setActualDataType(actualType);
|
||||
socket->fireActualDataType();
|
||||
}
|
||||
|
||||
@@ -124,32 +124,32 @@ public:
|
||||
* @param actualType [COM_DT_VALUE, COM_DT_VECTOR, COM_DT_COLOR]
|
||||
* the actual data type that is coming from the connected output socket
|
||||
*/
|
||||
virtual void notifyActualDataTypeSet(InputSocket* socket, const DataType actualType);
|
||||
virtual void notifyActualDataTypeSet(InputSocket *socket, const DataType actualType);
|
||||
|
||||
/**
|
||||
* get the reference to a certain outputsocket
|
||||
* @param index
|
||||
* the index of the needed outputsocket
|
||||
*/
|
||||
OutputSocket* getOutputSocket(const int index);
|
||||
OutputSocket *getOutputSocket(const int index);
|
||||
|
||||
/**
|
||||
* get the reference to the first outputsocket
|
||||
* @param index
|
||||
* the index of the needed outputsocket
|
||||
*/
|
||||
inline OutputSocket* getOutputSocket() {return getOutputSocket(0);}
|
||||
inline OutputSocket *getOutputSocket() {return getOutputSocket(0);}
|
||||
|
||||
/**
|
||||
* get the reference to a certain inputsocket
|
||||
* @param index
|
||||
* the index of the needed inputsocket
|
||||
*/
|
||||
InputSocket* getInputSocket(const int index);
|
||||
InputSocket *getInputSocket(const int index);
|
||||
|
||||
|
||||
virtual bool isStatic() const {return false;}
|
||||
void getStaticValues(float* result) const {}
|
||||
void getStaticValues(float *result) const {}
|
||||
protected:
|
||||
NodeBase();
|
||||
|
||||
@@ -160,7 +160,7 @@ protected:
|
||||
*/
|
||||
void addInputSocket(DataType datatype);
|
||||
void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode);
|
||||
void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket* socket);
|
||||
void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket *socket);
|
||||
|
||||
/**
|
||||
* @brief add an OutputSocket to the collection of outputsockets
|
||||
@@ -168,7 +168,7 @@ protected:
|
||||
* @param socket the OutputSocket to add
|
||||
*/
|
||||
void addOutputSocket(DataType datatype);
|
||||
void addOutputSocket(DataType datatype, bNodeSocket* socket);
|
||||
void addOutputSocket(DataType datatype, bNodeSocket *socket);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
#include "COM_defines.h"
|
||||
#include "stdio.h"
|
||||
|
||||
NodeOperation::NodeOperation() {
|
||||
NodeOperation::NodeOperation()
|
||||
{
|
||||
this->resolutionInputSocketIndex = 0;
|
||||
this->complex = false;
|
||||
this->width = 0;
|
||||
@@ -35,13 +36,14 @@ NodeOperation::NodeOperation() {
|
||||
this->openCL = false;
|
||||
}
|
||||
|
||||
void NodeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void NodeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
unsigned int temp[2];
|
||||
unsigned int temp2[2];
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
|
||||
for (unsigned int index = 0 ; index < inputsockets.size();index++) {
|
||||
InputSocket* inputSocket = inputsockets[index];
|
||||
InputSocket *inputSocket = inputsockets[index];
|
||||
if (inputSocket->isConnected()) {
|
||||
if (index == this->resolutionInputSocketIndex) {
|
||||
inputSocket->determineResolution(resolution, preferredResolution);
|
||||
@@ -52,7 +54,7 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
|
||||
}
|
||||
}
|
||||
for (unsigned int index = 0 ; index < inputsockets.size();index++) {
|
||||
InputSocket* inputSocket = inputsockets[index];
|
||||
InputSocket *inputSocket = inputsockets[index];
|
||||
if (inputSocket->isConnected()) {
|
||||
if (index != resolutionInputSocketIndex) {
|
||||
inputSocket->determineResolution(temp, temp2);
|
||||
@@ -60,28 +62,36 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
|
||||
}
|
||||
}
|
||||
}
|
||||
void NodeOperation::setResolutionInputSocketIndex(unsigned int index) {
|
||||
void NodeOperation::setResolutionInputSocketIndex(unsigned int index)
|
||||
{
|
||||
this->resolutionInputSocketIndex = index;
|
||||
}
|
||||
void NodeOperation::initExecution() {
|
||||
void NodeOperation::initExecution()
|
||||
{
|
||||
}
|
||||
|
||||
void NodeOperation::initMutex() {
|
||||
void NodeOperation::initMutex()
|
||||
{
|
||||
BLI_mutex_init(&mutex);
|
||||
}
|
||||
void NodeOperation::deinitMutex() {
|
||||
void NodeOperation::deinitMutex()
|
||||
{
|
||||
BLI_mutex_end(&mutex);
|
||||
}
|
||||
void NodeOperation::deinitExecution() {
|
||||
void NodeOperation::deinitExecution()
|
||||
{
|
||||
}
|
||||
SocketReader* NodeOperation::getInputSocketReader(unsigned int inputSocketIndex) {
|
||||
SocketReader *NodeOperation::getInputSocketReader(unsigned int inputSocketIndex)
|
||||
{
|
||||
return this->getInputSocket(inputSocketIndex)->getReader();
|
||||
}
|
||||
NodeOperation* NodeOperation::getInputOperation(unsigned int inputSocketIndex) {
|
||||
NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex)
|
||||
{
|
||||
return this->getInputSocket(inputSocketIndex)->getOperation();
|
||||
}
|
||||
|
||||
void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets) {
|
||||
void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets)
|
||||
{
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
for (vector<InputSocket*>::iterator iterator = inputsockets.begin() ; iterator!= inputsockets.end() ; iterator++) {
|
||||
InputSocket *socket = *iterator;
|
||||
@@ -91,7 +101,8 @@ void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets) {
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti* output) {
|
||||
bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
if (this->isInputNode()) {
|
||||
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
return false;
|
||||
@@ -101,9 +112,9 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
|
||||
for (index = 0 ; index < inputsockets.size() ; index++) {
|
||||
InputSocket* inputsocket = inputsockets[index];
|
||||
InputSocket *inputsocket = inputsockets[index];
|
||||
if (inputsocket->isConnected()) {
|
||||
NodeOperation* inputoperation = (NodeOperation*)inputsocket->getConnection()->getFromNode();
|
||||
NodeOperation *inputoperation = (NodeOperation*)inputsocket->getConnection()->getFromNode();
|
||||
bool result = inputoperation->determineDependingAreaOfInterest(input, readOperation, output);
|
||||
if (result) {
|
||||
return true;
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
* @param clMemToCleanUp all created cl_mem references must be added to this list. Framework will clean this after execution
|
||||
* @param clKernelsToCleanUp all created cl_kernel references must be added to this list. Framework will clean this after execution
|
||||
*/
|
||||
virtual void executeOpenCL(cl_context context,cl_program program, cl_command_queue queue, MemoryBuffer* outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer** inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
|
||||
virtual void executeOpenCL(cl_context context,cl_program program, cl_command_queue queue, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer** inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
|
||||
virtual void deinitExecution();
|
||||
void deinitMutex();
|
||||
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
*/
|
||||
virtual const bool isActiveViewerOutput() const {return false;}
|
||||
|
||||
virtual bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output);
|
||||
virtual bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
/**
|
||||
* @brief set the index of the input socket that will determine the resolution of this operation
|
||||
@@ -222,11 +222,11 @@ protected:
|
||||
NodeOperation();
|
||||
|
||||
void setWidth(unsigned int width) {this->width = width;}
|
||||
void setHeight(unsigned int height) {this->height= height;}
|
||||
SocketReader* getInputSocketReader(unsigned int inputSocketindex);
|
||||
NodeOperation* getInputOperation(unsigned int inputSocketindex);
|
||||
void setHeight(unsigned int height) {this->height = height;}
|
||||
SocketReader *getInputSocketReader(unsigned int inputSocketindex);
|
||||
NodeOperation *getInputOperation(unsigned int inputSocketindex);
|
||||
|
||||
inline ThreadMutex* getMutex() {return &this->mutex;}
|
||||
inline ThreadMutex *getMutex() {return &this->mutex;}
|
||||
|
||||
/**
|
||||
* @brief set whether this operation is complex
|
||||
|
||||
@@ -24,26 +24,30 @@
|
||||
#include "COM_WorkScheduler.h"
|
||||
|
||||
|
||||
OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program) {
|
||||
OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program)
|
||||
{
|
||||
this->device = device;
|
||||
this->context = context;
|
||||
this->program = program;
|
||||
this->queue = NULL;
|
||||
}
|
||||
|
||||
bool OpenCLDevice::initialize() {
|
||||
bool OpenCLDevice::initialize()
|
||||
{
|
||||
cl_int error;
|
||||
queue = clCreateCommandQueue(context, device, 0, &error);
|
||||
return false;
|
||||
}
|
||||
|
||||
void OpenCLDevice::deinitialize() {
|
||||
void OpenCLDevice::deinitialize()
|
||||
{
|
||||
if (queue) {
|
||||
clReleaseCommandQueue(queue);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenCLDevice::execute(WorkPackage *work) {
|
||||
void OpenCLDevice::execute(WorkPackage *work)
|
||||
{
|
||||
const unsigned int chunkNumber = work->getChunkNumber();
|
||||
ExecutionGroup * executionGroup = work->getExecutionGroup();
|
||||
rcti rect;
|
||||
|
||||
@@ -25,30 +25,35 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
OutputSocket::OutputSocket(DataType datatype) :Socket(datatype) {
|
||||
OutputSocket::OutputSocket(DataType datatype) :Socket(datatype)
|
||||
{
|
||||
this->inputSocketDataTypeDeterminatorIndex = -1;
|
||||
}
|
||||
OutputSocket::OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex) :Socket(datatype) {
|
||||
OutputSocket::OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex) :Socket(datatype)
|
||||
{
|
||||
this->inputSocketDataTypeDeterminatorIndex = inputSocketDataTypeDeterminatorIndex;
|
||||
}
|
||||
|
||||
OutputSocket::OutputSocket(OutputSocket *from): Socket(from->getDataType()) {
|
||||
OutputSocket::OutputSocket(OutputSocket *from): Socket(from->getDataType())
|
||||
{
|
||||
this->inputSocketDataTypeDeterminatorIndex = from->getInputSocketDataTypeDeterminatorIndex();
|
||||
}
|
||||
|
||||
int OutputSocket::isOutputSocket() const { return true; }
|
||||
const int OutputSocket::isConnected() const { return this->connections.size()!=0; }
|
||||
|
||||
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
NodeBase* node = this->getNode();
|
||||
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
NodeBase *node = this->getNode();
|
||||
if (node->isOperation()) {
|
||||
NodeOperation* operation = (NodeOperation*)node;
|
||||
NodeOperation *operation = (NodeOperation*)node;
|
||||
operation->determineResolution(resolution, preferredResolution);
|
||||
operation->setResolution(resolution);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputSocket::determineActualDataType() {
|
||||
void OutputSocket::determineActualDataType()
|
||||
{
|
||||
DataType actualDatatype = this->getNode()->determineActualDataType(this);
|
||||
|
||||
/** @todo: set the channel info needs to be moved after integration with OCIO */
|
||||
@@ -79,18 +84,21 @@ void OutputSocket::determineActualDataType() {
|
||||
this->fireActualDataType();
|
||||
}
|
||||
|
||||
void OutputSocket::addConnection(SocketConnection *connection) {
|
||||
void OutputSocket::addConnection(SocketConnection *connection)
|
||||
{
|
||||
this->connections.push_back(connection);
|
||||
}
|
||||
|
||||
void OutputSocket::fireActualDataType() {
|
||||
void OutputSocket::fireActualDataType()
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->connections.size();index ++) {
|
||||
SocketConnection *connection = this->connections[index];
|
||||
connection->getToSocket()->notifyActualInputType(this->getActualDataType());
|
||||
}
|
||||
}
|
||||
void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single) {
|
||||
void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
|
||||
{
|
||||
if (isConnected()) {
|
||||
if (single) {
|
||||
SocketConnection *connection = this->connections[0];
|
||||
@@ -111,28 +119,31 @@ void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
|
||||
}
|
||||
}
|
||||
}
|
||||
void OutputSocket::removeFirstConnection() {
|
||||
void OutputSocket::removeFirstConnection()
|
||||
{
|
||||
SocketConnection *connection = this->connections[0];
|
||||
InputSocket* inputSocket = connection->getToSocket();
|
||||
InputSocket *inputSocket = connection->getToSocket();
|
||||
if (inputSocket != NULL) {
|
||||
inputSocket->setConnection(NULL);
|
||||
}
|
||||
this->connections.erase(this->connections.begin());
|
||||
}
|
||||
|
||||
void OutputSocket::clearConnections() {
|
||||
void OutputSocket::clearConnections()
|
||||
{
|
||||
while (this->isConnected()) {
|
||||
removeFirstConnection();
|
||||
}
|
||||
}
|
||||
|
||||
WriteBufferOperation* OutputSocket::findAttachedWriteBufferOperation() const {
|
||||
WriteBufferOperation *OutputSocket::findAttachedWriteBufferOperation() const
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->connections.size();index++) {
|
||||
SocketConnection* connection = this->connections[index];
|
||||
NodeBase* node = connection->getToNode();
|
||||
SocketConnection *connection = this->connections[index];
|
||||
NodeBase *node = connection->getToNode();
|
||||
if (node->isOperation()) {
|
||||
NodeOperation* operation = (NodeOperation*)node;
|
||||
NodeOperation *operation = (NodeOperation*)node;
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
return (WriteBufferOperation*)operation;
|
||||
}
|
||||
@@ -141,7 +152,8 @@ WriteBufferOperation* OutputSocket::findAttachedWriteBufferOperation() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ChannelInfo* OutputSocket::getChannelInfo(const int channelnumber) {
|
||||
ChannelInfo *OutputSocket::getChannelInfo(const int channelnumber)
|
||||
{
|
||||
return &this->channelinfo[channelnumber];
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex);
|
||||
OutputSocket(OutputSocket * from);
|
||||
void addConnection(SocketConnection *connection);
|
||||
SocketConnection* getConnection(unsigned int index) {return this->connections[index];}
|
||||
SocketConnection *getConnection(unsigned int index) {return this->connections[index];}
|
||||
const int isConnected() const;
|
||||
int isOutputSocket() const;
|
||||
|
||||
@@ -90,8 +90,8 @@ public:
|
||||
* @brief find a connected write buffer operation to this OutputSocket
|
||||
* @return WriteBufferOperation or NULL
|
||||
*/
|
||||
WriteBufferOperation* findAttachedWriteBufferOperation() const;
|
||||
ChannelInfo* getChannelInfo(const int channelnumber);
|
||||
WriteBufferOperation *findAttachedWriteBufferOperation() const;
|
||||
ChannelInfo *getChannelInfo(const int channelnumber);
|
||||
|
||||
/**
|
||||
* @brief trigger determine actual data type to all connected sockets
|
||||
|
||||
@@ -24,14 +24,16 @@
|
||||
#include "COM_Node.h"
|
||||
#include "COM_SocketConnection.h"
|
||||
|
||||
Socket::Socket(DataType datatype) {
|
||||
Socket::Socket(DataType datatype)
|
||||
{
|
||||
this->datatype = datatype;
|
||||
this->actualType = COM_DT_UNKNOWN;
|
||||
this->editorSocket = NULL;
|
||||
this->node = NULL;
|
||||
}
|
||||
|
||||
DataType Socket::getDataType() const {
|
||||
DataType Socket::getDataType() const
|
||||
{
|
||||
return this->datatype;
|
||||
}
|
||||
|
||||
@@ -39,9 +41,10 @@ int Socket::isInputSocket() const { return false; }
|
||||
int Socket::isOutputSocket() const { return false; }
|
||||
const int Socket::isConnected() const {return false;}
|
||||
void Socket::setNode(NodeBase *node) {this->node = node;}
|
||||
NodeBase* Socket::getNode() const {return this->node;}
|
||||
NodeBase *Socket::getNode() const {return this->node;}
|
||||
|
||||
DataType Socket::getActualDataType() const {return this->actualType;}
|
||||
void Socket::setActualDataType(DataType actualType) {
|
||||
void Socket::setActualDataType(DataType actualType)
|
||||
{
|
||||
this->actualType = actualType;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
/**
|
||||
* Reference to the node where this Socket belongs to
|
||||
*/
|
||||
NodeBase* node;
|
||||
NodeBase *node;
|
||||
|
||||
/**
|
||||
* the datatype of this socket. Is used for automatically data transformation.
|
||||
@@ -63,13 +63,13 @@ private:
|
||||
*/
|
||||
DataType actualType;
|
||||
|
||||
bNodeSocket* editorSocket;
|
||||
bNodeSocket *editorSocket;
|
||||
public:
|
||||
Socket(DataType datatype);
|
||||
|
||||
DataType getDataType() const;
|
||||
void setNode(NodeBase* node);
|
||||
NodeBase* getNode() const;
|
||||
void setNode(NodeBase *node);
|
||||
NodeBase *getNode() const;
|
||||
|
||||
/**
|
||||
* @brief get the actual data type
|
||||
@@ -91,8 +91,8 @@ public:
|
||||
virtual void determineResolution(int resolution[], unsigned int preferredResolution[]) {}
|
||||
virtual void determineActualDataType() {}
|
||||
|
||||
void setEditorSocket(bNodeSocket* editorSocket) {this->editorSocket = editorSocket;}
|
||||
bNodeSocket* getbNodeSocket() const {return this->editorSocket;}
|
||||
void setEditorSocket(bNodeSocket *editorSocket) {this->editorSocket = editorSocket;}
|
||||
bNodeSocket *getbNodeSocket() const {return this->editorSocket;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -23,30 +23,34 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
SocketConnection::SocketConnection() {
|
||||
SocketConnection::SocketConnection()
|
||||
{
|
||||
this->fromSocket = NULL;
|
||||
this->toSocket = NULL;
|
||||
this->setIgnoreResizeCheck(false);
|
||||
}
|
||||
|
||||
void SocketConnection::setFromSocket(OutputSocket* fromsocket) {
|
||||
void SocketConnection::setFromSocket(OutputSocket *fromsocket)
|
||||
{
|
||||
if (fromsocket == NULL) {
|
||||
throw "ERROR";
|
||||
}
|
||||
this->fromSocket = fromsocket;
|
||||
}
|
||||
|
||||
OutputSocket* SocketConnection::getFromSocket() const {return this->fromSocket;}
|
||||
void SocketConnection::setToSocket(InputSocket* tosocket) {
|
||||
OutputSocket *SocketConnection::getFromSocket() const {return this->fromSocket;}
|
||||
void SocketConnection::setToSocket(InputSocket *tosocket)
|
||||
{
|
||||
if (tosocket == NULL) {
|
||||
throw "ERROR";
|
||||
}
|
||||
this->toSocket = tosocket;
|
||||
}
|
||||
|
||||
InputSocket* SocketConnection::getToSocket() const {return this->toSocket;}
|
||||
InputSocket *SocketConnection::getToSocket() const {return this->toSocket;}
|
||||
|
||||
NodeBase* SocketConnection::getFromNode() const {
|
||||
NodeBase *SocketConnection::getFromNode() const
|
||||
{
|
||||
if (this->getFromSocket() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -54,7 +58,8 @@ NodeBase* SocketConnection::getFromNode() const {
|
||||
return this->getFromSocket()->getNode();
|
||||
}
|
||||
}
|
||||
NodeBase* SocketConnection::getToNode() const {
|
||||
NodeBase *SocketConnection::getToNode() const
|
||||
{
|
||||
if (this->getToSocket() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -62,7 +67,8 @@ NodeBase* SocketConnection::getToNode() const {
|
||||
return this->getToSocket()->getNode();
|
||||
}
|
||||
}
|
||||
bool SocketConnection::isValid() const {
|
||||
bool SocketConnection::isValid() const
|
||||
{
|
||||
if ((this->getToSocket() != NULL && this->getFromSocket() != NULL)) {
|
||||
if (this->getFromNode()->isOperation() && this->getToNode()->isOperation()) {
|
||||
return true;
|
||||
@@ -71,10 +77,11 @@ bool SocketConnection::isValid() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SocketConnection::needsResolutionConversion() const {
|
||||
bool SocketConnection::needsResolutionConversion() const
|
||||
{
|
||||
if (this->ignoreResizeCheck) {return false;}
|
||||
NodeOperation* fromOperation = (NodeOperation*)this->getFromNode();
|
||||
NodeOperation* toOperation = (NodeOperation*)this->getToNode();
|
||||
NodeOperation *fromOperation = (NodeOperation*)this->getFromNode();
|
||||
NodeOperation *toOperation = (NodeOperation*)this->getToNode();
|
||||
if (this->toSocket->getResizeMode() == COM_SC_NO_RESIZE) {return false;}
|
||||
const unsigned int fromWidth = fromOperation->getWidth();
|
||||
const unsigned int fromHeight = fromOperation->getHeight();
|
||||
|
||||
@@ -66,25 +66,25 @@ public:
|
||||
* @brief set the startpoint of the connection
|
||||
* @param fromsocket
|
||||
*/
|
||||
void setFromSocket(OutputSocket* fromsocket);
|
||||
void setFromSocket(OutputSocket *fromsocket);
|
||||
|
||||
/**
|
||||
* @brief get the startpoint of the connection
|
||||
* @return from OutputSocket
|
||||
*/
|
||||
OutputSocket* getFromSocket() const;
|
||||
OutputSocket *getFromSocket() const;
|
||||
|
||||
/**
|
||||
* @brief set the endpoint of the connection
|
||||
* @param tosocket
|
||||
*/
|
||||
void setToSocket(InputSocket* tosocket);
|
||||
void setToSocket(InputSocket *tosocket);
|
||||
|
||||
/**
|
||||
* @brief get the endpoint of the connection
|
||||
* @return to InputSocket
|
||||
*/
|
||||
InputSocket* getToSocket() const;
|
||||
InputSocket *getToSocket() const;
|
||||
|
||||
/**
|
||||
* @brief check if this connection is valid
|
||||
|
||||
@@ -59,7 +59,7 @@ protected:
|
||||
* @param y the y-coordinate of the pixel to calculate in image space
|
||||
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
|
||||
*/
|
||||
virtual void executePixel(float* result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {}
|
||||
virtual void executePixel(float *result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {}
|
||||
|
||||
/**
|
||||
* @brief calculate a single pixel
|
||||
@@ -70,7 +70,7 @@ protected:
|
||||
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
|
||||
* @param chunkData chunk specific data a during execution time.
|
||||
*/
|
||||
virtual void executePixel(float* result, int x, int y, MemoryBuffer *inputBuffers[], void* chunkData) {
|
||||
virtual void executePixel(float *result, int x, int y, MemoryBuffer *inputBuffers[], void *chunkData) {
|
||||
executePixel(result, x, y, COM_PS_NEAREST, inputBuffers);
|
||||
}
|
||||
|
||||
@@ -84,26 +84,26 @@ protected:
|
||||
* @param dy
|
||||
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
|
||||
*/
|
||||
virtual void executePixel(float* result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {}
|
||||
virtual void executePixel(float *result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {}
|
||||
|
||||
public:
|
||||
inline void read(float* result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
inline void read(float *result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
executePixel(result, x, y, sampler, inputBuffers);
|
||||
}
|
||||
inline void read(float* result, int x, int y, MemoryBuffer *inputBuffers[], void* chunkData) {
|
||||
inline void read(float *result, int x, int y, MemoryBuffer *inputBuffers[], void *chunkData) {
|
||||
executePixel(result, x, y, inputBuffers, chunkData);
|
||||
}
|
||||
inline void read(float* result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {
|
||||
inline void read(float *result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {
|
||||
executePixel(result, x, y, dx, dy, inputBuffers);
|
||||
}
|
||||
|
||||
virtual void* initializeTileData(rcti *rect, MemoryBuffer** memoryBuffers) {
|
||||
virtual void *initializeTileData(rcti *rect, MemoryBuffer** memoryBuffers) {
|
||||
return 0;
|
||||
}
|
||||
virtual void deinitializeTileData(rcti *rect, MemoryBuffer** memoryBuffers, void* data) {
|
||||
virtual void deinitializeTileData(rcti *rect, MemoryBuffer** memoryBuffers, void *data) {
|
||||
}
|
||||
|
||||
virtual MemoryBuffer* getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return 0;}
|
||||
virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return 0;}
|
||||
|
||||
|
||||
inline const unsigned int getWidth() const {return this->width;}
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_WorkPackage.h"
|
||||
|
||||
WorkPackage::WorkPackage(ExecutionGroup *group, unsigned int chunkNumber) {
|
||||
WorkPackage::WorkPackage(ExecutionGroup *group, unsigned int chunkNumber)
|
||||
{
|
||||
this->executionGroup = group;
|
||||
this->chunkNumber = chunkNumber;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
/**
|
||||
* @brief executionGroup with the operations-setup to be evaluated
|
||||
*/
|
||||
ExecutionGroup* executionGroup;
|
||||
ExecutionGroup *executionGroup;
|
||||
|
||||
/**
|
||||
* @brief number of the chunk to be executed
|
||||
@@ -48,12 +48,12 @@ public:
|
||||
* @param group the ExecutionGroup
|
||||
* @param chunkNumber the number of the chunk
|
||||
*/
|
||||
WorkPackage(ExecutionGroup* group, unsigned int chunkNumber);
|
||||
WorkPackage(ExecutionGroup *group, unsigned int chunkNumber);
|
||||
|
||||
/**
|
||||
* @brief get the ExecutionGroup
|
||||
*/
|
||||
ExecutionGroup* getExecutionGroup() const {return this->executionGroup;}
|
||||
ExecutionGroup *getExecutionGroup() const {return this->executionGroup;}
|
||||
|
||||
/**
|
||||
* @brief get the number of the chunk
|
||||
|
||||
@@ -65,14 +65,15 @@ static bool openclActive = false;
|
||||
|
||||
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
void* WorkScheduler::thread_execute_cpu(void* data) {
|
||||
void *WorkScheduler::thread_execute_cpu(void *data)
|
||||
{
|
||||
bool continueLoop = true;
|
||||
Device* device = (Device*)data;
|
||||
Device *device = (Device*)data;
|
||||
while (continueLoop) {
|
||||
WorkPackage* work = (WorkPackage*)BLI_thread_queue_pop(cpuqueue);
|
||||
WorkPackage *work = (WorkPackage*)BLI_thread_queue_pop(cpuqueue);
|
||||
if (work) {
|
||||
device->execute(work);
|
||||
delete work;
|
||||
device->execute(work);
|
||||
delete work;
|
||||
}
|
||||
PIL_sleep_ms(10);
|
||||
|
||||
@@ -83,11 +84,12 @@ void* WorkScheduler::thread_execute_cpu(void* data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* WorkScheduler::thread_execute_gpu(void* data) {
|
||||
void *WorkScheduler::thread_execute_gpu(void *data)
|
||||
{
|
||||
bool continueLoop = true;
|
||||
Device* device = (Device*)data;
|
||||
Device *device = (Device*)data;
|
||||
while (continueLoop) {
|
||||
WorkPackage* work = (WorkPackage*)BLI_thread_queue_pop(gpuqueue);
|
||||
WorkPackage *work = (WorkPackage*)BLI_thread_queue_pop(gpuqueue);
|
||||
if (work) {
|
||||
device->execute(work);
|
||||
delete work;
|
||||
@@ -106,8 +108,9 @@ bool WorkScheduler::isStopping() {return state == COM_WSS_STOPPING;}
|
||||
|
||||
|
||||
|
||||
void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber) {
|
||||
WorkPackage* package = new WorkPackage(group, chunkNumber);
|
||||
void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber)
|
||||
{
|
||||
WorkPackage *package = new WorkPackage(group, chunkNumber);
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
|
||||
CPUDevice device;
|
||||
device.execute(package);
|
||||
@@ -126,14 +129,15 @@ void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorkScheduler::start(CompositorContext &context) {
|
||||
void WorkScheduler::start(CompositorContext &context)
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
unsigned int index;
|
||||
cpuqueue = BLI_thread_queue_init();
|
||||
BLI_thread_queue_nowait(cpuqueue);
|
||||
BLI_init_threads(&cputhreads, thread_execute_cpu, cpudevices.size());
|
||||
for (index = 0 ; index < cpudevices.size() ; index ++) {
|
||||
Device* device = cpudevices[index];
|
||||
Device *device = cpudevices[index];
|
||||
BLI_insert_thread(&cputhreads, device);
|
||||
}
|
||||
#ifdef COM_OPENCL_ENABLED
|
||||
@@ -142,7 +146,7 @@ void WorkScheduler::start(CompositorContext &context) {
|
||||
BLI_thread_queue_nowait(gpuqueue);
|
||||
BLI_init_threads(&gputhreads, thread_execute_gpu, gpudevices.size());
|
||||
for (index = 0 ; index < gpudevices.size() ; index ++) {
|
||||
Device* device = gpudevices[index];
|
||||
Device *device = gpudevices[index];
|
||||
BLI_insert_thread(&gputhreads, device);
|
||||
}
|
||||
openclActive = true;
|
||||
@@ -154,7 +158,8 @@ void WorkScheduler::start(CompositorContext &context) {
|
||||
#endif
|
||||
state = COM_WSS_STARTED;
|
||||
}
|
||||
void WorkScheduler::finish() {
|
||||
void WorkScheduler::finish()
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
#ifdef COM_OPENCL_ENABLED
|
||||
if (openclActive) {
|
||||
@@ -174,7 +179,8 @@ void WorkScheduler::finish() {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
void WorkScheduler::stop() {
|
||||
void WorkScheduler::stop()
|
||||
{
|
||||
state = COM_WSS_STOPPING;
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
BLI_end_threads(&cputhreads);
|
||||
@@ -191,7 +197,8 @@ void WorkScheduler::stop() {
|
||||
state = COM_WSS_STOPPED;
|
||||
}
|
||||
|
||||
bool WorkScheduler::hasGPUDevices() {
|
||||
bool WorkScheduler::hasGPUDevices()
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
#ifdef COM_OPENCL_ENABLED
|
||||
return gpudevices.size()>0;
|
||||
@@ -203,11 +210,13 @@ bool WorkScheduler::hasGPUDevices() {
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data) {
|
||||
extern void clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data)
|
||||
{
|
||||
printf("OPENCL error: %s\n", errinfo);
|
||||
}
|
||||
|
||||
void WorkScheduler::initialize() {
|
||||
void WorkScheduler::initialize()
|
||||
{
|
||||
state = COM_WSS_UNKNOWN;
|
||||
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
@@ -257,7 +266,7 @@ void WorkScheduler::initialize() {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
char* build_log = new char[ret_val_size+1];
|
||||
char *build_log = new char[ret_val_size+1];
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
build_log[ret_val_size] = '\0';
|
||||
@@ -268,7 +277,7 @@ void WorkScheduler::initialize() {
|
||||
unsigned int indexDevices;
|
||||
for (indexDevices = 0 ; indexDevices < totalNumberOfDevices ; indexDevices ++) {
|
||||
cl_device_id device = cldevices[indexDevices];
|
||||
OpenCLDevice* clDevice = new OpenCLDevice(context, device, program);
|
||||
OpenCLDevice *clDevice = new OpenCLDevice(context, device, program);
|
||||
clDevice->initialize(),
|
||||
gpudevices.push_back(clDevice);
|
||||
char resultString[32];
|
||||
@@ -286,9 +295,10 @@ void WorkScheduler::initialize() {
|
||||
state = COM_WSS_INITIALIZED;
|
||||
}
|
||||
|
||||
void WorkScheduler::deinitialize() {
|
||||
void WorkScheduler::deinitialize()
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
Device* device;
|
||||
Device *device;
|
||||
while (cpudevices.size()>0) {
|
||||
device = cpudevices.back();
|
||||
cpudevices.pop_back();
|
||||
|
||||
@@ -59,13 +59,13 @@ class WorkScheduler {
|
||||
* @brief main thread loop for cpudevices
|
||||
* inside this loop new work is queried and being executed
|
||||
*/
|
||||
static void* thread_execute_cpu(void* data);
|
||||
static void *thread_execute_cpu(void *data);
|
||||
|
||||
/**
|
||||
* @brief main thread loop for gpudevices
|
||||
* inside this loop new work is queried and being executed
|
||||
*/
|
||||
static void* thread_execute_gpu(void* data);
|
||||
static void *thread_execute_gpu(void *data);
|
||||
#endif
|
||||
public:
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
* @param group the execution group
|
||||
* @param chunkNumber the number of the chunk in the group to be executed
|
||||
*/
|
||||
static void schedule(ExecutionGroup* group, int chunkNumber);
|
||||
static void schedule(ExecutionGroup *group, int chunkNumber);
|
||||
|
||||
/**
|
||||
* @brief initialize the WorkScheduler
|
||||
|
||||
@@ -31,7 +31,8 @@ extern "C" {
|
||||
#include "COM_WorkScheduler.h"
|
||||
|
||||
static ThreadMutex *compositorMutex;
|
||||
void COM_execute(bNodeTree *editingtree, int rendering) {
|
||||
void COM_execute(bNodeTree *editingtree, int rendering)
|
||||
{
|
||||
if (compositorMutex == NULL) { /// TODO: move to blender startup phase
|
||||
compositorMutex = new ThreadMutex();
|
||||
BLI_mutex_init(compositorMutex);
|
||||
@@ -51,7 +52,7 @@ void COM_execute(bNodeTree *editingtree, int rendering) {
|
||||
editingtree->stats_draw(editingtree->sdh, (char*)"Compositing");
|
||||
|
||||
/* initialize execution system */
|
||||
ExecutionSystem* system = new ExecutionSystem(editingtree, rendering);
|
||||
ExecutionSystem *system = new ExecutionSystem(editingtree, rendering);
|
||||
system->execute();
|
||||
delete system;
|
||||
|
||||
|
||||
@@ -31,15 +31,16 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *valueSocket = this->getInputSocket(0);
|
||||
InputSocket *color1Socket = this->getInputSocket(1);
|
||||
InputSocket *color2Socket = this->getInputSocket(2);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
MixBaseOperation *convertProg;
|
||||
NodeTwoFloats *ntf= (NodeTwoFloats*)editorNode->storage;
|
||||
NodeTwoFloats *ntf = (NodeTwoFloats*)editorNode->storage;
|
||||
if (ntf->x!= 0.0f) {
|
||||
AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation();
|
||||
mixOperation->setX(ntf->x);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
class AlphaOverNode: public Node {
|
||||
public:
|
||||
AlphaOverNode(bNode* editorNode) :Node(editorNode) {}
|
||||
AlphaOverNode(bNode *editorNode) :Node(editorNode) {}
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_BilateralBlurOperation.h"
|
||||
|
||||
BilateralBlurNode::BilateralBlurNode(bNode *editorNode): Node(editorNode) {
|
||||
BilateralBlurNode::BilateralBlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NodeBilateralBlurData *data = (NodeBilateralBlurData*)this->getbNode()->storage;
|
||||
BilateralBlurOperation *operation = new BilateralBlurOperation();
|
||||
operation->setQuality(context->getQuality());
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class BilateralBlurNode: public Node {
|
||||
public:
|
||||
BilateralBlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,11 +29,13 @@
|
||||
#include "COM_GaussianBokehBlurOperation.h"
|
||||
#include "COM_FastGaussianBlurOperation.h"
|
||||
|
||||
BlurNode::BlurNode(bNode *editorNode): Node(editorNode) {
|
||||
BlurNode::BlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* editorNode = this->getbNode();
|
||||
void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeBlurData * data = (NodeBlurData*)editorNode->storage;
|
||||
#if 0
|
||||
const bNodeSocket *sock = this->getInputSocket(1)->getbNodeSocket();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
class BlurNode: public Node {
|
||||
public:
|
||||
BlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,11 +30,13 @@
|
||||
#include "COM_VariableSizeBokehBlurOperation.h"
|
||||
#include "COM_ConvertDepthToRadiusOperation.h"
|
||||
|
||||
BokehBlurNode::BokehBlurNode(bNode *editorNode): Node(editorNode) {
|
||||
BokehBlurNode::BokehBlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
Object* camob = context->getScene()->camera;
|
||||
void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
Object *camob = context->getScene()->camera;
|
||||
|
||||
if (this->getInputSocket(2)->isConnected()) {
|
||||
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
class BokehBlurNode: public Node {
|
||||
public:
|
||||
BokehBlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_BokehImageOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
BokehImageNode::BokehImageNode(bNode *editorNode): Node(editorNode) {
|
||||
BokehImageNode::BokehImageNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
BokehImageOperation *operation = new BokehImageOperation();
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
graph->addOperation(operation);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class BokehImageNode: public Node {
|
||||
public:
|
||||
BokehImageNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_BoxMaskOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
BoxMaskNode::BoxMaskNode(bNode *editorNode): Node(editorNode) {
|
||||
BoxMaskNode::BoxMaskNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BoxMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BoxMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
BoxMaskOperation *operation;
|
||||
operation = new BoxMaskOperation();
|
||||
operation->setData((NodeBoxMask*)this->getbNode()->storage);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class BoxMaskNode: public Node {
|
||||
public:
|
||||
BoxMaskNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_BrightnessOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
BrightnessNode::BrightnessNode(bNode *editorNode): Node(editorNode) {
|
||||
BrightnessNode::BrightnessNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
/// @todo: add anti alias when not FSA
|
||||
void BrightnessNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BrightnessNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
BrightnessOperation *operation = new BrightnessOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0));
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class BrightnessNode: public Node {
|
||||
public:
|
||||
BrightnessNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,13 +30,14 @@
|
||||
ChannelMatteNode::ChannelMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
|
||||
|
||||
NodeOperation *convert=NULL;
|
||||
bNode* node = this->getbNode();
|
||||
bNode *node = this->getbNode();
|
||||
|
||||
/* colorspace */
|
||||
switch (node->custom1) {
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
ChromaMatteNode::ChromaMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketKey = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
@@ -40,7 +41,7 @@ void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
operationRGBToYCC_Key->setMode(0); /* BLI_YCC_ITU_BT601 */
|
||||
|
||||
ChromaMatteOperation *operation = new ChromaMatteOperation();
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
operation->setSettings((NodeChroma*)editorsnode->storage);
|
||||
|
||||
inputSocketImage->relinkConnections(operationRGBToYCC_Image->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -27,19 +27,20 @@
|
||||
#include "BKE_node.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
ColorBalanceNode::ColorBalanceNode(bNode* editorNode): Node(editorNode)
|
||||
ColorBalanceNode::ColorBalanceNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputImageSocket = this->getInputSocket(1);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
|
||||
bNode* node = this->getbNode();
|
||||
NodeColorBalance *n= (NodeColorBalance *)node->storage;
|
||||
bNode *node = this->getbNode();
|
||||
NodeColorBalance *n = (NodeColorBalance *)node->storage;
|
||||
NodeOperation*operation;
|
||||
if (node->custom1 == 0) {
|
||||
ColorBalanceLGGOperation* operationLGG = new ColorBalanceLGGOperation();
|
||||
ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
class ColorBalanceNode : public Node
|
||||
{
|
||||
public:
|
||||
ColorBalanceNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
ColorBalanceNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
|
||||
};
|
||||
|
||||
#endif // COM_ColorBalanceNODE_H
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include "COM_ColorCorrectionOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode): Node(editorNode) {
|
||||
ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColorCorrectionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorCorrectionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
ColorCorrectionOperation *operation = new ColorCorrectionOperation();
|
||||
bNode* editorNode = getbNode();
|
||||
bNode *editorNode = getbNode();
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0),true, 0, graph);
|
||||
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1),true, 1, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class ColorCorrectionNode: public Node {
|
||||
public:
|
||||
ColorCorrectionNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_ColorCurveOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColorCurveNode::ColorCurveNode(bNode *editorNode): Node(editorNode) {
|
||||
ColorCurveNode::ColorCurveNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
ColorCurveOperation *operation = new ColorCurveOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class ColorCurveNode: public Node {
|
||||
public:
|
||||
ColorCurveNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
ColorMatteNode::ColorMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketKey = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
@@ -38,7 +39,7 @@ void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorConte
|
||||
ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation();
|
||||
|
||||
ColorMatteOperation *operation = new ColorMatteOperation();
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
operation->setSettings((NodeChroma*)editorsnode->storage);
|
||||
|
||||
inputSocketImage->relinkConnections(operationRGBToHSV_Image->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include "COM_SetColorOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColorNode::ColorNode(bNode *editorNode): Node(editorNode) {
|
||||
ColorNode::ColorNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
bNodeSocket* socket = this->getEditorOutputSocket(0);
|
||||
bNodeSocket *socket = this->getEditorOutputSocket(0);
|
||||
bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)socket->default_value;
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
|
||||
operation->setChannels(dval->value);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class ColorNode: public Node {
|
||||
public:
|
||||
ColorNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,16 +27,17 @@
|
||||
#include "COM_SeparateChannelOperation.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
ColorRampNode::ColorRampNode(bNode* editorNode): Node(editorNode)
|
||||
ColorRampNode::ColorRampNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketAlpha = this->getOutputSocket(1);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
ColorRampOperation * operation = new ColorRampOperation();
|
||||
ColorRampOperation *operation = new ColorRampOperation();
|
||||
outputSocket->relinkConnections(operation->getOutputSocket(0));
|
||||
if (outputSocketAlpha->isConnected()) {
|
||||
SeparateChannelOperation *operation2 = new SeparateChannelOperation();
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
class ColorRampNode : public Node
|
||||
{
|
||||
public:
|
||||
ColorRampNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
ColorRampNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif // COM_ColorRampNODE_H
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
ColorSpillNode::ColorSpillNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketFac = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
|
||||
|
||||
ColorSpillOperation *operation;
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_ConvertColorToBWOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColourToBWNode::ColourToBWNode(bNode *editorNode): Node(editorNode) {
|
||||
ColourToBWNode::ColourToBWNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *colourSocket = this->getInputSocket(0);
|
||||
OutputSocket *valueSocket = this->getOutputSocket(0);
|
||||
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ConvertHSVToRGBOperation.h"
|
||||
|
||||
CombineHSVANode::CombineHSVANode(bNode *editorNode): CombineRGBANode(editorNode) {
|
||||
CombineHSVANode::CombineHSVANode(bNode *editorNode): CombineRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CombineHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void CombineHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
ConvertHSVToRGBOperation *operation = new ConvertHSVToRGBOperation();
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
if (outputSocket->isConnected()) {
|
||||
|
||||
@@ -29,11 +29,13 @@
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
|
||||
CombineRGBANode::CombineRGBANode(bNode *editorNode): Node(editorNode) {
|
||||
CombineRGBANode::CombineRGBANode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputRSocket = this->getInputSocket(0);
|
||||
InputSocket *inputGSocket = this->getInputSocket(1);
|
||||
InputSocket *inputBSocket = this->getInputSocket(2);
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
#include "COM_CombineYCCANode.h"
|
||||
#include "COM_ConvertYCCToRGBOperation.h"
|
||||
|
||||
CombineYCCANode::CombineYCCANode(bNode *editorNode): CombineRGBANode(editorNode) {
|
||||
CombineYCCANode::CombineYCCANode(bNode *editorNode): CombineRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation();
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
#include "COM_CombineYUVANode.h"
|
||||
#include "COM_ConvertYUVToRGBOperation.h"
|
||||
|
||||
CombineYUVANode::CombineYUVANode(bNode *editorNode): CombineRGBANode(editorNode) {
|
||||
CombineYUVANode::CombineYUVANode(bNode *editorNode): CombineRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CombineYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void CombineYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
ConvertYUVToRGBOperation *operation = new ConvertYUVToRGBOperation();
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
if (outputSocket->isConnected()) {
|
||||
|
||||
@@ -24,10 +24,12 @@
|
||||
#include "COM_CompositorOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
CompositorNode::CompositorNode(bNode *editorNode): Node(editorNode) {
|
||||
CompositorNode::CompositorNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *imageSocket = this->getInputSocket(0);
|
||||
InputSocket *alphaSocket = this->getInputSocket(1);
|
||||
if (imageSocket->isConnected()) {
|
||||
|
||||
@@ -24,9 +24,10 @@
|
||||
#include "COM_ConvertKeyToPremulOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
NodeOperation* operation = NULL;
|
||||
bNode* node = this->getbNode();
|
||||
void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NodeOperation *operation = NULL;
|
||||
bNode *node = this->getbNode();
|
||||
|
||||
/* value hardcoded in rna_nodetree.c */
|
||||
if (node->custom1 == 1) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
class ConvertAlphaNode: public Node {
|
||||
public:
|
||||
ConvertAlphaNode(bNode* editorNode) :Node(editorNode) {}
|
||||
ConvertAlphaNode(bNode *editorNode) :Node(editorNode) {}
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
|
||||
@@ -24,11 +24,13 @@
|
||||
#include "COM_CropOperation.h"
|
||||
|
||||
|
||||
CropNode::CropNode(bNode *editorNode) : Node(editorNode) {
|
||||
CropNode::CropNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* node = getbNode();
|
||||
void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *node = getbNode();
|
||||
NodeTwoXYs *cropSettings = (NodeTwoXYs*)node->storage;
|
||||
bool relative = (bool)node->custom2;
|
||||
bool cropImage = (bool)node->custom1;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class CropNode: public Node {
|
||||
public:
|
||||
CropNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,16 +33,18 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_GammaCorrectOperation.h"
|
||||
|
||||
DefocusNode::DefocusNode(bNode *editorNode): Node(editorNode) {
|
||||
DefocusNode::DefocusNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
Scene *scene= (Scene*)node->id;
|
||||
Object* camob = (scene)? scene->camera: NULL;
|
||||
Scene *scene = (Scene*)node->id;
|
||||
Object *camob = (scene)? scene->camera: NULL;
|
||||
NodeDefocus *data = (NodeDefocus*)node->storage;
|
||||
|
||||
NodeOperation* radiusOperation;
|
||||
NodeOperation *radiusOperation;
|
||||
if (data->no_zbuf) {
|
||||
MathMultiplyOperation *multiply = new MathMultiplyOperation();
|
||||
SetValueOperation *multiplier = new SetValueOperation();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
class DefocusNode: public Node {
|
||||
public:
|
||||
DefocusNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,15 +25,16 @@
|
||||
#include "COM_DifferenceMatteOperation.h"
|
||||
#include "COM_SetAlphaOperation.h"
|
||||
|
||||
DifferenceMatteNode::DifferenceMatteNode(bNode* editorNode): Node(editorNode)
|
||||
DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputSocket2 = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
DifferenceMatteOperation * operationSet = new DifferenceMatteOperation();
|
||||
operationSet->setSettings((NodeChroma*)editorNode->storage);
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
class DifferenceMatteNode : public Node
|
||||
{
|
||||
public:
|
||||
DifferenceMatteNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
DifferenceMatteNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif // COM_DifferenceMatteNODE_H
|
||||
|
||||
@@ -27,11 +27,13 @@
|
||||
#include "COM_AntiAliasOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
DilateErodeNode::DilateErodeNode(bNode *editorNode): Node(editorNode) {
|
||||
DilateErodeNode::DilateErodeNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* editorNode = this->getbNode();
|
||||
void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
DilateErodeOperation *operation = new DilateErodeOperation();
|
||||
operation->setDistance(editorNode->custom2);
|
||||
operation->setInset(2.0f);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class DilateErodeNode: public Node {
|
||||
public:
|
||||
DilateErodeNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_DirectionalBlurOperation.h"
|
||||
|
||||
DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode): Node(editorNode) {
|
||||
DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NodeDBlurData *data = (NodeDBlurData*)this->getbNode()->storage;
|
||||
DirectionalBlurOperation *operation = new DirectionalBlurOperation();
|
||||
operation->setQuality(context->getQuality());
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class DirectionalBlurNode: public Node {
|
||||
public:
|
||||
DirectionalBlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include "COM_DisplaceSimpleOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
DisplaceNode::DisplaceNode(bNode *editorNode): Node(editorNode) {
|
||||
DisplaceNode::DisplaceNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplaceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
|
||||
@@ -27,14 +27,15 @@
|
||||
DistanceMatteNode::DistanceMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketKey = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
|
||||
|
||||
DistanceMatteOperation *operation = new DistanceMatteOperation();
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
operation->setSettings((NodeChroma*)editorsnode->storage);
|
||||
|
||||
inputSocketImage->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode): Node(editorNode) {
|
||||
DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
DoubleEdgeMaskOperation *operation;
|
||||
bNode* bnode = this->getbNode();
|
||||
bNode *bnode = this->getbNode();
|
||||
|
||||
operation = new DoubleEdgeMaskOperation();
|
||||
operation->setAdjecentOnly(bnode->custom1);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class DoubleEdgeMaskNode: public Node {
|
||||
public:
|
||||
DoubleEdgeMaskNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_EllipseMaskOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
EllipseMaskNode::EllipseMaskNode(bNode *editorNode): Node(editorNode) {
|
||||
EllipseMaskNode::EllipseMaskNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void EllipseMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void EllipseMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
EllipseMaskOperation *operation;
|
||||
operation = new EllipseMaskOperation();
|
||||
operation->setData((NodeEllipseMask*)this->getbNode()->storage);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class EllipseMaskNode: public Node {
|
||||
public:
|
||||
EllipseMaskNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,11 +27,12 @@
|
||||
#include "BKE_node.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
FilterNode::FilterNode(bNode* editorNode): Node(editorNode)
|
||||
FilterNode::FilterNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputImageSocket = this->getInputSocket(1);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
class FilterNode : public Node
|
||||
{
|
||||
public:
|
||||
FilterNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
FilterNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif // COM_FILTERNODE_H
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_FlipOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
FlipNode::FlipNode(bNode *editorNode) : Node(editorNode) {
|
||||
FlipNode::FlipNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
FlipOperation *operation = new FlipOperation();
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class FlipNode: public Node {
|
||||
public:
|
||||
FlipNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_GammaOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
GammaNode::GammaNode(bNode *editorNode): Node(editorNode) {
|
||||
GammaNode::GammaNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void GammaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void GammaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
GammaOperation *operation = new GammaOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class GammaNode: public Node {
|
||||
public:
|
||||
GammaNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,12 +30,14 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
GlareNode::GlareNode(bNode *editorNode): Node(editorNode) {
|
||||
GlareNode::GlareNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
bNode* node = this->getbNode();
|
||||
NodeGlare* glare = (NodeGlare*)node->storage;
|
||||
void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)\
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
NodeGlare *glare = (NodeGlare*)node->storage;
|
||||
|
||||
switch (glare->type) {
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class GlareNode: public Node {
|
||||
public:
|
||||
GlareNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,13 +24,16 @@
|
||||
#include "COM_SocketProxyNode.h"
|
||||
#include "COM_ExecutionSystemHelper.h"
|
||||
|
||||
GroupNode::GroupNode(bNode *editorNode): Node(editorNode) {
|
||||
GroupNode::GroupNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
}
|
||||
|
||||
void GroupNode::ungroup(ExecutionSystem &system) {
|
||||
void GroupNode::ungroup(ExecutionSystem &system)
|
||||
{
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
vector<OutputSocket*> &outputsockets = this->getOutputSockets();
|
||||
unsigned int index;
|
||||
@@ -65,6 +68,6 @@ void GroupNode::ungroup(ExecutionSystem &system) {
|
||||
}
|
||||
}
|
||||
|
||||
bNodeTree* subtree = (bNodeTree*)this->getbNode()->id;
|
||||
bNodeTree *subtree = (bNodeTree*)this->getbNode()->id;
|
||||
ExecutionSystemHelper::addbNodeTree(system, nodes_start, subtree);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
class GroupNode: public Node {
|
||||
public:
|
||||
GroupNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
|
||||
/**
|
||||
* @brief check if this node a group node.
|
||||
|
||||
@@ -33,14 +33,16 @@
|
||||
#include "DNA_node_types.h"
|
||||
#include "COM_HueSaturationValueCorrectOperation.h"
|
||||
|
||||
HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode): Node(editorNode) {
|
||||
HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *valueSocket = this->getInputSocket(0);
|
||||
InputSocket *colourSocket = this->getInputSocket(1);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
CurveMapping *storage = (CurveMapping*)editorsnode->storage;
|
||||
|
||||
if (colourSocket->isConnected() && outputSocket->isConnected()) {
|
||||
|
||||
@@ -32,14 +32,16 @@
|
||||
#include "COM_ChangeHSVOperation.h"
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode): Node(editorNode) {
|
||||
HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *valueSocket = this->getInputSocket(0);
|
||||
InputSocket *colourSocket = this->getInputSocket(1);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
NodeHueSat *storage = (NodeHueSat*)editorsnode->storage;
|
||||
|
||||
ConvertRGBToHSVOperation * rgbToHSV = new ConvertRGBToHSVOperation();
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_AntiAliasOperation.h"
|
||||
|
||||
IDMaskNode::IDMaskNode(bNode *editorNode): Node(editorNode) {
|
||||
IDMaskNode::IDMaskNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
void IDMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* bnode = this->getbNode();
|
||||
void IDMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *bnode = this->getbNode();
|
||||
IDMaskOperation *operation;
|
||||
operation = new IDMaskOperation();
|
||||
operation->setObjectIndex(bnode->custom1);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class IDMaskNode: public Node {
|
||||
public:
|
||||
IDMaskNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
#include "BKE_node.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
ImageNode::ImageNode(bNode *editorNode): Node(editorNode) {
|
||||
ImageNode::ImageNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
NodeOperation* ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer* rl, Image* image, ImageUser* user, int framenumber, int outputsocketIndex, int pass, DataType datatype) {
|
||||
NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int pass, DataType datatype)
|
||||
{
|
||||
OutputSocket *outputSocket = this->getOutputSocket(outputsocketIndex);
|
||||
MultilayerBaseOperation * operation = NULL;
|
||||
switch (datatype) {
|
||||
@@ -55,7 +57,8 @@ NodeOperation* ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer
|
||||
return operation;
|
||||
}
|
||||
|
||||
void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
/// Image output
|
||||
OutputSocket *outputImage = this->getOutputSocket(0);
|
||||
bNode *editorNode = this->getbNode();
|
||||
@@ -77,7 +80,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
|
||||
NodeImageLayer *storage = (NodeImageLayer*)bnodeSocket->storage;
|
||||
int passindex = storage->pass_index;
|
||||
int layerindex = storage->layer_index;
|
||||
RenderLayer *rl= (RenderLayer*)BLI_findlink(&image->rr->layers, layerindex);
|
||||
RenderLayer *rl = (RenderLayer*)BLI_findlink(&image->rr->layers, layerindex);
|
||||
if (rl) {
|
||||
|
||||
RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
|
||||
|
||||
@@ -36,9 +36,9 @@ extern "C" {
|
||||
class ImageNode : public Node {
|
||||
|
||||
private:
|
||||
NodeOperation* doMultilayerCheck(ExecutionSystem *system, RenderLayer* rl, Image* image, ImageUser* user, int framenumber, int outputsocketIndex, int pass, DataType datatype);
|
||||
NodeOperation *doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int pass, DataType datatype);
|
||||
public:
|
||||
ImageNode(bNode* editorNode);
|
||||
ImageNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
|
||||
};
|
||||
|
||||
@@ -26,12 +26,14 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "BKE_node.h"
|
||||
|
||||
InvertNode::InvertNode(bNode *editorNode): Node(editorNode) {
|
||||
InvertNode::InvertNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void InvertNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void InvertNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InvertOperation *operation = new InvertOperation();
|
||||
bNode* node = this->getbNode();
|
||||
bNode *node = this->getbNode();
|
||||
operation->setColor(node->custom1 & CMP_CHAN_RGB);
|
||||
operation->setAlpha(node->custom1 & CMP_CHAN_A);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class InvertNode: public Node {
|
||||
public:
|
||||
InvertNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
#include "COM_ProjectorLensDistortionOperation.h"
|
||||
#include "COM_ScreenLensDistortionOperation.h"
|
||||
|
||||
LensDistortionNode::LensDistortionNode(bNode *editorNode): Node(editorNode) {
|
||||
LensDistortionNode::LensDistortionNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* editorNode = this->getbNode();
|
||||
void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeLensDist * data = (NodeLensDist*)editorNode->storage;
|
||||
if (data->proj) {
|
||||
ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation();
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class LensDistortionNode: public Node {
|
||||
public:
|
||||
LensDistortionNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,14 +28,15 @@
|
||||
LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void LuminanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void LuminanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
|
||||
|
||||
ConvertRGBToYUVOperation *rgbToYUV = new ConvertRGBToYUVOperation();
|
||||
LuminanceMatteOperation *operationSet = new LuminanceMatteOperation();
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
operationSet->setSettings((NodeChroma*)editorsnode->storage);
|
||||
|
||||
inputSocket->relinkConnections(rgbToYUV->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -23,17 +23,19 @@
|
||||
#include "COM_MapUVOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
MapUVNode::MapUVNode(bNode *editorNode): Node(editorNode) {
|
||||
MapUVNode::MapUVNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void MapUVNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void MapUVNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
MapUVOperation *operation = new MapUVOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
|
||||
|
||||
bNode* node = this->getbNode();
|
||||
bNode *node = this->getbNode();
|
||||
operation->setAlpha((float)node->custom1);
|
||||
operation->setResolutionInputSocketIndex(1);
|
||||
|
||||
|
||||
@@ -25,13 +25,15 @@
|
||||
#include "COM_MapValueOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
MapValueNode::MapValueNode(bNode *editorNode): Node(editorNode) {
|
||||
MapValueNode::MapValueNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void MapValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void MapValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *colourSocket = this->getInputSocket(0);
|
||||
OutputSocket *valueSocket = this->getOutputSocket(0);
|
||||
TexMapping* storage = (TexMapping*)this->getbNode()->storage;
|
||||
TexMapping *storage = (TexMapping*)this->getbNode()->storage;
|
||||
MapValueOperation *convertProg = new MapValueOperation();
|
||||
convertProg->setSettings(storage);
|
||||
colourSocket->relinkConnections(convertProg->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
#include "COM_MathBaseOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
MathBaseOperation* operation=NULL;
|
||||
void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
MathBaseOperation *operation=NULL;
|
||||
|
||||
switch (this->getbNode()->custom1)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
class MathNode: public Node {
|
||||
public:
|
||||
MathNode(bNode* editorNode) :Node(editorNode) {}
|
||||
MathNode(bNode *editorNode) :Node(editorNode) {}
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
|
||||
@@ -46,16 +46,18 @@
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
|
||||
MixNode::MixNode(bNode *editorNode): Node(editorNode) {
|
||||
MixNode::MixNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *valueSocket = this->getInputSocket(0);
|
||||
InputSocket *color1Socket = this->getInputSocket(1);
|
||||
InputSocket *color2Socket = this->getInputSocket(2);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
MixBaseOperation *convertProg;
|
||||
|
||||
|
||||
@@ -32,10 +32,12 @@ extern "C" {
|
||||
#include "BKE_tracking.h"
|
||||
}
|
||||
|
||||
MovieClipNode::MovieClipNode(bNode *editorNode): Node(editorNode) {
|
||||
MovieClipNode::MovieClipNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
OutputSocket *outputMovieClip = this->getOutputSocket(0);
|
||||
OutputSocket *offsetXMovieClip = this->getOutputSocket(1);
|
||||
OutputSocket *offsetYMovieClip = this->getOutputSocket(2);
|
||||
@@ -46,7 +48,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
|
||||
MovieClip *movieClip = (MovieClip*)editorNode->id;
|
||||
MovieClipUser *movieClipUser = (MovieClipUser*)editorNode->storage;
|
||||
|
||||
ImBuf * ibuf= NULL;
|
||||
ImBuf * ibuf = NULL;
|
||||
if (movieClip) {
|
||||
ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser);
|
||||
}
|
||||
@@ -79,7 +81,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
|
||||
operation->setFramenumber(context->getFramenumber());
|
||||
graph->addOperation(operation);
|
||||
|
||||
MovieTrackingStabilization *stab= &movieClip->tracking.stabilization;
|
||||
MovieTrackingStabilization *stab = &movieClip->tracking.stabilization;
|
||||
float loc[2], scale, angle;
|
||||
loc[0] = 0.0f;
|
||||
loc[1] = 0.0f;
|
||||
|
||||
@@ -31,7 +31,7 @@ class MovieClipNode : public Node {
|
||||
|
||||
|
||||
public:
|
||||
MovieClipNode(bNode* editorNode);
|
||||
MovieClipNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
|
||||
};
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
|
||||
MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode) {
|
||||
MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void MovieDistortionNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
void MovieDistortionNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
bNode* bnode = this->getbNode();
|
||||
bNode *bnode = this->getbNode();
|
||||
MovieClip * clip = (MovieClip*)bnode->id;
|
||||
|
||||
MovieDistortionOperation * operation = new MovieDistortionOperation(bnode->custom1 == 1);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class MovieDistortionNode: public Node {
|
||||
public:
|
||||
MovieDistortionNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
#include "COM_SetVectorOperation.h"
|
||||
#include "COM_SetColorOperation.h"
|
||||
|
||||
MuteNode::MuteNode(bNode *editorNode): Node(editorNode) {
|
||||
MuteNode::MuteNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void MuteNode::reconnect(ExecutionSystem * graph, OutputSocket * output) {
|
||||
void MuteNode::reconnect(ExecutionSystem * graph, OutputSocket * output)
|
||||
{
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
for (unsigned int index = 0; index < inputsockets.size() ; index ++) {
|
||||
InputSocket *input = inputsockets[index];
|
||||
@@ -83,7 +85,8 @@ void MuteNode::reconnect(ExecutionSystem * graph, OutputSocket * output) {
|
||||
output->clearConnections();
|
||||
}
|
||||
|
||||
void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
vector<OutputSocket*> &outputsockets = this->getOutputSockets();
|
||||
|
||||
for (unsigned int index = 0 ; index < outputsockets.size() ; index ++) {
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
class MuteNode: public Node {
|
||||
public:
|
||||
MuteNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
private:
|
||||
void reconnect(ExecutionSystem* graph, OutputSocket * output);
|
||||
void reconnect(ExecutionSystem *graph, OutputSocket * output);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,14 +26,15 @@
|
||||
#include "COM_DotproductOperation.h"
|
||||
#include "COM_SetVectorOperation.h"
|
||||
|
||||
NormalNode::NormalNode(bNode* editorNode): Node(editorNode)
|
||||
NormalNode::NormalNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketDotproduct = this->getOutputSocket(1);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
SetVectorOperation * operationSet = new SetVectorOperation();
|
||||
bNodeSocket * insock = (bNodeSocket*)editorNode->outputs.first;
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
class NormalNode : public Node
|
||||
{
|
||||
public:
|
||||
NormalNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
NormalNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif // COM_NormalNODE_H
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
#include "COM_NormalizeOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
NormalizeNode::NormalizeNode(bNode *editorNode): Node(editorNode) {
|
||||
NormalizeNode::NormalizeNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void NormalizeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void NormalizeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NormalizeOperation *operation = new NormalizeOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
class NormalizeNode: public Node {
|
||||
public:
|
||||
NormalizeNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,11 +27,13 @@
|
||||
#include "BLI_path_util.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
OutputFileNode::OutputFileNode(bNode *editorNode): Node(editorNode) {
|
||||
OutputFileNode::OutputFileNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
NodeImageMultiFile* storage = (NodeImageMultiFile*)this->getbNode()->storage;
|
||||
void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NodeImageMultiFile *storage = (NodeImageMultiFile*)this->getbNode()->storage;
|
||||
|
||||
if (!context->isRendering()) {
|
||||
/* XXX TODO as in previous implementation?
|
||||
|
||||
@@ -47,12 +47,14 @@
|
||||
#include "COM_ScaleOperation.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
|
||||
RenderLayersNode::RenderLayersNode(bNode *editorNode): Node(editorNode) {
|
||||
RenderLayersNode::RenderLayersNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void RenderLayersNode::testSocketConnection(ExecutionSystem* system, int outputSocketNumber, RenderLayersBaseProg * operation) {
|
||||
void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputSocketNumber, RenderLayersBaseProg * operation)
|
||||
{
|
||||
OutputSocket *outputSocket = this->getOutputSocket(outputSocketNumber);
|
||||
Scene* scene = (Scene*)this->getbNode()->id;
|
||||
Scene *scene = (Scene*)this->getbNode()->id;
|
||||
short layerId = this->getbNode()->custom1;
|
||||
|
||||
if (outputSocket->isConnected()) {
|
||||
@@ -77,7 +79,8 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem* system, int outputS
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void RenderLayersNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
testSocketConnection(graph, 0, new RenderLayersColourProg());
|
||||
testSocketConnection(graph, 1, new RenderLayersAlphaProg());
|
||||
testSocketConnection(graph, 2, new RenderLayersDepthProg());
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
*/
|
||||
class RenderLayersNode : public Node {
|
||||
public:
|
||||
RenderLayersNode(bNode* editorNode);
|
||||
RenderLayersNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
private:
|
||||
void testSocketConnection(ExecutionSystem* graph, int outputSocketNumber, RenderLayersBaseProg * operation);
|
||||
void testSocketConnection(ExecutionSystem *graph, int outputSocketNumber, RenderLayersBaseProg * operation);
|
||||
};
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_SetSamplerOperation.h"
|
||||
|
||||
RotateNode::RotateNode(bNode *editorNode) : Node(editorNode) {
|
||||
RotateNode::RotateNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputDegreeSocket = this->getInputSocket(1);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class RotateNode: public Node {
|
||||
public:
|
||||
RotateNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,15 +27,17 @@
|
||||
#include "BKE_node.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
|
||||
ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode) {
|
||||
ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputXSocket = this->getInputSocket(1);
|
||||
InputSocket *inputYSocket = this->getInputSocket(2);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
bNode* bnode = this->getbNode();
|
||||
bNode *bnode = this->getbNode();
|
||||
switch (bnode->custom1) {
|
||||
case CMP_SCALE_RELATIVE: {
|
||||
ScaleOperation *operation = new ScaleOperation();
|
||||
@@ -61,7 +63,7 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
|
||||
break;
|
||||
|
||||
case CMP_SCALE_RENDERPERCENT: {
|
||||
const RenderData* data = &context->getScene()->r;
|
||||
const RenderData *data = &context->getScene()->r;
|
||||
ScaleFixedSizeOperation * operation = new ScaleFixedSizeOperation();
|
||||
operation->setNewWidth(data->xsch*data->size/100.0f);
|
||||
operation->setNewHeight(data->ysch*data->size/100.0f);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class ScaleNode: public Node {
|
||||
public:
|
||||
ScaleNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ConvertRGBToHSVOperation.h"
|
||||
|
||||
SeparateHSVANode::SeparateHSVANode(bNode *editorNode): SeparateRGBANode(editorNode) {
|
||||
SeparateHSVANode::SeparateHSVANode(bNode *editorNode): SeparateRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void SeparateHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void SeparateHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
ConvertRGBToHSVOperation *operation = new ConvertRGBToHSVOperation();
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
if (inputSocket->isConnected()) {
|
||||
|
||||
@@ -28,11 +28,13 @@
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
|
||||
SeparateRGBANode::SeparateRGBANode(bNode *editorNode): Node(editorNode) {
|
||||
SeparateRGBANode::SeparateRGBANode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *imageSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputRSocket = this->getOutputSocket(0);
|
||||
OutputSocket *outputGSocket = this->getOutputSocket(1);
|
||||
@@ -45,26 +47,26 @@ void SeparateRGBANode::convertToOperations(ExecutionSystem *graph, CompositorCon
|
||||
imageSocket->relinkConnections(operation->getInputSocket(0), true, 0, true, graph);
|
||||
outputRSocket->relinkConnections(operation->getOutputSocket(0));
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
}
|
||||
if (outputGSocket->isConnected()) {
|
||||
SeparateChannelOperation *operation = new SeparateChannelOperation();
|
||||
operation->setChannel(1);
|
||||
imageSocket->relinkConnections(operation->getInputSocket(0), true, 0, true, graph);
|
||||
outputGSocket->relinkConnections(operation->getOutputSocket(0));
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
}
|
||||
if (outputBSocket->isConnected()) {
|
||||
SeparateChannelOperation *operation = new SeparateChannelOperation();
|
||||
operation->setChannel(2);
|
||||
imageSocket->relinkConnections(operation->getInputSocket(0), true, 0, true, graph);
|
||||
outputBSocket->relinkConnections(operation->getOutputSocket(0));
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
}
|
||||
if (outputASocket->isConnected()) {
|
||||
SeparateChannelOperation *operation = new SeparateChannelOperation();
|
||||
operation->setChannel(3);
|
||||
imageSocket->relinkConnections(operation->getInputSocket(0), true, 0, true, graph);
|
||||
outputASocket->relinkConnections(operation->getOutputSocket(0));
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ConvertRGBToYCCOperation.h"
|
||||
|
||||
SeparateYCCANode::SeparateYCCANode(bNode *editorNode): SeparateRGBANode(editorNode) {
|
||||
SeparateYCCANode::SeparateYCCANode(bNode *editorNode): SeparateRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void SeparateYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void SeparateYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
ConvertRGBToYCCOperation *operation = new ConvertRGBToYCCOperation();
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ConvertRGBToYUVOperation.h"
|
||||
|
||||
SeparateYUVANode::SeparateYUVANode(bNode *editorNode): SeparateRGBANode(editorNode) {
|
||||
SeparateYUVANode::SeparateYUVANode(bNode *editorNode): SeparateRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void SeparateYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void SeparateYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
ConvertRGBToYUVOperation *operation = new ConvertRGBToYUVOperation();
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
if (inputSocket->isConnected()) {
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
#include "COM_SetAlphaOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
void SetAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
SetAlphaOperation* operation = new SetAlphaOperation();
|
||||
void SetAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
SetAlphaOperation *operation = new SetAlphaOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 0, graph);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
class SetAlphaNode: public Node {
|
||||
public:
|
||||
SetAlphaNode(bNode* editorNode) :Node(editorNode) {}
|
||||
SetAlphaNode(bNode *editorNode) :Node(editorNode) {}
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
#include "COM_SetVectorOperation.h"
|
||||
#include "COM_SetColorOperation.h"
|
||||
|
||||
SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput): Node(editorNode, false) {
|
||||
SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput): Node(editorNode, false)
|
||||
{
|
||||
DataType dt;
|
||||
|
||||
dt = COM_DT_VALUE;
|
||||
@@ -42,7 +43,8 @@ SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bN
|
||||
this->addOutputSocket(dt, editorOutput);
|
||||
}
|
||||
|
||||
void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
OutputSocket * outputsocket = this->getOutputSocket(0);
|
||||
if (outputsocket->isConnected()) {
|
||||
SocketProxyOperation *operation = new SocketProxyOperation();
|
||||
@@ -52,7 +54,8 @@ void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
}
|
||||
}
|
||||
|
||||
void OutputSocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void OutputSocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
OutputSocket * outputsocket = this->getOutputSocket(0);
|
||||
InputSocket * inputsocket = this->getInputSocket(0);
|
||||
if (outputsocket->isConnected()) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class SocketProxyNode: public Node {
|
||||
public:
|
||||
SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
|
||||
virtual bool isProxyNode() const { return true; }
|
||||
};
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
class OutputSocketProxyNode: public SocketProxyNode {
|
||||
public:
|
||||
OutputSocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput): SocketProxyNode(editorNode, editorInput, editorOutput) {}
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
#include "COM_SplitViewerOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
SplitViewerNode::SplitViewerNode(bNode *editorNode): Node(editorNode) {
|
||||
SplitViewerNode::SplitViewerNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *image1Socket = this->getInputSocket(0);
|
||||
InputSocket *image2Socket = this->getInputSocket(1);
|
||||
Image* image = (Image*)this->getbNode()->id;
|
||||
Image *image = (Image*)this->getbNode()->id;
|
||||
ImageUser * imageUser = (ImageUser*) this->getbNode()->storage;
|
||||
if (image1Socket->isConnected() && image2Socket->isConnected()) {
|
||||
SplitViewerOperation *splitViewerOperation = new SplitViewerOperation();
|
||||
|
||||
@@ -32,12 +32,14 @@ extern "C" {
|
||||
#include "BKE_tracking.h"
|
||||
}
|
||||
|
||||
Stabilize2dNode::Stabilize2dNode(bNode *editorNode): Node(editorNode) {
|
||||
Stabilize2dNode::Stabilize2dNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *imageInput = this->getInputSocket(0);
|
||||
MovieClip *clip= (MovieClip *)getbNode()->id;
|
||||
MovieClip *clip = (MovieClip *)getbNode()->id;
|
||||
|
||||
ScaleOperation * scaleOperation = new ScaleOperation();
|
||||
RotateOperation * rotateOperation = new RotateOperation();
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
*/
|
||||
class Stabilize2dNode : public Node {
|
||||
public:
|
||||
Stabilize2dNode(bNode* editorNode);
|
||||
Stabilize2dNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
@@ -24,11 +24,13 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_SocketProxyOperation.h"
|
||||
|
||||
SwitchNode::SwitchNode(bNode *editorNode): Node(editorNode) {
|
||||
SwitchNode::SwitchNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SwitchNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void SwitchNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
SocketProxyOperation * operation = new SocketProxyOperation();
|
||||
int switchFrame = this->getbNode()->custom1;
|
||||
|
||||
|
||||
@@ -24,13 +24,15 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_TextureOperation.h"
|
||||
|
||||
TextureNode::TextureNode(bNode *editorNode): Node(editorNode) {
|
||||
TextureNode::TextureNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
bNode* editorNode = this->getbNode();
|
||||
Tex* texture = (Tex*)editorNode->id;
|
||||
TextureOperation* operation = new TextureOperation();
|
||||
void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
Tex *texture = (Tex*)editorNode->id;
|
||||
TextureOperation *operation = new TextureOperation();
|
||||
this->getOutputSocket(1)->relinkConnections(operation->getOutputSocket());
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, system);
|
||||
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, system);
|
||||
@@ -39,7 +41,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
|
||||
addPreviewOperation(system, operation->getOutputSocket(), 9);
|
||||
|
||||
if (this->getOutputSocket(0)->isConnected()) {
|
||||
TextureAlphaOperation* alphaOperation = new TextureAlphaOperation();
|
||||
TextureAlphaOperation *alphaOperation = new TextureAlphaOperation();
|
||||
this->getOutputSocket(0)->relinkConnections(alphaOperation->getOutputSocket());
|
||||
addLink(system, operation->getInputSocket(0)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(0));
|
||||
addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(1));
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
*/
|
||||
class TextureNode : public Node {
|
||||
public:
|
||||
TextureNode(bNode* editorNode);
|
||||
TextureNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
@@ -29,16 +29,18 @@ extern "C" {
|
||||
}
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
TimeNode::TimeNode(bNode *editorNode): Node(editorNode) {
|
||||
TimeNode::TimeNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
SetValueOperation *operation = new SetValueOperation();
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
|
||||
bNode* node = this->getbNode();
|
||||
bNode *node = this->getbNode();
|
||||
|
||||
/* stack order output: fac */
|
||||
float fac= 0.0f;
|
||||
float fac = 0.0f;
|
||||
const int framenumber = context->getFramenumber();
|
||||
|
||||
if (framenumber < node->custom1) {
|
||||
@@ -48,10 +50,10 @@ void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c
|
||||
fac = 1.0f;
|
||||
}
|
||||
else if (node->custom1 < node->custom2) {
|
||||
fac= (context->getFramenumber() - node->custom1)/(float)(node->custom2-node->custom1);
|
||||
fac = (context->getFramenumber() - node->custom1)/(float)(node->custom2-node->custom1);
|
||||
}
|
||||
|
||||
fac= curvemapping_evaluateF((CurveMapping*)node->storage, 0, fac);
|
||||
fac = curvemapping_evaluateF((CurveMapping*)node->storage, 0, fac);
|
||||
operation->setValue(CLAMPIS(fac, 0.0f, 1.0f));
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class TimeNode: public Node {
|
||||
public:
|
||||
TimeNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
#include "COM_TonemapOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
TonemapNode::TonemapNode(bNode *editorNode): Node(editorNode) {
|
||||
TonemapNode::TonemapNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void TonemapNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
NodeTonemap* data = (NodeTonemap*)this->getbNode()->storage;
|
||||
void TonemapNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
NodeTonemap *data = (NodeTonemap*)this->getbNode()->storage;
|
||||
TonemapOperation *operation = data->type==1?new PhotoreceptorTonemapOperation():new TonemapOperation();
|
||||
|
||||
operation->setData(data);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class TonemapNode: public Node {
|
||||
public:
|
||||
TonemapNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_SetSamplerOperation.h"
|
||||
|
||||
TransformNode::TransformNode(bNode *editorNode): Node(editorNode) {
|
||||
TransformNode::TransformNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *imageInput = this->getInputSocket(0);
|
||||
InputSocket *xInput = this->getInputSocket(1);
|
||||
InputSocket *yInput = this->getInputSocket(2);
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
*/
|
||||
class TransformNode : public Node {
|
||||
public:
|
||||
TransformNode(bNode* editorNode);
|
||||
TransformNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_TranslateOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode) {
|
||||
TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void TranslateNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void TranslateNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputXSocket = this->getInputSocket(1);
|
||||
InputSocket *inputYSocket = this->getInputSocket(2);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class TranslateNode: public Node {
|
||||
public:
|
||||
TranslateNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ValueNode::ValueNode(bNode *editorNode): Node(editorNode) {
|
||||
ValueNode::ValueNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
SetValueOperation *operation = new SetValueOperation();
|
||||
bNodeSocket* socket = this->getEditorOutputSocket(0);
|
||||
bNodeSocket *socket = this->getEditorOutputSocket(0);
|
||||
bNodeSocketValueFloat *dval = (bNodeSocketValueFloat*)socket->default_value;
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
|
||||
operation->setValue(dval->value);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class ValueNode: public Node {
|
||||
public:
|
||||
ValueNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,12 +28,14 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
VectorBlurNode::VectorBlurNode(bNode *editorNode): Node(editorNode) {
|
||||
VectorBlurNode::VectorBlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
bNode* node = this->getbNode();
|
||||
NodeBlurData* vectorBlurSettings = (NodeBlurData*)node->storage;
|
||||
void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
NodeBlurData *vectorBlurSettings = (NodeBlurData*)node->storage;
|
||||
VectorBlurOperation *operation = new VectorBlurOperation();
|
||||
operation->setVectorBlurSettings(vectorBlurSettings);
|
||||
operation->setQuality(context->getQuality());
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class VectorBlurNode: public Node {
|
||||
public:
|
||||
VectorBlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#include "COM_VectorCurveOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
VectorCurveNode::VectorCurveNode(bNode *editorNode): Node(editorNode) {
|
||||
VectorCurveNode::VectorCurveNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void VectorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void VectorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
VectorCurveOperation *operation = new VectorCurveOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class VectorCurveNode: public Node {
|
||||
public:
|
||||
VectorCurveNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
#include "COM_CalculateMeanOperation.h"
|
||||
#include "COM_CalculateStandardDeviationOperation.h"
|
||||
|
||||
ViewLevelsNode::ViewLevelsNode(bNode *editorNode): Node(editorNode) {
|
||||
ViewLevelsNode::ViewLevelsNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket * input = this->getInputSocket(0);
|
||||
bool firstOperationConnected = false;
|
||||
if (input->isConnected()) {
|
||||
OutputSocket* inputSocket= input->getConnection()->getFromSocket();
|
||||
OutputSocket *inputSocket = input->getConnection()->getFromSocket();
|
||||
// add preview to inputSocket;
|
||||
|
||||
OutputSocket * socket = this->getOutputSocket(0);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class ViewLevelsNode: public Node {
|
||||
public:
|
||||
ViewLevelsNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,16 +26,18 @@
|
||||
#include "COM_ViewerOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ViewerNode::ViewerNode(bNode *editorNode): Node(editorNode) {
|
||||
ViewerNode::ViewerNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)\
|
||||
{
|
||||
InputSocket *imageSocket = this->getInputSocket(0);
|
||||
InputSocket *alphaSocket = this->getInputSocket(1);
|
||||
Image* image = (Image*)this->getbNode()->id;
|
||||
Image *image = (Image*)this->getbNode()->id;
|
||||
ImageUser * imageUser = (ImageUser*) this->getbNode()->storage;
|
||||
if (imageSocket->isConnected()) {
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
ViewerOperation *viewerOperation = new ViewerOperation();
|
||||
viewerOperation->setColorManagement( context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT);
|
||||
viewerOperation->setColorPredivide( context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
void ZCombineNode::convertToOperations(ExecutionSystem* system, CompositorContext * context) {
|
||||
void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
if (this->getOutputSocket(0)->isConnected()) {
|
||||
ZCombineOperation * operation = NULL;
|
||||
if (this->getbNode()->custom1) {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
class ZCombineNode: public Node {
|
||||
public:
|
||||
ZCombineNode(bNode* editorNode) :Node(editorNode) {}
|
||||
ZCombineNode(bNode *editorNode) :Node(editorNode) {}
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_AlphaOverKeyOperation.h"
|
||||
|
||||
AlphaOverKeyOperation::AlphaOverKeyOperation(): MixBaseOperation() {
|
||||
AlphaOverKeyOperation::AlphaOverKeyOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void AlphaOverKeyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputOverColor[4];
|
||||
float value[4];
|
||||
@@ -34,25 +36,25 @@ void AlphaOverKeyOperation::executePixel(float* outputValue, float x, float y, P
|
||||
inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
|
||||
inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers);
|
||||
|
||||
if (inputOverColor[3]<=0.0f) {
|
||||
if (inputOverColor[3] <= 0.0f) {
|
||||
outputValue[0] = inputColor1[0];
|
||||
outputValue[1] = inputColor1[1];
|
||||
outputValue[2] = inputColor1[2];
|
||||
outputValue[3] = inputColor1[3];
|
||||
}
|
||||
else if (value[0]==1.0f && inputOverColor[3]>=1.0f) {
|
||||
else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
|
||||
outputValue[0] = inputOverColor[0];
|
||||
outputValue[1] = inputOverColor[1];
|
||||
outputValue[2] = inputOverColor[2];
|
||||
outputValue[3] = inputOverColor[3];
|
||||
}
|
||||
else {
|
||||
float premul= value[0]*inputOverColor[3];
|
||||
float mul= 1.0f - premul;
|
||||
float premul = value[0]*inputOverColor[3];
|
||||
float mul = 1.0f - premul;
|
||||
|
||||
outputValue[0]= (mul*inputColor1[0]) + premul*inputOverColor[0];
|
||||
outputValue[1]= (mul*inputColor1[1]) + premul*inputOverColor[1];
|
||||
outputValue[2]= (mul*inputColor1[2]) + premul*inputOverColor[2];
|
||||
outputValue[3]= (mul*inputColor1[3]) + value[0]*inputOverColor[3];
|
||||
outputValue[0] = (mul*inputColor1[0]) + premul*inputOverColor[0];
|
||||
outputValue[1] = (mul*inputColor1[1]) + premul*inputOverColor[1];
|
||||
outputValue[2] = (mul*inputColor1[2]) + premul*inputOverColor[2];
|
||||
outputValue[3] = (mul*inputColor1[3]) + value[0]*inputOverColor[3];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
|
||||
#include "COM_AlphaOverMixedOperation.h"
|
||||
|
||||
AlphaOverMixedOperation::AlphaOverMixedOperation(): MixBaseOperation() {
|
||||
AlphaOverMixedOperation::AlphaOverMixedOperation(): MixBaseOperation()
|
||||
{
|
||||
this->x = 0.0f;
|
||||
}
|
||||
|
||||
void AlphaOverMixedOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void AlphaOverMixedOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputOverColor[4];
|
||||
float value[4];
|
||||
@@ -35,27 +37,27 @@ void AlphaOverMixedOperation::executePixel(float* outputValue, float x, float y,
|
||||
inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers);
|
||||
inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers);
|
||||
|
||||
if (inputOverColor[3]<=0.0f) {
|
||||
if (inputOverColor[3] <= 0.0f) {
|
||||
outputValue[0] = inputColor1[0];
|
||||
outputValue[1] = inputColor1[1];
|
||||
outputValue[2] = inputColor1[2];
|
||||
outputValue[3] = inputColor1[3];
|
||||
}
|
||||
else if (value[0]==1.0f && inputOverColor[3]>=1.0f) {
|
||||
else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
|
||||
outputValue[0] = inputOverColor[0];
|
||||
outputValue[1] = inputOverColor[1];
|
||||
outputValue[2] = inputOverColor[2];
|
||||
outputValue[3] = inputOverColor[3];
|
||||
}
|
||||
else {
|
||||
float addfac= 1.0f - this->x + inputOverColor[3]*this->x;
|
||||
float premul= value[0]*addfac;
|
||||
float mul= 1.0f - value[0]*inputOverColor[3];
|
||||
float addfac = 1.0f - this->x + inputOverColor[3]*this->x;
|
||||
float premul = value[0]*addfac;
|
||||
float mul = 1.0f - value[0]*inputOverColor[3];
|
||||
|
||||
outputValue[0]= (mul*inputColor1[0]) + premul*inputOverColor[0];
|
||||
outputValue[1]= (mul*inputColor1[1]) + premul*inputOverColor[1];
|
||||
outputValue[2]= (mul*inputColor1[2]) + premul*inputOverColor[2];
|
||||
outputValue[3]= (mul*inputColor1[3]) + value[0]*inputOverColor[3];
|
||||
outputValue[0] = (mul*inputColor1[0]) + premul*inputOverColor[0];
|
||||
outputValue[1] = (mul*inputColor1[1]) + premul*inputOverColor[1];
|
||||
outputValue[2] = (mul*inputColor1[2]) + premul*inputOverColor[2];
|
||||
outputValue[3] = (mul*inputColor1[3]) + value[0]*inputOverColor[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void setX(float x) {this->x = x;}
|
||||
};
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_AlphaOverPremultiplyOperation.h"
|
||||
|
||||
AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation(): MixBaseOperation() {
|
||||
AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void AlphaOverPremultiplyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputOverColor[4];
|
||||
float value[4];
|
||||
@@ -41,19 +43,19 @@ void AlphaOverPremultiplyOperation::executePixel(float* outputValue, float x, fl
|
||||
outputValue[2] = inputColor1[2];
|
||||
outputValue[3] = inputColor1[3];
|
||||
}
|
||||
else if (value[0]==1.0f && inputOverColor[3]>=1.0f) {
|
||||
else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
|
||||
outputValue[0] = inputOverColor[0];
|
||||
outputValue[1] = inputOverColor[1];
|
||||
outputValue[2] = inputOverColor[2];
|
||||
outputValue[3] = inputOverColor[3];
|
||||
}
|
||||
else {
|
||||
float mul= 1.0f - value[0]*inputOverColor[3];
|
||||
float mul = 1.0f - value[0]*inputOverColor[3];
|
||||
|
||||
outputValue[0]= (mul*inputColor1[0]) + value[0]*inputOverColor[0];
|
||||
outputValue[1]= (mul*inputColor1[1]) + value[0]*inputOverColor[1];
|
||||
outputValue[2]= (mul*inputColor1[2]) + value[0]*inputOverColor[2];
|
||||
outputValue[3]= (mul*inputColor1[3]) + value[0]*inputOverColor[3];
|
||||
outputValue[0] = (mul*inputColor1[0]) + value[0]*inputOverColor[0];
|
||||
outputValue[1] = (mul*inputColor1[1]) + value[0]*inputOverColor[1];
|
||||
outputValue[2] = (mul*inputColor1[2]) + value[0]*inputOverColor[2];
|
||||
outputValue[3] = (mul*inputColor1[3]) + value[0]*inputOverColor[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -28,19 +28,22 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
AntiAliasOperation::AntiAliasOperation(): NodeOperation() {
|
||||
AntiAliasOperation::AntiAliasOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->valueReader = NULL;
|
||||
this->buffer = NULL;
|
||||
this->setComplex(true);
|
||||
}
|
||||
void AntiAliasOperation::initExecution() {
|
||||
void AntiAliasOperation::initExecution()
|
||||
{
|
||||
this->valueReader = this->getInputSocketReader(0);
|
||||
NodeOperation::initMutex();
|
||||
}
|
||||
|
||||
void AntiAliasOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) {
|
||||
void AntiAliasOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data)
|
||||
{
|
||||
if (y < 0 || y >= this->height || x < 0 || x >= this->width) {
|
||||
color[0] = 0.0f;
|
||||
}
|
||||
@@ -51,7 +54,8 @@ void AntiAliasOperation::executePixel(float* color, int x, int y, MemoryBuffer *
|
||||
|
||||
}
|
||||
|
||||
void AntiAliasOperation::deinitExecution() {
|
||||
void AntiAliasOperation::deinitExecution()
|
||||
{
|
||||
this->valueReader = NULL;
|
||||
if (this->buffer) {
|
||||
delete buffer;
|
||||
@@ -59,13 +63,14 @@ void AntiAliasOperation::deinitExecution() {
|
||||
NodeOperation::deinitMutex();
|
||||
}
|
||||
|
||||
bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti imageInput;
|
||||
if (this->buffer) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
NodeOperation* operation = getInputOperation(0);
|
||||
NodeOperation *operation = getInputOperation(0);
|
||||
imageInput.xmax = operation->getWidth();
|
||||
imageInput.xmin = 0;
|
||||
imageInput.ymax = operation->getHeight();
|
||||
@@ -77,16 +82,17 @@ bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
|
||||
return false;
|
||||
}
|
||||
|
||||
void* AntiAliasOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *AntiAliasOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
if (this->buffer) {return buffer;}
|
||||
BLI_mutex_lock(getMutex());
|
||||
if (this->buffer == NULL) {
|
||||
MemoryBuffer* tile = (MemoryBuffer*)valueReader->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *tile = (MemoryBuffer*)valueReader->initializeTileData(rect, memoryBuffers);
|
||||
int size = tile->getHeight()*tile->getWidth();
|
||||
float * input = tile->getBuffer();
|
||||
char* valuebuffer = new char[size];
|
||||
char *valuebuffer = new char[size];
|
||||
for (int i = 0 ; i < size ; i ++) {
|
||||
float in = input[i* COM_NUMBER_OF_CHANNELS];
|
||||
float in = input[i * COM_NUMBER_OF_CHANNELS];
|
||||
if (in < 0.0f) { in = 0.0f;}
|
||||
if (in > 1.0f) {in = 1.0f;}
|
||||
valuebuffer[i] = in * 255;
|
||||
|
||||
@@ -43,14 +43,14 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
|
||||
@@ -27,7 +27,8 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
BilateralBlurOperation::BilateralBlurOperation() : NodeOperation() {
|
||||
BilateralBlurOperation::BilateralBlurOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -37,14 +38,16 @@ BilateralBlurOperation::BilateralBlurOperation() : NodeOperation() {
|
||||
this->inputDeterminatorProgram = NULL;
|
||||
}
|
||||
|
||||
void BilateralBlurOperation::initExecution() {
|
||||
void BilateralBlurOperation::initExecution()
|
||||
{
|
||||
this->inputColorProgram = getInputSocketReader(0);
|
||||
this->inputDeterminatorProgram = getInputSocketReader(1);
|
||||
this->space = this->data->sigma_space + this->data->iter;
|
||||
QualityStepHelper::initExecution(COM_QH_INCREASE);
|
||||
}
|
||||
|
||||
void BilateralBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void BilateralBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
// read the determinator color at x, y, this will be used as the reference color for the determinator
|
||||
float determinatorReferenceColor[4];
|
||||
float determinator[4];
|
||||
@@ -98,12 +101,14 @@ void BilateralBlurOperation::executePixel(float* color, int x, int y, MemoryBuff
|
||||
}
|
||||
}
|
||||
|
||||
void BilateralBlurOperation::deinitExecution() {
|
||||
void BilateralBlurOperation::deinitExecution()
|
||||
{
|
||||
this->inputColorProgram = NULL;
|
||||
this->inputDeterminatorProgram = NULL;
|
||||
}
|
||||
|
||||
bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
int add = ceil(this->space)+1;
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
class BilateralBlurOperation : public NodeOperation, public QualityStepHelper {
|
||||
private:
|
||||
SocketReader* inputColorProgram;
|
||||
SocketReader* inputDeterminatorProgram;
|
||||
NodeBilateralBlurData* data;
|
||||
SocketReader *inputColorProgram;
|
||||
SocketReader *inputDeterminatorProgram;
|
||||
NodeBilateralBlurData *data;
|
||||
float space;
|
||||
|
||||
public:
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -27,7 +27,8 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
BlurBaseOperation::BlurBaseOperation(): NodeOperation() {
|
||||
BlurBaseOperation::BlurBaseOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -37,24 +38,25 @@ BlurBaseOperation::BlurBaseOperation(): NodeOperation() {
|
||||
this->size = 1.0f;
|
||||
this->deleteData = false;
|
||||
}
|
||||
void BlurBaseOperation::initExecution() {
|
||||
void BlurBaseOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
this->inputSize = this->getInputSocketReader(1);
|
||||
this->data->image_in_width= this->getWidth();
|
||||
this->data->image_in_height= this->getHeight();
|
||||
this->data->image_in_width = this->getWidth();
|
||||
this->data->image_in_height = this->getHeight();
|
||||
if (this->data->relative) {
|
||||
switch (this->data->aspect) {
|
||||
case CMP_NODE_BLUR_ASPECT_NONE:
|
||||
this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_width);
|
||||
this->data->sizey= (int)(this->data->percenty*0.01f*this->data->image_in_height);
|
||||
this->data->sizex = (int)(this->data->percentx*0.01f*this->data->image_in_width);
|
||||
this->data->sizey = (int)(this->data->percenty*0.01f*this->data->image_in_height);
|
||||
break;
|
||||
case CMP_NODE_BLUR_ASPECT_Y:
|
||||
this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_width);
|
||||
this->data->sizey= (int)(this->data->percenty*0.01f*this->data->image_in_width);
|
||||
this->data->sizex = (int)(this->data->percentx*0.01f*this->data->image_in_width);
|
||||
this->data->sizey = (int)(this->data->percenty*0.01f*this->data->image_in_width);
|
||||
break;
|
||||
case CMP_NODE_BLUR_ASPECT_X:
|
||||
this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_height);
|
||||
this->data->sizey= (int)(this->data->percenty*0.01f*this->data->image_in_height);
|
||||
this->data->sizex = (int)(this->data->percentx*0.01f*this->data->image_in_height);
|
||||
this->data->sizey = (int)(this->data->percenty*0.01f*this->data->image_in_height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -63,7 +65,7 @@ void BlurBaseOperation::initExecution() {
|
||||
|
||||
}
|
||||
|
||||
float* BlurBaseOperation::make_gausstab(int rad)
|
||||
float *BlurBaseOperation::make_gausstab(int rad)
|
||||
{
|
||||
float *gausstab, sum, val;
|
||||
int i, n;
|
||||
@@ -74,19 +76,20 @@ float* BlurBaseOperation::make_gausstab(int rad)
|
||||
|
||||
sum = 0.0f;
|
||||
for (i = -rad; i <= rad; i++) {
|
||||
val= RE_filter_value(this->data->filtertype, (float)i/(float)rad);
|
||||
val = RE_filter_value(this->data->filtertype, (float)i/(float)rad);
|
||||
sum += val;
|
||||
gausstab[i+rad] = val;
|
||||
}
|
||||
|
||||
sum= 1.0f/sum;
|
||||
sum = 1.0f/sum;
|
||||
for (i=0; i<n; i++)
|
||||
gausstab[i]*= sum;
|
||||
|
||||
return gausstab;
|
||||
}
|
||||
|
||||
void BlurBaseOperation::deinitExecution() {
|
||||
void BlurBaseOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
this->inputSize = NULL;
|
||||
if (this->deleteData) {
|
||||
@@ -95,7 +98,8 @@ void BlurBaseOperation::deinitExecution() {
|
||||
this->data = NULL;
|
||||
}
|
||||
|
||||
void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers) {
|
||||
void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
float result[4];
|
||||
this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
|
||||
this->size = result[0];
|
||||
|
||||
@@ -32,11 +32,11 @@ protected:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader* inputProgram;
|
||||
SocketReader* inputSize;
|
||||
SocketReader *inputProgram;
|
||||
SocketReader *inputSize;
|
||||
NodeBlurData * data;
|
||||
BlurBaseOperation();
|
||||
float* make_gausstab(int rad);
|
||||
float *make_gausstab(int rad);
|
||||
float size;
|
||||
bool deleteData;
|
||||
void updateSize(MemoryBuffer **memoryBuffers);
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void setData(NodeBlurData* data) {this->data= data;}
|
||||
void setData(NodeBlurData *data) {this->data = data;}
|
||||
|
||||
void deleteDataWhenFinished() {this->deleteData = true;}
|
||||
};
|
||||
|
||||
@@ -27,7 +27,8 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
BokehBlurOperation::BokehBlurOperation() : NodeOperation() {
|
||||
BokehBlurOperation::BokehBlurOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
@@ -41,12 +42,14 @@ BokehBlurOperation::BokehBlurOperation() : NodeOperation() {
|
||||
this->inputBoundingBoxReader = NULL;
|
||||
}
|
||||
|
||||
void* BokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
void *BokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void BokehBlurOperation::initExecution() {
|
||||
void BokehBlurOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = getInputSocketReader(0);
|
||||
this->inputBokehProgram = getInputSocketReader(1);
|
||||
this->inputBoundingBoxReader = getInputSocketReader(2);
|
||||
@@ -67,7 +70,8 @@ void BokehBlurOperation::initExecution() {
|
||||
QualityStepHelper::initExecution(COM_QH_INCREASE);
|
||||
}
|
||||
|
||||
void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float tempColor[4];
|
||||
float tempBoundingBox[4];
|
||||
float bokeh[4];
|
||||
@@ -81,8 +85,8 @@ void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *
|
||||
float overallmultiplyerr = 0;
|
||||
float overallmultiplyerg = 0;
|
||||
float overallmultiplyerb = 0;
|
||||
MemoryBuffer* inputBuffer = (MemoryBuffer*)data;
|
||||
float* buffer = inputBuffer->getBuffer();
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
@@ -126,13 +130,15 @@ void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *
|
||||
}
|
||||
}
|
||||
|
||||
void BokehBlurOperation::deinitExecution() {
|
||||
void BokehBlurOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
this->inputBokehProgram = NULL;
|
||||
this->inputBoundingBoxReader = NULL;
|
||||
}
|
||||
|
||||
bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
rcti bokehInput;
|
||||
|
||||
@@ -141,7 +147,7 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
|
||||
newInput.ymax = input->ymax + (size*this->getWidth());
|
||||
newInput.ymin = input->ymin - (size*this->getWidth());
|
||||
|
||||
NodeOperation* operation = getInputOperation(1);
|
||||
NodeOperation *operation = getInputOperation(1);
|
||||
bokehInput.xmax = operation->getWidth();
|
||||
bokehInput.xmin = 0;
|
||||
bokehInput.ymax = operation->getHeight();
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
class BokehBlurOperation : public NodeOperation, public QualityStepHelper {
|
||||
private:
|
||||
SocketReader* inputProgram;
|
||||
SocketReader* inputBokehProgram;
|
||||
SocketReader* inputBoundingBoxReader;
|
||||
SocketReader *inputProgram;
|
||||
SocketReader *inputBokehProgram;
|
||||
SocketReader *inputBoundingBoxReader;
|
||||
float size;
|
||||
float bokehMidX;
|
||||
float bokehMidY;
|
||||
@@ -37,11 +37,11 @@ private:
|
||||
public:
|
||||
BokehBlurOperation();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
#include "COM_BokehImageOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
BokehImageOperation::BokehImageOperation(): NodeOperation() {
|
||||
BokehImageOperation::BokehImageOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->deleteData = false;
|
||||
}
|
||||
void BokehImageOperation::initExecution() {
|
||||
void BokehImageOperation::initExecution()
|
||||
{
|
||||
this->centerX = getWidth() / 2;
|
||||
this->centerY = getHeight() / 2;
|
||||
this->center[0] = this->centerX;
|
||||
@@ -40,11 +42,13 @@ void BokehImageOperation::initExecution() {
|
||||
this->flapRadAdd-=M_PI*2;
|
||||
}
|
||||
}
|
||||
void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance) {
|
||||
void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance)
|
||||
{
|
||||
r[0] = sin(flapRad*flapNumber + flapRadAdd)*distance+centerX;
|
||||
r[1] = cos(flapRad*flapNumber + flapRadAdd)*distance+centerY;
|
||||
}
|
||||
float BokehImageOperation::isInsideBokeh(float distance, float x, float y) {
|
||||
float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
|
||||
{
|
||||
float insideBokeh = 0.0;
|
||||
const float deltaX = x - centerX;
|
||||
const float deltaY = y - centerY;
|
||||
@@ -80,7 +84,8 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) {
|
||||
}
|
||||
return insideBokeh;
|
||||
}
|
||||
void BokehImageOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void BokehImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float shift = this->data->lensshift;
|
||||
float shift2 = shift/2.0f;
|
||||
float distance = this->circularDistance;
|
||||
@@ -100,7 +105,8 @@ void BokehImageOperation::executePixel(float* color, float x, float y, PixelSamp
|
||||
color[3] = 1.0f;
|
||||
}
|
||||
|
||||
void BokehImageOperation::deinitExecution() {
|
||||
void BokehImageOperation::deinitExecution()
|
||||
{
|
||||
if (deleteData) {
|
||||
if (data) {
|
||||
delete data;
|
||||
@@ -109,7 +115,8 @@ void BokehImageOperation::deinitExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void BokehImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void BokehImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
resolution[0] = 512;
|
||||
resolution[1] = 512;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
BoxMaskOperation::BoxMaskOperation(): NodeOperation() {
|
||||
BoxMaskOperation::BoxMaskOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
@@ -33,7 +34,8 @@ BoxMaskOperation::BoxMaskOperation(): NodeOperation() {
|
||||
this->cosine = 0.0f;
|
||||
this->sine = 0.0f;
|
||||
}
|
||||
void BoxMaskOperation::initExecution() {
|
||||
void BoxMaskOperation::initExecution()
|
||||
{
|
||||
this->inputMask = this->getInputSocketReader(0);
|
||||
this->inputValue = this->getInputSocketReader(1);
|
||||
const double rad = DEG2RAD(this->data->rotation);
|
||||
@@ -42,7 +44,8 @@ void BoxMaskOperation::initExecution() {
|
||||
this->aspectRatio = ((float)this->getWidth())/this->getHeight();
|
||||
}
|
||||
|
||||
void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputMask[4];
|
||||
float inputValue[4];
|
||||
|
||||
@@ -108,7 +111,8 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler
|
||||
|
||||
}
|
||||
|
||||
void BoxMaskOperation::deinitExecution() {
|
||||
void BoxMaskOperation::deinitExecution()
|
||||
{
|
||||
this->inputMask = NULL;
|
||||
this->inputValue = NULL;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,20 +22,23 @@
|
||||
|
||||
#include "COM_BrightnessOperation.h"
|
||||
|
||||
BrightnessOperation::BrightnessOperation(): NodeOperation() {
|
||||
BrightnessOperation::BrightnessOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void BrightnessOperation::initExecution() {
|
||||
void BrightnessOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
this->inputBrightnessProgram = this->getInputSocketReader(1);
|
||||
this->inputContrastProgram = this->getInputSocketReader(2);
|
||||
}
|
||||
|
||||
void BrightnessOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void BrightnessOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
float a, b;
|
||||
float inputBrightness[4];
|
||||
@@ -68,7 +71,8 @@ void BrightnessOperation::executePixel(float* color, float x, float y, PixelSamp
|
||||
color[3] = inputValue[3];
|
||||
}
|
||||
|
||||
void BrightnessOperation::deinitExecution() {
|
||||
void BrightnessOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
this->inputBrightnessProgram = NULL;
|
||||
this->inputContrastProgram = NULL;
|
||||
|
||||
@@ -30,9 +30,9 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader * inputProgram;
|
||||
SocketReader * inputBrightnessProgram;
|
||||
SocketReader* inputContrastProgram;
|
||||
SocketReader *inputProgram;
|
||||
SocketReader *inputBrightnessProgram;
|
||||
SocketReader *inputContrastProgram;
|
||||
|
||||
public:
|
||||
BrightnessOperation();
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
|
||||
|
||||
|
||||
CalculateMeanOperation::CalculateMeanOperation(): NodeOperation() {
|
||||
CalculateMeanOperation::CalculateMeanOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->imageReader = NULL;
|
||||
@@ -34,27 +35,31 @@ CalculateMeanOperation::CalculateMeanOperation(): NodeOperation() {
|
||||
this->setting = 1;
|
||||
this->setComplex(true);
|
||||
}
|
||||
void CalculateMeanOperation::initExecution() {
|
||||
void CalculateMeanOperation::initExecution()
|
||||
{
|
||||
this->imageReader = this->getInputSocketReader(0);
|
||||
this->iscalculated = false;
|
||||
NodeOperation::initMutex();
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) {
|
||||
void CalculateMeanOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data)
|
||||
{
|
||||
color[0] = this->result;
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::deinitExecution() {
|
||||
void CalculateMeanOperation::deinitExecution()
|
||||
{
|
||||
this->imageReader = NULL;
|
||||
NodeOperation::deinitMutex();
|
||||
}
|
||||
|
||||
bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti imageInput;
|
||||
if (iscalculated) {
|
||||
return false;
|
||||
}
|
||||
NodeOperation* operation = getInputOperation(0);
|
||||
NodeOperation *operation = getInputOperation(0);
|
||||
imageInput.xmax = operation->getWidth();
|
||||
imageInput.xmin = 0;
|
||||
imageInput.ymax = operation->getHeight();
|
||||
@@ -65,10 +70,11 @@ bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti *input, ReadB
|
||||
return false;
|
||||
}
|
||||
|
||||
void* CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
BLI_mutex_lock(getMutex());
|
||||
if (!this->iscalculated) {
|
||||
MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
calculateMean(tile);
|
||||
this->iscalculated = true;
|
||||
}
|
||||
@@ -76,9 +82,10 @@ void* CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memo
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::calculateMean(MemoryBuffer * tile) {
|
||||
void CalculateMeanOperation::calculateMean(MemoryBuffer * tile)
|
||||
{
|
||||
this->result = 0.0f;
|
||||
float* buffer = tile->getBuffer();
|
||||
float *buffer = tile->getBuffer();
|
||||
int size = tile->getWidth()*tile->getHeight();
|
||||
int pixels = 0;
|
||||
float sum;
|
||||
|
||||
@@ -46,14 +46,14 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
@@ -64,6 +64,6 @@ public:
|
||||
void setSetting(int setting) {this->setting = setting;}
|
||||
|
||||
protected:
|
||||
void calculateMean(MemoryBuffer* tile);
|
||||
void calculateMean(MemoryBuffer *tile);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -26,20 +26,23 @@
|
||||
|
||||
|
||||
|
||||
CalculateStandardDeviationOperation::CalculateStandardDeviationOperation(): CalculateMeanOperation() {
|
||||
CalculateStandardDeviationOperation::CalculateStandardDeviationOperation(): CalculateMeanOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void CalculateStandardDeviationOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) {
|
||||
void CalculateStandardDeviationOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data)
|
||||
{
|
||||
color[0] = this->standardDeviation;
|
||||
}
|
||||
|
||||
void* CalculateStandardDeviationOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
BLI_mutex_lock(getMutex());
|
||||
if (!this->iscalculated) {
|
||||
MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
CalculateMeanOperation::calculateMean(tile);
|
||||
this->standardDeviation = 0.0f;
|
||||
float* buffer = tile->getBuffer();
|
||||
float *buffer = tile->getBuffer();
|
||||
int size = tile->getWidth()*tile->getHeight();
|
||||
int pixels = 0;
|
||||
float sum;
|
||||
|
||||
@@ -39,9 +39,9 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,21 +22,25 @@
|
||||
|
||||
#include "COM_ChangeHSVOperation.h"
|
||||
|
||||
ChangeHSVOperation::ChangeHSVOperation(): NodeOperation() {
|
||||
ChangeHSVOperation::ChangeHSVOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ChangeHSVOperation::initExecution() {
|
||||
void ChangeHSVOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ChangeHSVOperation::deinitExecution() {
|
||||
void ChangeHSVOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ChangeHSVOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
|
||||
inputOperation->read(inputColor1, x, y, sampler, inputBuffers);
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void setHue(float hue) {this->hue = hue;}
|
||||
void setSaturation(float saturation) {this->saturation = saturation;}
|
||||
|
||||
@@ -22,14 +22,16 @@
|
||||
#include "COM_ChannelMatteOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ChannelMatteOperation::ChannelMatteOperation(): NodeOperation() {
|
||||
ChannelMatteOperation::ChannelMatteOperation(): NodeOperation()
|
||||
{
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
|
||||
inputImageProgram = NULL;
|
||||
}
|
||||
|
||||
void ChannelMatteOperation::initExecution() {
|
||||
void ChannelMatteOperation::initExecution()
|
||||
{
|
||||
this->inputImageProgram = this->getInputSocketReader(0);
|
||||
|
||||
this->limit_range = this->limit_max - this->limit_min;
|
||||
@@ -76,11 +78,13 @@ void ChannelMatteOperation::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelMatteOperation::deinitExecution() {
|
||||
this->inputImageProgram= NULL;
|
||||
void ChannelMatteOperation::deinitExecution()
|
||||
{
|
||||
this->inputImageProgram = NULL;
|
||||
}
|
||||
|
||||
void ChannelMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inColor[4];
|
||||
float alpha;
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setSettings(NodeChroma* nodeChroma, const int custom2)
|
||||
void setSettings(NodeChroma *nodeChroma, const int custom2)
|
||||
{
|
||||
this->limit_max = nodeChroma->t1;
|
||||
this->limit_min = nodeChroma->t2;
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "COM_ChromaMatteOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ChromaMatteOperation::ChromaMatteOperation(): NodeOperation() {
|
||||
ChromaMatteOperation::ChromaMatteOperation(): NodeOperation()
|
||||
{
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
@@ -31,17 +32,20 @@ ChromaMatteOperation::ChromaMatteOperation(): NodeOperation() {
|
||||
inputKeyProgram = NULL;
|
||||
}
|
||||
|
||||
void ChromaMatteOperation::initExecution() {
|
||||
void ChromaMatteOperation::initExecution()
|
||||
{
|
||||
this->inputImageProgram = this->getInputSocketReader(0);
|
||||
this->inputKeyProgram = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void ChromaMatteOperation::deinitExecution() {
|
||||
this->inputImageProgram= NULL;
|
||||
this->inputKeyProgram= NULL;
|
||||
void ChromaMatteOperation::deinitExecution()
|
||||
{
|
||||
this->inputImageProgram = NULL;
|
||||
this->inputKeyProgram = NULL;
|
||||
}
|
||||
|
||||
void ChromaMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inKey[4];
|
||||
float inImage[4];
|
||||
|
||||
@@ -70,7 +74,7 @@ void ChromaMatteOperation::executePixel(float* outputValue, float x, float y, Pi
|
||||
|
||||
/*if within the acceptance angle */
|
||||
/* if kfg is <0 then the pixel is outside of the key color */
|
||||
kfg= x_angle-(fabsf(z_angle)/tanf(acceptance/2.f));
|
||||
kfg = x_angle-(fabsf(z_angle)/tanf(acceptance/2.f));
|
||||
|
||||
if (kfg>0.f) { /* found a pixel that is within key color */
|
||||
alpha=(1.f-kfg)*(gain);
|
||||
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;}
|
||||
void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,8 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope)
|
||||
return powf(x, power);
|
||||
}
|
||||
|
||||
ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation(): NodeOperation() {
|
||||
ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -42,12 +43,14 @@ ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation(): NodeOperation() {
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
}
|
||||
|
||||
void ColorBalanceASCCDLOperation::initExecution() {
|
||||
void ColorBalanceASCCDLOperation::initExecution()
|
||||
{
|
||||
this->inputValueOperation = this->getInputSocketReader(0);
|
||||
this->inputColorOperation = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void ColorBalanceASCCDLOperation::executePixel(float* outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
float value[4];
|
||||
|
||||
@@ -56,7 +59,7 @@ void ColorBalanceASCCDLOperation::executePixel(float* outputColor, float x, floa
|
||||
|
||||
float fac = value[0];
|
||||
fac = min(1.0f, fac);
|
||||
const float mfac= 1.0f - fac;
|
||||
const float mfac = 1.0f - fac;
|
||||
|
||||
outputColor[0] = mfac*inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->lift[0], this->gamma[0], this->gain[0]);
|
||||
outputColor[1] = mfac*inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->lift[1], this->gamma[1], this->gain[1]);
|
||||
@@ -65,7 +68,8 @@ void ColorBalanceASCCDLOperation::executePixel(float* outputColor, float x, floa
|
||||
|
||||
}
|
||||
|
||||
void ColorBalanceASCCDLOperation::deinitExecution() {
|
||||
void ColorBalanceASCCDLOperation::deinitExecution()
|
||||
{
|
||||
this->inputValueOperation = NULL;
|
||||
this->inputColorOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -30,7 +30,7 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g
|
||||
* but best keep it this way, sice testing for durian shows a similar calculation
|
||||
* without lin/srgb conversions gives bad results (over-saturated shadows) with colors
|
||||
* slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */
|
||||
float x= (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
|
||||
float x = (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
|
||||
|
||||
/* prevent NaN */
|
||||
if (x < 0.f) x = 0.f;
|
||||
@@ -38,7 +38,8 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g
|
||||
return powf(srgb_to_linearrgb(x), gamma_inv);
|
||||
}
|
||||
|
||||
ColorBalanceLGGOperation::ColorBalanceLGGOperation(): NodeOperation() {
|
||||
ColorBalanceLGGOperation::ColorBalanceLGGOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -47,12 +48,14 @@ ColorBalanceLGGOperation::ColorBalanceLGGOperation(): NodeOperation() {
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
}
|
||||
|
||||
void ColorBalanceLGGOperation::initExecution() {
|
||||
void ColorBalanceLGGOperation::initExecution()
|
||||
{
|
||||
this->inputValueOperation = this->getInputSocketReader(0);
|
||||
this->inputColorOperation = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void ColorBalanceLGGOperation::executePixel(float* outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
float value[4];
|
||||
|
||||
@@ -61,7 +64,7 @@ void ColorBalanceLGGOperation::executePixel(float* outputColor, float x, float y
|
||||
|
||||
float fac = value[0];
|
||||
fac = min(1.0f, fac);
|
||||
const float mfac= 1.0f - fac;
|
||||
const float mfac = 1.0f - fac;
|
||||
|
||||
outputColor[0] = mfac*inputColor[0] + fac * colorbalance_lgg(inputColor[0], this->lift[0], this->gamma_inv[0], this->gain[0]);
|
||||
outputColor[1] = mfac*inputColor[1] + fac * colorbalance_lgg(inputColor[1], this->lift[1], this->gamma_inv[1], this->gain[1]);
|
||||
@@ -70,7 +73,8 @@ void ColorBalanceLGGOperation::executePixel(float* outputColor, float x, float y
|
||||
|
||||
}
|
||||
|
||||
void ColorBalanceLGGOperation::deinitExecution() {
|
||||
void ColorBalanceLGGOperation::deinitExecution()
|
||||
{
|
||||
this->inputValueOperation = NULL;
|
||||
this->inputColorOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "COM_ColorCorrectionOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation() {
|
||||
ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -33,19 +34,21 @@ ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation() {
|
||||
this->greenChannelEnabled = true;
|
||||
this->blueChannelEnabled = true;
|
||||
}
|
||||
void ColorCorrectionOperation::initExecution() {
|
||||
void ColorCorrectionOperation::initExecution()
|
||||
{
|
||||
this->inputImage = this->getInputSocketReader(0);
|
||||
this->inputMask = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void ColorCorrectionOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ColorCorrectionOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputImageColor[4];
|
||||
float inputMask[4];
|
||||
this->inputImage->read(inputImageColor, x, y, sampler, inputBuffers);
|
||||
this->inputMask->read(inputMask, x, y, sampler, inputBuffers);
|
||||
|
||||
float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2])/3.0f;
|
||||
float contrast= this->data->master.contrast;
|
||||
float contrast = this->data->master.contrast;
|
||||
float saturation = this->data->master.saturation;
|
||||
float gamma = this->data->master.gamma;
|
||||
float gain = this->data->master.gain;
|
||||
@@ -54,7 +57,7 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix
|
||||
|
||||
float value = inputMask[0];
|
||||
value = min(1.0f, value);
|
||||
const float mvalue= 1.0f - value;
|
||||
const float mvalue = 1.0f - value;
|
||||
|
||||
float levelShadows = 0.0;
|
||||
float levelMidtones = 0.0;
|
||||
@@ -66,14 +69,14 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix
|
||||
}
|
||||
else if (level < this->data->startmidtones+MARGIN) {
|
||||
levelMidtones = ((level-this->data->startmidtones)*MARGIN_DIV)+0.5;
|
||||
levelShadows = 1.0- levelMidtones;
|
||||
levelShadows = 1.0 - levelMidtones;
|
||||
}
|
||||
else if (level < this->data->endmidtones-MARGIN) {
|
||||
levelMidtones = 1.0f;
|
||||
}
|
||||
else if (level < this->data->endmidtones+MARGIN) {
|
||||
levelHighlights = ((level-this->data->endmidtones)*MARGIN_DIV)+0.5;
|
||||
levelMidtones = 1.0- levelHighlights;
|
||||
levelMidtones = 1.0 - levelHighlights;
|
||||
}
|
||||
else {
|
||||
levelHighlights = 1.0f;
|
||||
@@ -134,7 +137,8 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix
|
||||
output[3] = inputImageColor[3];
|
||||
}
|
||||
|
||||
void ColorCorrectionOperation::deinitExecution() {
|
||||
void ColorCorrectionOperation::deinitExecution()
|
||||
{
|
||||
this->inputImage = NULL;
|
||||
this->inputMask = NULL;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader * inputImage;
|
||||
SocketReader* inputMask;
|
||||
SocketReader *inputImage;
|
||||
SocketReader *inputMask;
|
||||
NodeColorCorrection *data;
|
||||
|
||||
bool redChannelEnabled;
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -30,7 +30,8 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation() {
|
||||
ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
@@ -44,7 +45,8 @@ ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation() {
|
||||
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
}
|
||||
void ColorCurveOperation::initExecution() {
|
||||
void ColorCurveOperation::initExecution()
|
||||
{
|
||||
CurveBaseOperation::initExecution();
|
||||
this->inputFacProgram = this->getInputSocketReader(0);
|
||||
this->inputImageProgram = this->getInputSocketReader(1);
|
||||
@@ -55,7 +57,8 @@ void ColorCurveOperation::initExecution() {
|
||||
|
||||
}
|
||||
|
||||
void ColorCurveOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float black[4];
|
||||
float white[4];
|
||||
float fac[4];
|
||||
@@ -69,24 +72,25 @@ void ColorCurveOperation::executePixel(float* color, float x, float y, PixelSamp
|
||||
this->inputFacProgram->read(fac, x, y, sampler, inputBuffers);
|
||||
this->inputImageProgram->read(image, x, y, sampler, inputBuffers);
|
||||
|
||||
if (fac[0]>=1.0)
|
||||
if (fac[0] >= 1.0)
|
||||
curvemapping_evaluate_premulRGBF(this->curveMapping, color, image);
|
||||
else if (*fac<=0.0) {
|
||||
color[0]= image[0];
|
||||
color[1]= image[1];
|
||||
color[2]= image[2];
|
||||
color[0] = image[0];
|
||||
color[1] = image[1];
|
||||
color[2] = image[2];
|
||||
}
|
||||
else {
|
||||
float col[4], mfac= 1.0f-*fac;
|
||||
float col[4], mfac = 1.0f-*fac;
|
||||
curvemapping_evaluate_premulRGBF(this->curveMapping, col, image);
|
||||
color[0]= mfac*image[0] + *fac*col[0];
|
||||
color[1]= mfac*image[1] + *fac*col[1];
|
||||
color[2]= mfac*image[2] + *fac*col[2];
|
||||
color[0] = mfac*image[0] + *fac*col[0];
|
||||
color[1] = mfac*image[1] + *fac*col[1];
|
||||
color[2] = mfac*image[2] + *fac*col[2];
|
||||
}
|
||||
color[3]= image[3];
|
||||
color[3] = image[3];
|
||||
}
|
||||
|
||||
void ColorCurveOperation::deinitExecution() {
|
||||
void ColorCurveOperation::deinitExecution()
|
||||
{
|
||||
this->inputFacProgram = NULL;
|
||||
this->inputImageProgram = NULL;
|
||||
this->inputBlackProgram = NULL;
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "COM_ColorMatteOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ColorMatteOperation::ColorMatteOperation(): NodeOperation() {
|
||||
ColorMatteOperation::ColorMatteOperation(): NodeOperation()
|
||||
{
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
@@ -31,23 +32,26 @@ ColorMatteOperation::ColorMatteOperation(): NodeOperation() {
|
||||
inputKeyProgram = NULL;
|
||||
}
|
||||
|
||||
void ColorMatteOperation::initExecution() {
|
||||
void ColorMatteOperation::initExecution()
|
||||
{
|
||||
this->inputImageProgram = this->getInputSocketReader(0);
|
||||
this->inputKeyProgram = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void ColorMatteOperation::deinitExecution() {
|
||||
this->inputImageProgram= NULL;
|
||||
this->inputKeyProgram= NULL;
|
||||
void ColorMatteOperation::deinitExecution()
|
||||
{
|
||||
this->inputImageProgram = NULL;
|
||||
this->inputKeyProgram = NULL;
|
||||
}
|
||||
|
||||
void ColorMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ColorMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inColor[4];
|
||||
float inKey[4];
|
||||
|
||||
const float hue=this->settings->t1;
|
||||
const float sat=this->settings->t2;
|
||||
const float val=this->settings->t3;
|
||||
const float hue = this->settings->t1;
|
||||
const float sat = this->settings->t2;
|
||||
const float val = this->settings->t3;
|
||||
|
||||
float h_wrap;
|
||||
|
||||
@@ -62,19 +66,19 @@ void ColorMatteOperation::executePixel(float* outputValue, float x, float y, Pix
|
||||
if (
|
||||
/* do hue last because it needs to wrap, and does some more checks */
|
||||
|
||||
/* sat */ (fabsf(inColor[1]-inKey[1]) < sat) &&
|
||||
/* val */ (fabsf(inColor[2]-inKey[2]) < val) &&
|
||||
/* sat */ (fabsf(inColor[1] - inKey[1]) < sat) &&
|
||||
/* val */ (fabsf(inColor[2] - inKey[2]) < val) &&
|
||||
|
||||
/* multiply by 2 because it wraps on both sides of the hue,
|
||||
* otherwise 0.5 would key all hue's */
|
||||
|
||||
/* hue */ ((h_wrap= 2.f * fabsf(inColor[0]-inKey[0])) < hue || (2.f - h_wrap) < hue)
|
||||
/* hue */ ((h_wrap = 2.f * fabsf(inColor[0]-inKey[0])) < hue || (2.f - h_wrap) < hue)
|
||||
) {
|
||||
outputValue[0]=0.f; /*make transparent*/
|
||||
outputValue[0] = 0.0f; /*make transparent*/
|
||||
}
|
||||
|
||||
else { /*pixel is outside key color */
|
||||
outputValue[0]=inColor[3]; /* make pixel just as transparent as it was before */
|
||||
outputValue[0] = inColor[3]; /* make pixel just as transparent as it was before */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;}
|
||||
void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -30,24 +30,28 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
ColorRampOperation::ColorRampOperation(): NodeOperation() {
|
||||
ColorRampOperation::ColorRampOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->inputProgram = NULL;
|
||||
this->colorBand = NULL;
|
||||
}
|
||||
void ColorRampOperation::initExecution() {
|
||||
void ColorRampOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ColorRampOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ColorRampOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float values[4];
|
||||
|
||||
this->inputProgram->read(values, x, y, sampler, inputBuffers);
|
||||
do_colorband(this->colorBand, values[0], color);
|
||||
}
|
||||
|
||||
void ColorRampOperation::deinitExecution() {
|
||||
void ColorRampOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ private:
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader * inputProgram;
|
||||
ColorBand* colorBand;
|
||||
ColorBand *colorBand;
|
||||
public:
|
||||
ColorRampOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void setColorBand(ColorBand* colorBand) {this->colorBand = colorBand;}
|
||||
void setColorBand(ColorBand *colorBand) {this->colorBand = colorBand;}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include "BLI_math.h"
|
||||
#define avg(a,b) ((a+b)/2)
|
||||
|
||||
ColorSpillOperation::ColorSpillOperation(): NodeOperation() {
|
||||
ColorSpillOperation::ColorSpillOperation(): NodeOperation()
|
||||
{
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_VALUE);
|
||||
addOutputSocket(COM_DT_COLOR);
|
||||
@@ -34,7 +35,8 @@ ColorSpillOperation::ColorSpillOperation(): NodeOperation() {
|
||||
this->spillChannel = 1; // GREEN
|
||||
}
|
||||
|
||||
void ColorSpillOperation::initExecution() {
|
||||
void ColorSpillOperation::initExecution()
|
||||
{
|
||||
this->inputImageReader = this->getInputSocketReader(0);
|
||||
this->inputFacReader = this->getInputSocketReader(1);
|
||||
if (spillChannel == 0) {
|
||||
@@ -76,12 +78,14 @@ void ColorSpillOperation::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void ColorSpillOperation::deinitExecution() {
|
||||
this->inputImageReader= NULL;
|
||||
void ColorSpillOperation::deinitExecution()
|
||||
{
|
||||
this->inputImageReader = NULL;
|
||||
this->inputFacReader = NULL;
|
||||
}
|
||||
|
||||
void ColorSpillOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ColorSpillOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float fac[4];
|
||||
float input[4];
|
||||
float map;
|
||||
@@ -102,11 +106,13 @@ void ColorSpillOperation::executePixel(float* outputValue, float x, float y, Pix
|
||||
outputValue[3]=input[3];
|
||||
}
|
||||
}
|
||||
float ColorSpillOperation::calculateMapValue(float fac, float *input) {
|
||||
float ColorSpillOperation::calculateMapValue(float fac, float *input)
|
||||
{
|
||||
return fac * (input[this->spillChannel]-(this->settings->limscale*input[settings->limchan]));
|
||||
}
|
||||
|
||||
|
||||
float ColorSpillAverageOperation::calculateMapValue(float fac, float *input) {
|
||||
float ColorSpillAverageOperation::calculateMapValue(float fac, float *input)
|
||||
{
|
||||
return fac * (input[this->spillChannel]-(this->settings->limscale*avg(input[this->channel2], input[this->channel3])));
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setSettings(NodeColorspill* nodeColorSpill) {this->settings= nodeColorSpill;}
|
||||
void setSettings(NodeColorspill *nodeColorSpill) {this->settings = nodeColorSpill;}
|
||||
void setSpillChannel(int channel) {this->spillChannel = channel;}
|
||||
|
||||
float calculateMapValue(float fac, float *input);
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "COM_CombineChannelsOperation.h"
|
||||
#include <stdio.h>
|
||||
|
||||
CombineChannelsOperation::CombineChannelsOperation() : NodeOperation() {
|
||||
CombineChannelsOperation::CombineChannelsOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
@@ -35,14 +36,16 @@ CombineChannelsOperation::CombineChannelsOperation() : NodeOperation() {
|
||||
this->inputChannel3Operation = NULL;
|
||||
this->inputChannel4Operation = NULL;
|
||||
}
|
||||
void CombineChannelsOperation::initExecution() {
|
||||
void CombineChannelsOperation::initExecution()
|
||||
{
|
||||
this->inputChannel1Operation = this->getInputSocketReader(0);
|
||||
this->inputChannel2Operation = this->getInputSocketReader(1);
|
||||
this->inputChannel3Operation = this->getInputSocketReader(2);
|
||||
this->inputChannel4Operation = this->getInputSocketReader(3);
|
||||
}
|
||||
|
||||
void CombineChannelsOperation::deinitExecution() {
|
||||
void CombineChannelsOperation::deinitExecution()
|
||||
{
|
||||
this->inputChannel1Operation = NULL;
|
||||
this->inputChannel2Operation = NULL;
|
||||
this->inputChannel3Operation = NULL;
|
||||
@@ -50,7 +53,8 @@ void CombineChannelsOperation::deinitExecution() {
|
||||
}
|
||||
|
||||
|
||||
void CombineChannelsOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void CombineChannelsOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float input[4];
|
||||
/// @todo: remove if statements
|
||||
if (this->inputChannel1Operation) {
|
||||
|
||||
@@ -36,7 +36,8 @@ extern "C" {
|
||||
#include "PIL_time.h"
|
||||
|
||||
|
||||
CompositorOperation::CompositorOperation() : NodeOperation() {
|
||||
CompositorOperation::CompositorOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
|
||||
@@ -46,7 +47,8 @@ CompositorOperation::CompositorOperation() : NodeOperation() {
|
||||
this->alphaInput = NULL;
|
||||
}
|
||||
|
||||
void CompositorOperation::initExecution() {
|
||||
void CompositorOperation::initExecution()
|
||||
{
|
||||
// When initializing the tree during initial load the width and height can be zero.
|
||||
this->imageInput = getInputSocketReader(0);
|
||||
this->alphaInput = getInputSocketReader(1);
|
||||
@@ -54,13 +56,13 @@ void CompositorOperation::initExecution() {
|
||||
this->outputBuffer=(float*) MEM_callocN(this->getWidth()*this->getHeight()*4*sizeof(float), "CompositorOperation");
|
||||
}
|
||||
const Scene * scene = this->scene;
|
||||
Render* re= RE_GetRender(scene->id.name);
|
||||
RenderResult *rr= RE_AcquireResultWrite(re);
|
||||
Render *re = RE_GetRender(scene->id.name);
|
||||
RenderResult *rr = RE_AcquireResultWrite(re);
|
||||
if (rr) {
|
||||
if (rr->rectf != NULL) {
|
||||
MEM_freeN(rr->rectf);
|
||||
}
|
||||
rr->rectf= outputBuffer;
|
||||
rr->rectf = outputBuffer;
|
||||
}
|
||||
if (re) {
|
||||
RE_ReleaseResult(re);
|
||||
@@ -69,16 +71,18 @@ void CompositorOperation::initExecution() {
|
||||
|
||||
}
|
||||
|
||||
void CompositorOperation::deinitExecution() {
|
||||
void CompositorOperation::deinitExecution()
|
||||
{
|
||||
this->outputBuffer = NULL;
|
||||
this->imageInput = NULL;
|
||||
this->alphaInput = NULL;
|
||||
}
|
||||
|
||||
|
||||
void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) {
|
||||
void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
|
||||
{
|
||||
float color[8]; // 7 is enough
|
||||
float* buffer = this->outputBuffer;
|
||||
float *buffer = this->outputBuffer;
|
||||
|
||||
if (!buffer) return;
|
||||
int x1 = rect->xmin;
|
||||
@@ -109,9 +113,10 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, Mem
|
||||
}
|
||||
}
|
||||
|
||||
void CompositorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void CompositorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
int width = this->scene->r.xsch*this->scene->r.size/100;
|
||||
int height= this->scene->r.ysch*this->scene->r.size/100;
|
||||
int height = this->scene->r.ysch*this->scene->r.size/100;
|
||||
preferredResolution[0] = width;
|
||||
preferredResolution[1] = height;
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ private:
|
||||
/**
|
||||
* @brief local reference to the scene
|
||||
*/
|
||||
const Scene* scene;
|
||||
const Scene *scene;
|
||||
|
||||
/**
|
||||
* @brief local reference to the node tree
|
||||
*/
|
||||
const bNodeTree* tree;
|
||||
const bNodeTree *tree;
|
||||
|
||||
/**
|
||||
* @brief reference to the output float buffer
|
||||
@@ -49,17 +49,17 @@ private:
|
||||
/**
|
||||
* @brief local reference to the input image operation
|
||||
*/
|
||||
SocketReader* imageInput;
|
||||
SocketReader *imageInput;
|
||||
|
||||
/**
|
||||
* @brief local reference to the input alpha operation
|
||||
*/
|
||||
SocketReader* alphaInput;
|
||||
SocketReader *alphaInput;
|
||||
public:
|
||||
CompositorOperation();
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers);
|
||||
void setScene(const Scene* scene) {this->scene = scene;}
|
||||
void setbNodeTree(const bNodeTree* tree) {this->tree= tree;}
|
||||
void setScene(const Scene *scene) {this->scene = scene;}
|
||||
void setbNodeTree(const bNodeTree *tree) {this->tree = tree;}
|
||||
bool isOutputOperation(bool rendering) const {return rendering;}
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
@@ -25,23 +25,27 @@
|
||||
extern "C" {
|
||||
#include "IMB_imbuf.h"
|
||||
}
|
||||
ConvertColorProfileOperation::ConvertColorProfileOperation(): NodeOperation() {
|
||||
ConvertColorProfileOperation::ConvertColorProfileOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
this->predivided = false;
|
||||
}
|
||||
|
||||
void ConvertColorProfileOperation::initExecution() {
|
||||
void ConvertColorProfileOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertColorProfileOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertColorProfileOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float color[4];
|
||||
inputOperation->read(color, x, y, sampler, inputBuffers);
|
||||
IMB_buffer_float_from_float(outputValue, color, 4, this->toProfile, this->fromProfile, this->predivided, 1, 1, 0, 0);
|
||||
}
|
||||
|
||||
void ConvertColorProfileOperation::deinitExecution() {
|
||||
void ConvertColorProfileOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,22 +22,26 @@
|
||||
|
||||
#include "COM_ConvertColorToBWOperation.h"
|
||||
|
||||
ConvertColorToBWOperation::ConvertColorToBWOperation(): NodeOperation() {
|
||||
ConvertColorToBWOperation::ConvertColorToBWOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertColorToBWOperation::initExecution() {
|
||||
void ConvertColorToBWOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertColorToBWOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers);
|
||||
outputValue[0] = (inputColor[0]*0.35f + inputColor[1]*0.45f + inputColor[2]*0.2f)*inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertColorToBWOperation::deinitExecution() {
|
||||
void ConvertColorToBWOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,20 +22,24 @@
|
||||
|
||||
#include "COM_ConvertColorToVectorOperation.h"
|
||||
|
||||
ConvertColorToVectorOperation::ConvertColorToVectorOperation(): NodeOperation() {
|
||||
ConvertColorToVectorOperation::ConvertColorToVectorOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertColorToVectorOperation::initExecution() {
|
||||
void ConvertColorToVectorOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertColorToVectorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertColorToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
inputOperation->read(outputValue, x, y, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
void ConvertColorToVectorOperation::deinitExecution() {
|
||||
void ConvertColorToVectorOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,22 +22,26 @@
|
||||
|
||||
#include "COM_ConvertColourToValueProg.h"
|
||||
|
||||
ConvertColourToValueProg::ConvertColourToValueProg(): NodeOperation() {
|
||||
ConvertColourToValueProg::ConvertColourToValueProg(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertColourToValueProg::initExecution() {
|
||||
void ConvertColourToValueProg::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertColourToValueProg::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertColourToValueProg::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers);
|
||||
outputValue[0] = ((inputColor[0] + inputColor[1] + inputColor[2])/3.0f)*inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertColourToValueProg::deinitExecution() {
|
||||
void ConvertColourToValueProg::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "DNA_camera_types.h"
|
||||
|
||||
ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation() {
|
||||
ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->inputOperation = NULL;
|
||||
@@ -33,13 +34,14 @@ ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation()
|
||||
this->maxRadius = 32.0f;
|
||||
}
|
||||
|
||||
float ConvertDepthToRadiusOperation::determineFocalDistance() {
|
||||
float ConvertDepthToRadiusOperation::determineFocalDistance()
|
||||
{
|
||||
|
||||
if (cameraObject == NULL || cameraObject->type != OB_CAMERA) {
|
||||
return 10.0f;
|
||||
}
|
||||
else {
|
||||
Camera *camera= (Camera*)this->cameraObject->data;
|
||||
Camera *camera = (Camera*)this->cameraObject->data;
|
||||
cam_lens = camera->lens;
|
||||
if (camera->dof_ob) {
|
||||
/* too simple, better to return the distance on the view axis only
|
||||
@@ -56,10 +58,11 @@ float ConvertDepthToRadiusOperation::determineFocalDistance() {
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertDepthToRadiusOperation::initExecution() {
|
||||
void ConvertDepthToRadiusOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
float focalDistance = determineFocalDistance();
|
||||
if (focalDistance==0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */
|
||||
if (focalDistance == 0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */
|
||||
inverseFocalDistance = 1.f/focalDistance;
|
||||
this->aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight());
|
||||
this->aperture = 0.5f*(this->cam_lens / (this->aspect*32.f)) / this->fStop;
|
||||
@@ -67,7 +70,8 @@ void ConvertDepthToRadiusOperation::initExecution() {
|
||||
this->dof_sp = (float)minsz / (16.f / cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
|
||||
}
|
||||
|
||||
void ConvertDepthToRadiusOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
float z;
|
||||
float radius;
|
||||
@@ -93,6 +97,7 @@ void ConvertDepthToRadiusOperation::executePixel(float* outputValue, float x, fl
|
||||
else outputValue[0] = 0.0f;
|
||||
}
|
||||
|
||||
void ConvertDepthToRadiusOperation::deinitExecution() {
|
||||
void ConvertDepthToRadiusOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
void setfStop(float fStop) {this->fStop = fStop;}
|
||||
void setMaxRadius(float maxRadius) {this->maxRadius = maxRadius;}
|
||||
void setCameraObject(Object* camera) {this->cameraObject = camera;}
|
||||
void setCameraObject(Object *camera) {this->cameraObject = camera;}
|
||||
float determineFocalDistance();
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -23,24 +23,28 @@
|
||||
#include "COM_ConvertHSVToRGBOperation.h"
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
ConvertHSVToRGBOperation::ConvertHSVToRGBOperation(): NodeOperation() {
|
||||
ConvertHSVToRGBOperation::ConvertHSVToRGBOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertHSVToRGBOperation::initExecution() {
|
||||
void ConvertHSVToRGBOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertHSVToRGBOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertHSVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(inputColor, x, y, sampler, inputBuffers);
|
||||
hsv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
|
||||
outputValue[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertHSVToRGBOperation::deinitExecution() {
|
||||
void ConvertHSVToRGBOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,18 +22,21 @@
|
||||
#include "COM_ConvertKeyToPremulOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ConvertKeyToPremulOperation::ConvertKeyToPremulOperation(): NodeOperation() {
|
||||
ConvertKeyToPremulOperation::ConvertKeyToPremulOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->inputColor = NULL;
|
||||
}
|
||||
|
||||
void ConvertKeyToPremulOperation::initExecution() {
|
||||
void ConvertKeyToPremulOperation::initExecution()
|
||||
{
|
||||
this->inputColor = getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertKeyToPremulOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertKeyToPremulOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
float alpha;
|
||||
|
||||
@@ -48,6 +51,7 @@ void ConvertKeyToPremulOperation::executePixel(float* outputValue, float x, floa
|
||||
outputValue[3] = alpha;
|
||||
}
|
||||
|
||||
void ConvertKeyToPremulOperation::deinitExecution() {
|
||||
void ConvertKeyToPremulOperation::deinitExecution()
|
||||
{
|
||||
this->inputColor = NULL;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
@@ -22,18 +22,21 @@
|
||||
#include "COM_ConvertPremulToKeyOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ConvertPremulToKeyOperation::ConvertPremulToKeyOperation(): NodeOperation() {
|
||||
ConvertPremulToKeyOperation::ConvertPremulToKeyOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->inputColor = NULL;
|
||||
}
|
||||
|
||||
void ConvertPremulToKeyOperation::initExecution() {
|
||||
void ConvertPremulToKeyOperation::initExecution()
|
||||
{
|
||||
this->inputColor = getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertPremulToKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
float alpha;
|
||||
|
||||
@@ -41,9 +44,9 @@ void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, floa
|
||||
alpha = inputValue[3];
|
||||
|
||||
if (fabsf(alpha) < 1e-5f) {
|
||||
outputValue[0]= 0.f;
|
||||
outputValue[1]= 0.f;
|
||||
outputValue[2]= 0.f;
|
||||
outputValue[0] = 0.f;
|
||||
outputValue[1] = 0.f;
|
||||
outputValue[2] = 0.f;
|
||||
}
|
||||
else {
|
||||
outputValue[0] = inputValue[0] / alpha;
|
||||
@@ -55,6 +58,7 @@ void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, floa
|
||||
outputValue[3] = alpha;
|
||||
}
|
||||
|
||||
void ConvertPremulToKeyOperation::deinitExecution() {
|
||||
void ConvertPremulToKeyOperation::deinitExecution()
|
||||
{
|
||||
this->inputColor = NULL;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
@@ -23,23 +23,27 @@
|
||||
#include "COM_ConvertRGBToHSVOperation.h"
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
ConvertRGBToHSVOperation::ConvertRGBToHSVOperation(): NodeOperation() {
|
||||
ConvertRGBToHSVOperation::ConvertRGBToHSVOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertRGBToHSVOperation::initExecution() {
|
||||
void ConvertRGBToHSVOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertRGBToHSVOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertRGBToHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(inputColor, x, y, sampler, inputBuffers);
|
||||
rgb_to_hsv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
|
||||
outputValue[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertRGBToHSVOperation::deinitExecution() {
|
||||
void ConvertRGBToHSVOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,17 +22,20 @@
|
||||
#include "COM_ConvertRGBToYCCOperation.h"
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
ConvertRGBToYCCOperation::ConvertRGBToYCCOperation(): NodeOperation() {
|
||||
ConvertRGBToYCCOperation::ConvertRGBToYCCOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertRGBToYCCOperation::initExecution() {
|
||||
void ConvertRGBToYCCOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertRGBToYCCOperation::setMode(int mode) {
|
||||
void ConvertRGBToYCCOperation::setMode(int mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
@@ -48,7 +51,8 @@ void ConvertRGBToYCCOperation::setMode(int mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertRGBToYCCOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertRGBToYCCOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
float color[3];
|
||||
|
||||
@@ -62,6 +66,7 @@ void ConvertRGBToYCCOperation::executePixel(float* outputValue, float x, float y
|
||||
outputValue[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertRGBToYCCOperation::deinitExecution() {
|
||||
void ConvertRGBToYCCOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,23 +22,27 @@
|
||||
#include "COM_ConvertRGBToYUVOperation.h"
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
ConvertRGBToYUVOperation::ConvertRGBToYUVOperation(): NodeOperation() {
|
||||
ConvertRGBToYUVOperation::ConvertRGBToYUVOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertRGBToYUVOperation::initExecution() {
|
||||
void ConvertRGBToYUVOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertRGBToYUVOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertRGBToYUVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(inputColor, x, y, sampler, inputBuffers);
|
||||
rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
|
||||
outputValue[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertRGBToYUVOperation::deinitExecution() {
|
||||
void ConvertRGBToYUVOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,16 +22,19 @@
|
||||
|
||||
#include "COM_ConvertValueToColourProg.h"
|
||||
|
||||
ConvertValueToColourProg::ConvertValueToColourProg(): NodeOperation() {
|
||||
ConvertValueToColourProg::ConvertValueToColourProg(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void ConvertValueToColourProg::initExecution() {
|
||||
void ConvertValueToColourProg::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertValueToColourProg::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertValueToColourProg::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
this->inputProgram->read(inputValue, x, y, sampler, inputBuffers);
|
||||
color[0] = inputValue[0];
|
||||
@@ -40,6 +43,7 @@ void ConvertValueToColourProg::executePixel(float* color, float x, float y, Pixe
|
||||
color[3] = 1.0f;
|
||||
}
|
||||
|
||||
void ConvertValueToColourProg::deinitExecution() {
|
||||
void ConvertValueToColourProg::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -30,14 +30,14 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader* inputProgram;
|
||||
SocketReader *inputProgram;
|
||||
public:
|
||||
ConvertValueToColourProg();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,17 +22,20 @@
|
||||
|
||||
#include "COM_ConvertValueToVectorOperation.h"
|
||||
|
||||
ConvertValueToVectorOperation::ConvertValueToVectorOperation(): NodeOperation() {
|
||||
ConvertValueToVectorOperation::ConvertValueToVectorOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertValueToVectorOperation::initExecution() {
|
||||
void ConvertValueToVectorOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertValueToVectorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertValueToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float input[4];
|
||||
inputOperation->read(input, x, y, sampler, inputBuffers);
|
||||
outputValue[0] = input[0];
|
||||
@@ -41,6 +44,7 @@ void ConvertValueToVectorOperation::executePixel(float* outputValue, float x, fl
|
||||
outputValue[3] = 0.0f;
|
||||
}
|
||||
|
||||
void ConvertValueToVectorOperation::deinitExecution() {
|
||||
void ConvertValueToVectorOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,21 +22,25 @@
|
||||
|
||||
#include "COM_ConvertVectorToColorOperation.h"
|
||||
|
||||
ConvertVectorToColorOperation::ConvertVectorToColorOperation(): NodeOperation() {
|
||||
ConvertVectorToColorOperation::ConvertVectorToColorOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertVectorToColorOperation::initExecution() {
|
||||
void ConvertVectorToColorOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertVectorToColorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertVectorToColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
inputOperation->read(outputValue, x, y, sampler, inputBuffers);
|
||||
outputValue[3] = 1.0f;
|
||||
}
|
||||
|
||||
void ConvertVectorToColorOperation::deinitExecution() {
|
||||
void ConvertVectorToColorOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,22 +22,26 @@
|
||||
|
||||
#include "COM_ConvertVectorToValueOperation.h"
|
||||
|
||||
ConvertVectorToValueOperation::ConvertVectorToValueOperation(): NodeOperation() {
|
||||
ConvertVectorToValueOperation::ConvertVectorToValueOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertVectorToValueOperation::initExecution() {
|
||||
void ConvertVectorToValueOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertVectorToValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertVectorToValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float input[4];
|
||||
inputOperation->read(input, x, y, sampler, inputBuffers);
|
||||
outputValue[0] = (input[0]+input[1]+input[2])/3.0f;
|
||||
}
|
||||
|
||||
void ConvertVectorToValueOperation::deinitExecution() {
|
||||
void ConvertVectorToValueOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,17 +22,20 @@
|
||||
#include "COM_ConvertYCCToRGBOperation.h"
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
ConvertYCCToRGBOperation::ConvertYCCToRGBOperation(): NodeOperation() {
|
||||
ConvertYCCToRGBOperation::ConvertYCCToRGBOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertYCCToRGBOperation::initExecution() {
|
||||
void ConvertYCCToRGBOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertYCCToRGBOperation::setMode(int mode) {
|
||||
void ConvertYCCToRGBOperation::setMode(int mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
@@ -48,7 +51,8 @@ void ConvertYCCToRGBOperation::setMode(int mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertYCCToRGBOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertYCCToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(inputColor, x, y, sampler, inputBuffers);
|
||||
|
||||
@@ -61,7 +65,8 @@ void ConvertYCCToRGBOperation::executePixel(float* outputValue, float x, float y
|
||||
outputValue[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertYCCToRGBOperation::deinitExecution() {
|
||||
void ConvertYCCToRGBOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,24 +22,28 @@
|
||||
#include "COM_ConvertYUVToRGBOperation.h"
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
ConvertYUVToRGBOperation::ConvertYUVToRGBOperation(): NodeOperation() {
|
||||
ConvertYUVToRGBOperation::ConvertYUVToRGBOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void ConvertYUVToRGBOperation::initExecution() {
|
||||
void ConvertYUVToRGBOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ConvertYUVToRGBOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ConvertYUVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(inputColor, x, y, sampler, inputBuffers);
|
||||
yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
|
||||
outputValue[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void ConvertYUVToRGBOperation::deinitExecution() {
|
||||
void ConvertYUVToRGBOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -23,15 +23,18 @@
|
||||
#include "COM_ConvolutionEdgeFilterOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFilterOperation() {
|
||||
ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFilterOperation()
|
||||
{
|
||||
}
|
||||
inline void addFilter(float* result, float*input, float value) {
|
||||
inline void addFilter(float *result, float*input, float value)
|
||||
{
|
||||
result[0] += input[0] * value;
|
||||
result[1] += input[1] * value;
|
||||
result[2] += input[2] * value;
|
||||
}
|
||||
|
||||
void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float in1[4],in2[4], res1[4], res2[4];
|
||||
|
||||
float value[4];
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class ConvolutionEdgeFilterOperation: public ConvolutionFilterOperation {
|
||||
public:
|
||||
ConvolutionEdgeFilterOperation();
|
||||
void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_ConvolutionFilterOperation.h"
|
||||
|
||||
ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation() {
|
||||
ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -31,12 +32,14 @@ ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation() {
|
||||
this->filter = NULL;
|
||||
this->setComplex(true);
|
||||
}
|
||||
void ConvolutionFilterOperation::initExecution() {
|
||||
void ConvolutionFilterOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
this->inputValueOperation = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) {
|
||||
void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9)
|
||||
{
|
||||
this->filter = new float[9];
|
||||
this->filter[0] = f1;
|
||||
this->filter[1] = f2;
|
||||
@@ -51,7 +54,8 @@ void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, floa
|
||||
this->filterWidth = 3;
|
||||
}
|
||||
|
||||
void ConvolutionFilterOperation::deinitExecution() {
|
||||
void ConvolutionFilterOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
this->inputValueOperation = NULL;
|
||||
if (this->filter) {
|
||||
@@ -61,7 +65,8 @@ void ConvolutionFilterOperation::deinitExecution() {
|
||||
}
|
||||
|
||||
|
||||
void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
color[0] = 0.0;
|
||||
color[1] = 0.0;
|
||||
color[2] = 0.0;
|
||||
@@ -123,7 +128,8 @@ void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryB
|
||||
color[2] = color[2]*value[0] + in2[2] * mval;
|
||||
}
|
||||
|
||||
bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
int addx = (this->filterWidth-1)/2+1;
|
||||
int addy = (this->filterHeight-1)/2+1;
|
||||
|
||||
@@ -33,13 +33,13 @@ private:
|
||||
protected:
|
||||
SocketReader *inputOperation;
|
||||
SocketReader *inputValueOperation;
|
||||
float* filter;
|
||||
float *filter;
|
||||
|
||||
public:
|
||||
ConvolutionFilterOperation();
|
||||
void set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9);
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
@@ -23,22 +23,24 @@
|
||||
#include "COM_CropOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
CropBaseOperation::CropBaseOperation() :NodeOperation() {
|
||||
CropBaseOperation::CropBaseOperation() :NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
this->settings = NULL;
|
||||
}
|
||||
|
||||
void CropBaseOperation::updateArea() {
|
||||
void CropBaseOperation::updateArea()
|
||||
{
|
||||
SocketReader * inputReference = this->getInputSocketReader(0);
|
||||
float width = inputReference->getWidth();
|
||||
float height = inputReference->getHeight();
|
||||
if (this->relative) {
|
||||
settings->x1= width * settings->fac_x1;
|
||||
settings->x2= width * settings->fac_x2;
|
||||
settings->y1= height * settings->fac_y1;
|
||||
settings->y2= height * settings->fac_y2;
|
||||
settings->x1 = width * settings->fac_x1;
|
||||
settings->x2 = width * settings->fac_x2;
|
||||
settings->y1 = height * settings->fac_y1;
|
||||
settings->y2 = height * settings->fac_y2;
|
||||
}
|
||||
if (width <= settings->x1 + 1)
|
||||
settings->x1 = width - 1;
|
||||
@@ -55,19 +57,23 @@ void CropBaseOperation::updateArea() {
|
||||
this->ymin = MIN2(settings->y1, settings->y2);
|
||||
}
|
||||
|
||||
void CropBaseOperation::initExecution() {
|
||||
void CropBaseOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
updateArea();
|
||||
}
|
||||
|
||||
void CropBaseOperation::deinitExecution() {
|
||||
void CropBaseOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
CropOperation::CropOperation() :CropBaseOperation() {
|
||||
CropOperation::CropOperation() :CropBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
if ((x < this->xmax && x >= xmin) && (y < ymax && y >= ymin)) {
|
||||
inputOperation->read(color, x, y, sampler, inputBuffers);
|
||||
}
|
||||
@@ -79,10 +85,12 @@ void CropOperation::executePixel(float *color, float x, float y, PixelSampler sa
|
||||
}
|
||||
}
|
||||
|
||||
CropImageOperation::CropImageOperation() :CropBaseOperation() {
|
||||
CropImageOperation::CropImageOperation() :CropBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
newInput.xmax = input->xmax + this->xmin;
|
||||
@@ -93,13 +101,15 @@ bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
|
||||
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
}
|
||||
|
||||
void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[]) {
|
||||
void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[])
|
||||
{
|
||||
NodeOperation::determineResolution(resolution, preferedResolution);
|
||||
updateArea();
|
||||
resolution[0] = this->xmax - this->xmin;
|
||||
resolution[1] = this->ymax - this->ymin;
|
||||
}
|
||||
|
||||
void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
this->inputOperation->read(color, (x + this->xmin), (y + this->ymin), sampler, inputBuffers);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void setCropSettings(NodeTwoXYs *settings) {this->settings = settings;}
|
||||
void setRelative(bool rel) {this->relative =rel;}
|
||||
void setRelative(bool rel) {this->relative = rel;}
|
||||
};
|
||||
|
||||
class CropOperation: public CropBaseOperation {
|
||||
|
||||
@@ -30,9 +30,11 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
CurveBaseOperation::CurveBaseOperation(): NodeOperation() {
|
||||
CurveBaseOperation::CurveBaseOperation(): NodeOperation()
|
||||
{
|
||||
this->curveMapping = NULL;
|
||||
}
|
||||
void CurveBaseOperation::initExecution() {
|
||||
void CurveBaseOperation::initExecution()
|
||||
{
|
||||
curvemapping_initialize(this->curveMapping);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ public:
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void setCurveMapping(CurveMapping* mapping) {this->curveMapping = mapping;}
|
||||
void setCurveMapping(CurveMapping *mapping) {this->curveMapping = mapping;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "COM_DifferenceMatteOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation() {
|
||||
DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation()
|
||||
{
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
@@ -32,16 +33,19 @@ DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation() {
|
||||
inputImage2Program = NULL;
|
||||
}
|
||||
|
||||
void DifferenceMatteOperation::initExecution() {
|
||||
void DifferenceMatteOperation::initExecution()
|
||||
{
|
||||
this->inputImage1Program = this->getInputSocketReader(0);
|
||||
this->inputImage2Program = this->getInputSocketReader(1);
|
||||
}
|
||||
void DifferenceMatteOperation::deinitExecution() {
|
||||
this->inputImage1Program= NULL;
|
||||
this->inputImage2Program= NULL;
|
||||
void DifferenceMatteOperation::deinitExecution()
|
||||
{
|
||||
this->inputImage1Program = NULL;
|
||||
this->inputImage2Program = NULL;
|
||||
}
|
||||
|
||||
void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inColor1[4];
|
||||
float inColor2[4];
|
||||
|
||||
@@ -53,9 +57,9 @@ void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y
|
||||
this->inputImage1Program->read(inColor1, x, y, sampler, inputBuffers);
|
||||
this->inputImage2Program->read(inColor2, x, y, sampler, inputBuffers);
|
||||
|
||||
difference= fabs(inColor2[0]-inColor1[0])+
|
||||
fabs(inColor2[1]-inColor1[1])+
|
||||
fabs(inColor2[2]-inColor1[2]);
|
||||
difference = (fabs(inColor2[0] - inColor1[0]) +
|
||||
fabs(inColor2[1] - inColor1[1]) +
|
||||
fabs(inColor2[2] - inColor1[2]));
|
||||
|
||||
/*average together the distances*/
|
||||
difference=difference/3.0;
|
||||
@@ -78,7 +82,7 @@ void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y
|
||||
}
|
||||
else {
|
||||
/*foreground object*/
|
||||
outputValue[0]= inColor1[3];
|
||||
outputValue[0] = inColor1[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
*/
|
||||
class DifferenceMatteOperation : public NodeOperation {
|
||||
private:
|
||||
NodeChroma* settings;
|
||||
NodeChroma *settings;
|
||||
SocketReader * inputImage1Program;
|
||||
SocketReader* inputImage2Program;
|
||||
SocketReader *inputImage2Program;
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
@@ -43,11 +43,11 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;}
|
||||
void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "COM_DilateErodeOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
DilateErodeOperation::DilateErodeOperation(): NodeOperation() {
|
||||
DilateErodeOperation::DilateErodeOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->setComplex(true);
|
||||
@@ -32,7 +33,8 @@ DilateErodeOperation::DilateErodeOperation(): NodeOperation() {
|
||||
this->_switch = 0.5f;
|
||||
this->distance = 0.0f;
|
||||
}
|
||||
void DilateErodeOperation::initExecution() {
|
||||
void DilateErodeOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
if (this->distance < 0.0f) {
|
||||
this->scope = - this->distance + this->inset;
|
||||
@@ -50,12 +52,14 @@ void DilateErodeOperation::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void* DilateErodeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void* buffer = inputProgram->initializeTileData(NULL, memoryBuffers);
|
||||
void *DilateErodeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
void *buffer = inputProgram->initializeTileData(NULL, memoryBuffers);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void DilateErodeOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float inputValue[4];
|
||||
const float sw = this->_switch;
|
||||
const float distance = this->distance;
|
||||
@@ -64,9 +68,9 @@ void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer
|
||||
const float inset = this->inset;
|
||||
float mindist = rd*2;
|
||||
|
||||
MemoryBuffer* inputBuffer = (MemoryBuffer*)data;
|
||||
float* buffer = inputBuffer->getBuffer();
|
||||
rcti* rect = inputBuffer->getRect();
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
rcti *rect = inputBuffer->getRect();
|
||||
const int minx = max(x - scope, rect->xmin);
|
||||
const int miny = max(y - scope, rect->ymin);
|
||||
const int maxx = min(x + scope, rect->xmax);
|
||||
@@ -137,11 +141,13 @@ void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer
|
||||
}
|
||||
}
|
||||
|
||||
void DilateErodeOperation::deinitExecution() {
|
||||
void DilateErodeOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
bool DilateErodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool DilateErodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
newInput.xmax = input->xmax + scope;
|
||||
|
||||
@@ -47,14 +47,14 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,8 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation() {
|
||||
DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
@@ -35,7 +36,8 @@ DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation() {
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
void DirectionalBlurOperation::initExecution() {
|
||||
void DirectionalBlurOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = getInputSocketReader(0);
|
||||
QualityStepHelper::initExecution(COM_QH_INCREASE);
|
||||
const float angle = this->data->angle;
|
||||
@@ -48,37 +50,38 @@ void DirectionalBlurOperation::initExecution() {
|
||||
const float width = getWidth();
|
||||
const float height = getHeight();
|
||||
|
||||
const float a= angle;
|
||||
const float itsc= 1.f / pow(2.f, (float)iterations);
|
||||
const float a = angle;
|
||||
const float itsc = 1.f / pow(2.f, (float)iterations);
|
||||
float D;
|
||||
|
||||
D= distance * sqrtf(width*width + height*height);
|
||||
center_x_pix= center_x * width;
|
||||
center_y_pix= center_y * height;
|
||||
D = distance * sqrtf(width*width + height*height);
|
||||
center_x_pix = center_x * width;
|
||||
center_y_pix = center_y * height;
|
||||
|
||||
tx= itsc * D * cos(a);
|
||||
ty= -itsc * D * sin(a);
|
||||
sc= itsc * zoom;
|
||||
rot= itsc * spin;
|
||||
rot = itsc * spin;
|
||||
|
||||
}
|
||||
|
||||
void DirectionalBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void DirectionalBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
const int iterations = pow(2.f, this->data->iter);
|
||||
float col[4]= {0,0,0,0};
|
||||
float col2[4]= {0,0,0,0};
|
||||
float col[4] = {0,0,0,0};
|
||||
float col2[4] = {0,0,0,0};
|
||||
this->inputProgram->read(col2, x, y, COM_PS_NEAREST, inputBuffers);
|
||||
float ltx = tx;
|
||||
float lty = ty;
|
||||
float lsc = sc;
|
||||
float lrot = rot;
|
||||
/* blur the image */
|
||||
for (int i= 0; i < iterations; ++i) {
|
||||
const float cs= cos(lrot), ss= sin(lrot);
|
||||
const float isc= 1.f / (1.f + lsc);
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
const float cs = cos(lrot), ss = sin(lrot);
|
||||
const float isc = 1.f / (1.f + lsc);
|
||||
|
||||
const float v= isc * (y - center_y_pix) + lty;
|
||||
const float u= isc * (x - center_x_pix) + ltx;
|
||||
const float v = isc * (y - center_y_pix) + lty;
|
||||
const float u = isc * (x - center_x_pix) + ltx;
|
||||
|
||||
this->inputProgram->read(col, cs * u + ss * v + center_x_pix, cs * v - ss * u + center_y_pix, COM_PS_NEAREST, inputBuffers);
|
||||
|
||||
@@ -99,11 +102,13 @@ void DirectionalBlurOperation::executePixel(float* color, int x, int y, MemoryBu
|
||||
color[3] = col2[3]/iterations;
|
||||
}
|
||||
|
||||
void DirectionalBlurOperation::deinitExecution() {
|
||||
void DirectionalBlurOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
newInput.xmax = this->getWidth();
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
class DirectionalBlurOperation : public NodeOperation, public QualityStepHelper {
|
||||
private:
|
||||
SocketReader* inputProgram;
|
||||
NodeDBlurData* data;
|
||||
SocketReader *inputProgram;
|
||||
NodeDBlurData *data;
|
||||
|
||||
float center_x_pix, center_y_pix;
|
||||
float tx, ty;
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
DisplaceOperation::DisplaceOperation(): NodeOperation() {
|
||||
DisplaceOperation::DisplaceOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
@@ -37,7 +38,8 @@ DisplaceOperation::DisplaceOperation(): NodeOperation() {
|
||||
this->inputScaleYProgram = NULL;
|
||||
}
|
||||
|
||||
void DisplaceOperation::initExecution() {
|
||||
void DisplaceOperation::initExecution()
|
||||
{
|
||||
this->inputColorProgram = this->getInputSocketReader(0);
|
||||
this->inputVectorProgram = this->getInputSocketReader(1);
|
||||
this->inputScaleXProgram = this->getInputSocketReader(2);
|
||||
@@ -52,7 +54,7 @@ void DisplaceOperation::initExecution() {
|
||||
* in order to take effect */
|
||||
#define DISPLACE_EPSILON 0.01f
|
||||
|
||||
void DisplaceOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data)
|
||||
void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float inVector[4];
|
||||
float inScale[4];
|
||||
@@ -97,14 +99,16 @@ void DisplaceOperation::executePixel(float* color, int x, int y, MemoryBuffer *i
|
||||
this->inputColorProgram->read(color, u, v, dxt, dyt, inputBuffers);
|
||||
}
|
||||
|
||||
void DisplaceOperation::deinitExecution() {
|
||||
void DisplaceOperation::deinitExecution()
|
||||
{
|
||||
this->inputColorProgram = NULL;
|
||||
this->inputVectorProgram = NULL;
|
||||
this->inputScaleXProgram = NULL;
|
||||
this->inputScaleYProgram = NULL;
|
||||
}
|
||||
|
||||
bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti colorInput;
|
||||
rcti vectorInput;
|
||||
NodeOperation *operation=NULL;
|
||||
|
||||
@@ -29,10 +29,10 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader* inputColorProgram;
|
||||
SocketReader* inputVectorProgram;
|
||||
SocketReader* inputScaleXProgram;
|
||||
SocketReader* inputScaleYProgram;
|
||||
SocketReader *inputColorProgram;
|
||||
SocketReader *inputVectorProgram;
|
||||
SocketReader *inputScaleXProgram;
|
||||
SocketReader *inputScaleYProgram;
|
||||
|
||||
float width_x4;
|
||||
float height_x4;
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation() {
|
||||
DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
@@ -36,7 +37,8 @@ DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation() {
|
||||
this->inputScaleYProgram = NULL;
|
||||
}
|
||||
|
||||
void DisplaceSimpleOperation::initExecution() {
|
||||
void DisplaceSimpleOperation::initExecution()
|
||||
{
|
||||
this->inputColorProgram = this->getInputSocketReader(0);
|
||||
this->inputVectorProgram = this->getInputSocketReader(1);
|
||||
this->inputScaleXProgram = this->getInputSocketReader(2);
|
||||
@@ -51,7 +53,7 @@ void DisplaceSimpleOperation::initExecution() {
|
||||
* in order to take effect */
|
||||
#define DISPLACE_EPSILON 0.01f
|
||||
|
||||
void DisplaceSimpleOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
void DisplaceSimpleOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inVector[4];
|
||||
float inScale[4];
|
||||
@@ -83,14 +85,16 @@ void DisplaceSimpleOperation::executePixel(float* color, float x, float y, Pixel
|
||||
this->inputColorProgram->read(color, u, v, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
void DisplaceSimpleOperation::deinitExecution() {
|
||||
void DisplaceSimpleOperation::deinitExecution()
|
||||
{
|
||||
this->inputColorProgram = NULL;
|
||||
this->inputVectorProgram = NULL;
|
||||
this->inputScaleXProgram = NULL;
|
||||
this->inputScaleYProgram = NULL;
|
||||
}
|
||||
|
||||
bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti colorInput;
|
||||
NodeOperation *operation=NULL;
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader* inputColorProgram;
|
||||
SocketReader* inputVectorProgram;
|
||||
SocketReader* inputScaleXProgram;
|
||||
SocketReader* inputScaleYProgram;
|
||||
SocketReader *inputColorProgram;
|
||||
SocketReader *inputVectorProgram;
|
||||
SocketReader *inputScaleXProgram;
|
||||
SocketReader *inputScaleYProgram;
|
||||
|
||||
float width_x4;
|
||||
float height_x4;
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "COM_DistanceMatteOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
DistanceMatteOperation::DistanceMatteOperation(): NodeOperation() {
|
||||
DistanceMatteOperation::DistanceMatteOperation(): NodeOperation()
|
||||
{
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
@@ -31,17 +32,20 @@ DistanceMatteOperation::DistanceMatteOperation(): NodeOperation() {
|
||||
inputKeyProgram = NULL;
|
||||
}
|
||||
|
||||
void DistanceMatteOperation::initExecution() {
|
||||
void DistanceMatteOperation::initExecution()
|
||||
{
|
||||
this->inputImageProgram = this->getInputSocketReader(0);
|
||||
this->inputKeyProgram = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void DistanceMatteOperation::deinitExecution() {
|
||||
this->inputImageProgram= NULL;
|
||||
this->inputKeyProgram= NULL;
|
||||
void DistanceMatteOperation::deinitExecution()
|
||||
{
|
||||
this->inputImageProgram = NULL;
|
||||
this->inputKeyProgram = NULL;
|
||||
}
|
||||
|
||||
void DistanceMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inKey[4];
|
||||
float inImage[4];
|
||||
|
||||
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;}
|
||||
void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_DotproductOperation.h"
|
||||
|
||||
DotproductOperation::DotproductOperation() : NodeOperation() {
|
||||
DotproductOperation::DotproductOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
@@ -30,19 +31,22 @@ DotproductOperation::DotproductOperation() : NodeOperation() {
|
||||
this->input1Operation = NULL;
|
||||
this->input2Operation = NULL;
|
||||
}
|
||||
void DotproductOperation::initExecution() {
|
||||
void DotproductOperation::initExecution()
|
||||
{
|
||||
this->input1Operation = this->getInputSocketReader(0);
|
||||
this->input2Operation = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void DotproductOperation::deinitExecution() {
|
||||
void DotproductOperation::deinitExecution()
|
||||
{
|
||||
this->input1Operation = NULL;
|
||||
this->input2Operation = NULL;
|
||||
}
|
||||
|
||||
/** @todo: current implementation is the inverse of a dotproduct. not 'logically' correct
|
||||
*/
|
||||
void DotproductOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void DotproductOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float input1[4];
|
||||
float input2[4];
|
||||
this->input1Operation->read(input1, x, y, sampler, inputBuffers);
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
|
||||
// this part has been copied from the double edge mask
|
||||
// Contributor(s): Peter Larabell.
|
||||
static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) {
|
||||
static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
|
||||
{
|
||||
int x;
|
||||
unsigned int isz=0; // inner edge size
|
||||
unsigned int osz=0; // outer edge size
|
||||
@@ -106,7 +107,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int
|
||||
}
|
||||
|
||||
/* Test the TOP row of pixels in buffer, except corners */
|
||||
for (x= t-1; x>=(t-rw)+2; x--) {
|
||||
for (x = t-1; x>=(t-rw)+2; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel to the right, or to the left, are empty in the inner mask,
|
||||
@@ -126,7 +127,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int
|
||||
}
|
||||
|
||||
/* Test the BOTTOM row of pixels in buffer, except corners */
|
||||
for (x= rw-2; x; x--) {
|
||||
for (x = rw-2; x; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel to the right, or to the left, are empty in the inner mask,
|
||||
@@ -145,7 +146,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int
|
||||
}
|
||||
}
|
||||
/* Test the LEFT edge of pixels in buffer, except corners */
|
||||
for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel underneath, or above, are empty in the inner mask,
|
||||
@@ -165,7 +166,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int
|
||||
}
|
||||
|
||||
/* Test the RIGHT edge of pixels in buffer, except corners */
|
||||
for (x= t-rw; x>rw; x-=rw) {
|
||||
for (x = t-rw; x>rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel underneath, or above, are empty in the inner mask,
|
||||
@@ -189,7 +190,8 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int
|
||||
rsize[2]=gsz;
|
||||
}
|
||||
|
||||
static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) {
|
||||
static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
|
||||
{
|
||||
int x;
|
||||
unsigned int isz=0; // inner edge size
|
||||
unsigned int osz=0; // outer edge size
|
||||
@@ -292,7 +294,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in
|
||||
}
|
||||
}
|
||||
/* Test the TOP row of pixels in buffer, except corners */
|
||||
for (x= t-1; x>=(t-rw)+2; x--) {
|
||||
for (x = t-1; x>=(t-rw)+2; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel to the left, or to the right, are empty in the inner mask,
|
||||
@@ -318,7 +320,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in
|
||||
}
|
||||
|
||||
/* Test the BOTTOM row of pixels in buffer, except corners */
|
||||
for (x= rw-2; x; x--) {
|
||||
for (x = rw-2; x; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel to the left, or to the right, are empty in the inner mask,
|
||||
@@ -343,7 +345,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in
|
||||
}
|
||||
}
|
||||
/* Test the LEFT edge of pixels in buffer, except corners */
|
||||
for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel underneath, or above, are empty in the inner mask,
|
||||
@@ -369,7 +371,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in
|
||||
}
|
||||
|
||||
/* Test the RIGHT edge of pixels in buffer, except corners */
|
||||
for (x= t-rw; x>rw; x-=rw) {
|
||||
for (x = t-rw; x>rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if pixel underneath, or above, are empty in the inner mask,
|
||||
@@ -399,7 +401,8 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in
|
||||
rsize[2]=gsz;
|
||||
}
|
||||
|
||||
static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) {
|
||||
static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
|
||||
{
|
||||
int x;
|
||||
unsigned int isz=0; // inner edge size
|
||||
unsigned int osz=0; // outer edge size
|
||||
@@ -475,7 +478,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim
|
||||
}
|
||||
|
||||
/* Test the TOP row of pixels in buffer, except corners */
|
||||
for (x= t-1; x>=(t-rw)+2; x--) {
|
||||
for (x = t-1; x>=(t-rw)+2; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty to the left or to the right
|
||||
@@ -494,7 +497,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim
|
||||
}
|
||||
|
||||
/* Test the BOTTOM row of pixels in buffer, except corners */
|
||||
for (x= rw-2; x; x--) {
|
||||
for (x = rw-2; x; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty to the left or to the right
|
||||
@@ -512,7 +515,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim
|
||||
}
|
||||
}
|
||||
/* Test the LEFT edge of pixels in buffer, except corners */
|
||||
for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty underneath or above
|
||||
@@ -531,7 +534,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim
|
||||
}
|
||||
|
||||
/* Test the RIGHT edge of pixels in buffer, except corners */
|
||||
for (x= t-rw; x>rw; x-=rw) {
|
||||
for (x = t-rw; x>rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty underneath or above
|
||||
@@ -554,7 +557,8 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim
|
||||
rsize[2]=gsz;
|
||||
}
|
||||
|
||||
static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) {
|
||||
static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
|
||||
{
|
||||
int x;
|
||||
unsigned int isz=0; // inner edge size
|
||||
unsigned int osz=0; // outer edge size
|
||||
@@ -653,7 +657,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li
|
||||
}
|
||||
}
|
||||
/* Test the TOP row of pixels in buffer, except corners */
|
||||
for (x= t-1; x>=(t-rw)+2; x--) {
|
||||
for (x = t-1; x>=(t-rw)+2; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty to the left or to the right
|
||||
@@ -678,7 +682,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li
|
||||
}
|
||||
|
||||
/* Test the BOTTOM row of pixels in buffer, except corners */
|
||||
for (x= rw-2; x; x--) {
|
||||
for (x = rw-2; x; x--) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty to the left or to the right
|
||||
@@ -702,7 +706,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li
|
||||
}
|
||||
}
|
||||
/* Test the LEFT edge of pixels in buffer, except corners */
|
||||
for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
for (x = t-(rw<<1)+1; x>=rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty underneath or above
|
||||
@@ -727,7 +731,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li
|
||||
}
|
||||
|
||||
/* Test the RIGHT edge of pixels in buffer, except corners */
|
||||
for (x= t-rw; x>rw; x-=rw) {
|
||||
for (x = t-rw; x>rw; x-=rw) {
|
||||
// test if inner mask is filled
|
||||
if (limask[x]) {
|
||||
// test if inner mask is empty underneath or above
|
||||
@@ -756,7 +760,8 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li
|
||||
rsize[2]=gsz;
|
||||
}
|
||||
|
||||
static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) {
|
||||
static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
|
||||
{
|
||||
int x; // x = pixel loop counter
|
||||
int a; // a = pixel loop counter
|
||||
int dx; // dx = delta x
|
||||
@@ -765,7 +770,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l
|
||||
int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
|
||||
int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
|
||||
/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
|
||||
for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
|
||||
for (x = (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
|
||||
a=x-2;
|
||||
pix_prevRow=a+rw;
|
||||
pix_nextRow=a-rw;
|
||||
@@ -781,9 +786,9 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l
|
||||
then the current pixel is counted as being a true outer edge pixel.
|
||||
*/
|
||||
if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
|
||||
(!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
|
||||
(!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
|
||||
(!lomask[pix_prevRow] && !limask[pix_prevRow]))
|
||||
(!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
|
||||
(!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
|
||||
(!lomask[pix_prevRow] && !limask[pix_prevRow]))
|
||||
{
|
||||
in_osz++; // increment the outer boundary pixel count
|
||||
lres[a]=3; // flag pixel as part of outer edge
|
||||
@@ -817,7 +822,8 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l
|
||||
rsize[2]=in_gsz;
|
||||
}
|
||||
|
||||
static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) {
|
||||
static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
|
||||
{
|
||||
int x; // x = pixel loop counter
|
||||
int a; // a = pixel loop counter
|
||||
int dx; // dx = delta x
|
||||
@@ -826,7 +832,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i
|
||||
int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
|
||||
int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
|
||||
/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
|
||||
for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
|
||||
for (x = (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
|
||||
a=x-2;
|
||||
pix_prevRow=a+rw;
|
||||
pix_nextRow=a-rw;
|
||||
@@ -842,9 +848,9 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i
|
||||
then the current pixel is counted as being a true outer edge pixel.
|
||||
*/
|
||||
if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
|
||||
(!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
|
||||
(!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
|
||||
(!lomask[pix_prevRow] && !limask[pix_prevRow]))
|
||||
(!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
|
||||
(!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
|
||||
(!lomask[pix_prevRow] && !limask[pix_prevRow]))
|
||||
{
|
||||
in_osz++; // increment the outer boundary pixel count
|
||||
lres[a]=3; // flag pixel as part of outer edge
|
||||
@@ -858,9 +864,9 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i
|
||||
}
|
||||
else {
|
||||
if ((!limask[pix_nextCol] && lomask[pix_nextCol]) ||
|
||||
(!limask[pix_prevCol] && lomask[pix_prevCol]) ||
|
||||
(!limask[pix_nextRow] && lomask[pix_nextRow]) ||
|
||||
(!limask[pix_prevRow] && lomask[pix_prevRow]))
|
||||
(!limask[pix_prevCol] && lomask[pix_prevCol]) ||
|
||||
(!limask[pix_nextRow] && lomask[pix_nextRow]) ||
|
||||
(!limask[pix_prevRow] && lomask[pix_prevRow]))
|
||||
{
|
||||
in_isz++; // increment the inner boundary pixel count
|
||||
lres[a]=4; // flag pixel as part of inner edge
|
||||
@@ -882,7 +888,8 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i
|
||||
rsize[2]=in_gsz;
|
||||
}
|
||||
|
||||
static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz) {
|
||||
static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz)
|
||||
{
|
||||
int x; // x = pixel loop counter
|
||||
int a; // a = temporary pixel index buffer loop counter
|
||||
unsigned int ud; // ud = unscaled edge distance
|
||||
@@ -904,7 +911,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
|
||||
|
||||
This does make the assumption that x and y can fit in 16 unsigned bits
|
||||
so if Blender starts doing renders greater than 65536 in either direction
|
||||
this will need to allocate gbuf[] as unsigned int* and allocate 8 bytes
|
||||
this will need to allocate gbuf[] as unsigned int *and allocate 8 bytes
|
||||
per flagged pixel.
|
||||
|
||||
In general, the buffer on-screen:
|
||||
@@ -992,7 +999,8 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
|
||||
|
||||
}
|
||||
|
||||
static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset) {
|
||||
static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset)
|
||||
{
|
||||
int x; // x = pixel loop counter
|
||||
int a; // a = temporary pixel index buffer loop counter
|
||||
int fsz; // size of the frame
|
||||
@@ -1068,7 +1076,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
|
||||
Loop through all gradient pixels.
|
||||
*/
|
||||
|
||||
for (x= gsz-1; x>=0; x--) {
|
||||
for (x = gsz-1; x>=0; x--) {
|
||||
gradientFillOffset=x<<1;
|
||||
t=gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x]
|
||||
fsz=gbuf[gradientFillOffset+1]; // calculate row of pixel indexed by gbuf[x]
|
||||
@@ -1089,7 +1097,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
|
||||
odist=*(float*)&rsl; // reciprocal square root
|
||||
odist=odist*(rsopf-(rsf*odist*odist)); // -- ** this line can be iterated for more accuracy ** --
|
||||
dmin=0xffffffff; // reset min distance to edge pixel
|
||||
for (a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels
|
||||
for (a = innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels
|
||||
ud=a<<1;
|
||||
dy=t-gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel
|
||||
dx=fsz-gbuf[ud+1]; // compute delta in X from gradient pixel to inside edge pixel
|
||||
@@ -1121,8 +1129,8 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g
|
||||
|
||||
// end of copy
|
||||
|
||||
void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float *res) {
|
||||
|
||||
void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float *res)
|
||||
{
|
||||
unsigned int *lres; // lres = unsigned int pointer to output pixel buffer (for bit operations)
|
||||
unsigned int *limask; // limask = unsigned int pointer to inner mask (for bit operations)
|
||||
unsigned int *lomask; // lomask = unsigned int pointer to outer mask (for bit operations)
|
||||
@@ -1144,10 +1152,10 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float
|
||||
|
||||
t=(this->getWidth()*this->getHeight())-1; // determine size of the frame
|
||||
|
||||
lres= (unsigned int*)res; // unsigned int pointer to output buffer (for bit level ops)
|
||||
lres = (unsigned int*)res; // unsigned int pointer to output buffer (for bit level ops)
|
||||
limask=(unsigned int*)imask; // unsigned int pointer to input mask (for bit level ops)
|
||||
lomask=(unsigned int*)omask; // unsigned int pointer to output mask (for bit level ops)
|
||||
rw= this->getWidth(); // width of a row of pixels
|
||||
rw = this->getWidth(); // width of a row of pixels
|
||||
|
||||
|
||||
/*
|
||||
@@ -1207,7 +1215,7 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float
|
||||
gsz=rsize[2]; // by the do_*EdgeDetection() function.
|
||||
|
||||
fsz=gsz+isz+osz; // calculate size of pixel index buffer needed
|
||||
gbuf= new unsigned short[fsz*2]; // allocate edge/gradient pixel index buffer
|
||||
gbuf = new unsigned short[fsz*2]; // allocate edge/gradient pixel index buffer
|
||||
|
||||
do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz);
|
||||
do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset);
|
||||
@@ -1216,7 +1224,8 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float
|
||||
}
|
||||
}
|
||||
|
||||
DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation() {
|
||||
DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
@@ -1227,7 +1236,8 @@ DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation() {
|
||||
this->setComplex(true);
|
||||
}
|
||||
|
||||
bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
if (this->cachedInstance == NULL) {
|
||||
rcti newInput;
|
||||
newInput.xmax = this->getWidth();
|
||||
@@ -1241,23 +1251,25 @@ bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, Read
|
||||
}
|
||||
}
|
||||
|
||||
void DoubleEdgeMaskOperation::initExecution() {
|
||||
void DoubleEdgeMaskOperation::initExecution()
|
||||
{
|
||||
this->inputInnerMask = this->getInputSocketReader(0);
|
||||
this->inputOuterMask = this->getInputSocketReader(1);
|
||||
initMutex();
|
||||
this->cachedInstance = NULL;
|
||||
}
|
||||
|
||||
void* DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
if (this->cachedInstance) return this->cachedInstance;
|
||||
|
||||
BLI_mutex_lock(getMutex());
|
||||
if (this->cachedInstance == NULL) {
|
||||
MemoryBuffer* innerMask = (MemoryBuffer*)inputInnerMask->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer* outerMask= (MemoryBuffer*)inputOuterMask->initializeTileData(rect, memoryBuffers);
|
||||
float* data = new float[this->getWidth()*this->getHeight()];
|
||||
float* imask = innerMask->convertToValueBuffer();
|
||||
float* omask = outerMask->convertToValueBuffer();
|
||||
MemoryBuffer *innerMask = (MemoryBuffer*)inputInnerMask->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *outerMask = (MemoryBuffer*)inputOuterMask->initializeTileData(rect, memoryBuffers);
|
||||
float *data = new float[this->getWidth()*this->getHeight()];
|
||||
float *imask = innerMask->convertToValueBuffer();
|
||||
float *omask = outerMask->convertToValueBuffer();
|
||||
doDoubleEdgeMask(imask, omask, data);
|
||||
delete imask;
|
||||
delete omask;
|
||||
@@ -1266,8 +1278,9 @@ void* DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **mem
|
||||
BLI_mutex_unlock(getMutex());
|
||||
return this->cachedInstance;
|
||||
}
|
||||
void DoubleEdgeMaskOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
float* buffer = (float*) data;
|
||||
void DoubleEdgeMaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float *buffer = (float*) data;
|
||||
int index = (y*this->getWidth() + x);
|
||||
color[0] = buffer[index];
|
||||
color[1] = buffer[index+1];
|
||||
@@ -1275,7 +1288,8 @@ void DoubleEdgeMaskOperation::executePixel(float* color, int x, int y, MemoryBuf
|
||||
color[3] = buffer[index+3];
|
||||
}
|
||||
|
||||
void DoubleEdgeMaskOperation::deinitExecution() {
|
||||
void DoubleEdgeMaskOperation::deinitExecution()
|
||||
{
|
||||
this->inputInnerMask = NULL;
|
||||
this->inputOuterMask = NULL;
|
||||
deinitMutex();
|
||||
|
||||
@@ -34,15 +34,15 @@ private:
|
||||
SocketReader * inputInnerMask;
|
||||
bool adjecentOnly;
|
||||
bool keepInside;
|
||||
float* cachedInstance;
|
||||
float *cachedInstance;
|
||||
public:
|
||||
DoubleEdgeMaskOperation();
|
||||
|
||||
void doDoubleEdgeMask(float* inner, float *outer, float *res);
|
||||
void doDoubleEdgeMask(float *inner, float *outer, float *res);
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
EllipseMaskOperation::EllipseMaskOperation(): NodeOperation() {
|
||||
EllipseMaskOperation::EllipseMaskOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
@@ -33,7 +34,8 @@ EllipseMaskOperation::EllipseMaskOperation(): NodeOperation() {
|
||||
this->cosine = 0.0f;
|
||||
this->sine = 0.0f;
|
||||
}
|
||||
void EllipseMaskOperation::initExecution() {
|
||||
void EllipseMaskOperation::initExecution()
|
||||
{
|
||||
this->inputMask = this->getInputSocketReader(0);
|
||||
this->inputValue = this->getInputSocketReader(1);
|
||||
const double rad = DEG2RAD(this->data->rotation);
|
||||
@@ -42,7 +44,8 @@ void EllipseMaskOperation::initExecution() {
|
||||
this->aspectRatio = ((float)this->getWidth())/this->getHeight();
|
||||
}
|
||||
|
||||
void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputMask[4];
|
||||
float inputValue[4];
|
||||
|
||||
@@ -112,7 +115,8 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam
|
||||
|
||||
}
|
||||
|
||||
void EllipseMaskOperation::deinitExecution() {
|
||||
void EllipseMaskOperation::deinitExecution()
|
||||
{
|
||||
this->inputMask = NULL;
|
||||
this->inputValue = NULL;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -24,17 +24,20 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation() {
|
||||
FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation()
|
||||
{
|
||||
this->iirgaus = false;
|
||||
}
|
||||
|
||||
void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data) {
|
||||
void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
MemoryBuffer *newData = (MemoryBuffer*)data;
|
||||
|
||||
newData->read(color, x, y);
|
||||
}
|
||||
|
||||
bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
rcti sizeInput;
|
||||
sizeInput.xmin = 0;
|
||||
@@ -63,7 +66,8 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re
|
||||
}
|
||||
}
|
||||
|
||||
void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *copy = newBuf->duplicate();
|
||||
updateSize(memoryBuffers);
|
||||
@@ -90,12 +94,14 @@ void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **m
|
||||
return copy;
|
||||
}
|
||||
|
||||
void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) {
|
||||
void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
|
||||
{
|
||||
MemoryBuffer *newData = (MemoryBuffer*)data;
|
||||
delete newData;
|
||||
}
|
||||
|
||||
void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int chan, int xy) {
|
||||
void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int chan, int xy)
|
||||
{
|
||||
double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
|
||||
double *X, *Y, *W;
|
||||
int i, x, y, sz;
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
void IIR_gauss(MemoryBuffer *src, float sigma, int channel, int xy);
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
|
||||
|
||||
};
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_FlipOperation.h"
|
||||
|
||||
FlipOperation::FlipOperation() : NodeOperation() {
|
||||
FlipOperation::FlipOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
@@ -30,23 +31,27 @@ FlipOperation::FlipOperation() : NodeOperation() {
|
||||
this->flipX = true;
|
||||
this->flipY = false;
|
||||
}
|
||||
void FlipOperation::initExecution() {
|
||||
void FlipOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void FlipOperation::deinitExecution() {
|
||||
void FlipOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
void FlipOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void FlipOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float nx = this->flipX?this->getWidth()-1-x:x;
|
||||
float ny = this->flipY?this->getHeight()-1-y:y;
|
||||
|
||||
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
if (this->flipX) {
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
#include "COM_FogGlowImageOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
FogGlowImageOperation::FogGlowImageOperation(): NodeOperation() {
|
||||
FogGlowImageOperation::FogGlowImageOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
void FogGlowImageOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void FogGlowImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
const float cs_r = 1.f, cs_g = 1.f, cs_b = 1.f;
|
||||
|
||||
float u, v, w, d, r;
|
||||
@@ -42,7 +44,8 @@ void FogGlowImageOperation::executePixel(float* color, float x, float y, PixelSa
|
||||
color[3] = 1.0f;
|
||||
}
|
||||
|
||||
void FogGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void FogGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
resolution[0] = 512;
|
||||
resolution[1] = 512;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
};
|
||||
|
||||
@@ -23,16 +23,19 @@
|
||||
#include "COM_GammaCorrectOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
GammaCorrectOperation::GammaCorrectOperation(): NodeOperation() {
|
||||
GammaCorrectOperation::GammaCorrectOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void GammaCorrectOperation::initExecution() {
|
||||
void GammaCorrectOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void GammaCorrectOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
this->inputProgram->read(inputColor, x, y, sampler, inputBuffers);
|
||||
if (inputColor[3] > 0.0f) {
|
||||
@@ -56,20 +59,24 @@ void GammaCorrectOperation::executePixel(float* color, float x, float y, PixelSa
|
||||
color[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void GammaCorrectOperation::deinitExecution() {
|
||||
void GammaCorrectOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
GammaUncorrectOperation::GammaUncorrectOperation(): NodeOperation() {
|
||||
GammaUncorrectOperation::GammaUncorrectOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void GammaUncorrectOperation::initExecution() {
|
||||
void GammaUncorrectOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void GammaUncorrectOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void GammaUncorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor[4];
|
||||
this->inputProgram->read(inputColor, x, y, sampler, inputBuffers);
|
||||
|
||||
@@ -93,6 +100,7 @@ void GammaUncorrectOperation::executePixel(float* color, float x, float y, Pixel
|
||||
color[3] = inputColor[3];
|
||||
}
|
||||
|
||||
void GammaUncorrectOperation::deinitExecution() {
|
||||
void GammaUncorrectOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -23,19 +23,22 @@
|
||||
#include "COM_GammaOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
GammaOperation::GammaOperation(): NodeOperation() {
|
||||
GammaOperation::GammaOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputProgram = NULL;
|
||||
this->inputGammaProgram = NULL;
|
||||
}
|
||||
void GammaOperation::initExecution() {
|
||||
void GammaOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
this->inputGammaProgram = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void GammaOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void GammaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
float inputGamma[4];
|
||||
|
||||
@@ -50,7 +53,8 @@ void GammaOperation::executePixel(float* color, float x, float y, PixelSampler s
|
||||
color[3] = inputValue[3];
|
||||
}
|
||||
|
||||
void GammaOperation::deinitExecution() {
|
||||
void GammaOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
this->inputGammaProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader * inputProgram;
|
||||
SocketReader* inputGammaProgram;
|
||||
SocketReader *inputGammaProgram;
|
||||
|
||||
public:
|
||||
GammaOperation();
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -27,23 +27,26 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
GaussianBokehBlurOperation::GaussianBokehBlurOperation(): BlurBaseOperation() {
|
||||
GaussianBokehBlurOperation::GaussianBokehBlurOperation(): BlurBaseOperation()
|
||||
{
|
||||
this->gausstab = NULL;
|
||||
}
|
||||
|
||||
void* GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
updateGauss(memoryBuffers);
|
||||
void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) {
|
||||
void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
if (this->gausstab == NULL) {
|
||||
float radxf;
|
||||
float radyf;
|
||||
int n;
|
||||
float* dgauss;
|
||||
float* ddgauss;
|
||||
float *dgauss;
|
||||
float *ddgauss;
|
||||
float val;
|
||||
int j, i;
|
||||
const float width = this->getWidth();
|
||||
@@ -52,56 +55,57 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) {
|
||||
|
||||
radxf = size*(float)this->data->sizex;
|
||||
if (radxf>width/2.0f)
|
||||
radxf= width/2.0f;
|
||||
radxf = width/2.0f;
|
||||
else if (radxf<1.0f)
|
||||
radxf= 1.0f;
|
||||
radxf = 1.0f;
|
||||
|
||||
/* vertical */
|
||||
radyf = size*(float)this->data->sizey;
|
||||
if (radyf>height/2.0f)
|
||||
radyf= height/2.0f;
|
||||
radyf = height/2.0f;
|
||||
else if (radyf<1.0f)
|
||||
radyf= 1.0f;
|
||||
radyf = 1.0f;
|
||||
|
||||
radx= ceil(radxf);
|
||||
rady= ceil(radyf);
|
||||
radx = ceil(radxf);
|
||||
rady = ceil(radyf);
|
||||
|
||||
n = (2*radx+1)*(2*rady+1);
|
||||
|
||||
/* create a full filter image */
|
||||
ddgauss= new float[n];
|
||||
dgauss= ddgauss;
|
||||
val= 0.0f;
|
||||
ddgauss = new float[n];
|
||||
dgauss = ddgauss;
|
||||
val = 0.0f;
|
||||
for (j=-rady; j<=rady; j++) {
|
||||
for (i=-radx; i<=radx; i++, dgauss++) {
|
||||
float fj= (float)j/radyf;
|
||||
float fi= (float)i/radxf;
|
||||
float dist= sqrt(fj*fj + fi*fi);
|
||||
*dgauss= RE_filter_value(this->data->filtertype, dist);
|
||||
float fj = (float)j / radyf;
|
||||
float fi = (float)i / radxf;
|
||||
float dist = sqrt(fj * fj + fi * fi);
|
||||
*dgauss = RE_filter_value(this->data->filtertype, dist);
|
||||
|
||||
val+= *dgauss;
|
||||
}
|
||||
}
|
||||
if (val!=0.0f) {
|
||||
val= 1.0f/val;
|
||||
for (j= n -1; j>=0; j--)
|
||||
val = 1.0f/val;
|
||||
for (j = n - 1; j>=0; j--)
|
||||
ddgauss[j]*= val;
|
||||
}
|
||||
else ddgauss[4]= 1.0f;
|
||||
else ddgauss[4] = 1.0f;
|
||||
|
||||
gausstab = ddgauss;
|
||||
}
|
||||
}
|
||||
|
||||
void GaussianBokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float tempColor[4];
|
||||
tempColor[0] = 0;
|
||||
tempColor[1] = 0;
|
||||
tempColor[2] = 0;
|
||||
tempColor[3] = 0;
|
||||
float overallmultiplyer = 0;
|
||||
MemoryBuffer* inputBuffer = (MemoryBuffer*)data;
|
||||
float* buffer = inputBuffer->getBuffer();
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
@@ -138,13 +142,15 @@ void GaussianBokehBlurOperation::executePixel(float* color, int x, int y, Memory
|
||||
color[3] = tempColor[3]*divider;
|
||||
}
|
||||
|
||||
void GaussianBokehBlurOperation::deinitExecution() {
|
||||
void GaussianBokehBlurOperation::deinitExecution()
|
||||
{
|
||||
BlurBaseOperation::deinitExecution();
|
||||
delete this->gausstab;
|
||||
this->gausstab = NULL;
|
||||
}
|
||||
|
||||
bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
rcti sizeInput;
|
||||
sizeInput.xmin = 0;
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
|
||||
class GaussianBokehBlurOperation : public BlurBaseOperation {
|
||||
private:
|
||||
float* gausstab;
|
||||
float *gausstab;
|
||||
int radx, rady;
|
||||
void updateGauss(MemoryBuffer **memoryBuffers);
|
||||
|
||||
public:
|
||||
GaussianBokehBlurOperation();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
|
||||
@@ -27,40 +27,43 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
GaussianXBlurOperation::GaussianXBlurOperation(): BlurBaseOperation() {
|
||||
GaussianXBlurOperation::GaussianXBlurOperation(): BlurBaseOperation()
|
||||
{
|
||||
this->gausstab = NULL;
|
||||
this->rad = 0;
|
||||
|
||||
}
|
||||
|
||||
void* GaussianXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *GaussianXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
updateGauss(memoryBuffers);
|
||||
void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) {
|
||||
void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
if (this->gausstab == NULL) {
|
||||
updateSize(memoryBuffers);
|
||||
float rad = size*this->data->sizex;
|
||||
if (rad<1)
|
||||
rad= 1;
|
||||
rad = 1;
|
||||
|
||||
this->rad = rad;
|
||||
this->gausstab = BlurBaseOperation::make_gausstab(rad);
|
||||
}
|
||||
}
|
||||
|
||||
void GaussianXBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data) {
|
||||
|
||||
void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float tempColor[4];
|
||||
tempColor[0] = 0;
|
||||
tempColor[1] = 0;
|
||||
tempColor[2] = 0;
|
||||
tempColor[3] = 0;
|
||||
float overallmultiplyer = 0;
|
||||
MemoryBuffer* inputBuffer = (MemoryBuffer*)data;
|
||||
float* buffer = inputBuffer->getBuffer();
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
@@ -94,13 +97,15 @@ void GaussianXBlurOperation::executePixel(float* color, int x, int y, MemoryBuff
|
||||
color[3] = tempColor[3]*divider;
|
||||
}
|
||||
|
||||
void GaussianXBlurOperation::deinitExecution() {
|
||||
void GaussianXBlurOperation::deinitExecution()
|
||||
{
|
||||
BlurBaseOperation::deinitExecution();
|
||||
delete this->gausstab;
|
||||
this->gausstab = NULL;
|
||||
}
|
||||
|
||||
bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
rcti sizeInput;
|
||||
sizeInput.xmin = 0;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
class GaussianXBlurOperation : public BlurBaseOperation {
|
||||
private:
|
||||
float* gausstab;
|
||||
float *gausstab;
|
||||
int rad;
|
||||
void updateGauss(MemoryBuffer **memoryBuffers);
|
||||
public:
|
||||
@@ -36,14 +36,14 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -27,39 +27,42 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
GaussianYBlurOperation::GaussianYBlurOperation(): BlurBaseOperation() {
|
||||
GaussianYBlurOperation::GaussianYBlurOperation(): BlurBaseOperation()
|
||||
{
|
||||
this->gausstab = NULL;
|
||||
this->rad = 0;
|
||||
}
|
||||
|
||||
void* GaussianYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *GaussianYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
updateGauss(memoryBuffers);
|
||||
void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) {
|
||||
void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
if (this->gausstab == NULL) {
|
||||
updateSize(memoryBuffers);
|
||||
float rad = size*this->data->sizey;
|
||||
if (rad<1)
|
||||
rad= 1;
|
||||
rad = 1;
|
||||
|
||||
this->rad = rad;
|
||||
this->gausstab = BlurBaseOperation::make_gausstab(rad);
|
||||
}
|
||||
}
|
||||
|
||||
void GaussianYBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data) {
|
||||
|
||||
void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float tempColor[4];
|
||||
tempColor[0] = 0;
|
||||
tempColor[1] = 0;
|
||||
tempColor[2] = 0;
|
||||
tempColor[3] = 0;
|
||||
float overallmultiplyer = 0;
|
||||
MemoryBuffer* inputBuffer = (MemoryBuffer*)data;
|
||||
float* buffer = inputBuffer->getBuffer();
|
||||
MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
|
||||
float *buffer = inputBuffer->getBuffer();
|
||||
int bufferwidth = inputBuffer->getWidth();
|
||||
int bufferstartx = inputBuffer->getRect()->xmin;
|
||||
int bufferstarty = inputBuffer->getRect()->ymin;
|
||||
@@ -91,13 +94,15 @@ void GaussianYBlurOperation::executePixel(float* color, int x, int y, MemoryBuff
|
||||
color[3] = tempColor[3]*divider;
|
||||
}
|
||||
|
||||
void GaussianYBlurOperation::deinitExecution() {
|
||||
void GaussianYBlurOperation::deinitExecution()
|
||||
{
|
||||
BlurBaseOperation::deinitExecution();
|
||||
delete this->gausstab;
|
||||
this->gausstab = NULL;
|
||||
}
|
||||
|
||||
bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
rcti sizeInput;
|
||||
sizeInput.xmin = 0;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
class GaussianYBlurOperation : public BlurBaseOperation {
|
||||
private:
|
||||
float* gausstab;
|
||||
float *gausstab;
|
||||
int rad;
|
||||
void updateGauss(MemoryBuffer **memoryBuffers);
|
||||
public:
|
||||
@@ -36,14 +36,14 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -23,21 +23,24 @@
|
||||
#include "COM_GlareBaseOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
GlareBaseOperation::GlareBaseOperation(): NodeOperation() {
|
||||
GlareBaseOperation::GlareBaseOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->settings = NULL;
|
||||
this->cachedInstance = NULL;
|
||||
setComplex(true);
|
||||
}
|
||||
void GlareBaseOperation::initExecution() {
|
||||
void GlareBaseOperation::initExecution()
|
||||
{
|
||||
initMutex();
|
||||
this->inputProgram = getInputSocketReader(0);
|
||||
this->cachedInstance = NULL;
|
||||
}
|
||||
|
||||
void GlareBaseOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
float* buffer = (float*) data;
|
||||
void GlareBaseOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)\
|
||||
{
|
||||
float *buffer = (float*) data;
|
||||
int index = (y*this->getWidth() + x) * COM_NUMBER_OF_CHANNELS;
|
||||
color[0] = buffer[index];
|
||||
color[1] = buffer[index+1];
|
||||
@@ -45,7 +48,8 @@ void GlareBaseOperation::executePixel(float* color, int x, int y, MemoryBuffer *
|
||||
color[3] = buffer[index+3];
|
||||
}
|
||||
|
||||
void GlareBaseOperation::deinitExecution() {
|
||||
void GlareBaseOperation::deinitExecution()
|
||||
{
|
||||
deinitMutex();
|
||||
this->inputProgram = NULL;
|
||||
if (this->cachedInstance) {
|
||||
@@ -53,11 +57,12 @@ void GlareBaseOperation::deinitExecution() {
|
||||
this->cachedInstance = NULL;
|
||||
}
|
||||
}
|
||||
void* GlareBaseOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *GlareBaseOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
BLI_mutex_lock(getMutex());
|
||||
if (this->cachedInstance == NULL) {
|
||||
MemoryBuffer* tile = (MemoryBuffer*)inputProgram->initializeTileData(rect, memoryBuffers);
|
||||
float* data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS];
|
||||
MemoryBuffer *tile = (MemoryBuffer*)inputProgram->initializeTileData(rect, memoryBuffers);
|
||||
float *data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS];
|
||||
this->generateGlare(data, tile, this->settings);
|
||||
this->cachedInstance = data;
|
||||
}
|
||||
@@ -65,7 +70,8 @@ void* GlareBaseOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
|
||||
return this->cachedInstance;
|
||||
}
|
||||
|
||||
bool GlareBaseOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool GlareBaseOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
newInput.xmax = this->getWidth();
|
||||
newInput.xmin = 0;
|
||||
|
||||
@@ -37,14 +37,14 @@ private:
|
||||
*/
|
||||
NodeGlare * settings;
|
||||
|
||||
float* cachedInstance;
|
||||
float *cachedInstance;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -56,14 +56,14 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
|
||||
void setGlareSettings(NodeGlare * settings) {this->settings = settings;}
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
protected:
|
||||
GlareBaseOperation();
|
||||
|
||||
virtual void generateGlare(float* data, MemoryBuffer* inputTile, NodeGlare* settings) = 0;
|
||||
virtual void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -22,14 +22,15 @@
|
||||
|
||||
#include "COM_GlareSimpleStarOperation.h"
|
||||
|
||||
void GlareSimpleStarOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) {
|
||||
void GlareSimpleStarOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings)
|
||||
{
|
||||
int i, x, y, ym, yp, xm, xp;
|
||||
float c[4] = {0,0,0,0}, tc[4] = {0,0,0,0};
|
||||
const float f1 = 1.f - settings->fade, f2 = (1.f - f1)*0.5f;
|
||||
|
||||
|
||||
MemoryBuffer* tbuf1 = inputTile->duplicate();
|
||||
MemoryBuffer* tbuf2 = inputTile->duplicate();
|
||||
MemoryBuffer *tbuf1 = inputTile->duplicate();
|
||||
MemoryBuffer *tbuf2 = inputTile->duplicate();
|
||||
|
||||
for (i=0; i<settings->iter; i++) {
|
||||
// // (x || x-1, y-1) to (x || x+1, y+1)
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "COM_GlareStreaksOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) {
|
||||
void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings)
|
||||
{
|
||||
int x, y, n;
|
||||
unsigned int nump=0;
|
||||
float c1[4], c2[4], c3[4], c4[4];
|
||||
@@ -33,8 +34,8 @@ void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile,
|
||||
int size4 = size*4;
|
||||
|
||||
|
||||
MemoryBuffer* tsrc = inputTile->duplicate();
|
||||
MemoryBuffer* tdst = new MemoryBuffer(NULL, inputTile->getRect());
|
||||
MemoryBuffer *tsrc = inputTile->duplicate();
|
||||
MemoryBuffer *tdst = new MemoryBuffer(NULL, inputTile->getRect());
|
||||
tdst->clear();
|
||||
memset(data, 0, size4*sizeof(float));
|
||||
|
||||
@@ -46,7 +47,7 @@ void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile,
|
||||
const float vxp = vx*p4, vyp = vy*p4;
|
||||
const float wt = pow((double)settings->fade, (double)p4);
|
||||
const float cmo = 1.f - (float)pow((double)settings->colmod, (double)n+1); // colormodulation amount relative to current pass
|
||||
float* tdstcol = tdst->getBuffer();
|
||||
float *tdstcol = tdst->getBuffer();
|
||||
for (y=0; y<tsrc->getHeight(); ++y) {
|
||||
for (x=0; x<tsrc->getWidth(); ++x, tdstcol+=4) {
|
||||
// first pass no offset, always same for every pass, exact copy,
|
||||
@@ -75,7 +76,7 @@ void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile,
|
||||
}
|
||||
|
||||
// addImage(sbuf, tsrc, 1.f/(float)(6 - ndg->iter)); // add result to data @todo
|
||||
float* sourcebuffer = tsrc->getBuffer();
|
||||
float *sourcebuffer = tsrc->getBuffer();
|
||||
float factor = 1.f/(float)(6 - settings->iter);
|
||||
for (int i = 0 ; i < size4; i ++) {
|
||||
data[i] += sourcebuffer[i] * factor;
|
||||
|
||||
@@ -23,16 +23,19 @@
|
||||
#include "COM_GlareThresholdOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
GlareThresholdOperation::GlareThresholdOperation(): NodeOperation() {
|
||||
GlareThresholdOperation::GlareThresholdOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void GlareThresholdOperation::initExecution() {
|
||||
void GlareThresholdOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void GlareThresholdOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void GlareThresholdOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
this->inputProgram->read(color, x, y, sampler, inputBuffers);
|
||||
if ((0.212671f*color[0] + 0.71516f*color[1] + 0.072169f*color[2]) >= threshold) {
|
||||
color[0] -= threshold, color[1] -= threshold, color[2] -= threshold;
|
||||
@@ -43,6 +46,7 @@ void GlareThresholdOperation::executePixel(float* color, float x, float y, Pixel
|
||||
else color[0] = color[1] = color[2] = 0.f;
|
||||
}
|
||||
|
||||
void GlareThresholdOperation::deinitExecution() {
|
||||
void GlareThresholdOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -32,18 +32,21 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation(): CurveBaseOperation() {
|
||||
HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation(): CurveBaseOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void HueSaturationValueCorrectOperation::initExecution() {
|
||||
void HueSaturationValueCorrectOperation::initExecution()
|
||||
{
|
||||
CurveBaseOperation::initExecution();
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void HueSaturationValueCorrectOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void HueSaturationValueCorrectOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float hsv[4], f;
|
||||
|
||||
this->inputProgram->read(hsv, x, y, sampler, inputBuffers);
|
||||
@@ -63,12 +66,13 @@ void HueSaturationValueCorrectOperation::executePixel(float* output, float x, fl
|
||||
hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */
|
||||
CLAMP(hsv[1], 0.f, 1.f);
|
||||
|
||||
output[0]= hsv[0];
|
||||
output[1]= hsv[1];
|
||||
output[2]= hsv[2];
|
||||
output[3]= hsv[3];
|
||||
output[0] = hsv[0];
|
||||
output[1] = hsv[1];
|
||||
output[2] = hsv[2];
|
||||
output[3] = hsv[3];
|
||||
}
|
||||
|
||||
void HueSaturationValueCorrectOperation::deinitExecution() {
|
||||
void HueSaturationValueCorrectOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,16 +22,19 @@
|
||||
|
||||
#include "COM_IDMaskOperation.h"
|
||||
|
||||
IDMaskOperation::IDMaskOperation(): NodeOperation() {
|
||||
IDMaskOperation::IDMaskOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void IDMaskOperation::initExecution() {
|
||||
void IDMaskOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void IDMaskOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void IDMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
|
||||
this->inputProgram->read(inputValue, x, y, sampler, inputBuffers);
|
||||
@@ -39,7 +42,8 @@ void IDMaskOperation::executePixel(float* color, float x, float y, PixelSampler
|
||||
color[0] = a;
|
||||
}
|
||||
|
||||
void IDMaskOperation::deinitExecution() {
|
||||
void IDMaskOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader* inputProgram;
|
||||
SocketReader *inputProgram;
|
||||
|
||||
float objectIndex;
|
||||
public:
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -36,7 +36,8 @@ extern "C" {
|
||||
#include "IMB_imbuf_types.h"
|
||||
}
|
||||
|
||||
BaseImageOperation::BaseImageOperation(): NodeOperation() {
|
||||
BaseImageOperation::BaseImageOperation(): NodeOperation()
|
||||
{
|
||||
this->image = NULL;
|
||||
this->buffer = NULL;
|
||||
this->imageBuffer = NULL;
|
||||
@@ -47,20 +48,24 @@ BaseImageOperation::BaseImageOperation(): NodeOperation() {
|
||||
this->depthBuffer = NULL;
|
||||
this->numberOfChannels = 0;
|
||||
}
|
||||
ImageOperation::ImageOperation(): BaseImageOperation() {
|
||||
ImageOperation::ImageOperation(): BaseImageOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
ImageAlphaOperation::ImageAlphaOperation(): BaseImageOperation() {
|
||||
ImageAlphaOperation::ImageAlphaOperation(): BaseImageOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
ImageDepthOperation::ImageDepthOperation(): BaseImageOperation() {
|
||||
ImageDepthOperation::ImageDepthOperation(): BaseImageOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
ImBuf* BaseImageOperation::getImBuf() {
|
||||
ImBuf *BaseImageOperation::getImBuf()
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
|
||||
ibuf= BKE_image_get_ibuf(this->image, this->imageUser);
|
||||
ibuf = BKE_image_get_ibuf(this->image, this->imageUser);
|
||||
if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -72,8 +77,9 @@ ImBuf* BaseImageOperation::getImBuf() {
|
||||
}
|
||||
|
||||
|
||||
void BaseImageOperation::initExecution() {
|
||||
ImBuf *stackbuf= getImBuf();
|
||||
void BaseImageOperation::initExecution()
|
||||
{
|
||||
ImBuf *stackbuf = getImBuf();
|
||||
this->buffer = stackbuf;
|
||||
if (stackbuf) {
|
||||
this->imageBuffer = stackbuf->rect_float;
|
||||
@@ -84,19 +90,22 @@ void BaseImageOperation::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void BaseImageOperation::deinitExecution() {
|
||||
this->imageBuffer= NULL;
|
||||
void BaseImageOperation::deinitExecution()
|
||||
{
|
||||
this->imageBuffer = NULL;
|
||||
}
|
||||
|
||||
void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
ImBuf *stackbuf= getImBuf();
|
||||
void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
ImBuf *stackbuf = getImBuf();
|
||||
if (stackbuf) {
|
||||
resolution[0] = stackbuf->x;
|
||||
resolution[1] = stackbuf->y;
|
||||
}
|
||||
}
|
||||
|
||||
void ImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])\
|
||||
{
|
||||
if (this->imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
|
||||
color[0] = 0.0f;
|
||||
color[1] = 0.0f;
|
||||
@@ -118,7 +127,8 @@ void ImageOperation::executePixel(float *color, float x, float y, PixelSampler s
|
||||
}
|
||||
}
|
||||
|
||||
void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float tempcolor[4];
|
||||
|
||||
if (this->imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
|
||||
@@ -141,7 +151,8 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp
|
||||
}
|
||||
}
|
||||
|
||||
void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
if (this->depthBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
|
||||
color[0] = 0.0f;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ extern "C" {
|
||||
*/
|
||||
class BaseImageOperation : public NodeOperation {
|
||||
protected:
|
||||
ImBuf* buffer;
|
||||
Image* image;
|
||||
ImageUser* imageUser;
|
||||
ImBuf *buffer;
|
||||
Image *image;
|
||||
ImageUser *imageUser;
|
||||
float *imageBuffer;
|
||||
float *depthBuffer;
|
||||
int imageheight;
|
||||
@@ -56,14 +56,14 @@ protected:
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
|
||||
virtual ImBuf* getImBuf();
|
||||
virtual ImBuf *getImBuf();
|
||||
|
||||
public:
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void setImage(Image* image) {this->image = image;}
|
||||
void setImageUser(ImageUser* imageuser) {this->imageUser = imageuser;}
|
||||
void setImage(Image *image) {this->image = image;}
|
||||
void setImageUser(ImageUser *imageuser) {this->imageUser = imageuser;}
|
||||
|
||||
void setFramenumber(int framenumber) {this->framenumber = framenumber;}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_InvertOperation.h"
|
||||
|
||||
InvertOperation::InvertOperation(): NodeOperation() {
|
||||
InvertOperation::InvertOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -32,12 +33,14 @@ InvertOperation::InvertOperation(): NodeOperation() {
|
||||
this->alpha = false;
|
||||
setResolutionInputSocketIndex(1);
|
||||
}
|
||||
void InvertOperation::initExecution() {
|
||||
void InvertOperation::initExecution()
|
||||
{
|
||||
this->inputValueProgram = this->getInputSocketReader(0);
|
||||
this->inputColorProgram = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void InvertOperation::executePixel(float* out, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue[4];
|
||||
float inputColor[4];
|
||||
this->inputValueProgram->read(inputValue, x, y, sampler, inputBuffers);
|
||||
@@ -64,7 +67,8 @@ void InvertOperation::executePixel(float* out, float x, float y, PixelSampler sa
|
||||
|
||||
}
|
||||
|
||||
void InvertOperation::deinitExecution() {
|
||||
void InvertOperation::deinitExecution()
|
||||
{
|
||||
this->inputValueProgram = NULL;
|
||||
this->inputColorProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
double wavelength;
|
||||
float intensity;
|
||||
bool valid;
|
||||
void copyFrom(Ray* other) {
|
||||
void copyFrom(Ray *other) {
|
||||
copy_v3_v3(position, other->position);
|
||||
copy_v3_v3(direction, other->direction);
|
||||
copy_v2_v2(uv, other->uv);
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
double refraction3;
|
||||
float thicknessCoathing;
|
||||
virtual bool isFlat() = 0;
|
||||
virtual void intersect(Intersection* result, Ray* ray) = 0;
|
||||
virtual void intersect(Intersection *result, Ray *ray) = 0;
|
||||
};
|
||||
|
||||
class FlatInterface: public LensInterface {
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
this->thicknessCoathing = 0.0f;
|
||||
|
||||
}
|
||||
void intersect(Intersection* result, Ray* ray) {
|
||||
void intersect(Intersection *result, Ray *ray) {
|
||||
const float dz = this->position[2]-ray->position[2];
|
||||
result->position[0] = ray->position[0] + ray->direction[0]*(dz)/ray->direction[2];
|
||||
result->position[1] = ray->position[1] + ray->direction[1]*(dz)/ray->direction[2];
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
this->thicknessCoathing = coatingPhase/4/this->refraction2;
|
||||
}
|
||||
bool isFlat() {return false;}
|
||||
void intersect(Intersection* result, Ray* ray) {
|
||||
void intersect(Intersection *result, Ray *ray) {
|
||||
float delta[3] ={ray->position[0] - this->position[0],
|
||||
ray->position[1] - this->position[1],
|
||||
ray->position[2] - this->position[2]};
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
RayResult* getRayResult(int x, int y) {
|
||||
RayResult *getRayResult(int x, int y) {
|
||||
return &(raster[x+y*rasterLength]);
|
||||
}
|
||||
};
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
for (int j = i+1; j < interfaces.size()-1 ; j ++) {
|
||||
if (!interfaces[j]->isFlat()) {
|
||||
int length = interfaces.size()+2*(j-i);
|
||||
Bounce* bounce = new Bounce(interfaces[j], interfaces[i], length, step);
|
||||
Bounce *bounce = new Bounce(interfaces[j], interfaces[i], length, step);
|
||||
bounces.push_back(bounce);
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void addInterface(LensInterface* pinterface) {
|
||||
void addInterface(LensInterface *pinterface) {
|
||||
this->interfaces.push_back(pinterface);
|
||||
this->lensIndex = this->interfaces.size()-1;
|
||||
}
|
||||
@@ -245,23 +245,23 @@ public:
|
||||
|
||||
// VECCOPY(refract, view);
|
||||
|
||||
// dot= view[0]*n[0] + view[1]*n[1] + view[2]*n[2];
|
||||
// dot = view[0]*n[0] + view[1]*n[1] + view[2]*n[2];
|
||||
|
||||
// if (dot>0.0f) {
|
||||
// index = 1.0f/index;
|
||||
// fac= 1.0f - (1.0f - dot*dot)*index*index;
|
||||
// fac = 1.0f - (1.0f - dot*dot)*index*index;
|
||||
// if (fac<= 0.0f) return 0;
|
||||
// fac= -dot*index + sqrt(fac);
|
||||
// }
|
||||
// else {
|
||||
// fac= 1.0f - (1.0f - dot*dot)*index*index;
|
||||
// fac = 1.0f - (1.0f - dot*dot)*index*index;
|
||||
// if (fac<= 0.0f) return 0;
|
||||
// fac= -dot*index - sqrt(fac);
|
||||
// }
|
||||
|
||||
// refract[0]= index*view[0] + fac*n[0];
|
||||
// refract[1]= index*view[1] + fac*n[1];
|
||||
// refract[2]= index*view[2] + fac*n[2];
|
||||
// refract[0] = index*view[0] + fac*n[0];
|
||||
// refract[1] = index*view[1] + fac*n[1];
|
||||
// refract[2] = index*view[2] + fac*n[2];
|
||||
|
||||
// normalize_v3(refract);
|
||||
// return 1;
|
||||
@@ -301,9 +301,9 @@ public:
|
||||
|
||||
f1= -2.0f*dot_v3v3(n, view);
|
||||
|
||||
ref[0]= (view[0]+f1*n[0]);
|
||||
ref[1]= (view[1]+f1*n[1]);
|
||||
ref[2]= (view[2]+f1*n[2]);
|
||||
ref[0] = (view[0]+f1*n[0]);
|
||||
ref[1] = (view[1]+f1*n[1]);
|
||||
ref[2] = (view[2]+f1*n[2]);
|
||||
normalize_v3(ref);
|
||||
}
|
||||
|
||||
@@ -334,15 +334,15 @@ public:
|
||||
return ( out_s2+out_p2 ) / 2 ;
|
||||
}
|
||||
|
||||
void detectHit(Ray* result, Ray* inputRay, Bounce *bounce) {
|
||||
void detectHit(Ray *result, Ray *inputRay, Bounce *bounce) {
|
||||
int phase = 0;
|
||||
int delta = 1;
|
||||
int t = 1;
|
||||
int k;
|
||||
result->copyFrom(inputRay);
|
||||
result->valid = false;
|
||||
LensInterface* next = bounce->interface1;
|
||||
LensInterface* f = NULL;
|
||||
LensInterface *next = bounce->interface1;
|
||||
LensInterface *f = NULL;
|
||||
Intersection intersection;
|
||||
for (k = 0 ; k < bounce->length-1;k++, t+=delta) {
|
||||
f = this->interfaces[t];
|
||||
@@ -425,12 +425,13 @@ public:
|
||||
};
|
||||
|
||||
typedef struct LensFace {
|
||||
RayResult* v1;
|
||||
RayResult* v2;
|
||||
RayResult* v3;
|
||||
RayResult *v1;
|
||||
RayResult *v2;
|
||||
RayResult *v3;
|
||||
} LensFace;
|
||||
|
||||
LensGhostProjectionOperation::LensGhostProjectionOperation(): NodeOperation() {
|
||||
LensGhostProjectionOperation::LensGhostProjectionOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -441,12 +442,14 @@ LensGhostProjectionOperation::LensGhostProjectionOperation(): NodeOperation() {
|
||||
this->setComplex(false);
|
||||
}
|
||||
|
||||
LensGhostOperation::LensGhostOperation(): LensGhostProjectionOperation() {
|
||||
LensGhostOperation::LensGhostOperation(): LensGhostProjectionOperation()
|
||||
{
|
||||
this->setComplex(true);
|
||||
|
||||
}
|
||||
|
||||
void LensGhostProjectionOperation::initExecution() {
|
||||
void LensGhostProjectionOperation::initExecution()
|
||||
{
|
||||
if (this->cameraObject != NULL && this->lampObject != NULL) {
|
||||
if (lampObject == NULL || cameraObject == NULL) {
|
||||
visualLampPosition[0] = 0;
|
||||
@@ -491,7 +494,7 @@ void LensGhostProjectionOperation::initExecution() {
|
||||
system->addInterface(new SphereInterface(0.0f,0.0f, 6 CM, 3 CM, 2 CM, AIR, GLASS, 0.0f));
|
||||
system->addInterface(new SphereInterface(0.0f,0.0f, 5.5 CM, 3 CM, 2 CM, GLASS, AIR, 0.f));
|
||||
system->addInterface(new FlatInterface(0.0f,0.0f,0 CM, 30 MM)); // SENSOR
|
||||
system->bokehIndex =3;
|
||||
system->bokehIndex = 3;
|
||||
|
||||
// determine interfaces
|
||||
// LensSystem *system = new LensSystem();
|
||||
@@ -510,7 +513,8 @@ void LensGhostProjectionOperation::initExecution() {
|
||||
this->system = system;
|
||||
}
|
||||
|
||||
void LensGhostOperation::initExecution() {
|
||||
void LensGhostOperation::initExecution()
|
||||
{
|
||||
LensGhostProjectionOperation::initExecution();
|
||||
LensSystem *system = (LensSystem*)this->system;
|
||||
LensInterface *interface1 = system->interfaces[0];
|
||||
@@ -521,7 +525,7 @@ void LensGhostOperation::initExecution() {
|
||||
float wavelength = HERZ[iw];
|
||||
// for every bounce
|
||||
for (int ib = 0 ; ib < system->bounces.size() ; ib++) {
|
||||
Bounce* bounce = system->bounces[ib];
|
||||
Bounce *bounce = system->bounces[ib];
|
||||
// based on quality setting the number of iteration will be different (128^2, 64^2, 32^2)
|
||||
for (int xi = 0 ; xi < step ; xi ++) {
|
||||
float x = -interface1->radius+xi*(interface1->radius*2/step);
|
||||
@@ -572,11 +576,11 @@ void LensGhostOperation::initExecution() {
|
||||
// LensSystem *system = (LensSystem*)this->system;
|
||||
LensInterface * lens = system->interfaces[system->lensIndex];
|
||||
for (int i = 0 ; i < system->bounces.size() ; i ++) {
|
||||
Bounce* bounce = system->bounces[i];
|
||||
Bounce *bounce = system->bounces[i];
|
||||
for (int r = 0 ; r < bounce->rasterLength*bounce->rasterLength ; r ++) {
|
||||
RayResult *result = &bounce->raster[r];
|
||||
// if (result->valid) {
|
||||
float ru= result->x/lens->nominalRadius*width2+width2;
|
||||
float ru = result->x/lens->nominalRadius*width2+width2;
|
||||
float rv = result->y/lens->nominalRadius*height2+height2;
|
||||
result->screenX = ru;
|
||||
result->screenY = rv;
|
||||
@@ -586,7 +590,8 @@ void LensGhostOperation::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
vector<LensFace*>* result = new vector<LensFace*>();
|
||||
LensSystem *system = (LensSystem*)this->system;
|
||||
const float minx = rect->xmin;
|
||||
@@ -594,22 +599,22 @@ void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
|
||||
const float maxx = rect->xmax;
|
||||
const float maxy = rect->ymax;
|
||||
for (int i = 0 ; i < system->bounces.size() ; i ++) {
|
||||
Bounce* bounce = system->bounces[i];
|
||||
Bounce *bounce = system->bounces[i];
|
||||
int faceX, faceY;
|
||||
for (faceX = 0 ; faceX < bounce->rasterLength-1 ; faceX++) {
|
||||
for (faceY = 0 ; faceY < bounce->rasterLength-1 ; faceY++) {
|
||||
RayResult* vertex1 = bounce->getRayResult(faceX, faceY);
|
||||
RayResult* vertex2 = bounce->getRayResult(faceX+1, faceY);
|
||||
RayResult* vertex3 = bounce->getRayResult(faceX+1, faceY+1);
|
||||
RayResult* vertex4 = bounce->getRayResult(faceX, faceY+1);
|
||||
RayResult *vertex1 = bounce->getRayResult(faceX, faceY);
|
||||
RayResult *vertex2 = bounce->getRayResult(faceX+1, faceY);
|
||||
RayResult *vertex3 = bounce->getRayResult(faceX+1, faceY+1);
|
||||
RayResult *vertex4 = bounce->getRayResult(faceX, faceY+1);
|
||||
// early hit test
|
||||
if (!((vertex1->screenX < minx && vertex2->screenX < minx && vertex3->screenX < minx && vertex4->screenX < minx) ||
|
||||
(vertex1->screenX > maxx && vertex2->screenX > maxx && vertex3->screenX > maxx && vertex4->screenX > maxx) ||
|
||||
(vertex1->screenY < miny && vertex2->screenY < miny && vertex3->screenY < miny && vertex4->screenY < miny) ||
|
||||
(vertex1->screenY > maxy && vertex2->screenY > maxy && vertex3->screenY > maxy && vertex4->screenY > maxy))) {
|
||||
int number = vertex1->hasIntensity +vertex2->hasIntensity +vertex3->hasIntensity +vertex4->hasIntensity;
|
||||
int number = vertex1->hasIntensity + vertex2->hasIntensity + vertex3->hasIntensity + vertex4->hasIntensity;
|
||||
if (number == 4) {
|
||||
LensFace* face = new LensFace();
|
||||
LensFace *face = new LensFace();
|
||||
face->v1 = vertex1;
|
||||
face->v2 = vertex2;
|
||||
face->v3 = vertex3;
|
||||
@@ -652,7 +657,8 @@ void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
|
||||
return result;
|
||||
}
|
||||
|
||||
void LensGhostOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) {
|
||||
void LensGhostOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
|
||||
{
|
||||
if (data) {
|
||||
vector<LensFace*>* faces = (vector<LensFace*>*)data;
|
||||
while (faces->size() != 0) {
|
||||
@@ -665,7 +671,8 @@ void LensGhostOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryB
|
||||
}
|
||||
|
||||
|
||||
void LensGhostProjectionOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void LensGhostProjectionOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float bokeh[4];
|
||||
LensSystem *system = (LensSystem*)this->system;
|
||||
LensInterface *interface1 = system->interfaces[0];
|
||||
@@ -696,7 +703,7 @@ void LensGhostProjectionOperation::executePixel(float* color, float x, float y,
|
||||
|
||||
// for every bounce
|
||||
for (int ib = 0 ; ib < system->bounces.size() ; ib++) {
|
||||
Bounce* bounce = system->bounces[ib];
|
||||
Bounce *bounce = system->bounces[ib];
|
||||
// based on quality setting the number of iteration will be different (128^2, 64^2, 32^2)
|
||||
|
||||
Ray r;
|
||||
@@ -732,7 +739,8 @@ void LensGhostProjectionOperation::executePixel(float* color, float x, float y,
|
||||
|
||||
|
||||
|
||||
void LensGhostOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void LensGhostOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
vector<LensFace*>* faces = (vector<LensFace*>*)data;
|
||||
#if 0 /* UNUSED */
|
||||
const float bokehWidth = bokehReader->getWidth();
|
||||
@@ -747,9 +755,9 @@ void LensGhostOperation::executePixel(float* color, int x, int y, MemoryBuffer *
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < faces->size() ; index ++) {
|
||||
LensFace * face = faces->operator [](index);
|
||||
RayResult* vertex1 = face->v1;
|
||||
RayResult* vertex2 = face->v2;
|
||||
RayResult* vertex3 = face->v3;
|
||||
RayResult *vertex1 = face->v1;
|
||||
RayResult *vertex2 = face->v2;
|
||||
RayResult *vertex3 = face->v3;
|
||||
if (!((vertex1->screenX < x && vertex2->screenX < x && vertex3->screenX < x) ||
|
||||
(vertex1->screenX > x && vertex2->screenX > x && vertex3->screenX > x) ||
|
||||
(vertex1->screenY < y && vertex2->screenY < y && vertex3->screenY < y) ||
|
||||
@@ -783,13 +791,15 @@ void LensGhostOperation::executePixel(float* color, int x, int y, MemoryBuffer *
|
||||
}
|
||||
|
||||
|
||||
void LensGhostProjectionOperation::deinitExecution() {
|
||||
void LensGhostProjectionOperation::deinitExecution()
|
||||
{
|
||||
if (this->system) delete (LensSystem*)this->system;
|
||||
this->system = NULL;
|
||||
this->bokehReader = NULL;
|
||||
}
|
||||
|
||||
bool LensGhostProjectionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool LensGhostProjectionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti bokehInput;
|
||||
|
||||
NodeOperation *operation = this->getInputOperation(1);
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
class LensGhostProjectionOperation : public NodeOperation {
|
||||
protected:
|
||||
Object* lampObject;
|
||||
Lamp* lamp;
|
||||
Object* cameraObject;
|
||||
Object *lampObject;
|
||||
Lamp *lamp;
|
||||
Object *cameraObject;
|
||||
|
||||
void* system;
|
||||
void *system;
|
||||
float visualLampPosition[3];
|
||||
CompositorQuality quality;
|
||||
int step;
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -58,8 +58,8 @@ public:
|
||||
void deinitExecution();
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
void setLampObject(Object* lampObject) {this->lampObject = lampObject;}
|
||||
void setCameraObject(Object* cameraObject) {this->cameraObject = cameraObject;}
|
||||
void setLampObject(Object *lampObject) {this->lampObject = lampObject;}
|
||||
void setCameraObject(Object *cameraObject) {this->cameraObject = cameraObject;}
|
||||
|
||||
void setQuality(CompositorQuality quality) {this->quality = quality;}
|
||||
};
|
||||
@@ -68,12 +68,12 @@ class LensGhostOperation : public LensGhostProjectionOperation {
|
||||
public:
|
||||
LensGhostOperation();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
|
||||
@@ -23,13 +23,16 @@
|
||||
#include "COM_LensGlowImageOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
LensGlowImageOperation::LensGlowImageOperation(): NodeOperation() {
|
||||
LensGlowImageOperation::LensGlowImageOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
void LensGlowImageOperation::initExecution() {
|
||||
void LensGlowImageOperation::initExecution()
|
||||
{
|
||||
this->scale = 1/20000.0f;
|
||||
}
|
||||
void LensGlowImageOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void LensGlowImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
const float cs_r = 1.f, cs_g = 1.f, cs_b = 1.f;
|
||||
const float v = 2.f*(y / (float)512.0f) - 1.f;
|
||||
const float u = 2.f*(x / (float)512.0f) - 1.f;
|
||||
@@ -42,10 +45,12 @@ void LensGlowImageOperation::executePixel(float* color, float x, float y, PixelS
|
||||
color[3] = 1.0f;
|
||||
}
|
||||
|
||||
void LensGlowImageOperation::deinitExecution() {
|
||||
void LensGlowImageOperation::deinitExecution()
|
||||
{
|
||||
}
|
||||
|
||||
void LensGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void LensGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
resolution[0] = 512;
|
||||
resolution[1] = 512;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -23,17 +23,20 @@
|
||||
#include "COM_LensGlowOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
LensGlowOperation::LensGlowOperation(): NodeOperation() {
|
||||
LensGlowOperation::LensGlowOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputProgram = NULL;
|
||||
this->lamp = NULL;
|
||||
}
|
||||
void LensGlowOperation::initExecution() {
|
||||
void LensGlowOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void LensGlowOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void LensGlowOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
// const float emit100 = this->lamp->energy*100;
|
||||
// const float emit200 = emit100*2;
|
||||
// const float deltaX = 160-x;
|
||||
@@ -49,6 +52,7 @@ void LensGlowOperation::executePixel(float* color, float x, float y, PixelSample
|
||||
// color[3] = 1.0f;
|
||||
}
|
||||
|
||||
void LensGlowOperation::deinitExecution() {
|
||||
void LensGlowOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader * inputProgram;
|
||||
Lamp* lamp;
|
||||
Lamp *lamp;
|
||||
|
||||
public:
|
||||
LensGlowOperation();
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -51,6 +51,6 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void setLamp(Lamp* lamp) {this->lamp = lamp;}
|
||||
void setLamp(Lamp *lamp) {this->lamp = lamp;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,22 +22,26 @@
|
||||
#include "COM_LuminanceMatteOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
LuminanceMatteOperation::LuminanceMatteOperation(): NodeOperation() {
|
||||
LuminanceMatteOperation::LuminanceMatteOperation(): NodeOperation()
|
||||
{
|
||||
addInputSocket(COM_DT_COLOR);
|
||||
addOutputSocket(COM_DT_VALUE);
|
||||
|
||||
inputImageProgram = NULL;
|
||||
}
|
||||
|
||||
void LuminanceMatteOperation::initExecution() {
|
||||
void LuminanceMatteOperation::initExecution()
|
||||
{
|
||||
this->inputImageProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void LuminanceMatteOperation::deinitExecution() {
|
||||
this->inputImageProgram= NULL;
|
||||
void LuminanceMatteOperation::deinitExecution()
|
||||
{
|
||||
this->inputImageProgram = NULL;
|
||||
}
|
||||
|
||||
void LuminanceMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inColor[4];
|
||||
|
||||
const float high=this->settings->t1;
|
||||
|
||||
@@ -41,11 +41,11 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;}
|
||||
void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "COM_MapUVOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
MapUVOperation::MapUVOperation(): NodeOperation() {
|
||||
MapUVOperation::MapUVOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -33,12 +34,14 @@ MapUVOperation::MapUVOperation(): NodeOperation() {
|
||||
this->inputColorProgram = NULL;
|
||||
}
|
||||
|
||||
void MapUVOperation::initExecution() {
|
||||
void MapUVOperation::initExecution()
|
||||
{
|
||||
this->inputColorProgram = this->getInputSocketReader(0);
|
||||
this->inputUVProgram = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputUV[4];
|
||||
float uv_a[4], uv_b[4];
|
||||
float u,v;
|
||||
@@ -58,36 +61,36 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s
|
||||
/* adaptive sampling, red (U) channel */
|
||||
this->inputUVProgram->read(uv_a, x-1, y, COM_PS_NEAREST, inputBuffers);
|
||||
this->inputUVProgram->read(uv_b, x+1, y, COM_PS_NEAREST, inputBuffers);
|
||||
uv_l= uv_a[2]!=0.f? fabs(inputUV[0] - uv_a[0]) : 0.f;
|
||||
uv_r= uv_b[2]!=0.f? fabs(inputUV[0] - uv_b[0]) : 0.f;
|
||||
uv_l = uv_a[2]!=0.f? fabs(inputUV[0] - uv_a[0]) : 0.f;
|
||||
uv_r = uv_b[2]!=0.f? fabs(inputUV[0] - uv_b[0]) : 0.f;
|
||||
|
||||
dx= 0.5f * (uv_l + uv_r);
|
||||
dx = 0.5f * (uv_l + uv_r);
|
||||
|
||||
/* adaptive sampling, green (V) channel */
|
||||
this->inputUVProgram->read(uv_a, x, y-1, COM_PS_NEAREST, inputBuffers);
|
||||
this->inputUVProgram->read(uv_b, x, y+1, COM_PS_NEAREST, inputBuffers);
|
||||
uv_u= uv_a[2]!=0.f? fabs(inputUV[1] - uv_a[1]) : 0.f;
|
||||
uv_d= uv_b[2]!=0.f? fabs(inputUV[1] - uv_b[1]) : 0.f;
|
||||
uv_u = uv_a[2]!=0.f? fabs(inputUV[1] - uv_a[1]) : 0.f;
|
||||
uv_d = uv_b[2]!=0.f? fabs(inputUV[1] - uv_b[1]) : 0.f;
|
||||
|
||||
dy= 0.5f * (uv_u + uv_d);
|
||||
dy = 0.5f * (uv_u + uv_d);
|
||||
|
||||
/* more adaptive sampling, red and green (UV) channels */
|
||||
this->inputUVProgram->read(uv_a, x-1, y-1, COM_PS_NEAREST, inputBuffers);
|
||||
this->inputUVProgram->read(uv_b, x-1, y+1, COM_PS_NEAREST, inputBuffers);
|
||||
uv_l= uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f;
|
||||
uv_r= uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f;
|
||||
uv_u= uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f;
|
||||
uv_d= uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f;
|
||||
uv_l = uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f;
|
||||
uv_r = uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f;
|
||||
uv_u = uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f;
|
||||
uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f;
|
||||
|
||||
dx+= 0.25f * (uv_l + uv_r);
|
||||
dy+= 0.25f * (uv_u + uv_d);
|
||||
|
||||
this->inputUVProgram->read(uv_a, x+1, y-1, COM_PS_NEAREST, inputBuffers);
|
||||
this->inputUVProgram->read(uv_b, x+1, y+1, COM_PS_NEAREST, inputBuffers);
|
||||
uv_l= uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f;
|
||||
uv_r= uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f;
|
||||
uv_u= uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f;
|
||||
uv_d= uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f;
|
||||
uv_l = uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f;
|
||||
uv_r = uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f;
|
||||
uv_u = uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f;
|
||||
uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f;
|
||||
|
||||
dx+= 0.25f * (uv_l + uv_r);
|
||||
dy+= 0.25f * (uv_u + uv_d);
|
||||
@@ -95,12 +98,12 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s
|
||||
/* UV to alpha threshold */
|
||||
const float threshold = this->alpha * 0.05f;
|
||||
float alpha = 1.0f - threshold * (dx + dy);
|
||||
if (alpha < 0.f) alpha= 0.f;
|
||||
if (alpha < 0.f) alpha = 0.f;
|
||||
else alpha *= inputUV[2];
|
||||
|
||||
/* should use mipmap */
|
||||
dx= min(dx, 0.2f);
|
||||
dy= min(dy, 0.2f);
|
||||
dx = min(dx, 0.2f);
|
||||
dy = min(dy, 0.2f);
|
||||
|
||||
|
||||
/* EWA filtering */
|
||||
@@ -118,12 +121,14 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s
|
||||
}
|
||||
}
|
||||
|
||||
void MapUVOperation::deinitExecution() {
|
||||
void MapUVOperation::deinitExecution()
|
||||
{
|
||||
this->inputUVProgram = NULL;
|
||||
this->inputColorProgram = NULL;
|
||||
}
|
||||
|
||||
bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti colorInput;
|
||||
rcti uvInput;
|
||||
NodeOperation *operation=NULL;
|
||||
|
||||
@@ -29,8 +29,8 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader* inputUVProgram;
|
||||
SocketReader* inputColorProgram;
|
||||
SocketReader *inputUVProgram;
|
||||
SocketReader *inputColorProgram;
|
||||
|
||||
float alpha;
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,31 +22,35 @@
|
||||
|
||||
#include "COM_MapValueOperation.h"
|
||||
|
||||
MapValueOperation::MapValueOperation(): NodeOperation() {
|
||||
MapValueOperation::MapValueOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void MapValueOperation::initExecution() {
|
||||
void MapValueOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void MapValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MapValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float src[4];
|
||||
inputOperation->read(src, x, y, sampler, inputBuffers);
|
||||
TexMapping *texmap= this->settings;
|
||||
TexMapping *texmap = this->settings;
|
||||
float value = (src[0] + texmap->loc[0])*texmap->size[0];
|
||||
if (texmap->flag & TEXMAP_CLIP_MIN)
|
||||
if (value<texmap->min[0])
|
||||
value= texmap->min[0];
|
||||
value = texmap->min[0];
|
||||
if (texmap->flag & TEXMAP_CLIP_MAX)
|
||||
if (value>texmap->max[0])
|
||||
value= texmap->max[0];
|
||||
value = texmap->max[0];
|
||||
|
||||
outputValue[0] = value;
|
||||
}
|
||||
|
||||
void MapValueOperation::deinitExecution() {
|
||||
void MapValueOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
/**
|
||||
* @brief set the TexMapping settings
|
||||
*/
|
||||
void setSettings(TexMapping* settings) {this->settings = settings;}
|
||||
void setSettings(TexMapping *settings) {this->settings = settings;}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,8 @@ extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MathBaseOperation::MathBaseOperation(): NodeOperation() {
|
||||
MathBaseOperation::MathBaseOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
@@ -33,18 +34,21 @@ MathBaseOperation::MathBaseOperation(): NodeOperation() {
|
||||
this->inputValue2Operation = NULL;
|
||||
}
|
||||
|
||||
void MathBaseOperation::initExecution() {
|
||||
void MathBaseOperation::initExecution()
|
||||
{
|
||||
this->inputValue1Operation = this->getInputSocketReader(0);
|
||||
this->inputValue2Operation = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
|
||||
void MathBaseOperation::deinitExecution() {
|
||||
void MathBaseOperation::deinitExecution()
|
||||
{
|
||||
this->inputValue1Operation = NULL;
|
||||
this->inputValue2Operation = NULL;
|
||||
}
|
||||
|
||||
void MathAddOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -54,7 +58,8 @@ void MathAddOperation::executePixel(float* outputValue, float x, float y, PixelS
|
||||
outputValue[0] = inputValue1[0] + inputValue2[0];
|
||||
}
|
||||
|
||||
void MathSubtractOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -64,7 +69,8 @@ void MathSubtractOperation::executePixel(float* outputValue, float x, float y, P
|
||||
outputValue[0] = inputValue1[0] - inputValue2[0];
|
||||
}
|
||||
|
||||
void MathMultiplyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -74,7 +80,8 @@ void MathMultiplyOperation::executePixel(float* outputValue, float x, float y, P
|
||||
outputValue[0] = inputValue1[0] * inputValue2[0];
|
||||
}
|
||||
|
||||
void MathDivideOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -82,12 +89,13 @@ void MathDivideOperation::executePixel(float* outputValue, float x, float y, Pix
|
||||
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
|
||||
|
||||
if (inputValue2[0]==0) /* We don't want to divide by zero. */
|
||||
outputValue[0]= 0.0;
|
||||
outputValue[0] = 0.0;
|
||||
else
|
||||
outputValue[0]= inputValue1[0] / inputValue2[0];
|
||||
outputValue[0] = inputValue1[0] / inputValue2[0];
|
||||
}
|
||||
|
||||
void MathSineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -97,7 +105,8 @@ void MathSineOperation::executePixel(float* outputValue, float x, float y, Pixel
|
||||
outputValue[0] = sin(inputValue1[0]);
|
||||
}
|
||||
|
||||
void MathCosineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -107,7 +116,8 @@ void MathCosineOperation::executePixel(float* outputValue, float x, float y, Pix
|
||||
outputValue[0] = cos(inputValue1[0]);
|
||||
}
|
||||
|
||||
void MathTangentOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -117,7 +127,8 @@ void MathTangentOperation::executePixel(float* outputValue, float x, float y, Pi
|
||||
outputValue[0] = tan(inputValue1[0]);
|
||||
}
|
||||
|
||||
void MathArcSineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathArcSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -125,12 +136,13 @@ void MathArcSineOperation::executePixel(float* outputValue, float x, float y, Pi
|
||||
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
|
||||
|
||||
if (inputValue1[0] <= 1 && inputValue1[0] >= -1 )
|
||||
outputValue[0]= asin(inputValue1[0]);
|
||||
outputValue[0] = asin(inputValue1[0]);
|
||||
else
|
||||
outputValue[0]= 0.0;
|
||||
outputValue[0] = 0.0;
|
||||
}
|
||||
|
||||
void MathArcCosineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathArcCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -138,12 +150,13 @@ void MathArcCosineOperation::executePixel(float* outputValue, float x, float y,
|
||||
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
|
||||
|
||||
if (inputValue1[0] <= 1 && inputValue1[0] >= -1 )
|
||||
outputValue[0]= acos(inputValue1[0]);
|
||||
outputValue[0] = acos(inputValue1[0]);
|
||||
else
|
||||
outputValue[0]= 0.0;
|
||||
outputValue[0] = 0.0;
|
||||
}
|
||||
|
||||
void MathArcTangentOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathArcTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -153,7 +166,8 @@ void MathArcTangentOperation::executePixel(float* outputValue, float x, float y,
|
||||
outputValue[0] = atan(inputValue1[0]);
|
||||
}
|
||||
|
||||
void MathPowerOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathPowerOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -161,13 +175,13 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe
|
||||
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
|
||||
|
||||
if ( inputValue1[0] >= 0 ) {
|
||||
outputValue[0]= pow(inputValue1[0], inputValue2[0]);
|
||||
outputValue[0] = pow(inputValue1[0], inputValue2[0]);
|
||||
}
|
||||
else {
|
||||
float y_mod_1 = fmod(inputValue2[0], 1);
|
||||
/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
|
||||
if (y_mod_1 > 0.999 || y_mod_1 < 0.001) {
|
||||
outputValue[0]= pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5));
|
||||
outputValue[0] = pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5));
|
||||
}
|
||||
else {
|
||||
outputValue[0] = 0.0;
|
||||
@@ -175,7 +189,8 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe
|
||||
}
|
||||
}
|
||||
|
||||
void MathLogarithmOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathLogarithmOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -183,12 +198,13 @@ void MathLogarithmOperation::executePixel(float* outputValue, float x, float y,
|
||||
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
|
||||
|
||||
if ( inputValue1[0] > 0 && inputValue2[0] > 0 )
|
||||
outputValue[0]= log(inputValue1[0]) / log(inputValue2[0]);
|
||||
outputValue[0] = log(inputValue1[0]) / log(inputValue2[0]);
|
||||
else
|
||||
outputValue[0]= 0.0;
|
||||
outputValue[0] = 0.0;
|
||||
}
|
||||
|
||||
void MathMinimumOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathMinimumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -198,7 +214,8 @@ void MathMinimumOperation::executePixel(float* outputValue, float x, float y, Pi
|
||||
outputValue[0] = min(inputValue1[0], inputValue2[0]);
|
||||
}
|
||||
|
||||
void MathMaximumOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathMaximumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -208,7 +225,8 @@ void MathMaximumOperation::executePixel(float* outputValue, float x, float y, Pi
|
||||
outputValue[0] = max(inputValue1[0], inputValue2[0]);
|
||||
}
|
||||
|
||||
void MathRoundOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathRoundOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -218,7 +236,8 @@ void MathRoundOperation::executePixel(float* outputValue, float x, float y, Pixe
|
||||
outputValue[0] = round(inputValue1[0]);
|
||||
}
|
||||
|
||||
void MathLessThanOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathLessThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
@@ -228,7 +247,8 @@ void MathLessThanOperation::executePixel(float* outputValue, float x, float y, P
|
||||
outputValue[0] = inputValue1[0]<inputValue2[0]?1.0f:0.0f;
|
||||
}
|
||||
|
||||
void MathGreaterThanOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputValue1[4];
|
||||
float inputValue2[4];
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) = 0;
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) = 0;
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -63,88 +63,88 @@ public:
|
||||
class MathAddOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathAddOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathSubtractOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathSubtractOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathMultiplyOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathMultiplyOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathDivideOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathDivideOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathSineOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathSineOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathCosineOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathCosineOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathTangentOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathTangentOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
|
||||
class MathArcSineOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathArcSineOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathArcCosineOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathArcCosineOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathArcTangentOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathArcTangentOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathPowerOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathPowerOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathLogarithmOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathLogarithmOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathMinimumOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathMinimumOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathMaximumOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathMaximumOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathRoundOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathRoundOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathLessThanOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathLessThanOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
class MathGreaterThanOperation: public MathBaseOperation {
|
||||
public:
|
||||
MathGreaterThanOperation() : MathBaseOperation() {}
|
||||
void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixAddOperation.h"
|
||||
|
||||
MixAddOperation::MixAddOperation(): MixBaseOperation() {
|
||||
MixAddOperation::MixAddOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixAddOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
MixBaseOperation::MixBaseOperation(): NodeOperation() {
|
||||
MixBaseOperation::MixBaseOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
@@ -33,13 +34,15 @@ MixBaseOperation::MixBaseOperation(): NodeOperation() {
|
||||
this->setUseValueAlphaMultiply(false);
|
||||
}
|
||||
|
||||
void MixBaseOperation::initExecution() {
|
||||
void MixBaseOperation::initExecution()
|
||||
{
|
||||
this->inputValueOperation = this->getInputSocketReader(0);
|
||||
this->inputColor1Operation = this->getInputSocketReader(1);
|
||||
this->inputColor2Operation = this->getInputSocketReader(2);
|
||||
}
|
||||
|
||||
void MixBaseOperation::executePixel(float* outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -51,21 +54,23 @@ void MixBaseOperation::executePixel(float* outputColor, float x, float y, PixelS
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
outputColor[0] = valuem*(inputColor1[0])+value*(inputColor2[0]);
|
||||
outputColor[1] = valuem*(inputColor1[1])+value*(inputColor2[1]);
|
||||
outputColor[2] = valuem*(inputColor1[2])+value*(inputColor2[2]);
|
||||
outputColor[3] = inputColor1[3];
|
||||
}
|
||||
|
||||
void MixBaseOperation::deinitExecution() {
|
||||
void MixBaseOperation::deinitExecution()
|
||||
{
|
||||
this->inputValueOperation = NULL;
|
||||
this->inputColor1Operation = NULL;
|
||||
this->inputColor2Operation = NULL;
|
||||
}
|
||||
|
||||
void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
InputSocket* socket;
|
||||
void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
InputSocket *socket;
|
||||
unsigned int tempPreferredResolution[] = {0,0};
|
||||
unsigned int tempResolution[2];
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ protected:
|
||||
/**
|
||||
* Prefetched reference to the inputProgram
|
||||
*/
|
||||
SocketReader * inputValueOperation;
|
||||
SocketReader* inputColor1Operation;
|
||||
SocketReader* inputColor2Operation;
|
||||
SocketReader *inputValueOperation;
|
||||
SocketReader *inputColor1Operation;
|
||||
SocketReader *inputColor2Operation;
|
||||
bool valueAlphaMultiply;
|
||||
public:
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
MixBlendOperation::MixBlendOperation(): MixBaseOperation() {
|
||||
MixBlendOperation::MixBlendOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixBlendOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixBlendOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
@@ -39,7 +41,7 @@ void MixBlendOperation::executePixel(float* outputValue, float x, float y, Pixel
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
outputValue[0] = valuem*(inputColor1[0])+value*(inputColor2[0]);
|
||||
outputValue[1] = valuem*(inputColor1[1])+value*(inputColor2[1]);
|
||||
outputValue[2] = valuem*(inputColor1[2])+value*(inputColor2[2]);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixBurnOperation.h"
|
||||
|
||||
MixBurnOperation::MixBurnOperation(): MixBaseOperation() {
|
||||
MixBurnOperation::MixBurnOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixBurnOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -38,7 +40,7 @@ void MixBurnOperation::executePixel(float* outputValue, float x, float y, PixelS
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
tmp = valuem + value*inputColor2[0];
|
||||
if (tmp <= 0.0f)
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -26,10 +26,12 @@ extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixColorOperation::MixColorOperation(): MixBaseOperation() {
|
||||
MixColorOperation::MixColorOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixColorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -41,7 +43,7 @@ void MixColorOperation::executePixel(float* outputValue, float x, float y, Pixel
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float colH,colS,colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixDarkenOperation.h"
|
||||
|
||||
MixDarkenOperation::MixDarkenOperation(): MixBaseOperation() {
|
||||
MixDarkenOperation::MixDarkenOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixDarkenOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixDarkenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -37,16 +39,16 @@ void MixDarkenOperation::executePixel(float* outputValue, float x, float y, Pixe
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
float tmp;
|
||||
tmp=inputColor2[0]+((1.0f-inputColor2[0])*valuem);
|
||||
if (tmp < inputColor1[0]) outputValue[0]= tmp;
|
||||
if (tmp < inputColor1[0]) outputValue[0] = tmp;
|
||||
else outputValue[0] = inputColor1[0];
|
||||
tmp=inputColor2[1]+((1.0f-inputColor2[1])*valuem);
|
||||
if (tmp < inputColor1[1]) outputValue[1]= tmp;
|
||||
if (tmp < inputColor1[1]) outputValue[1] = tmp;
|
||||
else outputValue[1] = inputColor1[1];
|
||||
tmp=inputColor2[2]+((1.0f-inputColor2[2])*valuem);
|
||||
if (tmp < inputColor1[2]) outputValue[2]= tmp;
|
||||
if (tmp < inputColor1[2]) outputValue[2] = tmp;
|
||||
else outputValue[2] = inputColor1[2];
|
||||
|
||||
outputValue[3] = inputColor1[3];
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
#include "COM_MixDifferenceOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
MixDifferenceOperation::MixDifferenceOperation(): MixBaseOperation() {
|
||||
MixDifferenceOperation::MixDifferenceOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixDifferenceOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixDifferenceOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -38,7 +40,7 @@ void MixDifferenceOperation::executePixel(float* outputValue, float x, float y,
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
outputValue[0] = valuem*inputColor1[0] + value*fabsf(inputColor1[0]-inputColor2[0]);
|
||||
outputValue[1] = valuem*inputColor1[1] + value*fabsf(inputColor1[1]-inputColor2[1]);
|
||||
outputValue[2] = valuem*inputColor1[2] + value*fabsf(inputColor1[2]-inputColor2[2]);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixDivideOperation.h"
|
||||
|
||||
MixDivideOperation::MixDivideOperation(): MixBaseOperation() {
|
||||
MixDivideOperation::MixDivideOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixDivideOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -37,17 +39,17 @@ void MixDivideOperation::executePixel(float* outputValue, float x, float y, Pixe
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
if (inputColor2[0]!=0.0f)
|
||||
if (inputColor2[0] != 0.0f)
|
||||
outputValue[0] = valuem*(inputColor1[0]) + value*(inputColor1[0])/inputColor2[0];
|
||||
else
|
||||
outputValue[0] = 0.0f;
|
||||
if (inputColor2[1]!=0.0f)
|
||||
if (inputColor2[1] != 0.0f)
|
||||
outputValue[1] = valuem*(inputColor1[1]) + value*(inputColor1[1])/inputColor2[1];
|
||||
else
|
||||
outputValue[1] = 0.0f;
|
||||
if (inputColor2[2]!=0.0f)
|
||||
if (inputColor2[2] != 0.0f)
|
||||
outputValue[2] = valuem*(inputColor1[2]) + value*(inputColor1[2])/inputColor2[2];
|
||||
else
|
||||
outputValue[2] = 0.0f;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixDodgeOperation.h"
|
||||
|
||||
MixDodgeOperation::MixDodgeOperation(): MixBaseOperation() {
|
||||
MixDodgeOperation::MixDodgeOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixDodgeOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixDodgeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -26,10 +26,12 @@ extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixHueOperation::MixHueOperation(): MixBaseOperation() {
|
||||
MixHueOperation::MixHueOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixHueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -41,7 +43,7 @@ void MixHueOperation::executePixel(float* outputValue, float x, float y, PixelSa
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float colH,colS,colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixLightenOperation.h"
|
||||
|
||||
MixLightenOperation::MixLightenOperation(): MixBaseOperation() {
|
||||
MixLightenOperation::MixLightenOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixLightenOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixLightenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -39,13 +41,13 @@ void MixLightenOperation::executePixel(float* outputValue, float x, float y, Pix
|
||||
}
|
||||
float tmp;
|
||||
tmp=value * inputColor2[0];
|
||||
if (tmp > inputColor1[0]) outputValue[0]= tmp;
|
||||
if (tmp > inputColor1[0]) outputValue[0] = tmp;
|
||||
else outputValue[0] = inputColor1[0];
|
||||
tmp=value * inputColor2[1];
|
||||
if (tmp > inputColor1[1]) outputValue[1]= tmp;
|
||||
if (tmp > inputColor1[1]) outputValue[1] = tmp;
|
||||
else outputValue[1] = inputColor1[1];
|
||||
tmp=value * inputColor2[2];
|
||||
if (tmp > inputColor1[2]) outputValue[2]= tmp;
|
||||
if (tmp > inputColor1[2]) outputValue[2] = tmp;
|
||||
else outputValue[2] = inputColor1[2];
|
||||
outputValue[3] = inputColor1[3];
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixLinearLightOperation.h"
|
||||
|
||||
MixLinearLightOperation::MixLinearLightOperation(): MixBaseOperation() {
|
||||
MixLinearLightOperation::MixLinearLightOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixLinearLightOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixLinearLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixMultiplyOperation.h"
|
||||
|
||||
MixMultiplyOperation::MixMultiplyOperation(): MixBaseOperation() {
|
||||
MixMultiplyOperation::MixMultiplyOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixMultiplyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
@@ -38,7 +40,7 @@ void MixMultiplyOperation::executePixel(float* outputValue, float x, float y, Pi
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
outputValue[0] = inputColor1[0] *(valuem+value*inputColor2[0]);
|
||||
outputValue[1] = inputColor1[1] *(valuem+value*inputColor2[1]);
|
||||
outputValue[2] = inputColor1[2] *(valuem+value*inputColor2[2]);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixOverlayOperation.h"
|
||||
|
||||
MixOverlayOperation::MixOverlayOperation(): MixBaseOperation() {
|
||||
MixOverlayOperation::MixOverlayOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixOverlayOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixOverlayOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -38,7 +40,7 @@ void MixOverlayOperation::executePixel(float* outputValue, float x, float y, Pix
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
if (inputColor1[0] < 0.5f) {
|
||||
outputValue[0] = inputColor1[0] * (valuem + 2.0f*value*inputColor2[0]);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -26,10 +26,12 @@ extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixSaturationOperation::MixSaturationOperation(): MixBaseOperation() {
|
||||
MixSaturationOperation::MixSaturationOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixSaturationOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixSaturationOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -41,7 +43,7 @@ void MixSaturationOperation::executePixel(float* outputValue, float x, float y,
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float rH,rS,rV;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixScreenOperation.h"
|
||||
|
||||
MixScreenOperation::MixScreenOperation(): MixBaseOperation() {
|
||||
MixScreenOperation::MixScreenOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixScreenOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixScreenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float valuev[4];
|
||||
@@ -38,7 +40,7 @@ void MixScreenOperation::executePixel(float* outputValue, float x, float y, Pixe
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
outputValue[0] = 1.0f - (valuem + value*(1.0f-inputColor2[0])) *(1.0f-inputColor1[0]);
|
||||
outputValue[1] = 1.0f - (valuem + value*(1.0f-inputColor2[1])) *(1.0f-inputColor1[1]);
|
||||
|
||||
@@ -39,6 +39,6 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixSoftLightOperation.h"
|
||||
|
||||
MixSoftLightOperation::MixSoftLightOperation(): MixBaseOperation() {
|
||||
MixSoftLightOperation::MixSoftLightOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixSoftLightOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])\
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -37,7 +39,7 @@ void MixSoftLightOperation::executePixel(float* outputValue, float x, float y, P
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
float scr, scg, scb;
|
||||
|
||||
/* first calculate non-fac based Screen mix */
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include "COM_MixSubtractOperation.h"
|
||||
|
||||
MixSubtractOperation::MixSubtractOperation(): MixBaseOperation() {
|
||||
MixSubtractOperation::MixSubtractOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixSubtractOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -26,10 +26,12 @@ extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixValueOperation::MixValueOperation(): MixBaseOperation() {
|
||||
MixValueOperation::MixValueOperation(): MixBaseOperation()
|
||||
{
|
||||
}
|
||||
|
||||
void MixValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MixValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float value;
|
||||
@@ -41,7 +43,7 @@ void MixValueOperation::executePixel(float* outputValue, float x, float y, Pixel
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem= 1.0f-value;
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float rH,rS,rV;
|
||||
float colH,colS,colV;
|
||||
|
||||
@@ -39,6 +39,6 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -24,14 +24,16 @@
|
||||
extern "C" {
|
||||
#include "BKE_tracking.h"
|
||||
}
|
||||
MovieClipAttributeOperation::MovieClipAttributeOperation(): NodeOperation() {
|
||||
MovieClipAttributeOperation::MovieClipAttributeOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->valueSet = false;
|
||||
this->framenumber = 0;
|
||||
this->attribute = MCA_X;
|
||||
}
|
||||
|
||||
void MovieClipAttributeOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MovieClipAttributeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
if (!valueSet) {
|
||||
float loc[2], scale, angle;
|
||||
loc[0] = 0.0f;
|
||||
@@ -60,7 +62,8 @@ void MovieClipAttributeOperation::executePixel(float* outputValue, float x, floa
|
||||
outputValue[0] = this->value;
|
||||
}
|
||||
|
||||
void MovieClipAttributeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void MovieClipAttributeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
|
||||
void setMovieClip(MovieClip* clip) {this->clip = clip;}
|
||||
void setMovieClip(MovieClip *clip) {this->clip = clip;}
|
||||
void setFramenumber(int framenumber) {this->framenumber = framenumber;}
|
||||
void setAttribute(MovieClipAttribute attribute) {this->attribute = attribute;}
|
||||
};
|
||||
|
||||
@@ -31,7 +31,8 @@ extern "C" {
|
||||
}
|
||||
#include "BKE_image.h"
|
||||
|
||||
MovieClipOperation::MovieClipOperation(): NodeOperation() {
|
||||
MovieClipOperation::MovieClipOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->movieClip = NULL;
|
||||
this->movieClipBuffer = NULL;
|
||||
@@ -42,11 +43,12 @@ MovieClipOperation::MovieClipOperation(): NodeOperation() {
|
||||
}
|
||||
|
||||
|
||||
void MovieClipOperation::initExecution() {
|
||||
void MovieClipOperation::initExecution()
|
||||
{
|
||||
if (this->movieClip) {
|
||||
BKE_movieclip_user_set_frame(this->movieClipUser, this->framenumber);
|
||||
ImBuf *ibuf;
|
||||
ibuf= BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser);
|
||||
ibuf = BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser);
|
||||
if (ibuf) {
|
||||
this->movieClipBuffer = ibuf;
|
||||
if (ibuf->rect_float == NULL || ibuf->userflags&IB_RECT_INVALID) {
|
||||
@@ -57,14 +59,16 @@ void MovieClipOperation::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void MovieClipOperation::deinitExecution() {
|
||||
void MovieClipOperation::deinitExecution()
|
||||
{
|
||||
this->movieClipBuffer = NULL;
|
||||
}
|
||||
|
||||
void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
if (this->movieClip) {
|
||||
ibuf= BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser);
|
||||
ibuf = BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser);
|
||||
if (ibuf) {
|
||||
resolution[0] = ibuf->x;
|
||||
resolution[1] = ibuf->y;
|
||||
@@ -72,7 +76,8 @@ void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned
|
||||
}
|
||||
}
|
||||
|
||||
void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
if (this->movieClipBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
|
||||
color[0] = 0.0f;
|
||||
color[1] = 0.0f;
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
*/
|
||||
class MovieClipOperation : public NodeOperation {
|
||||
protected:
|
||||
MovieClip* movieClip;
|
||||
MovieClipUser* movieClipUser;
|
||||
MovieClip *movieClip;
|
||||
MovieClipUser *movieClipUser;
|
||||
ImBuf *movieClipBuffer;
|
||||
int movieClipheight;
|
||||
int movieClipwidth;
|
||||
@@ -54,8 +54,8 @@ public:
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void setMovieClip(MovieClip* image) {this->movieClip = image;}
|
||||
void setMovieClipUser(MovieClipUser* imageuser) {this->movieClipUser = imageuser;}
|
||||
void setMovieClip(MovieClip *image) {this->movieClip = image;}
|
||||
void setMovieClipUser(MovieClipUser *imageuser) {this->movieClipUser = imageuser;}
|
||||
|
||||
void setFramenumber(int framenumber) {this->framenumber = framenumber;}
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
@@ -32,7 +32,8 @@ extern "C" {
|
||||
vector<DistortionCache*> s_cache;
|
||||
|
||||
|
||||
MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperation() {
|
||||
MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
@@ -41,17 +42,18 @@ MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperat
|
||||
this->cache = NULL;
|
||||
this->distortion = distortion;
|
||||
}
|
||||
void MovieDistortionOperation::initExecution() {
|
||||
void MovieDistortionOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
if (this->movieClip) {
|
||||
for (int i = 0 ; i < s_cache.size() ; i ++) {
|
||||
DistortionCache* c = (DistortionCache*)s_cache[i];
|
||||
DistortionCache *c = (DistortionCache*)s_cache[i];
|
||||
if (c->isCacheFor(this->movieClip, this->width, this->height, this->distortion)) {
|
||||
this->cache = c;
|
||||
return;
|
||||
}
|
||||
}
|
||||
DistortionCache* newC = new DistortionCache(this->movieClip, this->width, this->height, this->distortion);
|
||||
DistortionCache *newC = new DistortionCache(this->movieClip, this->width, this->height, this->distortion);
|
||||
s_cache.push_back(newC);
|
||||
this->cache = newC;
|
||||
}
|
||||
@@ -60,13 +62,15 @@ void MovieDistortionOperation::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void MovieDistortionOperation::deinitExecution() {
|
||||
void MovieDistortionOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
this->movieClip = NULL;
|
||||
}
|
||||
|
||||
|
||||
void MovieDistortionOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MovieDistortionOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
|
||||
if (this->cache != NULL) {
|
||||
float u, v;
|
||||
@@ -78,7 +82,8 @@ void MovieDistortionOperation::executePixel(float *color,float x, float y, Pixel
|
||||
}
|
||||
}
|
||||
|
||||
bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
newInput.xmax = input->xmax + 100;
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
float *buffer;
|
||||
int *bufferCalculated;
|
||||
public:
|
||||
DistortionCache(MovieClip* movieclip, int width, int height, bool inverted) {
|
||||
DistortionCache(MovieClip *movieclip, int width, int height, bool inverted) {
|
||||
this->k1 = movieclip->tracking.camera.k1;
|
||||
this->k2 = movieclip->tracking.camera.k2;
|
||||
this->k3 = movieclip->tracking.camera.k3;
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
this->bufferCalculated[i] = 0;
|
||||
}
|
||||
}
|
||||
bool isCacheFor(MovieClip* movieclip, int width, int height, bool inverted) {
|
||||
bool isCacheFor(MovieClip *movieclip, int width, int height, bool inverted) {
|
||||
return this->k1 == movieclip->tracking.camera.k1 &&
|
||||
this->k2 == movieclip->tracking.camera.k2 &&
|
||||
this->k3 == movieclip->tracking.camera.k3 &&
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
this->height == height;
|
||||
}
|
||||
|
||||
void getUV(MovieTracking* trackingData, int x, int y, float *u, float*v) {
|
||||
void getUV(MovieTracking *trackingData, int x, int y, float *u, float*v) {
|
||||
if (x<0 || x >= this->width || y <0 || y >= this->height) {
|
||||
*u = x;
|
||||
*v = y;
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setMovieClip(MovieClip* clip) {this->movieClip = clip;}
|
||||
void setMovieClip(MovieClip *clip) {this->movieClip = clip;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -27,21 +27,24 @@ extern "C" {
|
||||
#include "IMB_imbuf_types.h"
|
||||
}
|
||||
|
||||
MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation() {
|
||||
MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation()
|
||||
{
|
||||
this->passId = pass;
|
||||
}
|
||||
ImBuf* MultilayerBaseOperation::getImBuf() {
|
||||
ImBuf *MultilayerBaseOperation::getImBuf()
|
||||
{
|
||||
RenderPass *rpass;
|
||||
rpass = (RenderPass *)BLI_findlink(&this->renderlayer->passes, this->passId);
|
||||
if (rpass) {
|
||||
this->imageUser->pass= this->passId;
|
||||
this->imageUser->pass = this->passId;
|
||||
BKE_image_multilayer_index(image->rr, this->imageUser);
|
||||
return BaseImageOperation::getImBuf();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MultilayerColorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MultilayerColorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
int yi = y;
|
||||
int xi = x;
|
||||
if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) {
|
||||
@@ -73,7 +76,8 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe
|
||||
}
|
||||
}
|
||||
|
||||
void MultilayerValueOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MultilayerValueOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
int yi = y;
|
||||
int xi = x;
|
||||
if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) {
|
||||
@@ -85,7 +89,8 @@ void MultilayerValueOperation::executePixel(float *color, float x, float y, Pixe
|
||||
}
|
||||
}
|
||||
|
||||
void MultilayerVectorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void MultilayerVectorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
int yi = y;
|
||||
int xi = x;
|
||||
if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) {
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
class MultilayerBaseOperation: public BaseImageOperation {
|
||||
private:
|
||||
int passId;
|
||||
RenderLayer* renderlayer;
|
||||
RenderLayer *renderlayer;
|
||||
protected:
|
||||
ImBuf* getImBuf();
|
||||
ImBuf *getImBuf();
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@@ -21,19 +21,22 @@
|
||||
|
||||
#include "COM_NormalizeOperation.h"
|
||||
|
||||
NormalizeOperation::NormalizeOperation(): NodeOperation() {
|
||||
NormalizeOperation::NormalizeOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->imageReader = NULL;
|
||||
this->cachedInstance = NULL;
|
||||
this->setComplex(true);
|
||||
}
|
||||
void NormalizeOperation::initExecution() {
|
||||
void NormalizeOperation::initExecution()
|
||||
{
|
||||
this->imageReader = this->getInputSocketReader(0);
|
||||
NodeOperation::initMutex();
|
||||
}
|
||||
|
||||
void NormalizeOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) {
|
||||
void NormalizeOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data)
|
||||
{
|
||||
/* using generic two floats struct to store x: min y: mult */
|
||||
NodeTwoFloats *minmult = (NodeTwoFloats *)data;
|
||||
|
||||
@@ -43,7 +46,8 @@ void NormalizeOperation::executePixel(float* color, int x, int y, MemoryBuffer *
|
||||
color[0] = (output[0] - minmult->x) * minmult->y;
|
||||
}
|
||||
|
||||
void NormalizeOperation::deinitExecution() {
|
||||
void NormalizeOperation::deinitExecution()
|
||||
{
|
||||
this->imageReader = NULL;
|
||||
if (this->cachedInstance) {
|
||||
delete cachedInstance;
|
||||
@@ -51,10 +55,11 @@ void NormalizeOperation::deinitExecution() {
|
||||
NodeOperation::deinitMutex();
|
||||
}
|
||||
|
||||
bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti imageInput;
|
||||
|
||||
NodeOperation* operation = getInputOperation(0);
|
||||
NodeOperation *operation = getInputOperation(0);
|
||||
imageInput.xmax = operation->getWidth();
|
||||
imageInput.xmin = 0;
|
||||
imageInput.ymax = operation->getHeight();
|
||||
@@ -69,12 +74,12 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
|
||||
/* The code below assumes all data is inside range +- this, and that input buffer is single channel */
|
||||
#define BLENDER_ZMAX 10000.0f
|
||||
|
||||
void* NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
|
||||
void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
BLI_mutex_lock(getMutex());
|
||||
|
||||
if (this->cachedInstance == NULL) {
|
||||
MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
/* using generic two floats struct to store x: min y: mult */
|
||||
NodeTwoFloats *minmult = new NodeTwoFloats();
|
||||
|
||||
@@ -104,5 +109,6 @@ void* NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu
|
||||
return this->cachedInstance;
|
||||
}
|
||||
|
||||
void NormalizeOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) {
|
||||
void NormalizeOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// @todo: this source needs to be generated from COM_OpenCLKernels.cl.
|
||||
/// not implemented yet. new data to h
|
||||
|
||||
const char* sourcecode = "/// This file contains all opencl kernels for node-operation implementations \n" \
|
||||
const char *sourcecode = "/// This file contains all opencl kernels for node-operation implementations \n" \
|
||||
"\n" \
|
||||
"__kernel void testKernel(__global __write_only image2d_t output) {\n" \
|
||||
" int x = get_global_id(0);\n" \
|
||||
|
||||
@@ -48,7 +48,8 @@ static int get_datatype_size(DataType datatype)
|
||||
}
|
||||
}
|
||||
|
||||
static float *init_buffer(unsigned int width, unsigned int height, DataType datatype) {
|
||||
static float *init_buffer(unsigned int width, unsigned int height, DataType datatype)
|
||||
{
|
||||
// When initializing the tree during initial load the width and height can be zero.
|
||||
if (width != 0 && height != 0) {
|
||||
int size = get_datatype_size(datatype);
|
||||
@@ -59,7 +60,7 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data
|
||||
}
|
||||
|
||||
static void write_buffer_rect(rcti *rect, MemoryBuffer** memoryBuffers, const bNodeTree *tree,
|
||||
SocketReader *reader, float* buffer, unsigned int width, DataType datatype)
|
||||
SocketReader *reader, float *buffer, unsigned int width, DataType datatype)
|
||||
{
|
||||
float color[4];
|
||||
int i, size = get_datatype_size(datatype);
|
||||
@@ -106,12 +107,14 @@ OutputSingleLayerOperation::OutputSingleLayerOperation(
|
||||
BLI_strncpy(this->path, path, sizeof(this->path));
|
||||
}
|
||||
|
||||
void OutputSingleLayerOperation::initExecution() {
|
||||
void OutputSingleLayerOperation::initExecution()
|
||||
{
|
||||
this->imageInput = getInputSocketReader(0);
|
||||
this->outputBuffer = init_buffer(this->getWidth(), this->getHeight(), this->datatype);
|
||||
}
|
||||
|
||||
void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) {
|
||||
void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
|
||||
{
|
||||
write_buffer_rect(rect, memoryBuffers, this->tree, imageInput, this->outputBuffer, this->getWidth(), this->datatype);
|
||||
}
|
||||
|
||||
@@ -120,14 +123,14 @@ void OutputSingleLayerOperation::deinitExecution()
|
||||
if (this->getWidth() * this->getHeight() != 0) {
|
||||
|
||||
int size = get_datatype_size(this->datatype);
|
||||
ImBuf *ibuf= IMB_allocImBuf(this->getWidth(), this->getHeight(), size*8, 0);
|
||||
Main *bmain= G.main; /* TODO, have this passed along */
|
||||
ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), size*8, 0);
|
||||
Main *bmain = G.main; /* TODO, have this passed along */
|
||||
char filename[FILE_MAX];
|
||||
|
||||
ibuf->channels = size;
|
||||
ibuf->rect_float= this->outputBuffer;
|
||||
ibuf->rect_float = this->outputBuffer;
|
||||
ibuf->mall |= IB_rectfloat;
|
||||
ibuf->dither= scene->r.dither_intensity;
|
||||
ibuf->dither = scene->r.dither_intensity;
|
||||
|
||||
if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
|
||||
ibuf->profile = IB_PROFILE_LINEAR_RGB;
|
||||
@@ -192,9 +195,9 @@ void OutputOpenExrMultiLayerOperation::deinitExecution()
|
||||
unsigned int width = this->getWidth();
|
||||
unsigned int height = this->getHeight();
|
||||
if (width != 0 && height != 0) {
|
||||
Main *bmain= G.main; /* TODO, have this passed along */
|
||||
Main *bmain = G.main; /* TODO, have this passed along */
|
||||
char filename[FILE_MAX];
|
||||
void *exrhandle= IMB_exr_get_handle();
|
||||
void *exrhandle = IMB_exr_get_handle();
|
||||
|
||||
BKE_makepicstring(filename, this->path, bmain->name, this->scene->r.cfra, R_IMF_IMTYPE_MULTILAYER,
|
||||
(this->scene->r.scemode & R_EXTENSION), true);
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
class OutputSingleLayerOperation : public NodeOperation {
|
||||
private:
|
||||
const Scene *scene;
|
||||
const bNodeTree* tree;
|
||||
const bNodeTree *tree;
|
||||
|
||||
ImageFormatData *format;
|
||||
char path[FILE_MAX];
|
||||
|
||||
float *outputBuffer;
|
||||
DataType datatype;
|
||||
SocketReader* imageInput;
|
||||
SocketReader *imageInput;
|
||||
|
||||
public:
|
||||
OutputSingleLayerOperation(const Scene *scene, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path);
|
||||
@@ -59,7 +59,7 @@ struct OutputOpenExrLayer {
|
||||
char name[EXR_TOT_MAXNAME-2];
|
||||
float *outputBuffer;
|
||||
DataType datatype;
|
||||
SocketReader* imageInput;
|
||||
SocketReader *imageInput;
|
||||
};
|
||||
|
||||
/* Writes inputs into OpenEXR multilayer channels. */
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
typedef std::vector<OutputOpenExrLayer> LayerList;
|
||||
|
||||
const Scene *scene;
|
||||
const bNodeTree* tree;
|
||||
const bNodeTree *tree;
|
||||
|
||||
char path[FILE_MAX];
|
||||
char exr_codec;
|
||||
|
||||
@@ -39,7 +39,8 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
PreviewOperation::PreviewOperation() : NodeOperation() {
|
||||
PreviewOperation::PreviewOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->outputBuffer = NULL;
|
||||
this->input = NULL;
|
||||
@@ -48,7 +49,8 @@ PreviewOperation::PreviewOperation() : NodeOperation() {
|
||||
this->priority = 0;
|
||||
}
|
||||
|
||||
void PreviewOperation::initExecution() {
|
||||
void PreviewOperation::initExecution()
|
||||
{
|
||||
this->input = getInputSocketReader(0);
|
||||
if (!this->node->preview) {
|
||||
this->node->preview = (bNodePreview*)MEM_callocN(sizeof(bNodePreview), "node preview");
|
||||
@@ -64,18 +66,20 @@ void PreviewOperation::initExecution() {
|
||||
if (this->node->preview->rect) {
|
||||
MEM_freeN(this->node->preview->rect);
|
||||
}
|
||||
this->node->preview->xsize= getWidth();
|
||||
this->node->preview->ysize= getHeight();
|
||||
this->node->preview->rect= outputBuffer;
|
||||
this->node->preview->xsize = getWidth();
|
||||
this->node->preview->ysize = getHeight();
|
||||
this->node->preview->rect = outputBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewOperation::deinitExecution() {
|
||||
void PreviewOperation::deinitExecution()
|
||||
{
|
||||
this->outputBuffer = NULL;
|
||||
this->input = NULL;
|
||||
}
|
||||
|
||||
void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers) {
|
||||
void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
int offset;
|
||||
float color[4];
|
||||
for (int y = rect->ymin ; y < rect->ymax ; y++) {
|
||||
@@ -96,7 +100,8 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory
|
||||
}
|
||||
}
|
||||
}
|
||||
bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
newInput.xmin = input->xmin/divider;
|
||||
@@ -106,7 +111,8 @@ bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferO
|
||||
|
||||
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
}
|
||||
void PreviewOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void PreviewOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
int width = resolution[0];
|
||||
int height = resolution[1];
|
||||
@@ -124,6 +130,7 @@ void PreviewOperation::determineResolution(unsigned int resolution[], unsigned i
|
||||
resolution[1] = height;
|
||||
}
|
||||
|
||||
const int PreviewOperation::getRenderPriority() const {
|
||||
const int PreviewOperation::getRenderPriority() const
|
||||
{
|
||||
return this->priority;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ protected:
|
||||
/**
|
||||
* @brief holds reference to the SDNA bNode, where this nodes will render the preview image for
|
||||
*/
|
||||
bNode* node;
|
||||
const bNodeTree* tree;
|
||||
SocketReader* input;
|
||||
bNode *node;
|
||||
const bNodeTree *tree;
|
||||
SocketReader *input;
|
||||
float divider;
|
||||
int priority;
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
void setbNode(bNode* node) { this->node = node;}
|
||||
void setbNodeTree(const bNodeTree* tree) { this->tree = tree;}
|
||||
void setbNode(bNode *node) { this->node = node;}
|
||||
void setbNodeTree(const bNodeTree *tree) { this->tree = tree;}
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
void setPriority(int priority) { this->priority = priority; }
|
||||
};
|
||||
|
||||
@@ -24,24 +24,28 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperation() {
|
||||
ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void ProjectorLensDistortionOperation::initExecution() {
|
||||
void ProjectorLensDistortionOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
kr = 0.25f*MAX2(MIN2(this->dispersion, 1.f), 0.f);
|
||||
kr2 = kr * 20;
|
||||
}
|
||||
|
||||
void* ProjectorLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void* buffer = inputProgram->initializeTileData(NULL, memoryBuffers);
|
||||
void *ProjectorLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
void *buffer = inputProgram->initializeTileData(NULL, memoryBuffers);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void ProjectorLensDistortionOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float inputValue[4];
|
||||
const float height = this->getHeight();
|
||||
const float width = this->getWidth();
|
||||
@@ -57,11 +61,13 @@ void ProjectorLensDistortionOperation::executePixel(float* color, int x, int y,
|
||||
color[3] = 1.0f;
|
||||
}
|
||||
|
||||
void ProjectorLensDistortionOperation::deinitExecution() {
|
||||
void ProjectorLensDistortionOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
newInput.ymax = input->ymax;
|
||||
newInput.ymin = input->ymin;
|
||||
|
||||
@@ -42,20 +42,20 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void setData(NodeLensDist* data) {this->data = data;}
|
||||
void setData(NodeLensDist *data) {this->data = data;}
|
||||
void setDispertion(float dispersion) {this->dispersion = dispersion;}
|
||||
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
@@ -22,13 +22,15 @@
|
||||
|
||||
#include "COM_QualityStepHelper.h"
|
||||
|
||||
QualityStepHelper::QualityStepHelper() {
|
||||
QualityStepHelper::QualityStepHelper()
|
||||
{
|
||||
this->quality = COM_QUALITY_HIGH;
|
||||
this->step = 1;
|
||||
this->offsetadd = 4;
|
||||
}
|
||||
|
||||
void QualityStepHelper::initExecution(QualityHelper helper) {
|
||||
void QualityStepHelper::initExecution(QualityHelper helper)
|
||||
{
|
||||
switch (helper) {
|
||||
case COM_QH_INCREASE:
|
||||
switch (this->quality) {
|
||||
|
||||
@@ -37,12 +37,12 @@ private:
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution(QualityHelper helper);
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution(QualityHelper helper);
|
||||
|
||||
inline int getStep() const {return this->step;}
|
||||
inline int getOffsetAdd() const {return this->offsetadd;}
|
||||
inline int getStep() const {return this->step;}
|
||||
inline int getOffsetAdd() const {return this->offsetadd;}
|
||||
|
||||
public:
|
||||
QualityStepHelper();
|
||||
|
||||
@@ -24,16 +24,19 @@
|
||||
#include "COM_WriteBufferOperation.h"
|
||||
#include "COM_defines.h"
|
||||
|
||||
ReadBufferOperation::ReadBufferOperation():NodeOperation() {
|
||||
ReadBufferOperation::ReadBufferOperation():NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->offset = 0;
|
||||
}
|
||||
|
||||
void* ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
return getInputMemoryBuffer(memoryBuffers);
|
||||
}
|
||||
|
||||
void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
if (this->memoryProxy != NULL) {
|
||||
WriteBufferOperation * operation = memoryProxy->getWriteBufferOperation();
|
||||
operation->determineResolution(resolution, preferredResolution);
|
||||
@@ -43,7 +46,8 @@ void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigne
|
||||
if (memoryProxy->getExecutor()) memoryProxy->getExecutor()->setResolution(resolution);
|
||||
}
|
||||
}
|
||||
void ReadBufferOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ReadBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
MemoryBuffer *inputBuffer = inputBuffers[this->offset];
|
||||
if (inputBuffer) {
|
||||
if (sampler == COM_PS_NEAREST) {
|
||||
@@ -55,14 +59,16 @@ void ReadBufferOperation::executePixel(float* color, float x, float y, PixelSamp
|
||||
}
|
||||
}
|
||||
|
||||
void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {
|
||||
void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
MemoryBuffer *inputBuffer = inputBuffers[this->offset];
|
||||
if (inputBuffer) {
|
||||
inputBuffer->readEWA(color, x, y, dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output) {
|
||||
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
if (this==readOperation) {
|
||||
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
return true;
|
||||
|
||||
@@ -33,18 +33,18 @@ private:
|
||||
public:
|
||||
ReadBufferOperation();
|
||||
int isBufferOperation() {return true;}
|
||||
void setMemoryProxy(MemoryProxy* memoryProxy) {this->memoryProxy = memoryProxy;}
|
||||
MemoryProxy* getMemoryProxy() {return this->memoryProxy;}
|
||||
void setMemoryProxy(MemoryProxy *memoryProxy) {this->memoryProxy = memoryProxy;}
|
||||
MemoryProxy *getMemoryProxy() {return this->memoryProxy;}
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]);
|
||||
const bool isReadBufferOperation() const {return true;}
|
||||
void setOffset(unsigned int offset) {this->offset = offset;}
|
||||
unsigned int getOffset() {return this->offset;}
|
||||
bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti* output);
|
||||
MemoryBuffer* getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return memoryBuffers[offset];}
|
||||
bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output);
|
||||
MemoryBuffer *getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return memoryBuffers[offset];}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_RenderLayersAOOperation.h"
|
||||
|
||||
RenderLayersAOOperation::RenderLayersAOOperation() :RenderLayersBaseProg(SCE_PASS_AO, 3) {
|
||||
RenderLayersAOOperation::RenderLayersAOOperation() :RenderLayersBaseProg(SCE_PASS_AO, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
|
||||
#include "COM_RenderLayersAlphaProg.h"
|
||||
|
||||
RenderLayersAlphaProg::RenderLayersAlphaProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4) {
|
||||
RenderLayersAlphaProg::RenderLayersAlphaProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void RenderLayersAlphaProg::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
int ix = x;
|
||||
int iy = y;
|
||||
float * inputBuffer = this->getInputBuffer();
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class RenderLayersAlphaProg : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersAlphaProg();
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ extern "C" {
|
||||
#include "RE_render_ext.h"
|
||||
}
|
||||
|
||||
RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): NodeOperation() {
|
||||
RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): NodeOperation()
|
||||
{
|
||||
this->renderpass = renderpass;
|
||||
this->setScene(NULL);
|
||||
this->inputBuffer = NULL;
|
||||
@@ -39,27 +40,28 @@ RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): Nod
|
||||
}
|
||||
|
||||
|
||||
void RenderLayersBaseProg::initExecution() {
|
||||
void RenderLayersBaseProg::initExecution()
|
||||
{
|
||||
Scene * scene = this->getScene();
|
||||
Render *re= (scene)? RE_GetRender(scene->id.name): NULL;
|
||||
RenderResult *rr= NULL;
|
||||
Render *re = (scene)? RE_GetRender(scene->id.name): NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
if (re)
|
||||
rr= RE_AcquireResultRead(re);
|
||||
rr = RE_AcquireResultRead(re);
|
||||
|
||||
if (rr) {
|
||||
SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&scene->r.layers, getLayerId());
|
||||
SceneRenderLayer *srl = (SceneRenderLayer*)BLI_findlink(&scene->r.layers, getLayerId());
|
||||
if (srl) {
|
||||
|
||||
RenderLayer *rl= RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
this->inputBuffer = RE_RenderLayerGetPass(rl, renderpass);
|
||||
|
||||
if (this->inputBuffer == NULL || renderpass == SCE_PASS_COMBINED) {
|
||||
this->inputBuffer = rl->rectf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
this->inputBuffer = RE_RenderLayerGetPass(rl, renderpass);
|
||||
|
||||
if (this->inputBuffer == NULL || renderpass == SCE_PASS_COMBINED) {
|
||||
this->inputBuffer = rl->rectf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (re) {
|
||||
RE_ReleaseResult(re);
|
||||
@@ -67,7 +69,8 @@ void RenderLayersBaseProg::initExecution() {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
int ix = x;
|
||||
int iy = y;
|
||||
|
||||
@@ -100,34 +103,36 @@ void RenderLayersBaseProg::executePixel(float* output, float x, float y, PixelSa
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::deinitExecution() {
|
||||
void RenderLayersBaseProg::deinitExecution()
|
||||
{
|
||||
this->inputBuffer = NULL;
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
Scene *sce= this->getScene();
|
||||
Render *re= (sce)? RE_GetRender(sce->id.name): NULL;
|
||||
RenderResult *rr= NULL;
|
||||
void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
Scene *sce = this->getScene();
|
||||
Render *re = (sce) ? RE_GetRender(sce->id.name) : NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
|
||||
if (re)
|
||||
rr= RE_AcquireResultRead(re);
|
||||
rr = RE_AcquireResultRead(re);
|
||||
|
||||
if (rr) {
|
||||
SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&sce->r.layers, getLayerId());
|
||||
SceneRenderLayer *srl = (SceneRenderLayer*)BLI_findlink(&sce->r.layers, getLayerId());
|
||||
if (srl) {
|
||||
RenderLayer *rl= RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
resolution[0]=rl->rectx;
|
||||
resolution[1]=rl->recty;
|
||||
}
|
||||
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
resolution[0]=rl->rectx;
|
||||
resolution[1]=rl->recty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (re)
|
||||
RE_ReleaseResult(re);
|
||||
RE_ReleaseResult(re);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
/**
|
||||
* Reference to the scene object.
|
||||
*/
|
||||
Scene* scene;
|
||||
Scene *scene;
|
||||
|
||||
/**
|
||||
* layerId of the layer where this operation needs to get its data from
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
/**
|
||||
* cached instance to the float buffer inside the layer
|
||||
*/
|
||||
float* inputBuffer;
|
||||
float *inputBuffer;
|
||||
|
||||
/**
|
||||
* renderpass where this operation needs to get its data from
|
||||
@@ -78,7 +78,7 @@ protected:
|
||||
/**
|
||||
* retrieve the reference to the float buffer of the renderer.
|
||||
*/
|
||||
inline float* getInputBuffer() {return this->inputBuffer;}
|
||||
inline float *getInputBuffer() {return this->inputBuffer;}
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -86,13 +86,13 @@ public:
|
||||
* @see RenderLayerNode to set the actual scene where
|
||||
* the data will be retrieved from.
|
||||
*/
|
||||
void setScene(Scene* scene) {this->scene = scene;}
|
||||
Scene* getScene() {return this->scene;}
|
||||
void setScene(Scene *scene) {this->scene = scene;}
|
||||
Scene *getScene() {return this->scene;}
|
||||
void setLayerId(short layerId) {this->layerId = layerId;}
|
||||
short getLayerId() {return this->layerId;}
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersColorOperation.h"
|
||||
|
||||
RenderLayersColorOperation::RenderLayersColorOperation() :RenderLayersBaseProg(SCE_PASS_RGBA, 4) {
|
||||
RenderLayersColorOperation::RenderLayersColorOperation() :RenderLayersBaseProg(SCE_PASS_RGBA, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersCyclesOperation.h"
|
||||
|
||||
RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) :RenderLayersBaseProg(pass, 3) {
|
||||
RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) :RenderLayersBaseProg(pass, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_RenderLayersDepthProg.h"
|
||||
|
||||
RenderLayersDepthProg::RenderLayersDepthProg() :RenderLayersBaseProg(SCE_PASS_Z, 1) {
|
||||
RenderLayersDepthProg::RenderLayersDepthProg() :RenderLayersBaseProg(SCE_PASS_Z, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersDiffuseOperation.h"
|
||||
|
||||
RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() :RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3) {
|
||||
RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() :RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersEmitOperation.h"
|
||||
|
||||
RenderLayersEmitOperation::RenderLayersEmitOperation() :RenderLayersBaseProg(SCE_PASS_EMIT, 3) {
|
||||
RenderLayersEmitOperation::RenderLayersEmitOperation() :RenderLayersBaseProg(SCE_PASS_EMIT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersEnvironmentOperation.h"
|
||||
|
||||
RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() :RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3) {
|
||||
RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() :RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersImageProg.h"
|
||||
|
||||
RenderLayersColourProg::RenderLayersColourProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4) {
|
||||
RenderLayersColourProg::RenderLayersColourProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersIndirectOperation.h"
|
||||
|
||||
RenderLayersIndirectOperation::RenderLayersIndirectOperation() :RenderLayersBaseProg(SCE_PASS_INDIRECT, 3) {
|
||||
RenderLayersIndirectOperation::RenderLayersIndirectOperation() :RenderLayersBaseProg(SCE_PASS_INDIRECT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersMaterialIndexOperation.h"
|
||||
|
||||
RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXMA, 1) {
|
||||
RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXMA, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersMistOperation.h"
|
||||
|
||||
RenderLayersMistOperation::RenderLayersMistOperation() :RenderLayersBaseProg(SCE_PASS_MIST, 1) {
|
||||
RenderLayersMistOperation::RenderLayersMistOperation() :RenderLayersBaseProg(SCE_PASS_MIST, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersNormalOperation.h"
|
||||
|
||||
RenderLayersNormalOperation::RenderLayersNormalOperation() :RenderLayersBaseProg(SCE_PASS_NORMAL, 3) {
|
||||
RenderLayersNormalOperation::RenderLayersNormalOperation() :RenderLayersBaseProg(SCE_PASS_NORMAL, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersObjectIndexOperation.h"
|
||||
|
||||
RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXOB, 1) {
|
||||
RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXOB, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersReflectionOperation.h"
|
||||
|
||||
RenderLayersReflectionOperation::RenderLayersReflectionOperation() :RenderLayersBaseProg(SCE_PASS_REFLECT, 3) {
|
||||
RenderLayersReflectionOperation::RenderLayersReflectionOperation() :RenderLayersBaseProg(SCE_PASS_REFLECT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersRefractionOperation.h"
|
||||
|
||||
RenderLayersRefractionOperation::RenderLayersRefractionOperation() :RenderLayersBaseProg(SCE_PASS_REFRACT, 3) {
|
||||
RenderLayersRefractionOperation::RenderLayersRefractionOperation() :RenderLayersBaseProg(SCE_PASS_REFRACT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersShadowOperation.h"
|
||||
|
||||
RenderLayersShadowOperation::RenderLayersShadowOperation() :RenderLayersBaseProg(SCE_PASS_SHADOW, 3) {
|
||||
RenderLayersShadowOperation::RenderLayersShadowOperation() :RenderLayersBaseProg(SCE_PASS_SHADOW, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersSpecularOperation.h"
|
||||
|
||||
RenderLayersSpecularOperation::RenderLayersSpecularOperation() :RenderLayersBaseProg(SCE_PASS_SPEC, 3) {
|
||||
RenderLayersSpecularOperation::RenderLayersSpecularOperation() :RenderLayersBaseProg(SCE_PASS_SPEC, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersSpeedOperation.h"
|
||||
|
||||
RenderLayersSpeedOperation::RenderLayersSpeedOperation() :RenderLayersBaseProg(SCE_PASS_VECTOR, 4) {
|
||||
RenderLayersSpeedOperation::RenderLayersSpeedOperation() :RenderLayersBaseProg(SCE_PASS_VECTOR, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersUVOperation.h"
|
||||
|
||||
RenderLayersUVOperation::RenderLayersUVOperation() :RenderLayersBaseProg(SCE_PASS_UV, 3) {
|
||||
RenderLayersUVOperation::RenderLayersUVOperation() :RenderLayersBaseProg(SCE_PASS_UV, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "COM_RotateOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
RotateOperation::RotateOperation() : NodeOperation() {
|
||||
RotateOperation::RotateOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -32,7 +33,8 @@ RotateOperation::RotateOperation() : NodeOperation() {
|
||||
this->degreeSocket = NULL;
|
||||
this->doDegree2RadConversion = false;
|
||||
}
|
||||
void RotateOperation::initExecution() {
|
||||
void RotateOperation::initExecution()
|
||||
{
|
||||
this->imageSocket = this->getInputSocketReader(0);
|
||||
this->degreeSocket = this->getInputSocketReader(1);
|
||||
this->centerX = this->getWidth()/2.0;
|
||||
@@ -50,13 +52,15 @@ void RotateOperation::initExecution() {
|
||||
this->sine = sin(rad);
|
||||
}
|
||||
|
||||
void RotateOperation::deinitExecution() {
|
||||
void RotateOperation::deinitExecution()
|
||||
{
|
||||
this->imageSocket = NULL;
|
||||
this->degreeSocket = NULL;
|
||||
}
|
||||
|
||||
|
||||
void RotateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void RotateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
const float dy = y - this->centerY;
|
||||
const float dx = x - this->centerX;
|
||||
const float nx = this->centerX+(this->cosine*dx + this->sine*dy);
|
||||
@@ -64,7 +68,8 @@ void RotateOperation::executePixel(float *color,float x, float y, PixelSampler s
|
||||
this->imageSocket->read(color, nx, ny, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
const float dxmin = input->xmin - this->centerX;
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_ScaleOperation.h"
|
||||
|
||||
ScaleOperation::ScaleOperation() : NodeOperation() {
|
||||
ScaleOperation::ScaleOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
@@ -32,7 +33,8 @@ ScaleOperation::ScaleOperation() : NodeOperation() {
|
||||
this->inputXOperation = NULL;
|
||||
this->inputYOperation = NULL;
|
||||
}
|
||||
void ScaleOperation::initExecution() {
|
||||
void ScaleOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
this->inputXOperation = this->getInputSocketReader(1);
|
||||
this->inputYOperation = this->getInputSocketReader(2);
|
||||
@@ -40,14 +42,16 @@ void ScaleOperation::initExecution() {
|
||||
this->centerY = this->getHeight()/2.0;
|
||||
}
|
||||
|
||||
void ScaleOperation::deinitExecution() {
|
||||
void ScaleOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
this->inputXOperation = NULL;
|
||||
this->inputYOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float scaleX[4];
|
||||
float scaleY[4];
|
||||
|
||||
@@ -62,7 +66,8 @@ void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sa
|
||||
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
float scaleX[4];
|
||||
float scaleY[4];
|
||||
@@ -83,17 +88,19 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe
|
||||
|
||||
|
||||
// SCALE ABSOLUTE
|
||||
ScaleAbsoluteOperation::ScaleAbsoluteOperation() : NodeOperation() {
|
||||
ScaleAbsoluteOperation::ScaleAbsoluteOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->inputOperation = NULL;
|
||||
this->inputXOperation= NULL;
|
||||
this->inputXOperation = NULL;
|
||||
this->inputYOperation = NULL;
|
||||
}
|
||||
void ScaleAbsoluteOperation::initExecution() {
|
||||
void ScaleAbsoluteOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
this->inputXOperation = this->getInputSocketReader(1);
|
||||
this->inputYOperation = this->getInputSocketReader(2);
|
||||
@@ -101,14 +108,16 @@ void ScaleAbsoluteOperation::initExecution() {
|
||||
this->centerY = this->getHeight()/2.0;
|
||||
}
|
||||
|
||||
void ScaleAbsoluteOperation::deinitExecution() {
|
||||
void ScaleAbsoluteOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
this->inputXOperation = NULL;
|
||||
this->inputYOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float scaleX[4];
|
||||
float scaleY[4];
|
||||
|
||||
@@ -128,7 +137,8 @@ void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSa
|
||||
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
float scaleX[4];
|
||||
float scaleY[4];
|
||||
@@ -154,28 +164,33 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB
|
||||
|
||||
|
||||
// Absolute fixed siez
|
||||
ScaleFixedSizeOperation::ScaleFixedSizeOperation() : NodeOperation() {
|
||||
ScaleFixedSizeOperation::ScaleFixedSizeOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
void ScaleFixedSizeOperation::initExecution() {
|
||||
void ScaleFixedSizeOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
this->relX = inputOperation->getWidth() / (float)this->newWidth;
|
||||
this->relY = inputOperation->getHeight() / (float)this->newHeight;
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::deinitExecution() {
|
||||
void ScaleFixedSizeOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
void ScaleFixedSizeOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ScaleFixedSizeOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
this->inputOperation->read(color, x*relX, y*relY, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
newInput.xmax = input->xmax *relX;
|
||||
@@ -186,7 +201,8 @@ bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, Read
|
||||
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
unsigned int nr[2];
|
||||
nr[0] = newWidth;
|
||||
nr[1] = newHeight;
|
||||
|
||||
@@ -27,13 +27,15 @@ extern "C" {
|
||||
#include "BLI_rand.h"
|
||||
}
|
||||
|
||||
ScreenLensDistortionOperation::ScreenLensDistortionOperation(): NodeOperation() {
|
||||
ScreenLensDistortionOperation::ScreenLensDistortionOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void ScreenLensDistortionOperation::initExecution() {
|
||||
void ScreenLensDistortionOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
kg = MAX2(MIN2(this->distortion, 1.f), -0.999f);
|
||||
// smaller dispersion range for somewhat more control
|
||||
@@ -53,15 +55,17 @@ void ScreenLensDistortionOperation::initExecution() {
|
||||
|
||||
}
|
||||
|
||||
void* ScreenLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void* buffer = inputProgram->initializeTileData(NULL, memoryBuffers);
|
||||
void *ScreenLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
void *buffer = inputProgram->initializeTileData(NULL, memoryBuffers);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void ScreenLensDistortionOperation::executePixel(float* outputColor, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
const float height = this->getHeight();
|
||||
const float width = this->getWidth();
|
||||
MemoryBuffer* buffer = (MemoryBuffer*)data;
|
||||
MemoryBuffer *buffer = (MemoryBuffer*)data;
|
||||
|
||||
int dr = 0, dg = 0, db = 0;
|
||||
float d, t, ln[6] = {0, 0, 0, 0, 0, 0};
|
||||
@@ -132,21 +136,23 @@ void ScreenLensDistortionOperation::executePixel(float* outputColor, int x, int
|
||||
if (db) outputColor[2] = 2.f*tc[2] / (float)db;
|
||||
|
||||
/* set alpha */
|
||||
outputColor[3]= 1.0f;
|
||||
outputColor[3] = 1.0f;
|
||||
}
|
||||
else {
|
||||
outputColor[0]= 0.0f;
|
||||
outputColor[1]= 0.0f;
|
||||
outputColor[2]= 0.0f;
|
||||
outputColor[3]= 0.0f;
|
||||
outputColor[0] = 0.0f;
|
||||
outputColor[1] = 0.0f;
|
||||
outputColor[2] = 0.0f;
|
||||
outputColor[3] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenLensDistortionOperation::deinitExecution() {
|
||||
void ScreenLensDistortionOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
void ScreenLensDistortionOperation::determineUV(float result[2], float x, float y) const {
|
||||
void ScreenLensDistortionOperation::determineUV(float result[2], float x, float y) const
|
||||
{
|
||||
const float v = sc*((y + 0.5f) - cy)/cy;
|
||||
const float u = sc*((x + 0.5f) - cx)/cx;
|
||||
const float t = ABS(MIN3(kr, kg, kb)*4);
|
||||
@@ -155,7 +161,8 @@ void ScreenLensDistortionOperation::determineUV(float result[2], float x, float
|
||||
result[1] = (v*d + 0.5f)*getHeight() - 0.5f;
|
||||
}
|
||||
|
||||
bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
newInput.xmin = 0;
|
||||
newInput.ymin = 0;
|
||||
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
SocketReader* inputProgram;
|
||||
SocketReader *inputProgram;
|
||||
|
||||
NodeLensDist * data;
|
||||
|
||||
@@ -48,27 +48,27 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void setData(NodeLensDist* data) {this->data = data;}
|
||||
void setData(NodeLensDist *data) {this->data = data;}
|
||||
void setDispertion(float dispersion) {this->dispersion = dispersion;}
|
||||
void setDistortion(float distortion) {this->distortion = distortion;}
|
||||
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
private:
|
||||
void determineUV(float* result, float x, float y) const;
|
||||
void determineUV(float *result, float x, float y) const;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -22,21 +22,25 @@
|
||||
|
||||
#include "COM_SeparateChannelOperation.h"
|
||||
|
||||
SeparateChannelOperation::SeparateChannelOperation() : NodeOperation() {
|
||||
SeparateChannelOperation::SeparateChannelOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
void SeparateChannelOperation::initExecution() {
|
||||
void SeparateChannelOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void SeparateChannelOperation::deinitExecution() {
|
||||
void SeparateChannelOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
void SeparateChannelOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void SeparateChannelOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float input[4];
|
||||
this->inputOperation->read(input, x, y, sampler, inputBuffers);
|
||||
color[0] = input[this->channel];
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_SetAlphaOperation.h"
|
||||
|
||||
SetAlphaOperation::SetAlphaOperation(): NodeOperation() {
|
||||
SetAlphaOperation::SetAlphaOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
@@ -31,12 +32,14 @@ SetAlphaOperation::SetAlphaOperation(): NodeOperation() {
|
||||
this->inputAlpha = NULL;
|
||||
}
|
||||
|
||||
void SetAlphaOperation::initExecution() {
|
||||
void SetAlphaOperation::initExecution()
|
||||
{
|
||||
this->inputColor = getInputSocketReader(0);
|
||||
this->inputAlpha = getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void SetAlphaOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void SetAlphaOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float alphaInput[4];
|
||||
|
||||
this->inputColor->read(outputValue, x, y, sampler, inputBuffers);
|
||||
@@ -45,7 +48,8 @@ void SetAlphaOperation::executePixel(float* outputValue, float x, float y, Pixel
|
||||
outputValue[3] = alphaInput[0];
|
||||
}
|
||||
|
||||
void SetAlphaOperation::deinitExecution() {
|
||||
void SetAlphaOperation::deinitExecution()
|
||||
{
|
||||
this->inputColor = NULL;
|
||||
this->inputAlpha = NULL;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
@@ -22,18 +22,21 @@
|
||||
|
||||
#include "COM_SetColorOperation.h"
|
||||
|
||||
SetColorOperation::SetColorOperation(): NodeOperation() {
|
||||
SetColorOperation::SetColorOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void SetColorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void SetColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
outputValue[0] = this->channel1;
|
||||
outputValue[1] = this->channel2;
|
||||
outputValue[2] = this->channel3;
|
||||
outputValue[3] = this->channel4;
|
||||
}
|
||||
|
||||
void SetColorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void SetColorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
const bool isSetOperation() const {return true;}
|
||||
|
||||
@@ -22,18 +22,22 @@
|
||||
|
||||
#include "COM_SetSamplerOperation.h"
|
||||
|
||||
SetSamplerOperation::SetSamplerOperation(): NodeOperation() {
|
||||
SetSamplerOperation::SetSamplerOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
void SetSamplerOperation::initExecution() {
|
||||
void SetSamplerOperation::initExecution()
|
||||
{
|
||||
this->reader = this->getInputSocketReader(0);
|
||||
}
|
||||
void SetSamplerOperation::deinitExecution() {
|
||||
void SetSamplerOperation::deinitExecution()
|
||||
{
|
||||
this->reader = NULL;
|
||||
}
|
||||
|
||||
void SetSamplerOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void SetSamplerOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
reader->read(output, x, y, this->sampler, inputBuffers);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
};
|
||||
|
||||
@@ -22,15 +22,18 @@
|
||||
|
||||
#include "COM_SetValueOperation.h"
|
||||
|
||||
SetValueOperation::SetValueOperation(): NodeOperation() {
|
||||
SetValueOperation::SetValueOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void SetValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void SetValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
outputValue[0] = this->value;
|
||||
}
|
||||
|
||||
void SetValueOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void SetValueOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
|
||||
const bool isSetOperation() const {return true;}
|
||||
|
||||
@@ -23,18 +23,21 @@
|
||||
#include "COM_SetVectorOperation.h"
|
||||
#include "COM_defines.h"
|
||||
|
||||
SetVectorOperation::SetVectorOperation(): NodeOperation() {
|
||||
SetVectorOperation::SetVectorOperation(): NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
||||
|
||||
void SetVectorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void SetVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
outputValue[0] = this->x;
|
||||
outputValue[1] = this->y;
|
||||
outputValue[2] = this->z;
|
||||
outputValue[3] = this->w;
|
||||
}
|
||||
|
||||
void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
if (preferredResolution[0] == 0 ||preferredResolution[1]==0) {
|
||||
resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH;
|
||||
resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT;
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
const bool isSetOperation() const {return true;}
|
||||
|
||||
@@ -22,20 +22,24 @@
|
||||
|
||||
#include "COM_SocketProxyOperation.h"
|
||||
|
||||
SocketProxyOperation::SocketProxyOperation() : NodeOperation() {
|
||||
SocketProxyOperation::SocketProxyOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR/*|COM_DT_VECTOR|COM_DT_VALUE*/);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void SocketProxyOperation::initExecution() {
|
||||
void SocketProxyOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void SocketProxyOperation::deinitExecution() {
|
||||
void SocketProxyOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
}
|
||||
|
||||
void SocketProxyOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void SocketProxyOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
this->inputOperation->read(color, x, y, sampler, inputBuffers);
|
||||
}
|
||||
|
||||
@@ -36,30 +36,34 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
SplitViewerOperation::SplitViewerOperation() : ViewerBaseOperation() {
|
||||
SplitViewerOperation::SplitViewerOperation() : ViewerBaseOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->image1Input = NULL;
|
||||
this->image2Input = NULL;
|
||||
}
|
||||
|
||||
void SplitViewerOperation::initExecution() {
|
||||
void SplitViewerOperation::initExecution()
|
||||
{
|
||||
// When initializing the tree during initial load the width and height can be zero.
|
||||
this->image1Input = getInputSocketReader(0);
|
||||
this->image2Input = getInputSocketReader(1);
|
||||
ViewerBaseOperation::initExecution();
|
||||
}
|
||||
|
||||
void SplitViewerOperation::deinitExecution() {
|
||||
void SplitViewerOperation::deinitExecution()
|
||||
{
|
||||
this->image1Input = NULL;
|
||||
this->image2Input = NULL;
|
||||
ViewerBaseOperation::deinitExecution();
|
||||
}
|
||||
|
||||
|
||||
void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) {
|
||||
float* buffer = this->outputBuffer;
|
||||
unsigned char* bufferDisplay = this->outputBufferDisplay;
|
||||
void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
|
||||
{
|
||||
float *buffer = this->outputBuffer;
|
||||
unsigned char *bufferDisplay = this->outputBufferDisplay;
|
||||
|
||||
if (!buffer) return;
|
||||
int x1 = rect->xmin;
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
class SplitViewerOperation : public ViewerBaseOperation {
|
||||
private:
|
||||
SocketReader* image1Input;
|
||||
SocketReader* image2Input;
|
||||
SocketReader *image1Input;
|
||||
SocketReader *image2Input;
|
||||
|
||||
float splitPercentage;
|
||||
bool xSplit;
|
||||
|
||||
@@ -25,30 +25,36 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
TextureBaseOperation::TextureBaseOperation(): NodeOperation() {
|
||||
TextureBaseOperation::TextureBaseOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VECTOR);//offset
|
||||
this->addInputSocket(COM_DT_VECTOR);//size
|
||||
this->texture = NULL;
|
||||
this->inputSize = NULL;
|
||||
this->inputOffset = NULL;
|
||||
}
|
||||
TextureOperation::TextureOperation() : TextureBaseOperation() {
|
||||
TextureOperation::TextureOperation() : TextureBaseOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
TextureAlphaOperation::TextureAlphaOperation() : TextureBaseOperation() {
|
||||
TextureAlphaOperation::TextureAlphaOperation() : TextureBaseOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void TextureBaseOperation::initExecution() {
|
||||
void TextureBaseOperation::initExecution()
|
||||
{
|
||||
this->inputOffset = getInputSocketReader(0);
|
||||
this->inputSize = getInputSocketReader(1);
|
||||
}
|
||||
void TextureBaseOperation::deinitExecution() {
|
||||
void TextureBaseOperation::deinitExecution()
|
||||
{
|
||||
this->inputSize = NULL;
|
||||
this->inputOffset = NULL;
|
||||
}
|
||||
|
||||
void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
if (preferredResolution[0] == 0 || preferredResolution[1] == 0) {
|
||||
resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH;
|
||||
resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT;
|
||||
@@ -59,7 +65,8 @@ void TextureBaseOperation::determineResolution(unsigned int resolution[], unsign
|
||||
}
|
||||
}
|
||||
|
||||
void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
TextureBaseOperation::executePixel(color, x, y, sampler, inputBuffers);
|
||||
color[0] = color[3];
|
||||
color[1] = 0.0f;
|
||||
@@ -67,7 +74,8 @@ void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSa
|
||||
color[3] = 0.0f;
|
||||
}
|
||||
|
||||
void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||
float textureSize[4];
|
||||
float textureOffset[4];
|
||||
@@ -81,21 +89,21 @@ void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSam
|
||||
this->inputSize->read(textureSize, x, y, sampler, inputBuffers);
|
||||
this->inputOffset->read(textureOffset, x, y, sampler, inputBuffers);
|
||||
|
||||
vec[0]= textureSize[0]*(u + textureOffset[0]);
|
||||
vec[1]= textureSize[1]*(v + textureOffset[1]);
|
||||
vec[2]= textureSize[2]*textureOffset[2];
|
||||
vec[0] = textureSize[0]*(u + textureOffset[0]);
|
||||
vec[1] = textureSize[1]*(v + textureOffset[1]);
|
||||
vec[2] = textureSize[2]*textureOffset[2];
|
||||
|
||||
retval= multitex_ext(this->texture, vec, NULL, NULL, 0, &texres);
|
||||
retval = multitex_ext(this->texture, vec, NULL, NULL, 0, &texres);
|
||||
|
||||
if (texres.talpha)
|
||||
color[3]= texres.ta;
|
||||
color[3] = texres.ta;
|
||||
else
|
||||
color[3]= texres.tin;
|
||||
color[3] = texres.tin;
|
||||
|
||||
if ((retval & TEX_RGB)) {
|
||||
color[0]= texres.tr;
|
||||
color[1]= texres.tg;
|
||||
color[2]= texres.tb;
|
||||
color[0] = texres.tr;
|
||||
color[1] = texres.tg;
|
||||
color[2] = texres.tb;
|
||||
}
|
||||
else color[0]= color[1]= color[2]= color[3];
|
||||
else color[0] = color[1] = color[2] = color[3];
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ extern "C" {
|
||||
*/
|
||||
class TextureBaseOperation : public NodeOperation {
|
||||
private:
|
||||
Tex* texture;
|
||||
Tex *texture;
|
||||
SocketReader *inputSize;
|
||||
SocketReader *inputOffset;
|
||||
|
||||
@@ -61,7 +61,7 @@ protected:
|
||||
public:
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
void setTexture(Tex* texture) {this->texture = texture;}
|
||||
void setTexture(Tex *texture) {this->texture = texture;}
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
};
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
|
||||
|
||||
|
||||
TonemapOperation::TonemapOperation(): NodeOperation() {
|
||||
TonemapOperation::TonemapOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->imageReader = NULL;
|
||||
@@ -34,12 +35,14 @@ TonemapOperation::TonemapOperation(): NodeOperation() {
|
||||
this->cachedInstance = NULL;
|
||||
this->setComplex(true);
|
||||
}
|
||||
void TonemapOperation::initExecution() {
|
||||
void TonemapOperation::initExecution()
|
||||
{
|
||||
this->imageReader = this->getInputSocketReader(0);
|
||||
NodeOperation::initMutex();
|
||||
}
|
||||
|
||||
void TonemapOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) {
|
||||
void TonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data)
|
||||
{
|
||||
AvgLogLum * avg = (AvgLogLum*)data;
|
||||
|
||||
float output[4];
|
||||
@@ -65,7 +68,8 @@ void TonemapOperation::executePixel(float* color, int x, int y, MemoryBuffer *in
|
||||
color[2] = output[2];
|
||||
color[3] = output[3];
|
||||
}
|
||||
void PhotoreceptorTonemapOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) {
|
||||
void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data)
|
||||
{
|
||||
AvgLogLum * avg = (AvgLogLum*)data;
|
||||
NodeTonemap *ntm = this->data;
|
||||
|
||||
@@ -96,7 +100,8 @@ void PhotoreceptorTonemapOperation::executePixel(float* color, int x, int y, Mem
|
||||
color[3] = output[3];
|
||||
}
|
||||
|
||||
void TonemapOperation::deinitExecution() {
|
||||
void TonemapOperation::deinitExecution()
|
||||
{
|
||||
this->imageReader = NULL;
|
||||
if (this->cachedInstance) {
|
||||
delete cachedInstance;
|
||||
@@ -104,10 +109,11 @@ void TonemapOperation::deinitExecution() {
|
||||
NodeOperation::deinitMutex();
|
||||
}
|
||||
|
||||
bool TonemapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool TonemapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti imageInput;
|
||||
|
||||
NodeOperation* operation = getInputOperation(0);
|
||||
NodeOperation *operation = getInputOperation(0);
|
||||
imageInput.xmax = operation->getWidth();
|
||||
imageInput.xmin = 0;
|
||||
imageInput.ymax = operation->getHeight();
|
||||
@@ -118,17 +124,18 @@ bool TonemapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferO
|
||||
return false;
|
||||
}
|
||||
|
||||
void* TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
BLI_mutex_lock(getMutex());
|
||||
if (this->cachedInstance == NULL) {
|
||||
MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers);
|
||||
AvgLogLum *data = new AvgLogLum();
|
||||
|
||||
float * buffer = tile->getBuffer();
|
||||
|
||||
float lsum = 0;
|
||||
int p = tile->getWidth() * tile->getHeight();
|
||||
float* bc = buffer;
|
||||
float *bc = buffer;
|
||||
float avl, maxl = -1e10f, minl = 1e10f;
|
||||
const float sc = 1.f/(p);
|
||||
float Lav = 0.f;
|
||||
@@ -159,5 +166,6 @@ void* TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff
|
||||
return this->cachedInstance;
|
||||
}
|
||||
|
||||
void TonemapOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) {
|
||||
void TonemapOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
|
||||
|
||||
/**
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void setData(NodeTonemap* data) {this->data = data;}
|
||||
void setData(NodeTonemap *data) {this->data = data;}
|
||||
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_TranslateOperation.h"
|
||||
|
||||
TranslateOperation::TranslateOperation() : NodeOperation() {
|
||||
TranslateOperation::TranslateOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
@@ -32,7 +33,8 @@ TranslateOperation::TranslateOperation() : NodeOperation() {
|
||||
this->inputXOperation = NULL;
|
||||
this->inputYOperation = NULL;
|
||||
}
|
||||
void TranslateOperation::initExecution() {
|
||||
void TranslateOperation::initExecution()
|
||||
{
|
||||
this->inputOperation = this->getInputSocketReader(0);
|
||||
this->inputXOperation = this->getInputSocketReader(1);
|
||||
this->inputYOperation = this->getInputSocketReader(2);
|
||||
@@ -44,18 +46,21 @@ void TranslateOperation::initExecution() {
|
||||
this->deltaY = tempDelta[0];
|
||||
}
|
||||
|
||||
void TranslateOperation::deinitExecution() {
|
||||
void TranslateOperation::deinitExecution()
|
||||
{
|
||||
this->inputOperation = NULL;
|
||||
this->inputXOperation = NULL;
|
||||
this->inputYOperation = NULL;
|
||||
}
|
||||
|
||||
|
||||
void TranslateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void TranslateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
this->inputOperation->read(color, x-this->getDeltaX(), y-this->getDeltaY(), sampler, inputBuffers);
|
||||
}
|
||||
|
||||
bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
|
||||
newInput.xmax = input->xmax - this->getDeltaX();
|
||||
|
||||
@@ -27,7 +27,8 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation() {
|
||||
VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); // do not resize the bokeh image.
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
@@ -42,14 +43,16 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation
|
||||
}
|
||||
|
||||
|
||||
void VariableSizeBokehBlurOperation::initExecution() {
|
||||
void VariableSizeBokehBlurOperation::initExecution()
|
||||
{
|
||||
this->inputProgram = getInputSocketReader(0);
|
||||
this->inputBokehProgram = getInputSocketReader(1);
|
||||
this->inputSizeProgram = getInputSocketReader(2);
|
||||
QualityStepHelper::initExecution(COM_QH_INCREASE);
|
||||
}
|
||||
|
||||
void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float tempColor[4];
|
||||
float readColor[4];
|
||||
float bokeh[4];
|
||||
@@ -87,8 +90,8 @@ void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, Me
|
||||
/* pass */
|
||||
}
|
||||
else if (size>= fabs(dx) && size >= fabs(dy)) {
|
||||
float u = 256+ dx*256/size;
|
||||
float v = 256+ dy*256/size;
|
||||
float u = 256 + dx*256/size;
|
||||
float v = 256 + dy*256/size;
|
||||
inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
|
||||
inputProgram->read(readColor, nx, ny, COM_PS_NEAREST, inputBuffers);
|
||||
tempColor[0] += bokeh[0] * readColor[0];
|
||||
@@ -109,13 +112,15 @@ void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, Me
|
||||
|
||||
}
|
||||
|
||||
void VariableSizeBokehBlurOperation::deinitExecution() {
|
||||
void VariableSizeBokehBlurOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
this->inputBokehProgram = NULL;
|
||||
this->inputSizeProgram = NULL;
|
||||
}
|
||||
|
||||
bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
rcti bokehInput;
|
||||
|
||||
@@ -128,7 +133,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu
|
||||
bokehInput.ymax = 512;
|
||||
bokehInput.ymin = 0;
|
||||
|
||||
NodeOperation* operation = getInputOperation(2);
|
||||
NodeOperation *operation = getInputOperation(2);
|
||||
if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepH
|
||||
private:
|
||||
int maxBlur;
|
||||
float threshold;
|
||||
SocketReader* inputProgram;
|
||||
SocketReader* inputBokehProgram;
|
||||
SocketReader* inputSizeProgram;
|
||||
SocketReader *inputProgram;
|
||||
SocketReader *inputBokehProgram;
|
||||
SocketReader *inputSizeProgram;
|
||||
|
||||
public:
|
||||
VariableSizeBokehBlurOperation();
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -28,7 +28,8 @@ extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
|
||||
VectorBlurOperation::VectorBlurOperation(): NodeOperation() {
|
||||
VectorBlurOperation::VectorBlurOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE); // ZBUF
|
||||
this->addInputSocket(COM_DT_COLOR); //SPEED
|
||||
@@ -40,7 +41,8 @@ VectorBlurOperation::VectorBlurOperation(): NodeOperation() {
|
||||
this->inputZProgram = NULL;
|
||||
setComplex(true);
|
||||
}
|
||||
void VectorBlurOperation::initExecution() {
|
||||
void VectorBlurOperation::initExecution()
|
||||
{
|
||||
initMutex();
|
||||
this->inputImageProgram = getInputSocketReader(0);
|
||||
this->inputZProgram = getInputSocketReader(1);
|
||||
@@ -50,8 +52,9 @@ void VectorBlurOperation::initExecution() {
|
||||
|
||||
}
|
||||
|
||||
void VectorBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) {
|
||||
float* buffer = (float*) data;
|
||||
void VectorBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
float *buffer = (float*) data;
|
||||
int index = (y*this->getWidth() + x) * COM_NUMBER_OF_CHANNELS;
|
||||
color[0] = buffer[index];
|
||||
color[1] = buffer[index+1];
|
||||
@@ -59,7 +62,8 @@ void VectorBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer
|
||||
color[3] = buffer[index+3];
|
||||
}
|
||||
|
||||
void VectorBlurOperation::deinitExecution() {
|
||||
void VectorBlurOperation::deinitExecution()
|
||||
{
|
||||
deinitMutex();
|
||||
this->inputImageProgram = NULL;
|
||||
this->inputSpeedProgram = NULL;
|
||||
@@ -69,15 +73,16 @@ void VectorBlurOperation::deinitExecution() {
|
||||
this->cachedInstance = NULL;
|
||||
}
|
||||
}
|
||||
void* VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
|
||||
void *VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
if (this->cachedInstance) return this->cachedInstance;
|
||||
|
||||
BLI_mutex_lock(getMutex());
|
||||
if (this->cachedInstance == NULL) {
|
||||
MemoryBuffer* tile = (MemoryBuffer*)inputImageProgram->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer* speed= (MemoryBuffer*)inputSpeedProgram->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer* z = (MemoryBuffer*)inputZProgram->initializeTileData(rect, memoryBuffers);
|
||||
float* data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS];
|
||||
MemoryBuffer *tile = (MemoryBuffer*)inputImageProgram->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *speed = (MemoryBuffer*)inputSpeedProgram->initializeTileData(rect, memoryBuffers);
|
||||
MemoryBuffer *z = (MemoryBuffer*)inputZProgram->initializeTileData(rect, memoryBuffers);
|
||||
float *data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS];
|
||||
memcpy(data, tile->getBuffer(),this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float));
|
||||
this->generateVectorBlur(data, tile, speed, z);
|
||||
this->cachedInstance = data;
|
||||
@@ -86,7 +91,8 @@ void* VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB
|
||||
return this->cachedInstance;
|
||||
}
|
||||
|
||||
bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
|
||||
bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
if (this->cachedInstance == NULL) {
|
||||
rcti newInput;
|
||||
newInput.xmax = this->getWidth();
|
||||
@@ -100,7 +106,8 @@ bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuff
|
||||
}
|
||||
}
|
||||
|
||||
void VectorBlurOperation::generateVectorBlur(float* data, MemoryBuffer* inputImage, MemoryBuffer* inputSpeed, MemoryBuffer* inputZ) {
|
||||
void VectorBlurOperation::generateVectorBlur(float *data, MemoryBuffer *inputImage, MemoryBuffer *inputSpeed, MemoryBuffer *inputZ)
|
||||
{
|
||||
float *zbuf = inputZ->convertToValueBuffer();
|
||||
NodeBlurData blurdata;
|
||||
blurdata.samples = this->settings->samples/QualityStepHelper::getStep();
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
*/
|
||||
NodeBlurData * settings;
|
||||
|
||||
float* cachedInstance;
|
||||
float *cachedInstance;
|
||||
|
||||
public:
|
||||
VectorBlurOperation();
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data);
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -60,13 +60,13 @@ public:
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
|
||||
void setVectorBlurSettings(NodeBlurData * settings) {this->settings = settings;}
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
protected:
|
||||
|
||||
void generateVectorBlur(float* data, MemoryBuffer* inputImage, MemoryBuffer* inputSpeed, MemoryBuffer* inputZ);
|
||||
void generateVectorBlur(float *data, MemoryBuffer *inputImage, MemoryBuffer *inputSpeed, MemoryBuffer *inputZ);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -30,27 +30,31 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
VectorCurveOperation::VectorCurveOperation(): CurveBaseOperation() {
|
||||
VectorCurveOperation::VectorCurveOperation(): CurveBaseOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VECTOR);
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
void VectorCurveOperation::initExecution() {
|
||||
void VectorCurveOperation::initExecution()
|
||||
{
|
||||
CurveBaseOperation::initExecution();
|
||||
this->inputProgram = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void VectorCurveOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void VectorCurveOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float input[4];
|
||||
|
||||
|
||||
this->inputProgram->read(input, x, y, sampler, inputBuffers);
|
||||
|
||||
curvemapping_evaluate_premulRGBF(this->curveMapping, output, input);
|
||||
output[3]= input[3];
|
||||
output[3] = input[3];
|
||||
}
|
||||
|
||||
void VectorCurveOperation::deinitExecution() {
|
||||
void VectorCurveOperation::deinitExecution()
|
||||
{
|
||||
this->inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
|
||||
@@ -38,7 +38,8 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
ViewerBaseOperation::ViewerBaseOperation() : NodeOperation() {
|
||||
ViewerBaseOperation::ViewerBaseOperation() : NodeOperation()
|
||||
{
|
||||
this->setImage(NULL);
|
||||
this->setImageUser(NULL);
|
||||
this->outputBuffer = NULL;
|
||||
@@ -47,25 +48,27 @@ ViewerBaseOperation::ViewerBaseOperation() : NodeOperation() {
|
||||
this->doColorManagement = true;
|
||||
}
|
||||
|
||||
void ViewerBaseOperation::initExecution() {
|
||||
void ViewerBaseOperation::initExecution()
|
||||
{
|
||||
// When initializing the tree during initial load the width and height can be zero.
|
||||
initImage();
|
||||
}
|
||||
|
||||
void ViewerBaseOperation::initImage() {
|
||||
Image* anImage = this->image;
|
||||
ImBuf *ibuf= BKE_image_acquire_ibuf(anImage, this->imageUser, &this->lock);
|
||||
void ViewerBaseOperation::initImage()
|
||||
{
|
||||
Image *anImage = this->image;
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(anImage, this->imageUser, &this->lock);
|
||||
|
||||
if (!ibuf) return;
|
||||
if (ibuf->x != (int)getWidth() || ibuf->y != (int)getHeight()) {
|
||||
imb_freerectImBuf(ibuf);
|
||||
imb_freerectfloatImBuf(ibuf);
|
||||
IMB_freezbuffloatImBuf(ibuf);
|
||||
ibuf->x= getWidth();
|
||||
ibuf->y= getHeight();
|
||||
ibuf->x = getWidth();
|
||||
ibuf->y = getHeight();
|
||||
imb_addrectImBuf(ibuf);
|
||||
imb_addrectfloatImBuf(ibuf);
|
||||
anImage->ok= IMA_OK_LOADED;
|
||||
anImage->ok = IMA_OK_LOADED;
|
||||
}
|
||||
|
||||
/* now we combine the input with ibuf */
|
||||
@@ -74,16 +77,19 @@ void ViewerBaseOperation::initImage() {
|
||||
|
||||
BKE_image_release_ibuf(this->image, this->lock);
|
||||
}
|
||||
void ViewerBaseOperation:: updateImage(rcti *rect) {
|
||||
void ViewerBaseOperation:: updateImage(rcti *rect)
|
||||
{
|
||||
/// @todo: introduce new event to update smaller area
|
||||
WM_main_add_notifier(NC_WINDOW|ND_DRAW, NULL);
|
||||
}
|
||||
|
||||
void ViewerBaseOperation::deinitExecution() {
|
||||
void ViewerBaseOperation::deinitExecution()
|
||||
{
|
||||
this->outputBuffer = NULL;
|
||||
}
|
||||
|
||||
const int ViewerBaseOperation::getRenderPriority() const {
|
||||
const int ViewerBaseOperation::getRenderPriority() const
|
||||
{
|
||||
if (this->isActiveViewerOutput()) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ protected:
|
||||
ImageUser * imageUser;
|
||||
void *lock;
|
||||
bool active;
|
||||
const bNodeTree* tree;
|
||||
const bNodeTree *tree;
|
||||
float centerX;
|
||||
float centerY;
|
||||
OrderOfChunks chunkOrder;
|
||||
@@ -45,11 +45,11 @@ public:
|
||||
bool isOutputOperation(bool rendering) const {return true;}
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void setImage(Image* image) {this->image = image;}
|
||||
void setImageUser(ImageUser* imageUser) {this->imageUser = imageUser;}
|
||||
void setImage(Image *image) {this->image = image;}
|
||||
void setImageUser(ImageUser *imageUser) {this->imageUser = imageUser;}
|
||||
const bool isActiveViewerOutput() const {return active;}
|
||||
void setActive(bool active) {this->active = active;}
|
||||
void setbNodeTree(const bNodeTree* tree) {this->tree = tree;}
|
||||
void setbNodeTree(const bNodeTree *tree) {this->tree = tree;}
|
||||
void setCenterX(float centerX) {this->centerX = centerX;}
|
||||
void setCenterY(float centerY) {this->centerY = centerY;}
|
||||
void setChunkOrder(OrderOfChunks tileOrder) {this->chunkOrder = tileOrder;}
|
||||
|
||||
@@ -39,7 +39,8 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
ViewerOperation::ViewerOperation() : ViewerBaseOperation() {
|
||||
ViewerOperation::ViewerOperation() : ViewerBaseOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
|
||||
@@ -47,23 +48,26 @@ ViewerOperation::ViewerOperation() : ViewerBaseOperation() {
|
||||
this->alphaInput = NULL;
|
||||
}
|
||||
|
||||
void ViewerOperation::initExecution() {
|
||||
void ViewerOperation::initExecution()
|
||||
{
|
||||
// When initializing the tree during initial load the width and height can be zero.
|
||||
this->imageInput = getInputSocketReader(0);
|
||||
this->alphaInput = getInputSocketReader(1);
|
||||
ViewerBaseOperation::initExecution();
|
||||
}
|
||||
|
||||
void ViewerOperation::deinitExecution() {
|
||||
void ViewerOperation::deinitExecution()
|
||||
{
|
||||
this->imageInput = NULL;
|
||||
this->alphaInput = NULL;
|
||||
ViewerBaseOperation::deinitExecution();
|
||||
}
|
||||
|
||||
|
||||
void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) {
|
||||
float* buffer = this->outputBuffer;
|
||||
unsigned char* bufferDisplay = this->outputBufferDisplay;
|
||||
void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
|
||||
{
|
||||
float *buffer = this->outputBuffer;
|
||||
unsigned char *bufferDisplay = this->outputBufferDisplay;
|
||||
if (!buffer) return;
|
||||
const int x1 = rect->xmin;
|
||||
const int y1 = rect->ymin;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
class ViewerOperation : public ViewerBaseOperation {
|
||||
private:
|
||||
SocketReader* imageInput;
|
||||
SocketReader* alphaInput;
|
||||
SocketReader *imageInput;
|
||||
SocketReader *alphaInput;
|
||||
|
||||
public:
|
||||
ViewerOperation();
|
||||
|
||||
@@ -26,37 +26,43 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/// @TODO: writebuffers don't have an actual data type set.
|
||||
WriteBufferOperation::WriteBufferOperation() :NodeOperation() {
|
||||
WriteBufferOperation::WriteBufferOperation() :NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->memoryProxy = new MemoryProxy();
|
||||
this->memoryProxy->setWriteBufferOperation(this);
|
||||
this->memoryProxy->setExecutor(NULL);
|
||||
this->tree = NULL;
|
||||
}
|
||||
WriteBufferOperation::~WriteBufferOperation() {
|
||||
WriteBufferOperation::~WriteBufferOperation()
|
||||
{
|
||||
if (this->memoryProxy) {
|
||||
delete this->memoryProxy;
|
||||
this->memoryProxy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteBufferOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void WriteBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
input->read(color, x, y, sampler, inputBuffers);
|
||||
}
|
||||
void WriteBufferOperation::initExecution() {
|
||||
void WriteBufferOperation::initExecution()
|
||||
{
|
||||
this->input = this->getInputOperation(0);
|
||||
MemoryManager::addMemoryProxy(this->memoryProxy);
|
||||
}
|
||||
void WriteBufferOperation::deinitExecution() {
|
||||
void WriteBufferOperation::deinitExecution()
|
||||
{
|
||||
this->input = NULL;
|
||||
}
|
||||
|
||||
|
||||
void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) {
|
||||
MemoryBuffer* memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber);
|
||||
float* buffer = memoryBuffer->getBuffer();
|
||||
void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers)
|
||||
{
|
||||
MemoryBuffer *memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber);
|
||||
float *buffer = memoryBuffer->getBuffer();
|
||||
if (this->input->isComplex()) {
|
||||
void* data = this->input->initializeTileData(rect, memoryBuffers);
|
||||
void *data = this->input->initializeTileData(rect, memoryBuffers);
|
||||
int x1 = rect->xmin;
|
||||
int y1 = rect->ymin;
|
||||
int x2 = rect->xmax;
|
||||
@@ -103,18 +109,19 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
||||
memoryBuffer->setCreatedState();
|
||||
}
|
||||
|
||||
void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** inputMemoryBuffers) {
|
||||
MemoryBuffer* outputMemoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), chunkNumber);
|
||||
float* outputFloatBuffer = outputMemoryBuffer->getBuffer();
|
||||
void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** inputMemoryBuffers)
|
||||
{
|
||||
MemoryBuffer *outputMemoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), chunkNumber);
|
||||
float *outputFloatBuffer = outputMemoryBuffer->getBuffer();
|
||||
cl_int error;
|
||||
/*
|
||||
1. create cl_mem from outputbuffer
|
||||
2. call NodeOperation (input) executeOpenCLChunk(.....)
|
||||
3. schedule readback from opencl to main device (outputbuffer)
|
||||
4. schedule native callback
|
||||
|
||||
note: list of cl_mem will be filled by 2, and needs to be cleaned up by 4
|
||||
*/
|
||||
* 1. create cl_mem from outputbuffer
|
||||
* 2. call NodeOperation (input) executeOpenCLChunk(.....)
|
||||
* 3. schedule readback from opencl to main device (outputbuffer)
|
||||
* 4. schedule native callback
|
||||
*
|
||||
* note: list of cl_mem will be filled by 2, and needs to be cleaned up by 4
|
||||
*/
|
||||
// STEP 1
|
||||
const unsigned int outputBufferWidth = outputMemoryBuffer->getWidth();
|
||||
const unsigned int outputBufferHeight = outputMemoryBuffer->getHeight();
|
||||
|
||||
@@ -38,14 +38,14 @@ public:
|
||||
WriteBufferOperation();
|
||||
~WriteBufferOperation();
|
||||
int isBufferOperation() {return true;}
|
||||
MemoryProxy* getMemoryProxy() {return this->memoryProxy;}
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
MemoryProxy *getMemoryProxy() {return this->memoryProxy;}
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
const bool isWriteBufferOperation() const {return true;}
|
||||
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers);
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void setbNodeTree(const bNodeTree* tree) {this->tree = tree;}
|
||||
void setbNodeTree(const bNodeTree *tree) {this->tree = tree;}
|
||||
void executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** memoryBuffers);
|
||||
|
||||
};
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "COM_ZCombineOperation.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
ZCombineOperation::ZCombineOperation(): NodeOperation() {
|
||||
ZCombineOperation::ZCombineOperation(): NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
@@ -37,14 +38,16 @@ ZCombineOperation::ZCombineOperation(): NodeOperation() {
|
||||
|
||||
}
|
||||
|
||||
void ZCombineOperation::initExecution() {
|
||||
void ZCombineOperation::initExecution()
|
||||
{
|
||||
this->image1Reader = this->getInputSocketReader(0);
|
||||
this->depth1Reader = this->getInputSocketReader(1);
|
||||
this->image2Reader = this->getInputSocketReader(2);
|
||||
this->depth2Reader = this->getInputSocketReader(3);
|
||||
}
|
||||
|
||||
void ZCombineOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ZCombineOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float depth1[4];
|
||||
float depth2[4];
|
||||
|
||||
@@ -57,7 +60,8 @@ void ZCombineOperation::executePixel(float* color, float x, float y, PixelSample
|
||||
this->image2Reader->read(color, x, y, sampler, inputBuffers);
|
||||
}
|
||||
}
|
||||
void ZCombineAlphaOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
float depth1[4];
|
||||
float depth2[4];
|
||||
float color1[4];
|
||||
@@ -81,7 +85,8 @@ void ZCombineAlphaOperation::executePixel(float* color, float x, float y, PixelS
|
||||
color[3] = MAX2(color1[3], color2[3]);
|
||||
}
|
||||
|
||||
void ZCombineOperation::deinitExecution() {
|
||||
void ZCombineOperation::deinitExecution()
|
||||
{
|
||||
this->image1Reader = NULL;
|
||||
this->depth1Reader = NULL;
|
||||
this->image2Reader = NULL;
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
*/
|
||||
class ZCombineOperation : public NodeOperation {
|
||||
protected:
|
||||
SocketReader* image1Reader;
|
||||
SocketReader* depth1Reader;
|
||||
SocketReader* image2Reader;
|
||||
SocketReader* depth2Reader;
|
||||
SocketReader *image1Reader;
|
||||
SocketReader *depth1Reader;
|
||||
SocketReader *image2Reader;
|
||||
SocketReader *depth2Reader;
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
@@ -47,11 +47,11 @@ public:
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
|
||||
class ZCombineAlphaOperation: public ZCombineOperation {
|
||||
void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -90,7 +90,7 @@ static int is_effected(PartialVisArea area,
|
||||
if (area == PARTIALVIS_ALL)
|
||||
return 1;
|
||||
else if (area == PARTIALVIS_MASKED) {
|
||||
return mask > 0.5;
|
||||
return mask > 0.5f;
|
||||
}
|
||||
else {
|
||||
int inside = planes_contain_v3(planes, 4, co);
|
||||
|
||||
Reference in New Issue
Block a user