Cleanup: enum class ChunkOrdering.
This commit is contained in:
parent
9c2d4ffbc1
commit
b5f70d92c2
|
@ -102,13 +102,13 @@ extern "C" {
|
|||
* ExecutionGroups that have no viewer-node,
|
||||
* will use a default one.
|
||||
* There are several possible chunk orders
|
||||
* - [@ref OrderOfChunks.COM_TO_CENTER_OUT]:
|
||||
* - [@ref ChunkOrdering.CenterOut]:
|
||||
* Start calculating from a configurable point and order by nearest chunk.
|
||||
* - [@ref OrderOfChunks.COM_TO_RANDOM]:
|
||||
* - [@ref ChunkOrdering.Random]:
|
||||
* Randomize all chunks.
|
||||
* - [@ref OrderOfChunks.COM_TO_TOP_DOWN]:
|
||||
* - [@ref ChunkOrdering.TopDown]:
|
||||
* Start calculation from the bottom to the top of the image.
|
||||
* - [@ref OrderOfChunks.COM_TO_RULE_OF_THIRDS]:
|
||||
* - [@ref ChunkOrdering.RuleOfThirds]:
|
||||
* Experimental order based on 9 hot-spots in the image.
|
||||
*
|
||||
* When the chunk-order is determined, the first few chunks will be checked if they can be scheduled.
|
||||
|
@ -122,7 +122,7 @@ extern "C" {
|
|||
*
|
||||
* \see ExecutionGroup.execute
|
||||
* \see ViewerOperation.getChunkOrder
|
||||
* \see OrderOfChunks
|
||||
* \see ChunkOrdering
|
||||
*
|
||||
* \section interest Area of interest
|
||||
* An ExecutionGroup can have dependencies to other ExecutionGroup's.
|
||||
|
|
|
@ -87,18 +87,18 @@ enum class CompositorPriority {
|
|||
* \brief The order of chunks to be scheduled
|
||||
* \ingroup Execution
|
||||
*/
|
||||
typedef enum OrderOfChunks {
|
||||
enum class ChunkOrdering {
|
||||
/** \brief order from a distance to centerX/centerY */
|
||||
COM_TO_CENTER_OUT = 0,
|
||||
CenterOut = 0,
|
||||
/** \brief order randomly */
|
||||
COM_TO_RANDOM = 1,
|
||||
Random = 1,
|
||||
/** \brief no ordering */
|
||||
COM_TO_TOP_DOWN = 2,
|
||||
TopDown = 2,
|
||||
/** \brief experimental ordering with 9 hot-spots. */
|
||||
COM_TO_RULE_OF_THIRDS = 3,
|
||||
} OrderOfChunks;
|
||||
RuleOfThirds = 3,
|
||||
|
||||
#define COM_ORDER_OF_CHUNKS_DEFAULT COM_TO_CENTER_OUT
|
||||
Default = ChunkOrdering::CenterOut,
|
||||
};
|
||||
|
||||
#define COM_RULE_OF_THIRDS_DIVIDER 100.0f
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
|
|||
NodeOperation *operation = this->getOutputOperation();
|
||||
float centerX = 0.5f;
|
||||
float centerY = 0.5f;
|
||||
OrderOfChunks order_type = COM_ORDER_OF_CHUNKS_DEFAULT;
|
||||
ChunkOrdering order_type = ChunkOrdering::Default;
|
||||
|
||||
if (operation->isViewerOperation()) {
|
||||
ViewerOperation *viewer = (ViewerOperation *)operation;
|
||||
|
@ -207,7 +207,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
|
|||
const int border_height = BLI_rcti_size_y(&this->m_viewerBorder);
|
||||
|
||||
switch (order_type) {
|
||||
case COM_TO_RANDOM: {
|
||||
case ChunkOrdering::Random: {
|
||||
static blender::RandomNumberGenerator rng;
|
||||
blender::MutableSpan<unsigned int> span = chunk_order.as_mutable_span();
|
||||
/* Shuffle twice to make it more random. */
|
||||
|
@ -215,7 +215,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
|
|||
rng.shuffle(span);
|
||||
break;
|
||||
}
|
||||
case COM_TO_CENTER_OUT: {
|
||||
case ChunkOrdering::CenterOut: {
|
||||
ChunkOrderHotspot hotspot(border_width * centerX, border_height * centerY, 0.0f);
|
||||
blender::Array<ChunkOrder> chunk_orders(m_chunks_len);
|
||||
for (index = 0; index < this->m_chunks_len; index++) {
|
||||
|
@ -234,7 +234,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
|
|||
|
||||
break;
|
||||
}
|
||||
case COM_TO_RULE_OF_THIRDS: {
|
||||
case ChunkOrdering::RuleOfThirds: {
|
||||
unsigned int tx = border_width / 6;
|
||||
unsigned int ty = border_height / 6;
|
||||
unsigned int mx = border_width / 2;
|
||||
|
@ -273,7 +273,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c
|
|||
|
||||
break;
|
||||
}
|
||||
case COM_TO_TOP_DOWN:
|
||||
case ChunkOrdering::TopDown:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ void SplitViewerNode::convertToOperations(NodeConverter &converter,
|
|||
|
||||
/* defaults - the viewer node has these options but not exposed for split view
|
||||
* we could use the split to define an area of interest on one axis at least */
|
||||
viewerOperation->setChunkOrder(COM_ORDER_OF_CHUNKS_DEFAULT);
|
||||
viewerOperation->setChunkOrder(ChunkOrdering::Default);
|
||||
viewerOperation->setCenterX(0.5f);
|
||||
viewerOperation->setCenterY(0.5f);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void ViewerNode::convertToOperations(NodeConverter &converter,
|
|||
viewerOperation->setbNodeTree(context.getbNodeTree());
|
||||
viewerOperation->setImage(image);
|
||||
viewerOperation->setImageUser(imageUser);
|
||||
viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1);
|
||||
viewerOperation->setChunkOrder((ChunkOrdering)editorNode->custom1);
|
||||
viewerOperation->setCenterX(editorNode->custom3);
|
||||
viewerOperation->setCenterY(editorNode->custom4);
|
||||
/* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */
|
||||
|
|
|
@ -32,7 +32,7 @@ class ViewerOperation : public NodeOperation {
|
|||
bool m_active;
|
||||
float m_centerX;
|
||||
float m_centerY;
|
||||
OrderOfChunks m_chunkOrder;
|
||||
ChunkOrdering m_chunkOrder;
|
||||
bool m_doDepthBuffer;
|
||||
ImBuf *m_ibuf;
|
||||
bool m_useAlphaInput;
|
||||
|
@ -82,7 +82,7 @@ class ViewerOperation : public NodeOperation {
|
|||
{
|
||||
this->m_centerY = centerY;
|
||||
}
|
||||
void setChunkOrder(OrderOfChunks tileOrder)
|
||||
void setChunkOrder(ChunkOrdering tileOrder)
|
||||
{
|
||||
this->m_chunkOrder = tileOrder;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class ViewerOperation : public NodeOperation {
|
|||
{
|
||||
return this->m_centerY;
|
||||
}
|
||||
OrderOfChunks getChunkOrder() const
|
||||
ChunkOrdering getChunkOrder() const
|
||||
{
|
||||
return this->m_chunkOrder;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue