Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-03-29 15:30:39 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-03-29 15:45:49 +0300
commit270df9a60fd892b52ba5104ca9352ea4b4082ecd (patch)
treed6a800f6e4c02c2cc4eae8080182eb15cd5ddf92
parent30bed91b78366e7e2b2f0bc928517c36756e28c2 (diff)
Cycles: Cleanup, don't use m_ prefix for public properties
-rw-r--r--intern/cycles/bvh/bvh.cpp68
-rw-r--r--intern/cycles/bvh/bvh_build.cpp42
-rw-r--r--intern/cycles/bvh/bvh_node.cpp34
-rw-r--r--intern/cycles/bvh/bvh_node.h68
4 files changed, 106 insertions, 106 deletions
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index cb579aea499..18e8c2bfdf2 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -424,7 +424,7 @@ static bool node_bvh_is_unaligned(const BVHNode *node)
{
const BVHNode *node0 = node->get_child(0),
*node1 = node->get_child(1);
- return node0->is_unaligned() || node1->is_unaligned();
+ return node0->is_unaligned || node1->is_unaligned;
}
RegularBVH::RegularBVH(const BVHParams& params_, const vector<Object*>& objects_)
@@ -438,19 +438,19 @@ void RegularBVH::pack_leaf(const BVHStackEntry& e,
assert(e.idx + BVH_NODE_LEAF_SIZE <= pack.leaf_nodes.size());
float4 data[BVH_NODE_LEAF_SIZE];
memset(data, 0, sizeof(data));
- if(leaf->num_triangles() == 1 && pack.prim_index[leaf->m_lo] == -1) {
+ if(leaf->num_triangles() == 1 && pack.prim_index[leaf->lo] == -1) {
/* object */
- data[0].x = __int_as_float(~(leaf->m_lo));
+ data[0].x = __int_as_float(~(leaf->lo));
data[0].y = __int_as_float(0);
}
else {
/* triangle */
- data[0].x = __int_as_float(leaf->m_lo);
- data[0].y = __int_as_float(leaf->m_hi);
+ data[0].x = __int_as_float(leaf->lo);
+ data[0].y = __int_as_float(leaf->hi);
}
- data[0].z = __uint_as_float(leaf->m_visibility);
+ data[0].z = __uint_as_float(leaf->visibility);
if(leaf->num_triangles() != 0) {
- data[0].w = __uint_as_float(pack.prim_type[leaf->m_lo]);
+ data[0].w = __uint_as_float(pack.prim_type[leaf->lo]);
}
memcpy(&pack.leaf_nodes[e.idx], data, sizeof(float4)*BVH_NODE_LEAF_SIZE);
@@ -460,7 +460,7 @@ void RegularBVH::pack_inner(const BVHStackEntry& e,
const BVHStackEntry& e0,
const BVHStackEntry& e1)
{
- if(e0.node->is_unaligned() || e1.node->is_unaligned()) {
+ if(e0.node->is_unaligned || e1.node->is_unaligned) {
pack_unaligned_inner(e, e0, e1);
} else {
pack_aligned_inner(e, e0, e1);
@@ -472,9 +472,9 @@ void RegularBVH::pack_aligned_inner(const BVHStackEntry& e,
const BVHStackEntry& e1)
{
pack_aligned_node(e.idx,
- e0.node->m_bounds, e1.node->m_bounds,
+ e0.node->bounds, e1.node->bounds,
e0.encodeIdx(), e1.encodeIdx(),
- e0.node->m_visibility, e1.node->m_visibility);
+ e0.node->visibility, e1.node->visibility);
}
void RegularBVH::pack_aligned_node(int idx,
@@ -515,10 +515,10 @@ void RegularBVH::pack_unaligned_inner(const BVHStackEntry& e,
pack_unaligned_node(e.idx,
e0.node->get_aligned_space(),
e1.node->get_aligned_space(),
- e0.node->m_bounds,
- e1.node->m_bounds,
+ e0.node->bounds,
+ e1.node->bounds,
e0.encodeIdx(), e1.encodeIdx(),
- e0.node->m_visibility, e1.node->m_visibility);
+ e0.node->visibility, e1.node->visibility);
}
void RegularBVH::pack_unaligned_node(int idx,
@@ -769,18 +769,18 @@ static bool node_qbvh_is_unaligned(const BVHNode *node)
*node1 = node->get_child(1);
bool has_unaligned = false;
if(node0->is_leaf()) {
- has_unaligned |= node0->is_unaligned();
+ has_unaligned |= node0->is_unaligned;
}
else {
- has_unaligned |= node0->get_child(0)->is_unaligned();
- has_unaligned |= node0->get_child(1)->is_unaligned();
+ has_unaligned |= node0->get_child(0)->is_unaligned;
+ has_unaligned |= node0->get_child(1)->is_unaligned;
}
if(node1->is_leaf()) {
- has_unaligned |= node1->is_unaligned();
+ has_unaligned |= node1->is_unaligned;
}
else {
- has_unaligned |= node1->get_child(0)->is_unaligned();
- has_unaligned |= node1->get_child(1)->is_unaligned();
+ has_unaligned |= node1->get_child(0)->is_unaligned;
+ has_unaligned |= node1->get_child(1)->is_unaligned;
}
return has_unaligned;
}
@@ -795,19 +795,19 @@ void QBVH::pack_leaf(const BVHStackEntry& e, const LeafNode *leaf)
{
float4 data[BVH_QNODE_LEAF_SIZE];
memset(data, 0, sizeof(data));
- if(leaf->num_triangles() == 1 && pack.prim_index[leaf->m_lo] == -1) {
+ if(leaf->num_triangles() == 1 && pack.prim_index[leaf->lo] == -1) {
/* object */
- data[0].x = __int_as_float(~(leaf->m_lo));
+ data[0].x = __int_as_float(~(leaf->lo));
data[0].y = __int_as_float(0);
}
else {
/* triangle */
- data[0].x = __int_as_float(leaf->m_lo);
- data[0].y = __int_as_float(leaf->m_hi);
+ data[0].x = __int_as_float(leaf->lo);
+ data[0].y = __int_as_float(leaf->hi);
}
- data[0].z = __uint_as_float(leaf->m_visibility);
+ data[0].z = __uint_as_float(leaf->visibility);
if(leaf->num_triangles() != 0) {
- data[0].w = __uint_as_float(pack.prim_type[leaf->m_lo]);
+ data[0].w = __uint_as_float(pack.prim_type[leaf->lo]);
}
memcpy(&pack.leaf_nodes[e.idx], data, sizeof(float4)*BVH_QNODE_LEAF_SIZE);
@@ -823,7 +823,7 @@ void QBVH::pack_inner(const BVHStackEntry& e,
*/
if(params.use_unaligned_nodes) {
for(int i = 0; i < num; i++) {
- if(en[i].node->is_unaligned()) {
+ if(en[i].node->is_unaligned) {
has_unaligned = true;
break;
}
@@ -848,15 +848,15 @@ void QBVH::pack_aligned_inner(const BVHStackEntry& e,
BoundBox bounds[4];
int child[4];
for(int i = 0; i < num; ++i) {
- bounds[i] = en[i].node->m_bounds;
+ bounds[i] = en[i].node->bounds;
child[i] = en[i].encodeIdx();
}
pack_aligned_node(e.idx,
bounds,
child,
- e.node->m_visibility,
- e.node->m_time_from,
- e.node->m_time_to,
+ e.node->visibility,
+ e.node->time_from,
+ e.node->time_to,
num);
}
@@ -917,16 +917,16 @@ void QBVH::pack_unaligned_inner(const BVHStackEntry& e,
int child[4];
for(int i = 0; i < num; ++i) {
aligned_space[i] = en[i].node->get_aligned_space();
- bounds[i] = en[i].node->m_bounds;
+ bounds[i] = en[i].node->bounds;
child[i] = en[i].encodeIdx();
}
pack_unaligned_node(e.idx,
aligned_space,
bounds,
child,
- e.node->m_visibility,
- e.node->m_time_from,
- e.node->m_time_to,
+ e.node->visibility,
+ e.node->time_from,
+ e.node->time_to,
num);
}
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index a212cb3343c..95c71b54da0 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -866,8 +866,8 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start,
uint visibility = objects[ref->prim_object()]->visibility;
BVHNode *leaf_node = new LeafNode(ref->bounds(), visibility, start, start+1);
- leaf_node->m_time_from = ref->time_from();
- leaf_node->m_time_to = ref->time_to();
+ leaf_node->time_from = ref->time_from();
+ leaf_node->time_to = ref->time_to();
return leaf_node;
}
else {
@@ -876,12 +876,12 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start,
BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, start+mid, num-mid);
BoundBox bounds = BoundBox::empty;
- bounds.grow(leaf0->m_bounds);
- bounds.grow(leaf1->m_bounds);
+ bounds.grow(leaf0->bounds);
+ bounds.grow(leaf1->bounds);
BVHNode *inner_node = new InnerNode(bounds, leaf0, leaf1);
- inner_node->m_time_from = min(leaf0->m_time_from, leaf1->m_time_from);
- inner_node->m_time_to = max(leaf0->m_time_to, leaf1->m_time_to);
+ inner_node->time_from = min(leaf0->time_from, leaf1->time_from);
+ inner_node->time_to = max(leaf0->time_to, leaf1->time_to);
return inner_node;
}
}
@@ -1004,19 +1004,19 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
time_from = min(time_from, ref.time_from());
time_to = max(time_to, ref.time_to());
}
- leaf_node->m_time_from = time_from;
- leaf_node->m_time_to = time_to;
+ leaf_node->time_from = time_from;
+ leaf_node->time_to = time_to;
}
if(alignment_found) {
/* Need to recalculate leaf bounds with new alignment. */
- leaf_node->m_bounds = BoundBox::empty;
+ leaf_node->bounds = BoundBox::empty;
for(int j = 0; j < num; ++j) {
const BVHReference &ref = p_ref[i][j];
BoundBox ref_bounds =
unaligned_heuristic.compute_aligned_prim_boundbox(
ref,
aligned_space);
- leaf_node->m_bounds.grow(ref_bounds);
+ leaf_node->bounds.grow(ref_bounds);
}
/* Set alignment space. */
leaf_node->set_aligned_space(aligned_space);
@@ -1099,8 +1099,8 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
*/
for(int i = 0; i < num_leaves; ++i) {
LeafNode *leaf = (LeafNode *)leaves[i];
- leaf->m_lo += start_index;
- leaf->m_hi += start_index;
+ leaf->lo += start_index;
+ leaf->hi += start_index;
}
/* Create leaf node for object. */
@@ -1129,17 +1129,17 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
return new InnerNode(range.bounds(), leaves[0], leaves[1]);
}
else if(num_leaves == 3) {
- BoundBox inner_bounds = merge(leaves[1]->m_bounds, leaves[2]->m_bounds);
+ BoundBox inner_bounds = merge(leaves[1]->bounds, leaves[2]->bounds);
BVHNode *inner = new InnerNode(inner_bounds, leaves[1], leaves[2]);
return new InnerNode(range.bounds(), leaves[0], inner);
} else {
/* Should be doing more branches if more primitive types added. */
assert(num_leaves <= 5);
- BoundBox inner_bounds_a = merge(leaves[0]->m_bounds, leaves[1]->m_bounds);
- BoundBox inner_bounds_b = merge(leaves[2]->m_bounds, leaves[3]->m_bounds);
+ BoundBox inner_bounds_a = merge(leaves[0]->bounds, leaves[1]->bounds);
+ BoundBox inner_bounds_b = merge(leaves[2]->bounds, leaves[3]->bounds);
BVHNode *inner_a = new InnerNode(inner_bounds_a, leaves[0], leaves[1]);
BVHNode *inner_b = new InnerNode(inner_bounds_b, leaves[2], leaves[3]);
- BoundBox inner_bounds_c = merge(inner_a->m_bounds, inner_b->m_bounds);
+ BoundBox inner_bounds_c = merge(inner_a->bounds, inner_b->bounds);
BVHNode *inner_c = new InnerNode(inner_bounds_c, inner_a, inner_b);
if(num_leaves == 5) {
return new InnerNode(range.bounds(), inner_c, leaves[4]);
@@ -1174,8 +1174,8 @@ void BVHBuild::rotate(BVHNode *node, int max_depth)
rotate(parent->children[c], max_depth-1);
/* compute current area of all children */
- BoundBox bounds0 = parent->children[0]->m_bounds;
- BoundBox bounds1 = parent->children[1]->m_bounds;
+ BoundBox bounds0 = parent->children[0]->bounds;
+ BoundBox bounds1 = parent->children[1]->bounds;
float area0 = bounds0.half_area();
float area1 = bounds1.half_area();
@@ -1195,8 +1195,8 @@ void BVHBuild::rotate(BVHNode *node, int max_depth)
BoundBox& other = (c == 0)? bounds1: bounds0;
/* transpose child bounds */
- BoundBox target0 = child->children[0]->m_bounds;
- BoundBox target1 = child->children[1]->m_bounds;
+ BoundBox target0 = child->children[0]->bounds;
+ BoundBox target1 = child->children[1]->bounds;
/* compute cost for both possible swaps */
float cost0 = merge(other, target1).half_area() - child_area[c];
@@ -1228,7 +1228,7 @@ void BVHBuild::rotate(BVHNode *node, int max_depth)
InnerNode *child = (InnerNode*)parent->children[best_child];
swap(parent->children[best_other], child->children[best_target]);
- child->m_bounds = merge(child->children[0]->m_bounds, child->children[1]->m_bounds);
+ child->bounds = merge(child->children[0]->bounds, child->children[1]->bounds);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_node.cpp b/intern/cycles/bvh/bvh_node.cpp
index 04178a68bcf..4f788c66797 100644
--- a/intern/cycles/bvh/bvh_node.cpp
+++ b/intern/cycles/bvh/bvh_node.cpp
@@ -62,12 +62,12 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
}
return cnt;
case BVH_STAT_ALIGNED_COUNT:
- if(!is_unaligned()) {
+ if(!is_unaligned) {
cnt = 1;
}
break;
case BVH_STAT_UNALIGNED_COUNT:
- if(is_unaligned()) {
+ if(is_unaligned) {
cnt = 1;
}
break;
@@ -75,7 +75,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
if(!is_leaf()) {
bool has_unaligned = false;
for(int j = 0; j < num_children(); j++) {
- has_unaligned |= get_child(j)->is_unaligned();
+ has_unaligned |= get_child(j)->is_unaligned;
}
cnt += has_unaligned? 0: 1;
}
@@ -84,7 +84,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
if(!is_leaf()) {
bool has_unaligned = false;
for(int j = 0; j < num_children(); j++) {
- has_unaligned |= get_child(j)->is_unaligned();
+ has_unaligned |= get_child(j)->is_unaligned;
}
cnt += has_unaligned? 1: 0;
}
@@ -95,12 +95,12 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
for(int i = 0; i < num_children(); i++) {
BVHNode *node = get_child(i);
if(node->is_leaf()) {
- has_unaligned |= node->is_unaligned();
+ has_unaligned |= node->is_unaligned;
}
else {
for(int j = 0; j < node->num_children(); j++) {
cnt += node->get_child(j)->getSubtreeSize(stat);
- has_unaligned |= node->get_child(j)->is_unaligned();
+ has_unaligned |= node->get_child(j)->is_unaligned;
}
}
}
@@ -113,12 +113,12 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
for(int i = 0; i < num_children(); i++) {
BVHNode *node = get_child(i);
if(node->is_leaf()) {
- has_unaligned |= node->is_unaligned();
+ has_unaligned |= node->is_unaligned;
}
else {
for(int j = 0; j < node->num_children(); j++) {
cnt += node->get_child(j)->getSubtreeSize(stat);
- has_unaligned |= node->get_child(j)->is_unaligned();
+ has_unaligned |= node->get_child(j)->is_unaligned;
}
}
}
@@ -126,10 +126,10 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
}
return cnt;
case BVH_STAT_ALIGNED_LEAF_COUNT:
- cnt = (is_leaf() && !is_unaligned()) ? 1 : 0;
+ cnt = (is_leaf() && !is_unaligned) ? 1 : 0;
break;
case BVH_STAT_UNALIGNED_LEAF_COUNT:
- cnt = (is_leaf() && is_unaligned()) ? 1 : 0;
+ cnt = (is_leaf() && is_unaligned) ? 1 : 0;
break;
default:
assert(0); /* unknown mode */
@@ -157,7 +157,7 @@ float BVHNode::computeSubtreeSAHCost(const BVHParams& p, float probability) cons
for(int i = 0; i < num_children(); i++) {
BVHNode *child = get_child(i);
- SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.safe_area()/m_bounds.safe_area());
+ SAH += child->computeSubtreeSAHCost(p, probability * child->bounds.safe_area()/bounds.safe_area());
}
return SAH;
@@ -165,15 +165,15 @@ float BVHNode::computeSubtreeSAHCost(const BVHParams& p, float probability) cons
uint BVHNode::update_visibility()
{
- if(!is_leaf() && m_visibility == 0) {
+ if(!is_leaf() && visibility == 0) {
InnerNode *inner = (InnerNode*)this;
BVHNode *child0 = inner->children[0];
BVHNode *child1 = inner->children[1];
- m_visibility = child0->update_visibility()|child1->update_visibility();
+ visibility = child0->update_visibility()|child1->update_visibility();
}
- return m_visibility;
+ return visibility;
}
void BVHNode::update_time()
@@ -184,8 +184,8 @@ void BVHNode::update_time()
BVHNode *child1 = inner->children[1];
child0->update_time();
child1->update_time();
- m_time_from = min(child0->m_time_from, child1->m_time_from);
- m_time_to = max(child0->m_time_to, child1->m_time_to);
+ time_from = min(child0->time_from, child1->time_from);
+ time_to = max(child0->time_to, child1->time_to);
}
}
@@ -209,7 +209,7 @@ void LeafNode::print(int depth) const
for(int i = 0; i < depth; i++)
printf(" ");
- printf("leaf node %d to %d\n", m_lo, m_hi);
+ printf("leaf node %d to %d\n", lo, hi);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h
index a22138eb8bf..60511b4b012 100644
--- a/intern/cycles/bvh/bvh_node.h
+++ b/intern/cycles/bvh/bvh_node.h
@@ -46,16 +46,16 @@ class BVHParams;
class BVHNode
{
public:
- BVHNode() : m_is_unaligned(false),
- m_aligned_space(NULL),
- m_time_from(0.0f),
- m_time_to(1.0f)
+ BVHNode() : is_unaligned(false),
+ aligned_space(NULL),
+ time_from(0.0f),
+ time_to(1.0f)
{
}
virtual ~BVHNode()
{
- delete m_aligned_space;
+ delete aligned_space;
}
virtual bool is_leaf() const = 0;
@@ -63,30 +63,26 @@ public:
virtual BVHNode *get_child(int i) const = 0;
virtual int num_triangles() const { return 0; }
virtual void print(int depth = 0) const = 0;
- bool is_unaligned() const { return m_is_unaligned; }
inline void set_aligned_space(const Transform& aligned_space)
{
- m_is_unaligned = true;
- if(m_aligned_space == NULL) {
- m_aligned_space = new Transform(aligned_space);
+ is_unaligned = true;
+ if(this->aligned_space == NULL) {
+ this->aligned_space = new Transform(aligned_space);
}
else {
- *m_aligned_space = aligned_space;
+ *this->aligned_space = aligned_space;
}
}
inline Transform get_aligned_space() const
{
- if(m_aligned_space == NULL) {
+ if(aligned_space == NULL) {
return transform_identity();
}
- return *m_aligned_space;
+ return *aligned_space;
}
- BoundBox m_bounds;
- uint m_visibility;
-
// Subtree functions
int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const;
float computeSubtreeSAHCost(const BVHParams& p, float probability = 1.0f) const;
@@ -95,13 +91,18 @@ public:
uint update_visibility();
void update_time();
- bool m_is_unaligned;
+ // Properties.
+ BoundBox bounds;
+ uint visibility;
+
+ bool is_unaligned;
- // TODO(sergey): Can be stored as 3x3 matrix, but better to have some
- // utilities and type defines in util_transform first.
- Transform *m_aligned_space;
+ /* TODO(sergey): Can be stored as 3x3 matrix, but better to have some
+ * utilities and type defines in util_transform first.
+ */
+ Transform *aligned_space;
- float m_time_from, m_time_to;
+ float time_from, time_to;
};
class InnerNode : public BVHNode
@@ -111,20 +112,20 @@ public:
BVHNode* child0,
BVHNode* child1)
{
- m_bounds = bounds;
+ this->bounds = bounds;
children[0] = child0;
children[1] = child1;
if(child0 && child1)
- m_visibility = child0->m_visibility|child1->m_visibility;
+ visibility = child0->visibility|child1->visibility;
else
- m_visibility = 0; /* happens on build cancel */
+ visibility = 0; /* happens on build cancel */
}
explicit InnerNode(const BoundBox& bounds)
{
- m_bounds = bounds;
- m_visibility = 0;
+ this->bounds = bounds;
+ visibility = 0;
children[0] = NULL;
children[1] = NULL;
}
@@ -140,12 +141,12 @@ public:
class LeafNode : public BVHNode
{
public:
- LeafNode(const BoundBox& bounds, uint visibility, int lo, int hi)
+ LeafNode(const BoundBox& bounds, uint visibility, int lo, int hi)
+ : lo(lo),
+ hi(hi)
{
- m_bounds = bounds;
- m_visibility = visibility;
- m_lo = lo;
- m_hi = hi;
+ this->bounds = bounds;
+ this->visibility = visibility;
}
LeafNode(const LeafNode& s)
@@ -157,14 +158,13 @@ public:
bool is_leaf() const { return true; }
int num_children() const { return 0; }
BVHNode *get_child(int) const { return NULL; }
- int num_triangles() const { return m_hi - m_lo; }
+ int num_triangles() const { return hi - lo; }
void print(int depth) const;
- int m_lo;
- int m_hi;
+ int lo;
+ int hi;
};
CCL_NAMESPACE_END
#endif /* __BVH_NODE_H__ */
-