OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4TextureShapeActivationMap Class Reference

Public Member Functions

 C4TextureShapeActivationMap (int32_t block_x0, int32_t block_y0, int32_t n_blocks_x, int32_t n_blocks_y, int32_t num_shapes)
 
int32_t Get (int32_t block_x, int32_t block_y, int32_t shape_idx, int32_t xpart, int32_t ypart, uint8_t *bg_pix) const
 
void Add (int32_t block_x, int32_t block_y, int32_t shape_idx, int32_t xpart, int32_t ypart, uint8_t back_pix)
 

Detailed Description

Definition at line 124 of file C4TextureShape.cpp.

Constructor & Destructor Documentation

C4TextureShapeActivationMap::C4TextureShapeActivationMap ( int32_t  block_x0,
int32_t  block_y0,
int32_t  n_blocks_x,
int32_t  n_blocks_y,
int32_t  num_shapes 
)
inline

Definition at line 137 of file C4TextureShape.cpp.

137  : block_x0(block_x0), block_y0(block_y0), n_blocks_x(n_blocks_x), n_blocks_y(n_blocks_y), num_shapes(num_shapes)
138  {
139  activation.resize(n_blocks_x * n_blocks_y * num_shapes * 4, 0);
140  back_pix.resize(n_blocks_x * n_blocks_y * num_shapes * 4, 0u);
141  }

Member Function Documentation

void C4TextureShapeActivationMap::Add ( int32_t  block_x,
int32_t  block_y,
int32_t  shape_idx,
int32_t  xpart,
int32_t  ypart,
uint8_t  back_pix 
)

Definition at line 165 of file C4TextureShape.cpp.

Referenced by C4TextureShape::Draw().

166 {
167  // activation map access
168  int32_t idx = Idx(block_x, block_y, shape_idx, xpart, ypart);
169  if (idx < 0)
170  {
171  // This can happen for maps in which the shape is too large or simply at landscape borders. So ignore.
172  return;
173  }
174  ++activation[idx];
175  back_pix[idx] = bg_pix;
176 }

Here is the caller graph for this function:

int32_t C4TextureShapeActivationMap::Get ( int32_t  block_x,
int32_t  block_y,
int32_t  shape_idx,
int32_t  xpart,
int32_t  ypart,
uint8_t *  bg_pix 
) const

Definition at line 155 of file C4TextureShape.cpp.

Referenced by C4TextureShape::Draw().

156 {
157  // activation map access
158  int32_t idx = Idx(block_x, block_y, shape_idx, xpart, ypart);
159  assert(idx >= 0);
160  if (idx < 0) return 0;
161  *bg_pix = back_pix[idx];
162  return activation[idx];
163 }

Here is the caller graph for this function:


The documentation for this class was generated from the following file: