g4tools  5.4.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::zb::buffer::point_writer Class Reference
Inheritance diagram for tools::zb::buffer::point_writer:
Inheritance graph
[legend]
Collaboration diagram for tools::zb::buffer::point_writer:
Collaboration graph
[legend]

Public Member Functions

virtual void write (ZPos a_x, ZPos a_y, ZZ a_z)
 
 point_writer (ZPixel a_pixel, buffer &a_buffer, unsigned int a_size)
 
virtual ~point_writer ()
 
 point_writer (const point_writer &a_from)
 
point_writeroperator= (const point_writer &a_from)
 
bool get_pixel (ZPos a_x, ZPos a_y, ZZ, ZPixel &a_pixel) const
 
- Public Member Functions inherited from tools::zb::buffer::writer
 writer (ZPixel a_pixel)
 
virtual ~writer ()
 
 writer (const writer &a_from)
 
writeroperator= (const writer &a_from)
 

Protected Member Functions

void _write (ZPos a_x, ZPos a_y, ZZ a_z)
 

Protected Attributes

bufferm_buffer
 
unsigned int m_size
 

Additional Inherited Members

- Public Attributes inherited from tools::zb::buffer::writer
ZPixel m_pixel
 

Detailed Description

Definition at line 42 of file buffer.

Constructor & Destructor Documentation

◆ point_writer() [1/2]

tools::zb::buffer::point_writer::point_writer ( ZPixel  a_pixel,
buffer a_buffer,
unsigned int  a_size 
)
inline

Definition at line 59 of file buffer.

60  :writer(a_pixel)
61  ,m_buffer(a_buffer)
62  ,m_size(a_size)
63  {}

◆ ~point_writer()

virtual tools::zb::buffer::point_writer::~point_writer ( )
inlinevirtual

Definition at line 64 of file buffer.

64 {}

◆ point_writer() [2/2]

tools::zb::buffer::point_writer::point_writer ( const point_writer a_from)
inline

Definition at line 66 of file buffer.

67  :writer(a_from)
68  ,m_buffer(a_from.m_buffer)
69  ,m_size(a_from.m_size)
70  {}

Member Function Documentation

◆ _write()

void tools::zb::buffer::point_writer::_write ( ZPos  a_x,
ZPos  a_y,
ZZ  a_z 
)
inlineprotected

Definition at line 86 of file buffer.

86  {
87  if((a_x<m_buffer.m_begX) || (a_x>m_buffer.m_endX)) return;
88  if((a_y<m_buffer.m_begY) || (a_y>m_buffer.m_endY)) return;
89 
90  ZReal zpoint = (ZReal)a_z;
91  unsigned long offset = a_y * m_buffer.m_zbw + a_x;
92  ZReal* zbuff = m_buffer.m_zbuffer + offset;
93 
94  if(m_buffer.m_depth_test) {if(zpoint<*zbuff) return;}
95 
96  ZPixel* zimage = m_buffer.m_zimage + offset;
97 
98  /* transparency :
99  ZPixel old_pix = *zimage;
100  // need the alpha of m_pixel !
101  */
102 
103  *zbuff = zpoint;
104  *zimage = m_pixel;
105  }

◆ get_pixel()

bool tools::zb::buffer::point_writer::get_pixel ( ZPos  a_x,
ZPos  a_y,
ZZ  ,
ZPixel a_pixel 
) const
inline

Definition at line 77 of file buffer.

77  {
78  if((a_x<m_buffer.m_begX) || (a_x>m_buffer.m_endX)) {a_pixel=0;return false;}
79  if((a_y<m_buffer.m_begY) || (a_y>m_buffer.m_endY)) {a_pixel=0;return false;}
80  unsigned long offset = a_y * m_buffer.m_zbw + a_x;
81  ZPixel* zimage = m_buffer.m_zimage + offset;
82  a_pixel = *zimage;
83  return true;
84  }

◆ operator=()

point_writer& tools::zb::buffer::point_writer::operator= ( const point_writer a_from)
inline

Definition at line 71 of file buffer.

71  {
72  writer::operator=(a_from);
73  m_size = a_from.m_size;
74  return *this;
75  }

◆ write()

virtual void tools::zb::buffer::point_writer::write ( ZPos  a_x,
ZPos  a_y,
ZZ  a_z 
)
inlinevirtual

Implements tools::zb::buffer::writer.

Definition at line 44 of file buffer.

44  {
45  if(m_size>=1) { //see zb_action::npix().
46  ZPos x,y;
47  for(int i=-int(m_size);i<=int(m_size);i++) {
48  x = a_x + i;
49  for(int j=-int(m_size);j<=int(m_size);j++) {
50  y = a_y + j;
51  _write(x,y,a_z);
52  }
53  }
54  } else {
55  _write(a_x,a_y,a_z);
56  }
57  }

Member Data Documentation

◆ m_buffer

buffer& tools::zb::buffer::point_writer::m_buffer
protected

Definition at line 107 of file buffer.

◆ m_size

unsigned int tools::zb::buffer::point_writer::m_size
protected

Definition at line 108 of file buffer.


The documentation for this class was generated from the following file:
tools::zb::buffer::m_depth_test
bool m_depth_test
Definition: buffer:597
tools::zb::buffer::point_writer::m_buffer
buffer & m_buffer
Definition: buffer:107
tools::zb::buffer::m_zbuffer
ZReal * m_zbuffer
Definition: buffer:598
tools::zb::buffer::m_zimage
ZPixel * m_zimage
Definition: buffer:601
tools::zb::buffer::m_begX
ZPos m_begX
Definition: buffer:604
tools::zb::buffer::m_endX
ZPos m_endX
Definition: buffer:605
tools::zb::buffer::ZPixel
unsigned int ZPixel
Definition: buffer:22
tools::zb::ZPos
int ZPos
Definition: point:10
tools::zb::buffer::point_writer::m_size
unsigned int m_size
Definition: buffer:108
tools::zb::buffer::m_begY
ZPos m_begY
Definition: buffer:604
tools::zb::buffer::writer::operator=
writer & operator=(const writer &a_from)
Definition: buffer:34
tools::zb::buffer::m_endY
ZPos m_endY
Definition: buffer:605
tools::zb::buffer::m_zbw
unsigned int m_zbw
Definition: buffer:603
tools::zb::buffer::writer::m_pixel
ZPixel m_pixel
Definition: buffer:39
tools::zb::buffer::writer::writer
writer(ZPixel a_pixel)
Definition: buffer:30
tools::zb::buffer::point_writer::_write
void _write(ZPos a_x, ZPos a_y, ZZ a_z)
Definition: buffer:86