本文整理汇总了C++中NodeOperation类的典型用法代码示例。如果您正苦于以下问题:C++ NodeOperation类的具体用法?C++ NodeOperation怎么用?C++ NodeOperation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: determineDependingAreaOfInterest
bool GaussianAlphaYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
#if 0 /* until we add size input */
rcti sizeInput;
sizeInput.xmin = 0;
sizeInput.ymin = 0;
sizeInput.xmax = 5;
sizeInput.ymax = 5;
NodeOperation *operation = this->getInputOperation(1);
if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
return true;
}
else
#endif
{
if (this->m_sizeavailable && this->m_gausstab != NULL) {
newInput.xmax = input->xmax;
newInput.xmin = input->xmin;
newInput.ymax = input->ymax + this->m_rad + 1;
newInput.ymin = input->ymin - this->m_rad - 1;
}
else {
newInput.xmax = this->getWidth();
newInput.xmin = 0;
newInput.ymax = this->getHeight();
newInput.ymin = 0;
}
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
}
示例2: setRenderBorder
void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax)
{
NodeOperation *operation = this->getOutputOperation();
if (operation->isOutputOperation(true)) {
/* Basically, setting border need to happen for only operations
* which operates in render resolution buffers (like compositor
* output nodes).
*
* In this cases adding border will lead to mapping coordinates
* from output buffer space to input buffer spaces when executing
* operation.
*
* But nodes like viewer and file output just shall display or
* safe the same exact buffer which goes to their input, no need
* in any kind of coordinates mapping.
*/
bool operationNeedsBorder = !(operation->isViewerOperation() ||
operation->isPreviewOperation() ||
operation->isFileOutputOperation());
if (operationNeedsBorder) {
BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width,
ymin * this->m_height, ymax * this->m_height);
}
}
}
示例3: add_datatype_conversions
void NodeOperationBuilder::add_datatype_conversions()
{
Links convert_links;
for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) {
const Link &link = *it;
/* proxy operations can skip data type conversion */
NodeOperation *from_op = &link.from()->getOperation();
NodeOperation *to_op = &link.to()->getOperation();
if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion()))
continue;
if (link.from()->getDataType() != link.to()->getDataType())
convert_links.push_back(link);
}
for (Links::const_iterator it = convert_links.begin(); it != convert_links.end(); ++it) {
const Link &link = *it;
NodeOperation *converter = Converter::convertDataType(link.from(), link.to());
if (converter) {
addOperation(converter);
removeInputLink(link.to());
addLink(link.from(), converter->getInputSocket(0));
addLink(converter->getOutputSocket(0), link.to());
}
}
}
示例4: determineDependingAreaOfInterest
bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
if (!this->m_sizeavailable) {
rcti sizeInput;
sizeInput.xmin = 0;
sizeInput.ymin = 0;
sizeInput.xmax = 5;
sizeInput.ymax = 5;
NodeOperation *operation = this->getInputOperation(1);
if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
return true;
}
}
{
if (this->m_sizeavailable && this->m_gausstab != NULL) {
newInput.xmax = input->xmax + this->m_filtersize + 1;
newInput.xmin = input->xmin - this->m_filtersize - 1;
newInput.ymax = input->ymax;
newInput.ymin = input->ymin;
}
else {
newInput.xmax = this->getWidth();
newInput.xmin = 0;
newInput.ymax = this->getHeight();
newInput.ymin = 0;
}
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
}
示例5: MEM_freeN
void ExecutionGroup::initExecution()
{
if (this->m_chunkExecutionStates != NULL) {
MEM_freeN(this->m_chunkExecutionStates);
}
unsigned int index;
determineNumberOfChunks();
this->m_chunkExecutionStates = NULL;
if (this->m_numberOfChunks != 0) {
this->m_chunkExecutionStates = (ChunkExecutionState *)MEM_mallocN(sizeof(ChunkExecutionState) * this->m_numberOfChunks, __func__);
for (index = 0; index < this->m_numberOfChunks; index++) {
this->m_chunkExecutionStates[index] = COM_ES_NOT_SCHEDULED;
}
}
unsigned int maxNumber = 0;
for (index = 0; index < this->m_operations.size(); index++) {
NodeOperation *operation = this->m_operations[index];
if (operation->isReadBufferOperation()) {
ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
this->m_cachedReadOperations.push_back(readOperation);
maxNumber = max(maxNumber, readOperation->getOffset());
}
}
maxNumber++;
this->m_cachedMaxReadBufferOffset = maxNumber;
}
示例6: BLI_rcti_init
bool NodeOperation::determineDependingAreaOfInterest(rcti *input,
ReadBufferOperation *readOperation,
rcti *output)
{
if (isInputOperation()) {
BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
return false;
}
else {
rcti tempOutput;
bool first = true;
for (int i = 0; i < getNumberOfInputSockets(); i++) {
NodeOperation *inputOperation = this->getInputOperation(i);
if (inputOperation &&
inputOperation->determineDependingAreaOfInterest(input, readOperation, &tempOutput)) {
if (first) {
output->xmin = tempOutput.xmin;
output->ymin = tempOutput.ymin;
output->xmax = tempOutput.xmax;
output->ymax = tempOutput.ymax;
first = false;
}
else {
output->xmin = min(output->xmin, tempOutput.xmin);
output->ymin = min(output->ymin, tempOutput.ymin);
output->xmax = max(output->xmax, tempOutput.xmax);
output->ymax = max(output->ymax, tempOutput.ymax);
}
}
}
return !first;
}
}
示例7: missingSocketLink
void RenderLayersNode::missingSocketLink(NodeConverter &converter,
NodeOutput *output) const
{
NodeOperation *operation;
switch (output->getDataType()) {
case COM_DT_COLOR:
{
const float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
SetColorOperation *color_operation = new SetColorOperation();
color_operation->setChannels(color);
operation = color_operation;
break;
}
case COM_DT_VECTOR:
{
const float vector[3] = {0.0f, 0.0f, 0.0f};
SetVectorOperation *vector_operation = new SetVectorOperation();
vector_operation->setVector(vector);
operation = vector_operation;
break;
}
case COM_DT_VALUE:
{
SetValueOperation *value_operation = new SetValueOperation();
value_operation->setValue(0.0f);
operation = value_operation;
break;
}
}
converter.mapOutputSocket(output, operation->getOutputSocket());
converter.addOperation(operation);
}
示例8: determineDependingAreaOfInterest
bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output)
{
rcti newInput;
rcti sizeInput;
sizeInput.xmin = 0;
sizeInput.ymin = 0;
sizeInput.xmax = 5;
sizeInput.ymax = 5;
NodeOperation *operation = this->getInputOperation(1);
if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) {
return true;
}
else {
if (this->m_iirgaus) {
return false;
}
else {
newInput.xmin = 0;
newInput.ymin = 0;
newInput.xmax = this->getWidth();
newInput.ymax = this->getHeight();
}
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
}
示例9: determineResolution
void ExecutionGroup::determineResolution(unsigned int resolution[2])
{
NodeOperation *operation = this->getOutputOperation();
resolution[0] = operation->getWidth();
resolution[1] = operation->getHeight();
this->setResolution(resolution);
BLI_rcti_init(&this->m_viewerBorder, 0, this->m_width, 0, this->m_height);
}
示例10: setViewerBorder
void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float ymax)
{
NodeOperation *operation = this->getOutputOperation();
if (operation->isViewerOperation() || operation->isPreviewOperation()) {
BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width,
ymin * this->m_height, ymax * this->m_height);
}
}
示例11: convertToOperations
void ChannelMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
{
bNode *node = this->getbNode();
NodeInput *inputSocketImage = this->getInputSocket(0);
NodeOutput *outputSocketImage = this->getOutputSocket(0);
NodeOutput *outputSocketMatte = this->getOutputSocket(1);
NodeOperation *convert = NULL;
/* colorspace */
switch (node->custom1) {
case CMP_NODE_CHANNEL_MATTE_CS_RGB:
break;
case CMP_NODE_CHANNEL_MATTE_CS_HSV: /* HSV */
convert = new ConvertRGBToHSVOperation();
break;
case CMP_NODE_CHANNEL_MATTE_CS_YUV: /* YUV */
convert = new ConvertRGBToYUVOperation();
break;
case CMP_NODE_CHANNEL_MATTE_CS_YCC: /* YCC */
convert = new ConvertRGBToYCCOperation();
((ConvertRGBToYCCOperation *)convert)->setMode(0); /* BLI_YCC_ITU_BT601 */
break;
default:
break;
}
ChannelMatteOperation *operation = new ChannelMatteOperation();
/* pass the ui properties to the operation */
operation->setSettings((NodeChroma *)node->storage, node->custom2);
converter.addOperation(operation);
SetAlphaOperation *operationAlpha = new SetAlphaOperation();
converter.addOperation(operationAlpha);
if (convert) {
converter.addOperation(convert);
converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0));
converter.addLink(convert->getOutputSocket(), operation->getInputSocket(0));
converter.addLink(convert->getOutputSocket(), operationAlpha->getInputSocket(0));
}
else {
converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0));
converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0));
}
converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0));
converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket());
converter.addPreview(operationAlpha->getOutputSocket());
}
示例12: findOutputNodeOperations
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];
if (operation->isOutputOperation(rendering)) {
result->push_back(operation);
}
}
}
示例13: MemoryBuffer
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int /*chunkNumber*/,
rcti *rect)
{
// we asume that this method is only called from complex execution groups.
NodeOperation *operation = this->getOutputOperation();
if (operation->isWriteBufferOperation()) {
WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation;
MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect);
return buffer;
}
return NULL;
}
示例14: reconnect
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];
if (input->getDataType() == output->getDataType()) {
if (input->isConnected()) {
output->relinkConnections(input->getConnection()->getFromSocket(), false);
return;
}
}
}
NodeOperation *operation = NULL;
switch (output->getDataType()) {
case COM_DT_VALUE:
{
SetValueOperation *valueoperation = new SetValueOperation();
valueoperation->setValue(0.0f);
operation = valueoperation;
break;
}
case COM_DT_VECTOR:
{
SetVectorOperation *vectoroperation = new SetVectorOperation();
vectoroperation->setX(0.0f);
vectoroperation->setY(0.0f);
vectoroperation->setW(0.0f);
operation = vectoroperation;
break;
}
case COM_DT_COLOR:
{
SetColorOperation *coloroperation = new SetColorOperation();
coloroperation->setChannel1(0.0f);
coloroperation->setChannel2(0.0f);
coloroperation->setChannel3(0.0f);
coloroperation->setChannel4(0.0f);
operation = coloroperation;
break;
}
}
if (operation) {
output->relinkConnections(operation->getOutputSocket(), false);
graph->addOperation(operation);
}
output->clearConnections();
}
示例15: getInputOperation
bool AntiAliasOperation::determineDependingAreaOfInterest(
rcti *input,
ReadBufferOperation *readOperation,
rcti *output)
{
rcti imageInput;
NodeOperation *operation = getInputOperation(0);
imageInput.xmax = input->xmax + 1;
imageInput.xmin = input->xmin - 1;
imageInput.ymax = input->ymax + 1;
imageInput.ymin = input->ymin - 1;
return operation->determineDependingAreaOfInterest(&imageInput,
readOperation,
output);
}