File size: 801 Bytes
c3f86e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include <cstdint>

extern "C" {
    void zbuff_check(int32_t * src_x, int32_t * src_y, float* depth, int data_size, bool* valid_mask, float * buffs, float * zbuffs, int height, int width) {

        // std::cout<<width<<std::endl;
        for (int i = 0; i < data_size; i++) {
            if (0 == valid_mask[i] ) {
                continue;
            }
            int x = src_x[i];
            int y = src_y[i];
            float z = depth[i];
            if (-1 == buffs[y*width+x] ) {
                buffs[y*width+x] = i;
                zbuffs[y*width+x] = z;
            }
            else{

                if (zbuffs[y*width+x] > z){
                    buffs[y*width+x] = i;
                    zbuffs[y*width+x] = z;
                }
            }
        }
    }
}